Skip to content

Commit

Permalink
fix: possible crash on second received code and on timeout (#57)
Browse files Browse the repository at this point in the history
* fix: possible crash

- unstable crash on second received code
- unstable crash on timeout

* feat(version): added fvm usage

* feat(version): updated usage for future workflow usage

* feat(version): read version from fvm config

* fix(version): pick flutter version from fvm config

* fix(version): up surf_lint_rules to evade invariant_booleans rule

* fix(version): up surf_lint_rules to evade invariant_booleans rule

* fix(example): fix example to comply analyzer

---------

Co-authored-by: Podushkin Vitaliy <[email protected]>
  • Loading branch information
tinted-knight and plasticfiresam authored Jul 12, 2023
1 parent 9ee394c commit 1e63cc3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ public class OTPPlugin : FlutterPlugin, MethodCallHandler, PluginRegistry.Activi
// Get SMS message content
val message = data.getStringExtra(SmsRetriever.EXTRA_SMS_MESSAGE)
lastResult?.success(message)
lastResult = null
} else {
// Consent denied. User can type OTC manually.
}
credentialPickerRequest -> if (resultCode == Activity.RESULT_OK && data != null) {
val phoneNumber =
Identity.getSignInClient(context!!).getPhoneNumberFromIntent(data)
lastResult?.success(phoneNumber)
lastResult = null
}
}
return true
Expand Down Expand Up @@ -170,6 +172,7 @@ public class OTPPlugin : FlutterPlugin, MethodCallHandler, PluginRegistry.Activi

override fun onFailure() {
lastResult?.error("408", "Timeout exception", null)
lastResult = null
}
}
}
Expand All @@ -182,11 +185,15 @@ public class OTPPlugin : FlutterPlugin, MethodCallHandler, PluginRegistry.Activi
smsRetrieverBroadcastReceiver = SmsRetrieverReceiver().also {
it.smsBroadcastReceiverListener = object : SmsRetrieverReceiver.SmsRetrieverBroadcastReceiverListener {
override fun onSuccess(sms: String?) {
sms?.let { it -> lastResult?.success(it) }
sms?.let { it ->
lastResult?.success(it)
lastResult = null
}
}

override fun onFailure() {
lastResult?.error("408", "Timeout exception", null)
lastResult = null
}
}
}
Expand Down

0 comments on commit 1e63cc3

Please sign in to comment.