mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-05-06 20:59:58 +00:00
android: hide reconnect when app hasn't connected once
This commit is contained in:
@@ -552,19 +552,22 @@ fun AirPodsSettingsScreen(viewModel: AirPodsViewModel, navController: NavControl
|
||||
}
|
||||
Spacer(Modifier.height(16.dp))
|
||||
}
|
||||
StyledButton(
|
||||
onClick = {
|
||||
viewModel.reconnectFromSavedMac()
|
||||
}, backdrop = backdrop, modifier = Modifier.fillMaxWidth(0.9f)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.reconnect_to_last_device), style = TextStyle(
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontFamily = FontFamily(Font(R.font.sf_pro)),
|
||||
color = if (isSystemInDarkTheme()) Color.White else Color.Black
|
||||
if (state.connectionSuccessful) {
|
||||
StyledButton(
|
||||
onClick = {
|
||||
viewModel.reconnectFromSavedMac()
|
||||
}, backdrop = backdrop, modifier = Modifier.fillMaxWidth(0.9f)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.reconnect_to_last_device),
|
||||
style = TextStyle(
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontFamily = FontFamily(Font(R.font.sf_pro)),
|
||||
color = if (isSystemInDarkTheme()) Color.White else Color.Black
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,9 @@ data class AirPodsUiState(
|
||||
val isPremium: Boolean = false,
|
||||
val vendorIdHook: Boolean = false,
|
||||
|
||||
val dynamicEndOfCharge: Boolean = false
|
||||
val dynamicEndOfCharge: Boolean = false,
|
||||
|
||||
val connectionSuccessful: Boolean = false
|
||||
)
|
||||
|
||||
class AirPodsViewModel(
|
||||
@@ -354,6 +356,8 @@ class AirPodsViewModel(
|
||||
val vendorIdHook = xposedRemotePref.getBoolean("vendor_id_hook", false)
|
||||
val dynamicEndOfCharge = sharedPreferences.getBoolean("dynamic_end_of_charge", false)
|
||||
|
||||
val connectionSuccessful = sharedPreferences.getBoolean("connection_successful", false)
|
||||
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
offListeningMode = offListeningModeEnabled,
|
||||
@@ -363,7 +367,8 @@ class AirPodsViewModel(
|
||||
leftAction = leftAction,
|
||||
rightAction = rightAction,
|
||||
vendorIdHook = vendorIdHook,
|
||||
dynamicEndOfCharge = dynamicEndOfCharge
|
||||
dynamicEndOfCharge = dynamicEndOfCharge,
|
||||
connectionSuccessful = connectionSuccessful
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user