Skip to content

Commit

Permalink
Move cleanUpChatroom to NextcloudTalkProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
0xf104a committed Dec 25, 2023
1 parent 5cb71f6 commit cbde68e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ public class NextcloudSSOAPI implements INextcloudAbstractAPI {
private String mStatusString = "Updating settings";
private String mETag = "";

private static String cleanUpChatroom(String chatroom){
String[] splits = chatroom.split("#");
if(splits.length == 0){
return null;
} else {
return splits[0];
}
}

public NextcloudSSOAPI(Context context, SingleSignOnAccount ssoAccount) {
NextcloudAPI.ApiConnectedListener apiCallback = new NextcloudAPI.ApiConnectedListener() {
@Override
Expand Down Expand Up @@ -128,8 +119,6 @@ public void removeNotification(int id) {

@Override
public void sendTalkReply(String chatroom, String message) throws JSONException {
//FIXME: the caller of this method should provide clean chatroom
chatroom = cleanUpChatroom(chatroom);
Map<String, List<String>> header = new HashMap<>();
LinkedList<String> values = new LinkedList<>();
values.add("application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,22 @@ public NotificationBuilderResult updateNotification(int id, NotificationBuilderR
return builderResult;
}

private static String cleanUpChatroom(@NonNull String chatroom){
String[] splits = chatroom.split("#");
if(splits.length == 0){
return null;
} else {
return splits[0];
}
}

@Override
public void onNotificationEvent(NotificationEvent event, Intent intent,
NotificationController controller) {
if (event == NOTIFICATION_EVENT_FASTREPLY) {
final String chatroom = intent.getStringExtra("talk_chatroom"); // the string send by spreed is chatroomid
final String chatroom =
cleanUpChatroom(
Objects.requireNonNull(intent.getStringExtra("talk_chatroom"))); // the string send by spreed is chatroomid
final int notification_id = intent.getIntExtra("notification_id", -1);
if (notification_id < 0) {
Log.wtf(TAG, "Bad notification id: " + notification_id);
Expand Down

0 comments on commit cbde68e

Please sign in to comment.