Browse Source

fix: #197 修复scopeDialog的可取消对话框默认值

drake 1 year ago
parent
commit
ef978f23f3
1 changed files with 8 additions and 3 deletions
  1. 8 3
      net/src/main/java/com/drake/net/utils/Scope.kt

+ 8 - 3
net/src/main/java/com/drake/net/utils/Scope.kt

@@ -32,7 +32,12 @@ import androidx.lifecycle.Lifecycle
 import androidx.lifecycle.LifecycleEventObserver
 import androidx.lifecycle.LifecycleOwner
 import com.drake.brv.PageRefreshLayout
-import com.drake.net.scope.*
+import com.drake.net.scope.AndroidScope
+import com.drake.net.scope.DialogCoroutineScope
+import com.drake.net.scope.NetCoroutineScope
+import com.drake.net.scope.PageCoroutineScope
+import com.drake.net.scope.StateCoroutineScope
+import com.drake.net.scope.ViewCoroutineScope
 import com.drake.statelayout.StateLayout
 import kotlinx.coroutines.CoroutineDispatcher
 import kotlinx.coroutines.CoroutineScope
@@ -109,7 +114,7 @@ fun Fragment.scopeLife(
  */
 fun FragmentActivity.scopeDialog(
     dialog: Dialog? = null,
-    cancelable: Boolean = true,
+    cancelable: Boolean? = null,
     dispatcher: CoroutineDispatcher = Dispatchers.Main,
     block: suspend CoroutineScope.() -> Unit
 ) = DialogCoroutineScope(this, dialog, cancelable, dispatcher).launch(block)
@@ -124,7 +129,7 @@ fun FragmentActivity.scopeDialog(
  */
 fun Fragment.scopeDialog(
     dialog: Dialog? = null,
-    cancelable: Boolean = true,
+    cancelable: Boolean? = null,
     dispatcher: CoroutineDispatcher = Dispatchers.Main,
     block: suspend CoroutineScope.() -> Unit
 ) = DialogCoroutineScope(requireActivity(), dialog, cancelable, dispatcher).launch(block)