Commit c8630df4 authored by Tiago Cunha's avatar Tiago Cunha Committed by GitHub

Merge branch 'develop' into fix/resend-crashes

parents 174d5d12 994b32c3
...@@ -56,13 +56,13 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -56,13 +56,13 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
editor.putString(RocketChatCache.KEY_SELECTED_ROOM_ID, editor.putString(RocketChatCache.KEY_SELECTED_ROOM_ID,
intent.getStringExtra(PushConstants.ROOM_ID)); intent.getStringExtra(PushConstants.ROOM_ID));
} }
if (intent.hasExtra(PushConstants.NOT_ID)) {
PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
}
editor.apply(); editor.apply();
} }
if (intent.hasExtra(PushConstants.NOT_ID)) {
PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
}
} }
private void updateHostnameIfNeeded(SharedPreferences prefs) { private void updateHostnameIfNeeded(SharedPreferences prefs) {
......
...@@ -102,18 +102,17 @@ public class PushNotificationHandler implements PushConstants { ...@@ -102,18 +102,17 @@ public class PushNotificationHandler implements PushConstants {
String hostname = getHostname(extras); String hostname = getHostname(extras);
String roomId = getRoomId(extras); String roomId = getRoomId(extras);
if (hostname == null || roomId == null || !isValidHostname(context, hostname)) {
return;
}
int notId = parseInt(NOT_ID, extras); int notId = parseInt(NOT_ID, extras);
Intent notificationIntent = new Intent(context, MainActivity.class); Intent notificationIntent = new Intent(context, MainActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.putExtra(PUSH_BUNDLE, extras); notificationIntent.putExtra(PUSH_BUNDLE, extras);
notificationIntent.putExtra(HOSTNAME, hostname);
notificationIntent.putExtra(ROOM_ID, roomId);
notificationIntent.putExtra(NOT_ID, notId); notificationIntent.putExtra(NOT_ID, notId);
if (hostname != null && roomId != null && isValidHostname(context, hostname)) {
notificationIntent.putExtra(HOSTNAME, hostname);
notificationIntent.putExtra(ROOM_ID, roomId);
}
int requestCode = random.nextInt(); int requestCode = random.nextInt();
PendingIntent contentIntent = PendingIntent PendingIntent contentIntent = PendingIntent
.getActivity(context, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); .getActivity(context, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment