@@ -2,10 +2,9 @@ package com.stringcare.library
22
33import android.content.Context
44import android.content.res.Resources
5- import android.os.Build
65import android.support.annotation.StringRes
76import java.nio.charset.Charset
8- import java.util.*
7+ import kotlin.Exception
98
109class CPlusLogic {
1110
@@ -75,8 +74,13 @@ class CPlusLogic {
7574 */
7675 @JvmStatic
7776 fun revealV2 (context : Context , @StringRes id : Int ): String {
78- val arr: ByteArray = context.getString(id).split(" , " ).map { it.toInt().toByte() }.toByteArray()
79- return String (SC ().jniRevealV2(context, getCertificateSHA1Fingerprint(context), arr))
77+ val value = context.getString(id)
78+ return try {
79+ val arr: ByteArray = value.split(" , " ).map { it.toInt().toByte() }.toByteArray()
80+ String (SC ().jniRevealV2(context, getCertificateSHA1Fingerprint(context), arr))
81+ } catch (e: Exception ) {
82+ value
83+ }
8084 }
8185
8286 /* *
@@ -86,8 +90,12 @@ class CPlusLogic {
8690 */
8791 @JvmStatic
8892 fun revealV2 (context : Context , value : String ): String {
89- val arr: ByteArray = value.split(" , " ).map { it.toInt().toByte() }.toByteArray()
90- return String (SC ().jniRevealV2(context, getCertificateSHA1Fingerprint(context), arr))
93+ return try {
94+ val arr: ByteArray = value.split(" , " ).map { it.toInt().toByte() }.toByteArray()
95+ return String (SC ().jniRevealV2(context, getCertificateSHA1Fingerprint(context), arr))
96+ } catch (e: Exception ) {
97+ value
98+ }
9199 }
92100
93101 /* *
@@ -125,11 +133,16 @@ class CPlusLogic {
125133 */
126134 @JvmStatic
127135 fun revealV3 (context : Context , @StringRes id : Int , androidTreatment : Boolean ): String {
128- val arr: ByteArray = context.getString(id).split(" , " ).map { it.toInt().toByte() }.toByteArray()
129- val reveal = String (SC ().jniRevealV3(context, getCertificateSHA1Fingerprint(context), arr))
130- return when (androidTreatment) {
131- true -> reveal.unescape()
132- false -> reveal
136+ val value = context.getString(id)
137+ return try {
138+ val arr: ByteArray = value.split(" , " ).map { it.toInt().toByte() }.toByteArray()
139+ val reveal = String (SC ().jniRevealV3(context, getCertificateSHA1Fingerprint(context), arr))
140+ when (androidTreatment) {
141+ true -> reveal.unescape()
142+ false -> reveal
143+ }
144+ } catch (e: Exception ) {
145+ value
133146 }
134147 }
135148
@@ -140,14 +153,18 @@ class CPlusLogic {
140153 */
141154 @JvmStatic
142155 fun revealV3 (context : Context , value : String , androidTreatment : Boolean ): String {
143- val arr: ByteArray = when (androidTreatment) {
144- true -> value.unescape()
145- false -> value
146- }.split(" , " ).map { it.toInt().toByte() }.toByteArray()
147- val reveal = String (SC ().jniRevealV3(context, getCertificateSHA1Fingerprint(context), arr))
148- return when (androidTreatment) {
149- true -> reveal.unescape()
150- false -> reveal
156+ return try {
157+ val arr: ByteArray = when (androidTreatment) {
158+ true -> value.unescape()
159+ false -> value
160+ }.split(" , " ).map { it.toInt().toByte() }.toByteArray()
161+ val reveal = String (SC ().jniRevealV3(context, getCertificateSHA1Fingerprint(context), arr))
162+ when (androidTreatment) {
163+ true -> reveal.unescape()
164+ false -> reveal
165+ }
166+ } catch (e: Exception ) {
167+ value
151168 }
152169 }
153170
0 commit comments