feat(alarmas): replace one-line reliability button with full diagnostics screen
Surface all six DiagnosticoAlarmasAndroid fields instead of three: the battery-optimization exemption and native pending-alarm count were already collected but silently dropped by the old widget. Each failing signal now offers a "Fix this" action that opens the right system settings screen (exact alarms, notifications, full-screen intent, battery optimization), guarded by SDK level and never crashing when a ROM lacks that screen. Manufacturers known for aggressive background killing (Xiaomi/Redmi/POCO, Huawei, Oppo, Vivo, OnePlus, Samsung) get an honest explanation that Autostart must be enabled manually, since there is no API to detect or grant it. Notifications now deep-links straight to ACTION_APP_NOTIFICATION_SETTINGS via a new openNotificationSettings native method, instead of reusing the runtime permission popup meant for first-time alarm creation. New copy is added to all 13 ARB locales with real per-language translations (not Spanish copies), verified by the ARB parity and anti-copy tests plus the corruption scanner.
This commit is contained in:
@@ -232,6 +232,10 @@ class MainActivity : AudioServiceActivity() {
|
||||
Log.d(tag, "alarm.channel requestIgnoreBatteryOptimizations")
|
||||
result.success(requestIgnoreBatteryOptimizations())
|
||||
}
|
||||
"openNotificationSettings" -> {
|
||||
Log.d(tag, "alarm.channel openNotificationSettings")
|
||||
result.success(openNotificationSettings())
|
||||
}
|
||||
"getInitialAlarmIntent" -> {
|
||||
val payload = alarmPayload(intent)
|
||||
Log.d(tag, "alarm.channel getInitialAlarmIntent payload=$payload")
|
||||
@@ -751,6 +755,39 @@ class MainActivity : AudioServiceActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the system's per-app notification settings screen directly
|
||||
* (diagnostics screen, fix/alarmas-fiabilidad). Unlike
|
||||
* [requestPostNotificationsPermission] -- which shows the runtime
|
||||
* permission popup and is meant for the FIRST time an alarm is created
|
||||
* -- this is meant for a user troubleshooting an alarm that already
|
||||
* failed, where the OS may no longer show that popup at all after a
|
||||
* prior denial. `ACTION_APP_NOTIFICATION_SETTINGS` only exists from API
|
||||
* 26; older devices fall back to the app's own details screen, which
|
||||
* still surfaces the notification toggle. Never throws across the
|
||||
* channel boundary -- an unresolvable intent on some ROM is caught and
|
||||
* reported as `false`, same shape as every other `request*`/`open*`
|
||||
* helper in this class.
|
||||
*/
|
||||
private fun openNotificationSettings(): Boolean {
|
||||
return try {
|
||||
val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
|
||||
putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
|
||||
}
|
||||
} else {
|
||||
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
||||
data = Uri.parse("package:$packageName")
|
||||
}
|
||||
}
|
||||
startActivity(intent)
|
||||
true
|
||||
} catch (error: Throwable) {
|
||||
Log.e(tag, "alarm.channel openNotificationSettings failed", error)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun openDirectory(path: String): Boolean {
|
||||
val folder = File(path)
|
||||
if (!folder.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user