Commit 994b32c3 authored by Tiago Cunha's avatar Tiago Cunha Committed by GitHub

Merge pull request #215 from RocketChat/fix/support-test-push

Added support back for the test push
parents 93333f70 0a613c0d
......@@ -56,13 +56,13 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
editor.putString(RocketChatCache.KEY_SELECTED_ROOM_ID,
intent.getStringExtra(PushConstants.ROOM_ID));
}
if (intent.hasExtra(PushConstants.NOT_ID)) {
PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
}
editor.apply();
}
if (intent.hasExtra(PushConstants.NOT_ID)) {
PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
}
}
private void updateHostnameIfNeeded(SharedPreferences prefs) {
......
......@@ -102,18 +102,17 @@ public class PushNotificationHandler implements PushConstants {
String hostname = getHostname(extras);
String roomId = getRoomId(extras);
if (hostname == null || roomId == null || !isValidHostname(context, hostname)) {
return;
}
int notId = parseInt(NOT_ID, extras);
Intent notificationIntent = new Intent(context, MainActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.putExtra(PUSH_BUNDLE, extras);
notificationIntent.putExtra(HOSTNAME, hostname);
notificationIntent.putExtra(ROOM_ID, roomId);
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();
PendingIntent contentIntent = PendingIntent
.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