Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliu9508 committed Apr 9, 2024
1 parent 11d50d0 commit 3238d9a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void onUserStateChange(@NonNull UserChangedState state) {
OneSignal.addUserJwtInvalidatedListner(new IUserJwtInvalidatedListener() {
@Override
public void onUserJwtInvalidated(@NonNull UserJwtInvalidatedEvent event) {
Log.v(Tag.LOG_TAG, "onUserJwtInvalidated fired with ID:" + event.getExternal_id());
Log.v(Tag.LOG_TAG, "onUserJwtInvalidated fired with ID:" + event.getExternalId());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package com.onesignal
*
*/
class UserJwtInvalidatedEvent(
val external_id: String
val externalId: String
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ internal class HttpClient(
con.readTimeout = timeout
con.setRequestProperty("SDK-Version", "onesignal/android/" + OneSignalUtils.SDK_VERSION)

if (jwt != null) {
con.setRequestProperty("Authentication", jwt)
if (!jwt.isNullOrEmpty()) {
con.setRequestProperty("Authentication", "Bearer $jwt")
}

if (OneSignalWrapper.sdkType != null && OneSignalWrapper.sdkVersion != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
return
}

// calling createAndSwitchToNewUser() replaces model with a default empty jwt
createAndSwitchToNewUser()
operationRepo!!.enqueue(
LoginUserOperation(
Expand All @@ -437,9 +438,6 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
identityModelStore!!.model.externalId,
),
)

// TODO: remove JWT Token for all future requests.
// calling createAndSwitchToNewUser() replaces model with a default null jwt
}
}

Expand All @@ -448,7 +446,6 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
return

identityModelStore!!.model.jwtToken = token
// TODO: update OperationRepo with new JWT
}

override fun addUserJwtInvalidatedListner(listener: IUserJwtInvalidatedListener) {
Expand Down

0 comments on commit 3238d9a

Please sign in to comment.