fix: dialog overlay not showing
This commit is contained in:
@@ -113,7 +113,7 @@ class RemoteSideContext(
|
||||
}
|
||||
|
||||
scriptManager.runtime.eachModule {
|
||||
callFunction("module.onManagerLoad",androidContext)
|
||||
callFunction("module.onManagerLoad", androidContext)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user