Skip to content

Commit dd41fe4

Browse files
committed
Fix lockscreen visibility
1 parent cd4a719 commit dd41fe4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/src/main/java/be/mygod/reactmap/follower/LocationSetter.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
124124
setContentIntent(PendingIntent.getActivity(app, 2,
125125
Intent(app, MainActivity::class.java).setAction(MainActivity.ACTION_CONFIGURE),
126126
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
127-
setVisibility(Notification.VISIBILITY_PUBLIC)
128127
setPublicVersion(build().clone())
129128
setContentText("$lat,$lon (stale ${formatTimeSpanFrom(time)}) > $human")
130129
}.build())

app/src/main/java/be/mygod/reactmap/webkit/SiteController.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import be.mygod.reactmap.R
1616
class SiteController(private val fragment: Fragment) : DefaultLifecycleObserver {
1717
companion object {
1818
const val CHANNEL_ID = "control"
19+
private const val NOTIFICATION_ID = 1
1920
}
2021
init {
2122
fragment.lifecycle.addObserver(this)
@@ -24,7 +25,7 @@ class SiteController(private val fragment: Fragment) : DefaultLifecycleObserver
2425
private val requestPermission = fragment.registerForActivityResult(ActivityResultContracts.RequestPermission()) {
2526
if (!it || !fragment.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) return@registerForActivityResult
2627
val context = fragment.requireContext()
27-
app.nm.notify(1, Notification.Builder(context, CHANNEL_ID).apply {
28+
app.nm.notify(NOTIFICATION_ID, Notification.Builder(context, CHANNEL_ID).apply {
2829
setWhen(0)
2930
setCategory(Notification.CATEGORY_SERVICE)
3031
setContentTitle(title ?: "Loading…")
@@ -54,5 +55,5 @@ class SiteController(private val fragment: Fragment) : DefaultLifecycleObserver
5455

5556
override fun onStart(owner: LifecycleOwner) =
5657
requestPermission.launch(android.Manifest.permission.POST_NOTIFICATIONS)
57-
override fun onStop(owner: LifecycleOwner) = app.nm.cancel(1)
58+
override fun onStop(owner: LifecycleOwner) = app.nm.cancel(NOTIFICATION_ID)
5859
}

0 commit comments

Comments
 (0)