-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup: identity verification improvement
- Loading branch information
1 parent
db78c39
commit 9d70a5c
Showing
37 changed files
with
204 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/IUserJwtInvalidatedListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/UserJwtInvalidatedEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...nalSDK/onesignal/core/src/main/java/com/onesignal/internal/IdentityVerificationService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.onesignal.internal | ||
|
||
import com.onesignal.core.internal.backend.ParamsObject | ||
import com.onesignal.core.internal.config.ConfigModelStore | ||
import com.onesignal.core.internal.config.FetchParamsObserver | ||
import com.onesignal.core.internal.operations.IOperationRepo | ||
import com.onesignal.core.internal.startup.IBootstrapService | ||
import com.onesignal.debug.LogLevel | ||
import com.onesignal.debug.internal.logging.Logging | ||
import com.onesignal.user.internal.identity.IdentityModelStore | ||
import com.onesignal.user.internal.operations.LoginUserOperation | ||
|
||
internal class IdentityVerificationService( | ||
private val _configModelStore: ConfigModelStore, | ||
private val _identityModelStore: IdentityModelStore, | ||
private val opRepo: IOperationRepo, | ||
) : IBootstrapService { | ||
override fun bootstrap() { | ||
_configModelStore.model.addFetchParamsObserver( | ||
object : FetchParamsObserver { | ||
override fun onParamsFetched(params: ParamsObject) { | ||
if (params.useIdentityVerification == true && _identityModelStore.model.jwtToken == null) { | ||
Logging.log(LogLevel.INFO, "A valid JWT is required for user ${_identityModelStore.model.externalId}.") | ||
return | ||
} | ||
|
||
// calling login either identity verification is turned off or a jwt is cached | ||
opRepo.enqueue( | ||
LoginUserOperation( | ||
_configModelStore.model.appId, | ||
_identityModelStore.model.onesignalId, | ||
_identityModelStore.model.externalId, | ||
), | ||
) | ||
} | ||
}, | ||
) | ||
} | ||
} |
Oops, something went wrong.