Skip to content

Commit

Permalink
Remove location permissions for now (#382)
Browse files Browse the repository at this point in the history
* bump version

* remove location permissions stuff for now
  • Loading branch information
KennyHuRadar authored Jul 15, 2024
1 parent d9ccd18 commit 00818c6
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 373 deletions.
14 changes: 0 additions & 14 deletions example/src/main/java/io/radar/example/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package io.radar.example

import android.Manifest
import android.content.Context
import android.location.Location
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View.OnClickListener
import android.widget.Button
import android.widget.LinearLayout
import android.widget.ScrollView
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import io.radar.sdk.Radar
import io.radar.sdk.RadarTrackingOptions
Expand All @@ -20,7 +14,6 @@ import io.radar.sdk.RadarVerifiedReceiver
import io.radar.sdk.model.RadarVerifiedLocationToken
import org.json.JSONObject
import java.util.EnumSet
import androidx.core.content.edit

class MainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -60,13 +53,6 @@ class MainActivity : AppCompatActivity() {
}

fun createButtons() {
createButton("requestForegorundPermission") {
Radar.requestForegroundLocationPermission()
}

createButton("requestBackgroundPermission") {
Radar.requestBackgroundLocationPermission()
}

createButton("getLocation") {
Radar.getLocation { status, location, stopped ->
Expand Down
11 changes: 0 additions & 11 deletions example/src/main/java/io/radar/example/MyRadarReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import io.radar.sdk.Radar
import io.radar.sdk.RadarReceiver
import io.radar.sdk.model.RadarEvent
import io.radar.sdk.model.RadarUser
import io.radar.sdk.model.RadarLocationPermissionStatus
import kotlin.random.Random

class MyRadarReceiver : RadarReceiver() {

Expand Down Expand Up @@ -70,13 +68,4 @@ class MyRadarReceiver : RadarReceiver() {
notify(context, message)
}

override fun onLocationPermissionStatusUpdated(
context: Context,
status: RadarLocationPermissionStatus
) {
val statusString = RadarLocationPermissionStatus.stringForLocationPermissionState(status.status)
val body = "Location permission status updated: ${statusString}"
notify(context, body)
}

}
2 changes: 1 addition & 1 deletion sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: "org.jetbrains.dokka"
apply plugin: 'io.radar.mvnpublish'

ext {
radarVersion = '3.14.0'
radarVersion = '3.15.0'
}

String buildNumber = ".${System.currentTimeMillis()}"
Expand Down
59 changes: 0 additions & 59 deletions sdk/src/main/java/io/radar/sdk/Radar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,6 @@ object Radar {
private lateinit var replayBuffer: RadarReplayBuffer
internal lateinit var batteryManager: RadarBatteryManager
private lateinit var verificationManager: RadarVerificationManager
private lateinit var locationPermissionManager: RadarLocationPermissionManager

/**
* Used by React Native module to setup the activity.
*/
@JvmStatic
fun onActivityCreate(activity: Activity, context: Context?) {
this.context = context ?: activity;
this.activity = activity;

val application = this.context as? Application
if (!this::locationPermissionManager.isInitialized) {
this.locationPermissionManager = RadarLocationPermissionManager(this.context, this.activity)
application?.registerActivityLifecycleCallbacks(locationPermissionManager)
}
}

/**
* Initializes the Radar SDK. Call this method from the main thread in `Application.onCreate()` before calling any other Radar methods.
Expand Down Expand Up @@ -550,11 +534,6 @@ object Radar {
}
application?.registerActivityLifecycleCallbacks(RadarActivityLifecycleCallbacks(fraud))

if (!this::locationPermissionManager.isInitialized) {
this.locationPermissionManager = RadarLocationPermissionManager(this.context, this.activity)
application?.registerActivityLifecycleCallbacks(locationPermissionManager)
}

val featureSettings = RadarSettings.getFeatureSettings(this.context)
if (featureSettings.usePersistence) {
Radar.loadReplayBufferFromSharedPreferences()
Expand Down Expand Up @@ -3123,39 +3102,6 @@ object Radar {
})
}
}
/**
* Requests foreground location permissions.
*/
@JvmStatic
fun requestForegroundLocationPermission() {
locationPermissionManager.requestForegroundLocationPermission()
}

/**
* Requests background location permissions.
*/
@JvmStatic
fun requestBackgroundLocationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
locationPermissionManager.requestBackgroundLocationPermission()
}
}

/**
* @return A RadarPermissionStatus object with the current location permissions status.
*/
@JvmStatic
fun getLocationPermissionStatus():RadarLocationPermissionStatus {
return locationPermissionManager.getLocationPermissionStatus()
}

/**
* Directs the user to the app settings to enable location permissions.
*/
@JvmStatic
fun openAppSettings() {
locationPermissionManager.openAppSettings()
}

/**
* Sets the log level for debug logs.
Expand Down Expand Up @@ -3496,11 +3442,6 @@ object Radar {
logger.i("📍️ Radar token updated | passed = ${token.passed}; expiresAt = ${token.expiresAt}; expiresIn = ${token.expiresIn}; token = ${token.token}")
}

internal fun sendLocationPermissionStatus(status: RadarLocationPermissionStatus) {
receiver?.onLocationPermissionStatusUpdated(context, status)

logger.i("📍️ Radar location permission updated | status = $status")
}

internal fun setLogPersistenceFeatureFlag(enabled: Boolean) {
this.logBuffer.setPersistentLogFeatureFlag(enabled)
Expand Down
116 changes: 0 additions & 116 deletions sdk/src/main/java/io/radar/sdk/RadarLocationPermissionManager.kt

This file was deleted.

8 changes: 0 additions & 8 deletions sdk/src/main/java/io/radar/sdk/RadarReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Context
import android.location.Location
import io.radar.sdk.Radar.RadarStatus
import io.radar.sdk.model.RadarEvent
import io.radar.sdk.model.RadarLocationPermissionStatus
import io.radar.sdk.model.RadarUser

/**
Expand Down Expand Up @@ -57,12 +56,5 @@ abstract class RadarReceiver {
*/
abstract fun onLog(context: Context, message: String)

/**
* Tells the reciever that the location permissions status was updated.
*
* @param[context] The context.
* @param[status] The location permissions status.
*/
abstract fun onLocationPermissionStatusUpdated(context: Context, status: RadarLocationPermissionStatus)

}
Loading

0 comments on commit 00818c6

Please sign in to comment.