V 1.1.24+1 Push Notification android, Smartlook activate

This commit is contained in:
Tibor Bossanyi (Freelancer)
2021-10-03 22:53:38 +02:00
parent 9c72df1d67
commit fd6a5a3145
31 changed files with 2284 additions and 77 deletions
+8
View File
@@ -56,6 +56,7 @@ import 'package:aitrainer_app/util/app_localization.dart';
import 'package:flutter_uxcam/flutter_uxcam.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:smartlook/smartlook.dart';
import 'package:upgrader/upgrader.dart';
import 'bloc/account/account_bloc.dart';
import 'bloc/body_development/body_development_bloc.dart';
@@ -146,8 +147,15 @@ Future<Null> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (!isInDebugMode) {
FlutterUxcam.startWithKey("wvdstyoml4tiwfd");
SetupOptions options = (
new SetupOptionsBuilder('682883e5cd71a46160c4f6ed070530ee593f49c6')
).build();
Smartlook.setupAndStartRecording(options);
}
print(" -- FireBase init..");
runApp(MultiBlocProvider(
+3 -2
View File
@@ -38,6 +38,7 @@ import 'package:package_info/package_info.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:aitrainer_app/model/exercise_type.dart';
import 'package:intl/intl.dart';
import 'package:smartlook/smartlook.dart';
import 'customer_exercise_device.dart';
import 'exercise_device.dart';
@@ -689,9 +690,9 @@ class Cache with Logging {
if (!isInDebugMode) {
FlurryData.setUserId(customerId.toString());
//Smartlook.setUserIdentifier(customerId.toString());
FlutterUxcam.setUserProperty("username", customerId.toString());
FlutterUxcam.setUserIdentity(customerId.toString());
Smartlook.setUserIdentifier(customerId.toString());
Track().track(TrackingEvent.enter);
}
@@ -701,7 +702,7 @@ class Cache with Logging {
});
print("Firebase token save: $firebaseMessageToken");
if (userLoggedIn!.firebaseRegToken == null && firebaseMessageToken != null) {
if (firebaseMessageToken != null) {
userLoggedIn!.firebaseRegToken = firebaseMessageToken;
CustomerRepository customerRepository = CustomerRepository();
customerRepository.customer = userLoggedIn;
+12 -2
View File
@@ -62,10 +62,20 @@ class FirebaseApi with logging.Logging {
badge: true,
sound: true,
);
this.firebaseRegToken = await FirebaseMessaging.instance.getToken();
this.firebaseRegToken = await FirebaseMessaging.instance.getToken();
Cache().firebaseMessageToken = firebaseRegToken;
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
log("FirebaseMessaging token $firebaseRegToken");
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Got a message whilst in the foreground!');
print('Message data: ${message.data}');
if (message.notification != null) {
print('Message also contained a notification: ${message.notification}');
}
});
} catch (e) {
// Set `_error` state to true if Firebase initialization fails
log("Error initializing Firebase");
+2 -1
View File
@@ -8,6 +8,7 @@ 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:smartlook/smartlook.dart';
class Track with Logging {
static final Track _singleton = Track._internal();
@@ -22,7 +23,7 @@ class Track with Logging {
void track(TrackingEvent event, {String eventValue = ""}) {
if (!isInDebugMode) {
FlurryData.logEvent(event.enumToString());
// Smartlook.setGlobalEventProperty(event.toString(), eventValue, false);
Smartlook.setGlobalEventProperty(event.toString(), eventValue, false);
FlutterUxcam.logEventWithProperties(event.enumToString(), {"value": eventValue});
model.Tracking tracking = model.Tracking();
//analytics.logEvent(name: event.enumToString(), parameters: {"value": eventValue});