fix: dialog overlay not showing

This commit is contained in:
rhunk
2023-11-26 12:31:14 +01:00
parent 5d370776a5
commit 284417b87d
3 changed files with 6 additions and 4 deletions

View File

@@ -113,7 +113,7 @@ class RemoteSideContext(
}
scriptManager.runtime.eachModule {
callFunction("module.onManagerLoad",androidContext)
callFunction("module.onManagerLoad", androidContext)
}
}

View File

@@ -1,5 +1,6 @@
package me.rhunk.snapenhance
import android.app.Activity
import android.content.Context
import java.lang.ref.WeakReference
@@ -8,7 +9,9 @@ object SharedContextHolder {
fun remote(context: Context): RemoteSideContext {
if (!::_remoteSideContext.isInitialized || _remoteSideContext.get() == null) {
_remoteSideContext = WeakReference(RemoteSideContext(context))
_remoteSideContext = WeakReference(RemoteSideContext(context.let {
if (it is Activity) it.applicationContext else it
}))
_remoteSideContext.get()?.reload()
}

View File

@@ -82,7 +82,6 @@ fun Dialog(
properties: DialogProperties = DialogProperties(),
content: @Composable () -> Unit
) {
val context = LocalContext.current
val view = LocalView.current
val density = LocalDensity.current
val layoutDirection = LocalLayoutDirection.current
@@ -112,7 +111,7 @@ fun Dialog(
DisposableEffect(dialog) {
// Set the dialog's window type to TYPE_APPLICATION_OVERLAY so it's compatible with compose overlays
if (Settings.canDrawOverlays(view.context) && context !is Activity) {
if (Settings.canDrawOverlays(view.context) && view.context !is Activity) {
dialog.window?.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY)
}
dialog.show()