aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/org/traccar/manager/MainFragment.kt52
1 files changed, 0 insertions, 52 deletions
diff --git a/app/src/main/java/org/traccar/manager/MainFragment.kt b/app/src/main/java/org/traccar/manager/MainFragment.kt
index 981f3d9..fba9d2d 100644
--- a/app/src/main/java/org/traccar/manager/MainFragment.kt
+++ b/app/src/main/java/org/traccar/manager/MainFragment.kt
@@ -16,17 +16,14 @@
@file:Suppress("DEPRECATION")
package org.traccar.manager
-import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.BroadcastReceiver
import android.content.Context
-import android.content.DialogInterface
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.ApplicationInfo
-import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
@@ -34,9 +31,6 @@ import android.util.Log
import android.view.View
import android.webkit.*
import android.widget.Toast
-import androidx.appcompat.app.AlertDialog
-import androidx.core.app.ActivityCompat
-import androidx.core.content.ContextCompat
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.preference.PreferenceManager
@@ -157,53 +151,8 @@ class MainFragment : WebViewFragment() {
}
}
- override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
- if (requestCode == REQUEST_PERMISSIONS_LOCATION) {
- val granted = grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED
- if (geolocationCallback != null) {
- geolocationCallback?.invoke(geolocationRequestOrigin, granted, false)
- geolocationRequestOrigin = null
- geolocationCallback = null
- }
- }
- }
-
- private var geolocationRequestOrigin: String? = null
- private var geolocationCallback: GeolocationPermissions.Callback? = null
-
private val webChromeClient = object : WebChromeClient() {
- override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
- geolocationRequestOrigin = null
- geolocationCallback = null
- if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION)) {
- AlertDialog.Builder(activity)
- .setMessage(R.string.permission_location_rationale)
- .setNeutralButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
- geolocationRequestOrigin = origin
- geolocationCallback = callback
- ActivityCompat.requestPermissions(
- activity,
- arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
- REQUEST_PERMISSIONS_LOCATION
- )
- }
- .show()
- } else {
- geolocationRequestOrigin = origin
- geolocationCallback = callback
- ActivityCompat.requestPermissions(
- activity,
- arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
- REQUEST_PERMISSIONS_LOCATION
- )
- }
- } else {
- callback.invoke(origin, true, false)
- }
- }
-
// Android 4.1+
@Suppress("UNUSED_PARAMETER")
fun openFileChooser(uploadMessage: ValueCallback<Uri?>?, acceptType: String?, capture: String?) {
@@ -242,7 +191,6 @@ class MainFragment : WebViewFragment() {
const val EVENT_LOGIN = "eventLogin"
const val EVENT_TOKEN = "eventToken"
const val KEY_TOKEN = "keyToken"
- private const val REQUEST_PERMISSIONS_LOCATION = 1
private const val REQUEST_FILE_CHOOSER = 1
}
}