Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public final class IterableConstants {
public static final String USER_INPUT = "userInput";

//Firebase
public static final String FIREBASE_RESOURCE_ID = "firebase_database_url";
public static final String FIREBASE_SENDER_ID = "gcm_defaultSenderId";
public static final String FIREBASE_MESSAGING_CLASS = "com.google.firebase.messaging.FirebaseMessaging";
public static final String FIREBASE_COMPATIBLE = "firebaseCompatible";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ PushRegistrationObject getDeviceToken() {
return null;
}

int firebaseResourceId = Util.getFirebaseResouceId(applicationContext);
if (firebaseResourceId == 0) {
IterableLogger.e(TAG, "Could not find firebase_database_url, please check that Firebase SDK is set up properly");
String senderId = Util.getSenderId(applicationContext);
if (senderId == null) {
IterableLogger.e(TAG, "Could not find gcm_defaultSenderId, please check that Firebase SDK is set up properly");
return null;
}

Expand Down Expand Up @@ -113,10 +113,6 @@ public void onSuccess(@NonNull JSONObject data) {
static class Util {
static UtilImpl instance = new UtilImpl();

static int getFirebaseResouceId(Context applicationContext) {
return instance.getFirebaseResouceId(applicationContext);
}

static String getFirebaseToken() {
return instance.getFirebaseToken();
}
Expand All @@ -130,10 +126,6 @@ static String getSenderId(Context applicationContext) {
}

static class UtilImpl {
int getFirebaseResouceId(Context applicationContext) {
return applicationContext.getResources().getIdentifier(IterableConstants.FIREBASE_RESOURCE_ID, IterableConstants.ANDROID_STRING, applicationContext.getPackageName());
}

String getFirebaseToken() {
FirebaseInstanceId instanceID = FirebaseInstanceId.getInstance();
return instanceID.getToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void tearDown() throws IOException {
@Test
public void testDisablePushOnLogout() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody("{}"));
when(pushRegistrationUtilMock.getFirebaseResouceId(any(Context.class))).thenReturn(1);
when(pushRegistrationUtilMock.getSenderId(any(Context.class))).thenReturn("12345");
when(pushRegistrationUtilMock.getFirebaseToken()).thenReturn(TEST_TOKEN);
IterableApi.initialize(getContext(), "apiKey", new IterableConfig.Builder().setAutoPushRegistration(true).build());
IterableApi.getInstance().setEmail("test@email.com");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setUp() throws Exception {
pushRegistrationUtilMock = mock(IterablePushRegistrationTask.Util.UtilImpl.class);
IterablePushRegistrationTask.Util.instance = pushRegistrationUtilMock;

when(pushRegistrationUtilMock.getFirebaseResouceId(any(Context.class))).thenReturn(1);
when(pushRegistrationUtilMock.getSenderId(any(Context.class))).thenReturn("12345");
}

@After
Expand Down