@@ -16,10 +16,11 @@ import co.thepeer.sdk.R
1616import co.thepeer.sdk.databinding.SdkActivityBinding
1717import co.thepeer.sdk.model.ThepeerParam
1818import co.thepeer.sdk.model.ThepeerResult
19- import co.thepeer.sdk.utils.*
2019import co.thepeer.sdk.utils.Logger
20+ import co.thepeer.sdk.utils.ThepeerConstants
2121import co.thepeer.sdk.utils.Urls
2222import co.thepeer.sdk.utils.WebInterface
23+ import co.thepeer.sdk.utils.isNetworkConnectionAvailable
2324
2425internal class ThepeerSdkActivity : AppCompatActivity () {
2526 private var params: ThepeerParam ? = null
@@ -45,7 +46,6 @@ internal class ThepeerSdkActivity : AppCompatActivity() {
4546 throw IllegalStateException (" Params should not be null. Initialize thePeer using this function Thepeer.Builder(...)" )
4647 }
4748
48-
4949 params?.let {
5050 url = Urls .createTransactionUrl(it)
5151 showWebView()
@@ -90,10 +90,8 @@ internal class ThepeerSdkActivity : AppCompatActivity() {
9090 startActivity(Intent (Intent .ACTION_VIEW , request?.url))
9191 return true
9292 }
93-
9493 }
9594
96-
9795 binding.webViewPeer.addJavascriptInterface(
9896 WebInterface { results ->
9997 redirectWithResult(results)
@@ -125,7 +123,6 @@ internal class ThepeerSdkActivity : AppCompatActivity() {
125123 Toast .makeText(this , getString(R .string.retry_text), Toast .LENGTH_LONG )
126124 .show()
127125 }
128-
129126 } else {
130127 Toast .makeText(this , " Something went wrong. Contact thePeer support" , Toast .LENGTH_LONG )
131128 .show()
@@ -139,7 +136,7 @@ internal class ThepeerSdkActivity : AppCompatActivity() {
139136 }
140137 }
141138
142- private fun hideRetryView (){
139+ private fun hideRetryView () {
143140 binding.includeRetryView.retryView.isVisible = false
144141 binding.loading.isVisible = true
145142 }
@@ -169,10 +166,9 @@ internal class ThepeerSdkActivity : AppCompatActivity() {
169166 object : OnBackPressedCallback (true ) {
170167 override fun handleOnBackPressed () {
171168 params = null
172- if (! isNetworkConnectionAvailable){
169+ if (! isNetworkConnectionAvailable) {
173170 finish()
174171 }
175172 }
176173 }
177-
178174}
0 commit comments