소스 검색

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

drake 1 년 전
부모
커밋
ef978f23f3
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  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)