@@ -65,11 +65,14 @@ import androidx.compose.ui.text.style.TextAlign
6565import androidx.compose.ui.tooling.preview.Preview
6666import androidx.compose.ui.unit.dp
6767import androidx.compose.ui.unit.sp
68+ import androidx.core.content.edit
69+ import androidx.core.net.toUri
6870import androidx.navigation.NavController
6971import androidx.navigation.compose.rememberNavController
7072import com.kyant.backdrop.backdrops.rememberLayerBackdrop
7173import com.kyant.backdrop.drawBackdrop
7274import com.kyant.backdrop.highlight.Highlight
75+ import dev.chrisbanes.haze.HazeState
7376import dev.chrisbanes.haze.hazeSource
7477import dev.chrisbanes.haze.materials.ExperimentalHazeMaterialsApi
7578import kotlinx.coroutines.launch
@@ -78,6 +81,7 @@ import me.kavishdevar.librepods.composables.AboutCard
7881import me.kavishdevar.librepods.composables.AudioSettings
7982import me.kavishdevar.librepods.composables.BatteryView
8083import me.kavishdevar.librepods.composables.CallControlSettings
84+ import me.kavishdevar.librepods.composables.ConfirmationDialog
8185import me.kavishdevar.librepods.composables.ConnectionSettings
8286import me.kavishdevar.librepods.composables.HearingHealthSettings
8387import me.kavishdevar.librepods.composables.MicrophoneSettings
@@ -212,6 +216,10 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
212216 }
213217
214218 val darkMode = isSystemInDarkTheme()
219+ val hazeStateS = remember { mutableStateOf(HazeState ()) }
220+
221+ val showDialog = remember { mutableStateOf(! sharedPreferences.getBoolean(" donationDialogShown" , false )) }
222+
215223 StyledScaffold (
216224 title = deviceName.text,
217225 actionButtons = listOf (
@@ -226,6 +234,7 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
226234 ),
227235 snackbarHostState = snackbarHostState
228236 ) { spacerHeight, hazeState ->
237+ hazeStateS.value = hazeState
229238 if (isLocallyConnected || isRemotelyConnected) {
230239 val instance = service.airpodsInstance
231240 if (instance == null ) {
@@ -339,6 +348,7 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
339348 Highlight .Ambient .copy(alpha = 0f )
340349 }
341350 )
351+ .hazeSource(hazeState)
342352 .padding(horizontal = 8 .dp),
343353 horizontalAlignment = Alignment .CenterHorizontally ,
344354 verticalArrangement = Arrangement .Center
@@ -405,6 +415,25 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
405415 }
406416 }
407417 }
418+ ConfirmationDialog (
419+ showDialog = showDialog,
420+ title = stringResource(R .string.support_librepods),
421+ message = stringResource(R .string.support_dialog_description),
422+ confirmText = stringResource(R .string.support_me) + " \uDBC0\uDEB5 " ,
423+ dismissText = stringResource(R .string.never_show_again),
424+ onConfirm = {
425+ val browserIntent = Intent (
426+ Intent .ACTION_VIEW ,
427+ " https://github.com/sponsors/kavishdevar" .toUri()
428+ )
429+ context.startActivity(browserIntent)
430+ sharedPreferences.edit { putBoolean(" donationDialogShown" , true ) }
431+ },
432+ onDismiss = {
433+ sharedPreferences.edit { putBoolean(" donationDialogShown" , true ) }
434+ },
435+ hazeState = hazeStateS.value,
436+ )
408437}
409438
410439@Preview
0 commit comments