Conversation
There was a problem hiding this comment.
Pull request overview
Adds a battery-optimization reminder flow using the existing Compose bottom-sheet reminder system, replacing the prior dedicated dialog activity approach.
Changes:
- Introduces a new
BatteryOptimizationReminderpopup type and UI copy (Battery_Optimization) across multiple locales. - Refactors
ReminderPageto take pre-resolved content text (String) so callers can usestringResource(...)directly. - Centralizes battery optimization detection/navigation in
ContextExtensionand removes the oldBatteryOptimizationDialogActivity+ legacy triggers.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/strings.xml | Adds Battery_Optimization string (default locale). |
| app/src/main/res/values-zh-rTW/strings.xml | Adds Traditional Chinese translation for Battery_Optimization. |
| app/src/main/res/values-zh-rCN/strings.xml | Adds Simplified Chinese translation for Battery_Optimization. |
| app/src/main/res/values-ru/strings.xml | Adds Russian translation for Battery_Optimization. |
| app/src/main/res/values-ja/strings.xml | Adds Japanese translation for Battery_Optimization. |
| app/src/main/res/values-es/strings.xml | Adds Spanish translation for Battery_Optimization. |
| app/src/main/java/one/mixin/android/ui/home/reminder/VerifyMobileReminderBottomSheetDialogFragment.kt | Updates reminder page content argument to pass a String via stringResource. |
| app/src/main/java/one/mixin/android/ui/home/reminder/ReminderPage.kt | Changes content parameter from @StringRes Int to String; removes internal stringResource(content) lookup. |
| app/src/main/java/one/mixin/android/ui/home/reminder/ReminderBottomSheetDialogFragment.kt | Adds battery optimization reminder selection + UI; updates other reminder content to pass strings. |
| app/src/main/java/one/mixin/android/ui/home/MainActivity.kt | Removes legacy battery optimization check and related imports. |
| app/src/main/java/one/mixin/android/ui/common/BatteryOptimizationDialogActivity.kt | Deletes the old dialog activity implementation. |
| app/src/main/java/one/mixin/android/job/BlazeMessageService.kt | Removes background-triggered battery optimization dialog; centralizes restriction check. |
| app/src/main/java/one/mixin/android/extension/ContextExtension.kt | Adds isBatteryOptimizationRestricted() and openBatteryOptimizationSetting() helpers. |
| app/src/main/AndroidManifest.xml | Removes BatteryOptimizationDialogActivity registration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import one.mixin.android.ui.common.MixinComposeBottomSheetDialogFragment | ||
| import one.mixin.android.ui.home.MainActivity | ||
| import one.mixin.android.ui.setting.SettingActivity | ||
| import one.mixin.android.util.RomUtil |
| return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
| R.string.setting_battery_optimize_title_one_ui_above_s | ||
| } else { | ||
| R.string.setting_battery_optimize_title_one_ui_below_s |
There was a problem hiding this comment.
Pull request overview
Adds a new in-app “Battery Optimization” reminder surfaced via the existing reminder bottom sheet flow, replacing the previous dedicated dialog activity and consolidating battery optimization detection/navigation into Context extensions.
Changes:
- Introduce a new
BatteryOptimizationReminderpopup type and reminder UI (new string + background image). - Refactor
ReminderPageto accept pre-resolvedStringcontent (instead of a@StringResid) and update call sites. - Remove
BatteryOptimizationDialogActivityand migrate battery-optimization checks/open-settings behavior intoContextExtension.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/strings.xml | Adds Battery_Optimization title string (EN). |
| app/src/main/res/values-zh-rTW/strings.xml | Adds Traditional Chinese translation for Battery_Optimization. |
| app/src/main/res/values-zh-rCN/strings.xml | Adds Simplified Chinese translation for Battery_Optimization. |
| app/src/main/res/values-ru/strings.xml | Adds Russian translation for Battery_Optimization. |
| app/src/main/res/values-ja/strings.xml | Adds Japanese translation for Battery_Optimization. |
| app/src/main/res/values-es/strings.xml | Adds Spanish translation for Battery_Optimization. |
| app/src/main/res/drawable-xxhdpi/bg_reminder_battery_optimization.png | Adds new reminder background asset. |
| app/src/main/java/one/mixin/android/ui/home/reminder/VerifyMobileReminderBottomSheetDialogFragment.kt | Updates reminder content argument to pass a resolved string via stringResource. |
| app/src/main/java/one/mixin/android/ui/home/reminder/ReminderPage.kt | Changes API: content becomes String and is rendered directly. |
| app/src/main/java/one/mixin/android/ui/home/reminder/ReminderBottomSheetDialogFragment.kt | Adds battery optimization reminder selection + UI, and opens battery optimization settings. |
| app/src/main/java/one/mixin/android/ui/home/MainActivity.kt | Removes the legacy battery optimization check hook. |
| app/src/main/java/one/mixin/android/ui/common/BatteryOptimizationDialogActivity.kt | Deletes the legacy dialog activity implementation. |
| app/src/main/java/one/mixin/android/job/BlazeMessageService.kt | Uses the new Context.isBatteryOptimizationRestricted() helper and removes dialog activity trigger. |
| app/src/main/java/one/mixin/android/extension/ContextExtension.kt | Adds isBatteryOptimizationRestricted() + openBatteryOptimizationSetting() and intent fallback logic. |
| app/src/main/AndroidManifest.xml | Removes BatteryOptimizationDialogActivity registration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @StringRes | ||
| private fun getBatteryOptimizationContentResId(): Int { | ||
| return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
| R.string.setting_battery_optimize_title_one_ui_above_s | ||
| } else { | ||
| R.string.setting_battery_optimize_title_one_ui_below_s | ||
| } | ||
| } |
There was a problem hiding this comment.
getBatteryOptimizationContentResId() always returns the One UI-specific instruction strings based solely on the Android version. This means non-One UI devices will see Samsung/One UI navigation text (e.g., Optimised/Unrestricted) even though there is already a generic setting_battery_optimize_title string.
Consider selecting the content string based on RomUtil.isOneUi (use the One UI strings only when true; otherwise fall back to R.string.setting_battery_optimize_title).
| import one.mixin.android.ui.common.MixinComposeBottomSheetDialogFragment | ||
| import one.mixin.android.ui.home.MainActivity | ||
| import one.mixin.android.ui.setting.SettingActivity | ||
| import one.mixin.android.util.RomUtil |
There was a problem hiding this comment.
RomUtil is imported but not referenced in this file. If you switch getBatteryOptimizationContentResId() to be One UI-aware you may end up using it; otherwise please remove the unused import to keep the file clean.
| import one.mixin.android.util.RomUtil |
| return getString(getBatteryOptimizationContentResId()) | ||
| .replace("<b>", "") | ||
| .replace("</b>", "") | ||
| .replace("**", "") | ||
| } | ||
|
|
There was a problem hiding this comment.
batteryOptimizationContent() strips <b> and ** markers by doing plain string replacements. This is brittle for localization (translators may legitimately use * characters) and also removes intended emphasis from the instruction text.
Prefer keeping these strings markup-free (plain text resources), or parse/render formatting explicitly (e.g., convert known markers into an AnnotatedString with bold spans in Compose).
| return getString(getBatteryOptimizationContentResId()) | |
| .replace("<b>", "") | |
| .replace("</b>", "") | |
| .replace("**", "") | |
| } | |
| // Return the localized string as-is; any formatting markers should be | |
| // interpreted explicitly at render time rather than stripped here. | |
| return getString(getBatteryOptimizationContentResId()) | |
| } |
No description provided.