v1.26 ios v2

This commit is contained in:
bossanyit
2022-10-29 10:01:00 +02:00
parent 208ada4251
commit 621d766335
50 changed files with 593 additions and 679 deletions
+3
View File
@@ -50,6 +50,7 @@ class RevenueCatPurchases with Logging {
log("Trial mode: $inTrial date: ${Cache().userLoggedIn!.trialDate}");
if (Cache().userLoggedIn!.admin == 1 || inTrial || Cache().userLoggedIn!.lifeLong == 1) {
Cache().hasPurchased = true;
log(" -- Purchased -- ");
}
}
@@ -94,6 +95,7 @@ class RevenueCatPurchases with Logging {
PurchaserInfo purchaserInfo = await Purchases.purchasePackage(selectedPackage);
if (purchaserInfo.entitlements.all["wt_subscription"] != null && purchaserInfo.entitlements.all["wt_subscription"]!.isActive) {
Cache().hasPurchased = true;
log(" -- Purchased -- ");
}
} else {
log("!!!! No Selected package to purchase");
@@ -107,6 +109,7 @@ class RevenueCatPurchases with Logging {
if (errorCode == PurchasesErrorCode.invalidReceiptError) {
log("iOS Sandbox invalid receipt");
Cache().hasPurchased = true;
log(" -- Purchased -- ");
return;
}
log(e.toString());
+17 -9
View File
@@ -6,9 +6,7 @@ import 'package:aitrainer_app/util/enums.dart';
import 'package:aitrainer_app/model/tracking.dart' as model;
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
//import 'package:flurry_data/flurry_data.dart';
//import 'package:flutter_uxcam/flutter_uxcam.dart';
//import 'package:flutter_smartlook/flutter_smartlook.dart';
import 'package:posthog_flutter/posthog_flutter.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
class Track with Logging {
@@ -22,12 +20,9 @@ class Track with Logging {
Track._internal();
void track(TrackingEvent event, {String eventValue = ""}) {
model.Tracking tracking = model.Tracking();
tracking.customerId = Cache().userLoggedIn == null ? 0 : Cache().userLoggedIn!.customerId!;
if (!isInDebugMode) {
//FlurryData.logEvent(event.enumToString());
//Smartlook.setGlobalEventProperty(event.toString(), eventValue, false);
//FlutterUxcam.logEventWithProperties(event.enumToString(), {"value": eventValue});
model.Tracking tracking = model.Tracking();
tracking.customerId = Cache().userLoggedIn == null ? 0 : Cache().userLoggedIn!.customerId!;
tracking.event = event.enumToString();
if (eventValue.isNotEmpty) {
tracking.eventValue = eventValue;
@@ -38,7 +33,20 @@ class Track with Logging {
FirebaseMessaging.instance.subscribeToTopic(event.enumToString());
analytics.logEvent(name: event.enumToString(), parameters: {"value": eventValue});
MatomoTracker.instance.trackEvent(eventName: event.enumToString(), eventCategory: "", action: eventValue, eventValue: tracking.customerId);
if (eventValue.isNotEmpty) {
MatomoTracker.instance.trackEvent(eventCategory: "wt", action: event.enumToString(), eventName: eventValue);
} else {
MatomoTracker.instance.trackEvent(eventCategory: "wt", action: event.enumToString());
}
Posthog().capture(
eventName: event.enumToString(),
properties: {
'action': eventValue,
'customer': tracking.customerId,
},
);
}
}
}