File tree 2 files changed +13
-4
lines changed
iterableapi/src/main/java/com/iterable/iterableapi
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) {
70
70
});
71
71
}
72
72
73
- String getEmail () {
73
+ public String getEmail () {
74
74
return _email ;
75
75
}
76
76
77
- String getUserId () {
77
+ public String getUserId () {
78
78
return _userId ;
79
79
}
80
80
81
- String getAuthToken () {
81
+ public String getAuthToken () {
82
82
return _authToken ;
83
83
}
84
84
Original file line number Diff line number Diff line change @@ -49,6 +49,12 @@ public String call() throws Exception {
49
49
public void onSuccess (String authToken ) {
50
50
if (authToken != null ) {
51
51
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 ;
52
58
}
53
59
IterableApi .getInstance ().setAuthToken (authToken );
54
60
pendingAuth = false ;
@@ -88,6 +94,9 @@ public void queueExpirationRefresh(String encodedJWT) {
88
94
}
89
95
} catch (Exception e ) {
90
96
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 );
91
100
}
92
101
}
93
102
@@ -102,7 +111,7 @@ void reSyncAuth() {
102
111
}
103
112
}
104
113
105
- private void scheduleAuthTokenRefresh (long timeDuration ) {
114
+ void scheduleAuthTokenRefresh (long timeDuration ) {
106
115
timer = new Timer (true );
107
116
try {
108
117
timer .schedule (new TimerTask () {
You can’t perform that action at this time.
0 commit comments