Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit e58235e

Browse files
Sam1301kunall17
authored andcommitted
Add stream/topic/pm description to start notifications.
1 parent 4824e9f commit e58235e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ public void onProgressUpdate(int percentage, String progress, int notificationId
12251225
MultipartBody.Part body = prepareFilePart("file", file, notifId, progressListener);
12261226

12271227
// start notification
1228-
setNotification(notifId, getString(R.string.init_notif_title));
1228+
setNotification(notifId, getString(R.string.init_notif_title) + getString(R.string.to_string) + getNotifTitle());
12291229

12301230
// finally, execute the request
12311231
// create upload service client
@@ -1275,6 +1275,26 @@ public void onFailure(Call<UploadResponse> call, Throwable t) {
12751275
});
12761276
}
12771277

1278+
private String getNotifTitle() {
1279+
String title = "";
1280+
MessageType messageType = isCurrentModeStream() ? MessageType.STREAM_MESSAGE : MessageType.PRIVATE_MESSAGE;
1281+
if (messageType == MessageType.STREAM_MESSAGE) {
1282+
title += streamActv.getText().toString();
1283+
title += " > " + topicActv.getText().toString();
1284+
}
1285+
1286+
if (TextUtils.isEmpty(title) || title.equals(" > ")) {
1287+
NarrowFilter filter = getCurrentMessageList().filter;
1288+
if (filter == null) {
1289+
title = getString(R.string.app_name);
1290+
} else {
1291+
title = filter.getTitle() + (filter.getSubtitle() != null ? " > " + filter.getSubtitle() : "");
1292+
}
1293+
}
1294+
1295+
return title;
1296+
}
1297+
12781298
/**
12791299
* Returns a cursor for the combinedAdapter used to suggest Emoji when ':' is typed in the {@link #messageEt}
12801300
*

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,5 @@
172172
<string name="upload_big_file">Yowza, that’s a big file.</string>
173173
<string name="photo_dialog">Take photo</string>
174174
<string name="pick_dialog">Pick a file</string>
175+
<string name="to_string">" to "</string>
175176
</resources>

0 commit comments

Comments
 (0)