π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update in-app purchases
ashil-pilot6e967bcdba9a
diff --git a/mobile/apps/photos/fdroid/overlay/lib/services/account/purchase_update_listener.dart b/mobile/apps/photos/fdroid/overlay/lib/services/account/purchase_update_listener.dartindex 666f76f20d..83ee08b68f 100644--- a/mobile/apps/photos/fdroid/overlay/lib/services/account/purchase_update_listener.dart+++ b/mobile/apps/photos/fdroid/overlay/lib/services/account/purchase_update_listener.dart@@ -1,3 +1,5 @@+Future<void> initializeStorePurchases() async {}+void listenForPurchaseUpdates({required bool Function() isOnSubscriptionPage,required Future<void> Function(String productID, String verificationData)diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lockindex 2a0c72a289..429029fb12 100644--- a/mobile/apps/photos/ios/Podfile.lock+++ b/mobile/apps/photos/ios/Podfile.lock@@ -504,7 +504,7 @@ SPEC CHECKSUMS:GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1home_widget: f169fc41fd807b4d46ab6615dc44d62adbf9f64f- in_app_purchase_storekit: d1a48cb0f8b29dbf5f85f782f5dd79b21b90a5e6+ in_app_purchase_storekit: 22cca7d08eebca9babdf4d07d0baccb73325d3c8integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586ejust_audio: 4e391f57b79cad2b0674030a00453ca5ce817eedlauncher_icon_switcher: 84c218d233505aa7d8655d8fa61a3ba802c022dadiff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex f8a59bd259..ea736890c4 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -41,6 +41,7 @@ import "package:photos/l10n/l10n.dart";import 'package:photos/module/upload/service/file_uploader.dart';import 'package:photos/module/upload/service/local_file_update_service.dart';import "package:photos/service_locator.dart";+import "package:photos/services/account/purchase_update_listener.dart";import "package:photos/services/account/user_service.dart";import 'package:photos/services/app_lifecycle_service.dart';import 'package:photos/services/collections_service.dart';@@ -89,6 +90,7 @@ enum ForegroundStartupMode { normal, picker }void main() async {debugRepaintRainbowEnabled = false;WidgetsFlutterBinding.ensureInitialized();+ await initializeStorePurchases();ente_ui.AppThemeConfig.initialize(ente_ui.EnteApp.photos);await initIsIPad();if (isIPad) {diff --git a/mobile/apps/photos/lib/services/account/purchase_update_listener.dart b/mobile/apps/photos/lib/services/account/purchase_update_listener.dartindex ccdd18cd44..94a821ba42 100644--- a/mobile/apps/photos/lib/services/account/purchase_update_listener.dart+++ b/mobile/apps/photos/lib/services/account/purchase_update_listener.dart@@ -1,6 +1,23 @@import "dart:io";import "package:in_app_purchase/in_app_purchase.dart";+import "package:in_app_purchase_storekit/in_app_purchase_storekit.dart";++Future<void> initializeStorePurchases() async {+ if (!Platform.isIOS) {+ return;+ }++ // This must run during app initialization, before any code reads+ // InAppPurchase.instance.purchaseStream. Flutter registers StoreKit 2 before+ // main(), so switch to StoreKit 1 and re-register the Dart implementation+ // early enough for its transaction observer to be initialized.+ // TODO: Remove this fallback after the server supports StoreKit 2 JWS+ // verification.+ // ignore: deprecated_member_use+ await InAppPurchaseStoreKitPlatform.enableStoreKit1();+ InAppPurchaseStoreKitPlatform.registerPlatform();+}void listenForPurchaseUpdates({required bool Function() isOnSubscriptionPage,diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yamlindex 85923f5bdf..7f5f102b70 100644--- a/mobile/apps/photos/pubspec.yaml+++ b/mobile/apps/photos/pubspec.yaml@@ -147,7 +147,8 @@ dependencies:http: 1.6.0hugeicons: 1.1.7image: 4.7.0- in_app_purchase: 3.2.1+ in_app_purchase: 3.3.0+ in_app_purchase_storekit: 0.4.11intl: 0.20.2just_audio: 0.10.5latlong2: 0.9.1diff --git a/mobile/apps/photos/scripts/prepare_fdroid_source.sh b/mobile/apps/photos/scripts/prepare_fdroid_source.shindex 6b27209a7b..20a33fd0e0 100755--- a/mobile/apps/photos/scripts/prepare_fdroid_source.sh+++ b/mobile/apps/photos/scripts/prepare_fdroid_source.sh@@ -10,9 +10,9 @@ fail() {remove_direct_dependencies() {local count- count=$(rg -c "^ (firebase_core|firebase_messaging|in_app_purchase):" pubspec.yaml || true)- [[ "$count" == "3" ]] || fail "expected three restricted dependencies in pubspec.yaml"- perl -0pi -e 's/^ (firebase_core|firebase_messaging|in_app_purchase):[^\n]*\n//mg' pubspec.yaml+ count=$(rg -c "^ (firebase_core|firebase_messaging|in_app_purchase_storekit|in_app_purchase):" pubspec.yaml || true)+ [[ "$count" == "4" ]] || fail "expected four restricted dependencies in pubspec.yaml"+ perl -0pi -e 's/^ (firebase_core|firebase_messaging|in_app_purchase_storekit|in_app_purchase):[^\n]*\n//mg' pubspec.yaml}remove_playstore_sources() {@@ -24,7 +24,7 @@ copy_fdroid_overlay() {}assert_fdroid_source() {- if rg -n "package:(firebase_core|firebase_messaging|in_app_purchase)" lib pubspec.yaml; then+ if rg -n "package:(firebase_core|firebase_messaging|in_app_purchase_storekit|in_app_purchase)" lib pubspec.yaml; thenfail "restricted package imports or direct dependencies remain"fidiff --git a/mobile/pubspec.lock b/mobile/pubspec.lockindex a7d2a8eca0..1561b301d3 100644--- a/mobile/pubspec.lock+++ b/mobile/pubspec.lock@@ -1425,18 +1425,18 @@ packages:dependency: transitivedescription:name: in_app_purchase- sha256: "11a40f148eeb4f681a0572003e2b33432e110c90c1bbb4f9ef83b81ec0c4f737"+ sha256: "0e9510b80b0074e89ab0a8e0fc901439b779dc9ae575ab8d419253c6e1627716"url: "https://pub.dev"source: hosted- version: "3.2.1"+ version: "3.3.0"in_app_purchase_android:dependency: transitivedescription:name: in_app_purchase_android- sha256: "518b48a385dfc1aa278080472969c6cee0c3d41ef8b9511b0071dd015473ecf1"+ sha256: b8af1b6f0e57076b5da5ede71e3af2d727017c0416ad2a41017c6ed2b102381durl: "https://pub.dev"source: hosted- version: "0.4.0+11"+ version: "0.5.0"in_app_purchase_platform_interface:dependency: transitivedescription:@@ -1449,10 +1449,10 @@ packages:dependency: transitivedescription:name: in_app_purchase_storekit- sha256: "6ce1361278cacc0481508989ba419b2c9f46a2b0dc54b3fe54f5ee63c2718fef"+ sha256: "702a23c3d2ddc177b075d521d264900e82f01663881e4ef3ce17775de298c0e3"url: "https://pub.dev"source: hosted- version: "0.3.22+1"+ version: "0.4.11"integration_test:dependency: transitivedescription: flutter