diff --git a/src/containers/PermissionWizard/HeroMode.js b/src/containers/PermissionWizard/HeroMode.js index 8d87c01..5c23a08 100644 --- a/src/containers/PermissionWizard/HeroMode.js +++ b/src/containers/PermissionWizard/HeroMode.js @@ -256,15 +256,7 @@ const HeroMode = () => { "Sans la localisation en arrière-plan, vous ne pourrez pas être alerté des situations d'urgence à proximité lorsque l'application est fermée.", ); } - if ( - Platform.OS === "android" && - batteryOptimizationEnabled && - batteryOptAttempted - ) { - warnings.push( - "L'optimisation de la batterie est encore activée. L'application pourrait ne pas fonctionner correctement en arrière-plan.", - ); - } + // Battery optimization warning is now handled in the Android settings box return warnings.length > 0 ? ( {warnings.map((warning, index) => ( @@ -280,12 +272,36 @@ const HeroMode = () => { }; const renderAndroidPermissionWarning = () => { + const hasBatteryOptimizationIssue = + batteryOptimizationEnabled && batteryOptAttempted; + return ( - + Paramètres Android + + {hasBatteryOptimizationIssue && ( + + + L'optimisation de la + batterie est encore activée. L'application pourrait ne pas + fonctionner correctement en arrière-plan. + + + )} + Sur Android, les permissions peuvent être automatiquement révoquées si l'application n'est pas utilisée pendant une longue période. @@ -306,9 +322,14 @@ const HeroMode = () => { version d'Android) - {batteryOptimizationEnabled && batteryOptAttempted && ( + {hasBatteryOptimizationIssue && ( - + Pour désactiver l'optimisation de la batterie : @@ -627,6 +648,10 @@ const useStyles = createStyles(({ wp, hp, scaleText, theme: { colors } }) => ({ borderWidth: 1, borderColor: colors.warn, }, + androidWarningCritical: { + borderColor: colors.error, + borderWidth: 2, + }, androidWarningHeader: { flexDirection: "row", alignItems: "center", @@ -664,6 +689,23 @@ const useStyles = createStyles(({ wp, hp, scaleText, theme: { colors } }) => ({ marginTop: 5, color: colors.primary, }, + batteryOptimizationAlert: { + backgroundColor: colors.errorContainer || colors.surfaceVariant, + padding: 15, + borderRadius: 6, + marginBottom: 15, + borderWidth: 1, + borderColor: colors.error, + }, + batteryOptimizationAlertText: { + fontSize: 15, + lineHeight: 20, + fontWeight: "500", + }, + batteryOptimizationText: { + fontWeight: "600", + color: colors.error, + }, // iOS styles iosWarning: { backgroundColor: colors.surfaceVariant,