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

Commit 271c3c0

Browse files
committed
Remove references of humbughq from GCM messaging
1 parent 526f349 commit 271c3c0

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

app/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ android {
4141
buildTypes {
4242
debug {
4343
applicationIdSuffix '.dev'
44-
manifestPlaceholders = [ permissionPackage : "com.humbughq.mobile.dev"]
45-
manifestPlaceholders += [ fabricKey : ""]
44+
manifestPlaceholders = [ fabricKey : ""]
4645
ext.enableCrashlytics = false
4746
buildConfigField "String", "GOOGLE_CLIENT_ID", "\"659545034376-78hg5hmrvqr50nn53t0nme97ndhqjmvs.apps.googleusercontent.com\""
4847
}
4948
release {
5049
minifyEnabled false
5150
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
52-
manifestPlaceholders = [ permissionPackage : "com.humbughq.mobile"]
53-
manifestPlaceholders += [ fabricKey : project.property("fabricKey")]
51+
manifestPlaceholders = [ fabricKey : project.property("fabricKey")]
5452
buildConfigField "String", "GOOGLE_CLIENT_ID", "TODO: FILL THIS IN"
5553
}
5654
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
1010

1111
<permission
12-
android:name="${permissionPackage}.permission.C2D_MESSAGE"
12+
android:name="${applicationId}.permission.C2D_MESSAGE"
1313
android:protectionLevel="signature" />
1414

15-
<uses-permission android:name="${permissionPackage}.permission.C2D_MESSAGE" />
15+
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
1616
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
1717
<uses-permission android:name="android.permission.VIBRATE"/>
1818

@@ -49,14 +49,14 @@
4949
<intent-filter>
5050
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
5151

52-
<category android:name="com.humbughq.mobile" />
52+
<category android:name="${applicationId}" />
5353
</intent-filter>
5454
</receiver>
5555
<receiver
5656
android:name=".gcm.GcmShowNotificationReceiver"
5757
android:exported="false" >
5858
<intent-filter>
59-
<action android:name="com.humbughq.mobile.PushMessage.BROADCAST" />
59+
<action android:name="${applicationId}.PushMessage.BROADCAST" />
6060
</intent-filter>
6161
</receiver>
6262

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ protected void onResume() {
14261426

14271427
// Set up the BroadcastReceiver to trap GCM messages so notifications
14281428
// don't show while in the app
1429-
IntentFilter filter = new IntentFilter(GcmBroadcastReceiver.BROADCAST);
1429+
IntentFilter filter = new IntentFilter(GcmBroadcastReceiver.getGCMReceiverAction(getApplicationContext()));
14301430
filter.setPriority(2);
14311431
registerReceiver(onGcmMessage, filter);
14321432

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@
1414
// http://commonsware.com/blog/2010/08/11/activity-notification-ordered-broadcast.html
1515
// for the inspiration for the dispatch strategy.
1616

17-
// A com.humbughq.mobile.PushMessage.BROADCAST is broadcast to ordered receivers. If the
17+
// A com.zulip.android.PushMessage.BROADCAST is broadcast to ordered receivers. If the
1818
// HumbugActivity is active, its receiver gets the message first and inhibits it. Otherwise,
1919
// it is received by GcmShowNotificationReceiver. That launches a GcmIntentService that
2020
// displays the notification.
2121

2222
public class GcmBroadcastReceiver extends BroadcastReceiver {
2323

2424
private static final String TAG = "GCM";
25-
// FIXME Not sure if this is safe to change to a Zulip string
26-
public static final String BROADCAST = "com.humbughq.mobile.PushMessage.BROADCAST";
25+
26+
public static String getGCMReceiverAction(Context appContext) {
27+
return appContext.getPackageName() + ".PushMessage.BROADCAST";
28+
}
2729

2830
@Override
2931
public void onReceive(Context context, Intent intent) {
@@ -49,7 +51,7 @@ public void onReceive(Context context, Intent intent) {
4951

5052
Log.i(TAG, "Received: " + extras.toString());
5153
if (extras.getString("event").equals("message")) {
52-
Intent broadcast = new Intent(BROADCAST);
54+
Intent broadcast = new Intent(getGCMReceiverAction(context.getApplicationContext()));
5355
broadcast.putExtras(extras);
5456
context.sendOrderedBroadcast(broadcast, null);
5557
}

0 commit comments

Comments
 (0)