diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-07-20 23:20:05 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-07-20 23:20:05 -0700 |
commit | 482357db96cb41c0f8d0c9fac1dc0fb3820ee391 (patch) | |
tree | f7ca39de1517e9925c51e8fd874dcf1c2b76bbee | |
parent | a5d426d8cbe3d8c61ccf9ab32a94daf6e2c0bec5 (diff) | |
download | etbsa-traccar-manager-android-482357db96cb41c0f8d0c9fac1dc0fb3820ee391.tar.gz etbsa-traccar-manager-android-482357db96cb41c0f8d0c9fac1dc0fb3820ee391.tar.bz2 etbsa-traccar-manager-android-482357db96cb41c0f8d0c9fac1dc0fb3820ee391.zip |
Fix crashes
-rw-r--r-- | app/src/google/java/org/traccar/manager/GoogleMainApplication.kt | 2 | ||||
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainFragment.kt | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt b/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt index cfeaf6e..1c28987 100644 --- a/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt +++ b/app/src/google/java/org/traccar/manager/GoogleMainApplication.kt @@ -49,7 +49,7 @@ class GoogleMainApplication : Application() { private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { FirebaseMessaging.getInstance().token.addOnCompleteListener { - if (it.isComplete) { + if (it.isSuccessful) { broadcastToken(it.result) } } diff --git a/app/src/main/java/org/traccar/manager/MainFragment.kt b/app/src/main/java/org/traccar/manager/MainFragment.kt index 8aa0c15..2675d0c 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.kt +++ b/app/src/main/java/org/traccar/manager/MainFragment.kt @@ -102,9 +102,9 @@ class MainFragment : WebViewFragment() { private var openFileCallback: ValueCallback<Uri?>? = null private var openFileCallback2: ValueCallback<Array<Uri>>? = null - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (requestCode == REQUEST_FILE_CHOOSER) { - val result = if (resultCode != Activity.RESULT_OK) null else data.data + val result = if (resultCode != Activity.RESULT_OK) null else data?.data if (openFileCallback != null) { openFileCallback?.onReceiveValue(result) openFileCallback = null |