REF: Add backoff support so widget can rest if network requires it#8122
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds backoff support and improved widget management for Android widgets in the BlueWallet app. The changes enable widgets to handle network failures gracefully with exponential backoff retry mechanisms and enhanced resizing capabilities.
Key changes:
- Added exponential backoff and network constraint handling to widget update workers
- Enhanced widget XML configurations with resize support and keyguard display capabilities
- Improved widget lifecycle management with better caching and immediate update scheduling
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
market_widget_info.xml |
Added resize capabilities and keyguard support to market widget configuration |
bitcoin_price_widget_info.xml |
Added resize capabilities and keyguard support to bitcoin price widget configuration |
WidgetUpdateWorker.kt |
Implemented exponential backoff policy and network constraints for widget updates |
MarketWidget.kt |
Enhanced widget lifecycle with immediate updates and proper cleanup |
BitcoinPriceWidget.kt |
Added cached data display and improved widget initialization |
AppWidgetUtils.kt |
Added widget pinning support and utility functions for widget management |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| * Schedule a retry when network becomes available | ||
| */ | ||
| fun scheduleRetryOnNetworkAvailable(context: Context, appWidgetIds: IntArray) { | ||
| fun scheduleRetryOnNetworkAvailable(context: Context) { |
There was a problem hiding this comment.
The function signature has been changed from scheduleRetryOnNetworkAvailable(context: Context, appWidgetIds: IntArray) to scheduleRetryOnNetworkAvailable(context: Context), removing the appWidgetIds parameter. This is a breaking change that could affect callers expecting to pass widget IDs for targeted updates.
| super.onDisabled(context) | ||
| Log.d(TAG, "onDisabled called") | ||
| clearCache(context) | ||
| context.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE).edit().clear().apply() |
There was a problem hiding this comment.
This inline SharedPreferences clearing duplicates the logic that was previously in the removed clearCache method. Consider extracting this into a private method for better maintainability and consistency with the clearMarketData method in MarketWidget.
|
Wake the fuck up samurai, we have PRs to merge [all PRs for @Overtorment] https://github.com/BlueWallet/BlueWallet/pulls/review-requested/Overtorment |
|
Unbelievable. You, [subject name here], must be the pride of [subject hometown here]! |

No description provided.