Skip to content

Commit

Permalink
- signout callback added
Browse files Browse the repository at this point in the history
  • Loading branch information
Semih Özköroğlu committed Oct 17, 2022
1 parent aed45c8 commit ff9279c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/rbs/android/example/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class App : Application() {
config = RBSNetworkConfig.build {
region = RBSRegion.EU_WEST_1_BETA
sslPinningEnabled = true
interceptor = ChuckInterceptor(applicationContext)
}
)
}
Expand Down
2 changes: 0 additions & 2 deletions rbs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.preference:preference-ktx:1.1.1"

// JWT
Expand Down
6 changes: 4 additions & 2 deletions rbs/src/main/java/com/rettermobile/rbs/RBS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,21 @@ class RBS(
}
}

fun signOut() {
fun signOut(callback: ((Boolean, Throwable?) -> Unit)? = null) {
RBSLogger.log("signOut called")
val request = TokenManager.userId()?.let {
mapOf(Pair("allTokens", true), Pair("userId", it))
} ?: kotlin.run { mapOf(Pair("allTokens", true)) }


sendAction(RBSActions.LOGOUT.action, request, success = {
RBSLogger.log("signOut RBSActions.LOGOUT OK $it")
clearSession()
callback?.invoke(true, null)
}, error = {
RBSLogger.log("signOut RBSActions.LOGOUT ERROR ${it?.message ?: it?.stackTraceToString()}")
clearSession()

callback?.invoke(false, it)
})
}

Expand Down

0 comments on commit ff9279c

Please sign in to comment.