aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-08 00:39:40 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-08 00:39:40 -0600
commit89da5952f4da009bcdb18041c55f498dee4eeb7a (patch)
tree878bf5dbaaa451a37380a4439bca50471b74791c
parent6de89cb5f5ef0269e349c1496b0a6ede839e0934 (diff)
downloadetbsa-traccar-manager-android-master.tar.gz
etbsa-traccar-manager-android-master.tar.bz2
etbsa-traccar-manager-android-master.zip
Remove geolocation codeHEADmaster
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/java/org/traccar/manager/MainFragment.kt52
2 files changed, 0 insertions, 54 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d4e0b51..9be78aa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -5,8 +5,6 @@
package="org.traccar.manager">
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
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
}
}