Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Oct 27, 2023
1 parent 5f5445e commit a2b53d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,6 @@ public User showUser(long id) throws MastodonException {
}


@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<>();
Expand Down Expand Up @@ -1446,6 +1434,22 @@ public Rules getRules() throws ConnectionException {
}
}

/**
* 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
*
Expand Down Expand Up @@ -1802,7 +1806,7 @@ private void createPost(String endpoint, List<String> params) throws MastodonExc
}

/**
* create get response with user bearer token
* create get response with current bearer token
*
* @param endpoint endpoint to use
* @param params additional parameters
Expand Down Expand Up @@ -1830,7 +1834,7 @@ private Response get(String hostname, String endpoint, @Nullable String bearer,
}

/**
* create post response with user bearer token
* create post response with current bearer token
*
* @param endpoint endpoint to use
* @param params additional parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a2b53d7

Please sign in to comment.