diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 6166d1eb84..e1fcb64dfc 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2579,5 +2579,6 @@ "sub_changeSub": "Change subscription for", "sub_changeSubText": "Are you sure you want to change your subscription?", "sub_changeButton": "Change subscription", - "sub_renewedOn": "The subscription is renewed on:" + "sub_renewedOn": "The subscription is renewed on:", + "sub_restore": "Restore my subscription" } diff --git a/lib/config/subscription.dart b/lib/config/subscription.dart index ffcd287583..b43eebb047 100644 --- a/lib/config/subscription.dart +++ b/lib/config/subscription.dart @@ -39,4 +39,15 @@ class SubscriptionManager { SubscriptionManager().presentPaywall(); } } + + Future restoreSub() async { + try { + CustomerInfo customerInfo = await Purchases.restorePurchases(); + return customerInfo; + } on PlatformException catch (e) { + // Error restoring purchases + print('error: $e'); + return null; + } + } } diff --git a/lib/pages/login/not_subscribe.dart b/lib/pages/login/not_subscribe.dart index 6b47eeb3d3..e18768f748 100644 --- a/lib/pages/login/not_subscribe.dart +++ b/lib/pages/login/not_subscribe.dart @@ -54,6 +54,14 @@ class _NotSubscribePageState extends State { }, child: Text(L10n.of(context)!.sub_payWallButton), ), + const SizedBox(height: 20), + if (PlatformInfos.shouldInitializePurchase()) + ElevatedButton( + onPressed: () async { + await SubscriptionManager().restoreSub(); + }, + child: Text(L10n.of(context)!.sub_restore), + ), ], ), ), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 05ed1dd1e9..9707bf9deb 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -13,6 +13,7 @@ import dynamic_color import emoji_picker_flutter import file_selector_macos import flutter_app_badger +import flutter_inappwebview_macos import flutter_local_notifications import flutter_secure_storage_macos import flutter_web_auth_2 @@ -46,6 +47,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterAppBadgerPlugin.register(with: registry.registrar(forPlugin: "FlutterAppBadgerPlugin")) + InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) diff --git a/pubspec.lock b/pubspec.lock index f1229eda92..f2423a26e7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1107,10 +1107,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" intl_phone_field: dependency: "direct main" description: @@ -1188,26 +1188,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" license_checker: dependency: "direct dev" description: @@ -1292,10 +1292,10 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" matrix: dependency: "direct main" description: @@ -1316,10 +1316,10 @@ packages: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.11.0" mgrs_dart: dependency: transitive description: @@ -2057,10 +2057,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.1" timezone: dependency: transitive description: @@ -2361,10 +2361,10 @@ packages: dependency: transitive description: name: vm_service - sha256: a75f83f14ad81d5fe4b3319710b90dec37da0e22612326b696c9e1b8f34bbf48 + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.0" + version: "13.0.0" wakelock_platform_interface: dependency: transitive description: @@ -2487,5 +2487,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.2.3 <4.0.0" + flutter: ">=3.16.0"