Refactor: centralize subscription auto-update scheduling in SubscriptionUpdater (#5567)
* Initial plan * Refactor subscription auto-update system into SubscriptionUpdater facade Agent-Logs-Url: https://github.com/2dust/v2rayNG/sessions/63125c89-4db9-4572-8adb-10c29ea531f5 Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com> * Add TODO comment to legacy fallback in SubscriptionUpdater Agent-Logs-Url: https://github.com/2dust/v2rayNG/sessions/63125c89-4db9-4572-8adb-10c29ea531f5 Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com> * Use per-subscription auto-update intervals Migrate subscription auto-update from a global toggle/interval to per-subscription scheduling. - Add per-subscription updateInterval (Long, default 1440 minutes) and persist in SubEdit UI; validate minimum interval (15 minutes). - Update SubscriptionUpdater to schedule/cancel tasks per subscription, compute initial delay from subscription.lastUpdated, and skip when autoUpdate is disabled or subId is missing. - Remove legacy global auto-update prefs and fallback logic: deleted global prefs/UI handling, MmkvManager last-attempt encode/decode, and related default setting. - Ensure cancelling of scheduled task when removing a subscription and adjust SettingsManager initialization. - Add localized toast strings for invalid update interval and update related layouts/resources. This change enables individual update intervals per subscription and simplifies the updater by removing legacy global state and last-attempt persistence. * Allow optional force-reschedule for subscriptions Add a forceReschedule flag to SubscriptionUpdater.sync to choose the WorkManager policy (KEEP by default, REPLACE when forced). Refactor scheduleOne to accept an ExistingPeriodicWorkPolicy and use it when enqueuing periodic work; syncOne now forces REPLACE so a manual refresh recalculates next run. Remove the cancelAll helper and improve logging to include the reschedule flag/policy. This lets startup keep existing periodic work while allowing explicit reschedules when needed (e.g., after manual updates). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
1 parent
e8585a82c6
commit
3b4d895c1d
21 files changed
+238
-103
No files matched your search
@@ -305,6 +305,7 @@
|
||||
<string name="sub_setting_pre_profile">Previous proxy config remarks</string>
|
||||
<string name="sub_setting_next_profile">Next proxy config remarks</string>
|
||||
<string name="sub_setting_pre_profile_tip">The config remarks exist and are unique</string>
|
||||
<string name="toast_invalid_update_interval">Invalid update interval. Minimum is 15 minutes.</string>
|
||||
<string name="title_sub_update">Update subscription</string>
|
||||
<string name="title_ping_all_server">Tcping config</string>
|
||||
<string name="title_real_ping_all_server">Real delay config</string>
|
||||
|
||||
Reference in new issue
Block a user