Commit 0a613c0d authored by Tiago Cunha's avatar Tiago Cunha

Added support back for the test push

parent 93333f70
...@@ -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));
} }
editor.apply();
}
if (intent.hasExtra(PushConstants.NOT_ID)) { if (intent.hasExtra(PushConstants.NOT_ID)) {
PushNotificationHandler PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0)); .cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
} }
editor.apply();
}
} }
private void updateHostnameIfNeeded(SharedPreferences prefs) { private void updateHostnameIfNeeded(SharedPreferences prefs) {
......
...@@ -102,17 +102,16 @@ public class PushNotificationHandler implements PushConstants { ...@@ -102,17 +102,16 @@ 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(NOT_ID, notId);
if (hostname != null && roomId != null && isValidHostname(context, hostname)) {
notificationIntent.putExtra(HOSTNAME, hostname); notificationIntent.putExtra(HOSTNAME, hostname);
notificationIntent.putExtra(ROOM_ID, roomId); notificationIntent.putExtra(ROOM_ID, roomId);
notificationIntent.putExtra(NOT_ID, notId); }
int requestCode = random.nextInt(); int requestCode = random.nextInt();
PendingIntent contentIntent = PendingIntent PendingIntent contentIntent = PendingIntent
......
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