This commit is contained in:
nuclearfog 2023-10-27 11:33:59 +02:00
parent 5f5445e757
commit a2b53d7527
No known key found for this signature in database
GPG Key ID: 03488A185C476379
3 changed files with 19 additions and 22 deletions

View File

@ -78,14 +78,6 @@ public interface Connection {
*/
User showUser(long id) throws ConnectionException;
/**
* lookup user and return user information
*
* @param name screen name of the user
* @return user information
*/
User showUser(String name) throws ConnectionException;
/**
* search for users matching a search string
*

View File

@ -267,18 +267,6 @@ public class Mastodon implements Connection {
}
@Override
public User showUser(String name) throws MastodonException {
List<String> params = new ArrayList<>();
params.add("acct=" + StringUtils.encode(name));
try {
return createUser(get(ENDPOINT_LOOKUP_USER, params));
} catch (IOException e) {
throw new MastodonException(e);
}
}
@Override
public Users searchUsers(String search, long page) throws MastodonException {
List<String> params = new ArrayList<>();
@ -1446,6 +1434,22 @@ public class Mastodon implements Connection {
}
}
/**
* get user by screen name
*
* @param name screen name (@username)
* @return user instance
*/
private User showUser(String name) throws MastodonException {
List<String> params = new ArrayList<>();
params.add("acct=" + StringUtils.encode(name));
try {
return createUser(get(ENDPOINT_LOOKUP_USER, params));
} catch (IOException e) {
throw new MastodonException(e);
}
}
/**
* get information about the current user
*
@ -1802,7 +1806,7 @@ public class Mastodon implements Connection {
}
/**
* create get response with user bearer token
* create get response with current bearer token
*
* @param endpoint endpoint to use
* @param params additional parameters
@ -1830,7 +1834,7 @@ public class Mastodon implements Connection {
}
/**
* create post response with user bearer token
* create post response with current bearer token
*
* @param endpoint endpoint to use
* @param params additional parameters

View File

@ -24,6 +24,7 @@ public class PushNotificationReceiver extends MessagingReceiver implements Async
@Override
public void onMessage(@NonNull Context context, @NonNull byte[] message, @NonNull String instance) {
GlobalSettings settings = GlobalSettings.get(context);
// check if received push notification is intended for the current login
if (settings.isLoggedIn() && settings.pushEnabled() && settings.getLogin().getConfiguration().isWebpushSupported() && settings.getPushInstance().equals(instance)) {
NotificationLoader loader = new NotificationLoader(context);
NotificationLoader.Param param = new NotificationLoader.Param(NotificationLoader.Param.LOAD_UNREAD, 0, 0L, 0L);