CollectionReference<Map<String, dynamic>> usersRef =FirebaseFirestore.instance.collection("data");
Future<void> purchaseGoldPackage(Package package) async { try { await Purchases.purchasePackage(package).then((customerInfo) async { await Purchases.syncPurchases(); usersRef .doc( userID, ) .update({ 'status': 'gold', }); }); } catch (e) {}}
The code above is how i set a listener for a new customer subscription, then calling firestore to update a fieldValue “status” from ‘free’ to ‘gold’, which is how multiple devices get notified a purchase was made and the subscription is active.
This works 5 out of 10 times, which means i maybe half way there,
The issue is firestore update method dont get called half the time, leaving user with multiple devices hanging. which means the listener i set up for firestore which updates the UI of user devices wont get triggered, forcing users to restart app to see subscription changes, even though users still get what they paid for.
could someone please tell me if i set my RC listener the wrong way ? and if i don’t need to involve firestore sdk to get multiple devices to update app UI as soon as a purchase was successful
thanks!