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

Commit 42c983b

Browse files
committed
Fixes #503: Fix the camera opening on clicking the notification
1 parent ae8e53e commit 42c983b

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
import retrofit2.Call;
142142
import retrofit2.Response;
143143

144+
import static com.zulip.android.util.Constants.ACTION_MESSAGE_PUSH_NOTIFICATION;
144145
import static com.zulip.android.util.Constants.REQUEST_PICK_FILE;
145146

146147
/**
@@ -879,6 +880,9 @@ protected void onNewIntent(Intent intent) {
879880
// Handle single file being sent
880881
handleSentFile((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM));
881882
}
883+
} else if (ACTION_MESSAGE_PUSH_NOTIFICATION.equals(action)) {
884+
// Here, this condition can be used if some data has to be passed from the message push notification
885+
return; // We don't want to do with the data right so, do this return and skip the other check
882886
}
883887

884888
// extract file path of edited image

app/src/main/java/com/zulip/android/gcm/GcmIntentService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import java.io.IOException;
1919
import java.net.URL;
2020

21+
import static com.zulip.android.util.Constants.ACTION_MESSAGE_PUSH_NOTIFICATION;
22+
2123
/**
2224
* This {@code IntentService} does the actual handling of the GCM message.
2325
* {@code GcmBroadcastReceiver} (a {@code WakefulBroadcastReceiver}) holds a
@@ -48,7 +50,7 @@ private void sendNotification(Bundle msg) {
4850
.getSystemService(Context.NOTIFICATION_SERVICE);
4951

5052
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
51-
new Intent(this, ZulipActivity.class).addFlags(0), 0);
53+
new Intent(this, ZulipActivity.class).addFlags(0).setAction(ACTION_MESSAGE_PUSH_NOTIFICATION), 0);
5254

5355
String type = msg.getString("recipient_type");
5456
String tag = "zulip";

app/src/main/java/com/zulip/android/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ public class Constants {
2626
public static String END_POINT_REGISTER = "register";
2727
//if two continuous messages are from same sender and time difference is less than this then hide it
2828
public static long HIDE_TIMESTAMP_THRESHOLD = 60 * 1000;// 1 minute
29+
public static String ACTION_MESSAGE_PUSH_NOTIFICATION = "ACTION_MESSAGE_PUSH_NOTIFICATION";
2930
}

0 commit comments

Comments
 (0)