File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
iterableapi/src/main/java/com/iterable/iterableapi Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,15 @@ public void execute(@Nullable String data) {
7070 });
7171 }
7272
73- String getEmail () {
73+ public String getEmail () {
7474 return _email ;
7575 }
7676
77- String getUserId () {
77+ public String getUserId () {
7878 return _userId ;
7979 }
8080
81- String getAuthToken () {
81+ public String getAuthToken () {
8282 return _authToken ;
8383 }
8484
Original file line number Diff line number Diff line change @@ -49,6 +49,12 @@ public String call() throws Exception {
4949 public void onSuccess (String authToken ) {
5050 if (authToken != null ) {
5151 queueExpirationRefresh (authToken );
52+ } else {
53+ IterableLogger .w (TAG , "Auth token received as null. Calling the handler in 10 seconds" );
54+ //TODO: Make this time configurable and in sync with SDK initialization flow for auth null scenario
55+ scheduleAuthTokenRefresh (10000 );
56+ authHandler .onTokenRegistrationFailed (new Throwable ("Auth token null" ));
57+ return ;
5258 }
5359 IterableApi .getInstance ().setAuthToken (authToken );
5460 pendingAuth = false ;
@@ -88,6 +94,9 @@ public void queueExpirationRefresh(String encodedJWT) {
8894 }
8995 } catch (Exception e ) {
9096 IterableLogger .e (TAG , "Error while parsing JWT for the expiration" , e );
97+ authHandler .onTokenRegistrationFailed (new Throwable ("Auth token decode failure. Scheduling auth token refresh in 10 seconds..." ));
98+ //TODO: Sync with configured time duration once feature is available.
99+ scheduleAuthTokenRefresh (10000 );
91100 }
92101 }
93102
@@ -102,7 +111,7 @@ void reSyncAuth() {
102111 }
103112 }
104113
105- private void scheduleAuthTokenRefresh (long timeDuration ) {
114+ void scheduleAuthTokenRefresh (long timeDuration ) {
106115 timer = new Timer (true );
107116 try {
108117 timer .schedule (new TimerTask () {
You can’t perform that action at this time.
0 commit comments