-
-
Notifications
You must be signed in to change notification settings - Fork 358
Added the functionality for checking app update #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d26c5f1
feat: Added check updated functionality
Mayank4352 a46316f
feat: Added updated functionality on App launch
Mayank4352 2b6aee8
fix: Made the reduired changes and added localizations
Mayank4352 ad95a50
chore: update project structure
github-actions[bot] 59d2417
feat: Added test for about screen controller
Mayank4352 365924b
Merge branch 'dev' of https://github.com/Mayank4352/Resonate into dev
Mayank4352 ef39d7c
chore: update project structure
github-actions[bot] 5e62bbe
feat: made the requested changes
Mayank4352 2699cf7
Merge branch 'dev' of https://github.com/AOSSIE-Org/Resonate into dev
Mayank4352 eb2de02
feat: Added the localization chnages back
Mayank4352 ac21564
Merge branch 'dev' of https://github.com/Mayank4352/Resonate into dev
Mayank4352 867c3d3
chore: update project structure
github-actions[bot] b2418e6
feat: made the requested changes
Mayank4352 104e650
chore: update project structure
github-actions[bot] bf39ab1
feat: made the changes
Mayank4352 d73c017
Merge branch 'dev' of https://github.com/Mayank4352/Resonate into dev
Mayank4352 04a36ee
chore: update project structure
github-actions[bot] 3ea7c87
feat: made the change
Mayank4352 45e1577
Merge branch 'dev' of https://github.com/AOSSIE-Org/Resonate into dev
Mayank4352 d6e3864
chore: update project structure
github-actions[bot] 6bbeece
fix: fixed the issue with debug mode
Mayank4352 259edfc
fix: removed pubspec from gitignore
Mayank4352 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,27 @@ | ||
| import 'dart:developer'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:get/get.dart'; | ||
| import 'package:package_info_plus/package_info_plus.dart'; | ||
| import 'package:resonate/utils/enums/action_enum.dart'; | ||
| import 'package:upgrader/upgrader.dart'; | ||
| import 'package:url_launcher/url_launcher.dart'; | ||
| import 'package:resonate/utils/enums/update_enums.dart'; | ||
|
|
||
| class AboutAppScreenController extends GetxController { | ||
| final Rx<String> appVersion = "0.0.0".obs; | ||
| final Rx<String> appBuildNumber = "1".obs; | ||
| final Rx<bool> updateAvailable = false.obs; | ||
| final Rx<bool> isCheckingForUpdate = false.obs; | ||
|
|
||
| final showFullDescription = false.obs; | ||
|
|
||
| final String fullDescription = """ | ||
| Resonate is a revolutionary voice-based social media platform where every voice matters. | ||
| Join real-time audio conversations, participate in diverse discussions, and connect with | ||
| like-minded individuals. Our platform offers: | ||
| - Live audio rooms with topic-based discussions | ||
| - Seamless social networking through voice | ||
| - Community-driven content moderation | ||
| - Cross-platform compatibility | ||
| - End-to-end encrypted private conversations | ||
|
|
||
| Developed by the AOSSIE open source community, we prioritize user privacy and | ||
| community-driven development. Join us in shaping the future of social audio!"""; | ||
| final Upgrader upgrader = Upgrader( | ||
| debugDisplayAlways: true, | ||
| debugDisplayOnce: true, | ||
| debugLogging: true, | ||
| durationUntilAlertAgain: const Duration(days: 1), | ||
| ); | ||
|
|
||
| @override | ||
| void onInit() { | ||
|
|
@@ -33,26 +35,75 @@ community-driven development. Join us in shaping the future of social audio!"""; | |
| appVersion.value = packageInfo.version; | ||
| appBuildNumber.value = packageInfo.buildNumber; | ||
| } catch (e) { | ||
| Get.snackbar("Error", "Could not load package info"); | ||
| log('Could not load package info: $e'); | ||
|
||
| } | ||
| } | ||
|
|
||
| void toggleDescription() { | ||
| showFullDescription.toggle(); | ||
| } | ||
|
|
||
| Future<void> checkForUpdate() async { | ||
| // Implement actual update check logic | ||
| updateAvailable.value = await _fakeUpdateCheck(); | ||
| if (updateAvailable.value) { | ||
| Get.snackbar("Update Available", "A new version is available!"); | ||
| } else { | ||
| Get.snackbar("Up to Date", "You're using the latest version"); | ||
| Future<UpdateCheckResult> checkForUpdate({ | ||
| bool launchUpdateIfAvailable = false, | ||
| bool isManualCheck = false, | ||
| }) async { | ||
| isCheckingForUpdate.value = true; | ||
| try { | ||
| if (!Platform.isAndroid && !Platform.isIOS) { | ||
| return UpdateCheckResult.platformNotSupported; | ||
| } | ||
M4dhav marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Upgrader.clearSavedSettings(); | ||
| await upgrader.initialize(); | ||
| final needsUpdate = upgrader.shouldDisplayUpgrade(); | ||
M4dhav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| updateAvailable.value = needsUpdate; | ||
| if (needsUpdate) { | ||
| if (isManualCheck) { | ||
| Get.dialog( | ||
| UpgradeAlert(upgrader: upgrader), | ||
| barrierDismissible: false, | ||
| ); | ||
| } else if (launchUpdateIfAvailable) { | ||
| await launchStoreForUpdate(); | ||
| } else { | ||
| Get.dialog( | ||
| UpgradeAlert(upgrader: upgrader), | ||
| barrierDismissible: false, | ||
| ); | ||
| } | ||
| } | ||
M4dhav marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return needsUpdate | ||
| ? UpdateCheckResult.updateAvailable | ||
| : UpdateCheckResult.noUpdateAvailable; | ||
| } catch (e) { | ||
| log('Update check error: $e'); | ||
| return UpdateCheckResult.checkFailed; | ||
| } finally { | ||
| isCheckingForUpdate.value = false; | ||
| } | ||
| } | ||
|
|
||
| Future<bool> _fakeUpdateCheck() async { | ||
| await Future.delayed(const Duration(seconds: 1)); | ||
| return false; | ||
| Future<UpdateActionResult> launchStoreForUpdate() async { | ||
| try { | ||
| String storeUrl; | ||
| if (Platform.isAndroid) { | ||
| storeUrl = | ||
| 'https://play.google.com/store/apps/details?id=com.resonate.resonate'; | ||
| } else if (Platform.isIOS) { | ||
| // The App Store URL of app | ||
| storeUrl = ''; | ||
| } else { | ||
| return UpdateActionResult.error; | ||
| } | ||
| final uri = Uri.parse(storeUrl); | ||
| if (await canLaunchUrl(uri)) { | ||
| await launchUrl(uri, mode: LaunchMode.externalApplication); | ||
| return UpdateActionResult.success; | ||
| } else { | ||
| return UpdateActionResult.failed; | ||
| } | ||
| } catch (e) { | ||
| log('Update error: $e'); | ||
| return UpdateActionResult.error; | ||
| } | ||
M4dhav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t ignore pubspec.lock for apps.
For application repos, committing pubspec.lock ensures reproducible builds across CI/dev. Recommend removing this ignore.
Apply this diff:
-pubspec.lock📝 Committable suggestion
🤖 Prompt for AI Agents