File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
onesignal/src/main/java/com/onesignal
unittest/src/test/java/com/test/onesignal Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1683,7 +1683,7 @@ public void run() {
1683
1683
runIdsAvailable .run ();
1684
1684
}
1685
1685
1686
- private static void fireIdsAvailableCallback () {
1686
+ static void fireIdsAvailableCallback () {
1687
1687
if (idsAvailableHandler != null ) {
1688
1688
OSUtils .runOnMainUIThread (new Runnable () {
1689
1689
@ Override
Original file line number Diff line number Diff line change @@ -157,5 +157,7 @@ protected void fireEventsForUpdateFailure(JSONObject jsonFields) {
157
157
protected void onSuccessfulSync (JSONObject jsonFields ) {
158
158
if (jsonFields .has ("email" ))
159
159
OneSignal .fireEmailUpdateSuccess ();
160
+ if (jsonFields .has ("identifier" ))
161
+ OneSignal .fireIdsAvailableCallback ();
160
162
}
161
163
}
Original file line number Diff line number Diff line change @@ -591,13 +591,19 @@ public void testInvalidGoogleProjectNumberWithSuccessfulRegisterResponse() throw
591
591
// and is testing the same logic.
592
592
ShadowPushRegistratorGCM .fail = true ;
593
593
OneSignalInitWithBadProjectNum ();
594
-
595
594
threadAndTaskWait ();
596
595
Robolectric .getForegroundThreadScheduler ().runOneTask ();
597
- assertEquals (-7 , ShadowOneSignalRestClient .lastPost .getInt ("notification_types" ));
598
596
597
+ assertEquals (-7 , ShadowOneSignalRestClient .lastPost .getInt ("notification_types" ));
599
598
// Test that idsAvailable still fires
600
599
assertEquals (ShadowOneSignalRestClient .pushUserId , callBackUseId );
600
+ assertNull (getCallBackRegId ); // Since GCM registration failed, this should be null
601
+
602
+ // We now get a push token after the device registers with Onesignal,
603
+ // the idsAvailable callback should fire a 2nd time with a registrationId automatically
604
+ ShadowPushRegistratorGCM .manualFireRegisterForPush ();
605
+ threadAndTaskWait ();
606
+ assertEquals (ShadowPushRegistratorGCM .regId , getCallBackRegId );
601
607
}
602
608
603
609
@ Test
You can’t perform that action at this time.
0 commit comments