Skip to content

Commit bee267a

Browse files
committed
Set debug mode from Pluto setup
1 parent 8ee0209 commit bee267a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

pluto-kotlin-client-sdk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ apply plugin: 'kotlin-android-extensions'
44
apply plugin: 'maven-publish'
55

66
buildscript {
7-
ext.versionCode = 19
8-
ext.versionName = '0.8'
7+
ext.versionCode = 20
8+
ext.versionName = '0.8.1'
99
}
1010

1111
android {

pluto-kotlin-client-sdk/src/main/java/com/mushare/plutosdk/Pluto+Debug.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ import android.util.Log
44
import java.util.*
55

66
fun Pluto.simulateInvalidRefreshToken() {
7-
if (BuildConfig.DEBUG) {
7+
if (Pluto.isDebug) {
88
data.refreshToken = UUID.randomUUID().toString()
99
} else {
1010
Log.d("Pluto", "Pluto.simulateInvalidRefreshToken() should be invoked in DEBUG mode.")
1111
}
1212
}
1313

1414
fun Pluto.simulateInvalidAccessToken() {
15-
if (BuildConfig.DEBUG) {
15+
if (Pluto.isDebug) {
1616
data.accessToken = UUID.randomUUID().toString()
1717
} else {
1818
Log.d("Pluto", "Pluto.simulateInvalidAccessToken() should be invoked in DEBUG mode.")
1919
}
2020
}
2121

2222
fun Pluto.resetExpire(date: Date) {
23-
if (BuildConfig.DEBUG) {
23+
if (Pluto.isDebug) {
2424
data.expire = date.time.toInt() / 1000
2525
} else {
2626
Log.d("Pluto", "Pluto.resetExpire(date: Date) should be invoked in DEBUG mode.")

pluto-kotlin-client-sdk/src/main/java/com/mushare/plutosdk/Pluto.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@ class Pluto private constructor() {
9898
private lateinit var server: String
9999
internal lateinit var appId: String
100100
internal lateinit var context: Context
101+
internal var isDebug = false
102+
101103
private var isInitialized: Boolean = false
102104

103-
fun initialize(_context: Context, _server: String, _appId: String) {
104-
context = _context.applicationContext
105-
server = _server
106-
appId = _appId
107-
isInitialized = true
105+
fun initialize(context: Context, server: String, appId: String, isDebug: Boolean = false) {
106+
this.context = context.applicationContext
107+
this.server = server
108+
this.appId = appId
109+
this.isDebug = isDebug
110+
this.isInitialized = true
108111
}
109112

110113
fun getInstance(): Pluto? {

0 commit comments

Comments
 (0)