Skip to content
Permalink
Browse files

Update names

  • Loading branch information...
adityapk00 committed Apr 12, 2019
1 parent 43b00b0 commit e4862951eb1e7e7a9244f4064fdbca2f1df24ca9
Showing with 12 additions and 3 deletions.
  1. +2 −2 app/build.gradle
  2. +10 −1 app/src/main/java/com/adityapk/zcash/zqwandroid/DataModel.kt
@@ -10,8 +10,8 @@ android {
applicationId "com.adityapk.zcash.zqwandroid"
minSdkVersion 19
targetSdkVersion 28
versionCode 4
versionName "0.3.0"
versionCode 6
versionName "0.3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
@@ -57,6 +57,7 @@ object DataModel {

data class ParseResponse(val updateTxns: Boolean = false, val displayMsg: String? = null, val doDisconnect: Boolean = false)

// Parse the encrypted response string. This will decrypt it and pass it to parseDecryptedResponse()
fun parseResponse(response: String) : ParseResponse {
val json = Parser.default().parse(StringBuilder(response)) as JsonObject

@@ -75,8 +76,16 @@ object DataModel {
if (decrypted.startsWith("error")) {
return ParseResponse(false, "Encryption Error: $decrypted", true)
}
return parseResponse(decrypted)
return parseDecryptedResponse(decrypted)
} else {
// The input is unrecognized
return ParseResponse(false, "Unknown message received, JSON was missing a 'nonce'", true)
}
}

// Parse a decrypted response, which is expected to have a command's response
fun parseDecryptedResponse(response: String): ParseResponse {
val json = Parser.default().parse(StringBuilder(response)) as JsonObject

return when (json.string("command")) {
"getInfo" -> {

0 comments on commit e486295

Please sign in to comment.
You can’t perform that action at this time.