Skip to content

Commit ebb0800

Browse files
committed
feat(manifest): fixing pr comments
1 parent 5870612 commit ebb0800

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

AndroidSDK/src/com/leanplum/LeanplumCloudMessagingProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
abstract class LeanplumCloudMessagingProvider {
3636
private static String registrationId;
3737

38+
/**
39+
* Gets the registration Id associated with current messaging provider.
40+
*
41+
* @return Registration Id.
42+
*/
3843
static String getCurrentRegistrationId() {
3944
return registrationId;
4045
}

AndroidSDK/src/com/leanplum/LeanplumFcmProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737
*/
3838
class LeanplumFcmProvider extends LeanplumCloudMessagingProvider {
3939

40+
@Override
4041
public String getRegistrationId() {
4142
return FirebaseInstanceId.getInstance().getToken();
4243
}
4344

45+
@Override
4446
public boolean isInitialized() {
4547
return true;
4648
}
@@ -83,6 +85,7 @@ public boolean isManifestSetup() {
8385
return true;
8486
}
8587

88+
@Override
8689
public void unregister() {
8790
try {
8891
FirebaseInstanceId.getInstance().deleteInstanceId();

AndroidSDK/src/com/leanplum/LeanplumGcmProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public void storePreferences(Context context) {
6666
Constants.Defaults.PROPERTY_SENDER_IDS, senderIds);
6767
}
6868

69+
@Override
6970
public String getRegistrationId() {
7071
String registrationId = null;
7172
try {
@@ -107,6 +108,7 @@ public String getRegistrationId() {
107108
return registrationId;
108109
}
109110

111+
@Override
110112
public boolean isInitialized() {
111113
return senderIds != null || getCurrentRegistrationId() != null;
112114
}
@@ -161,6 +163,7 @@ public boolean isManifestSetup() {
161163
return false;
162164
}
163165

166+
@Override
164167
public void unregister() {
165168
try {
166169
InstanceID.getInstance(Leanplum.getContext()).deleteInstanceID();

AndroidSDK/src/com/leanplum/LeanplumManualProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@
2929
* @author Anna Orlova
3030
*/
3131
public class LeanplumManualProvider extends LeanplumCloudMessagingProvider {
32+
3233
LeanplumManualProvider(Context context, String registrationId) {
3334
onRegistrationIdReceived(context, registrationId);
3435
}
3536

37+
@Override
3638
public String getRegistrationId() {
3739
return getCurrentRegistrationId();
3840
}
3941

42+
@Override
4043
public boolean isInitialized() {
4144
return true;
4245
}
@@ -46,6 +49,7 @@ public boolean isManifestSetup() {
4649
return true;
4750
}
4851

52+
@Override
4953
public void unregister() {
5054
}
5155
}

AndroidSDK/src/com/leanplum/internal/LeanplumManifestHelper.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,19 @@ public static boolean checkComponent(ApplicationComponent componentType, String
223223
List<ResolveInfo> components = (componentType == ApplicationComponent.RECEIVER)
224224
? context.getPackageManager().queryBroadcastReceivers(new Intent(action), 0)
225225
: context.getPackageManager().queryIntentServices(new Intent(action), 0);
226+
if (components == null) {
227+
return false;
228+
}
226229
boolean foundComponent = false;
227230
for (ResolveInfo component : components) {
231+
if (component == null) {
232+
continue;
233+
}
228234
ComponentInfo componentInfo = (componentType == ApplicationComponent.RECEIVER)
229235
? component.activityInfo : component.serviceInfo;
230-
if (componentInfo.name.equals(name)) {
236+
if (componentInfo != null && componentInfo.name.equals(name)) {
231237
// Only check components from our package.
232-
if (componentInfo.packageName.equals(packageName)) {
238+
if (componentInfo.packageName != null && componentInfo.packageName.equals(packageName)) {
233239
foundComponent = true;
234240
}
235241
}

0 commit comments

Comments
 (0)