Skip to content

Commit 2045d30

Browse files
committed
chore: replace DisposableEffect with LaunchedEffect
1 parent 321f20f commit 2045d30

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/src/main/java/to/bitkit/ui/utils/RequestNotificationPermissions.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import androidx.activity.compose.rememberLauncherForActivityResult
66
import androidx.activity.result.contract.ActivityResultContracts
77
import androidx.compose.runtime.Composable
88
import androidx.compose.runtime.DisposableEffect
9+
import androidx.compose.runtime.LaunchedEffect
910
import androidx.compose.runtime.getValue
1011
import androidx.compose.runtime.mutableStateOf
1112
import androidx.compose.runtime.remember
@@ -57,15 +58,13 @@ fun RequestNotificationPermissions(
5758
}
5859

5960
// Request permission on first composition if needed
60-
DisposableEffect(Unit) {
61+
LaunchedEffect(Unit) {
6162
val currentPermissionState = NotificationUtils.areNotificationsEnabled(context)
6263
isGranted = currentPermissionState
6364
onPermissionChange(currentPermissionState)
6465

6566
if (!currentPermissionState && requiresPermission && showPermissionDialog) {
6667
launcher.launch(Manifest.permission.POST_NOTIFICATIONS)
6768
}
68-
69-
onDispose { }
7069
}
7170
}

0 commit comments

Comments
 (0)