6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 7da54450

AuthorNKL<nikolaj.king@gmail.com>
Date2025-02-20 14:41:33 +0100
added small fixes and tracking to various pages

Changed files

.../ios/Pods/Pods.xcodeproj/project.pbxproj        | 12 +++++------
 .../ios/Runner.xcodeproj/project.pbxproj           |  2 +-
 .../manifest.json                                  |  1 +
 .../authentication/bloc/authentication_bloc.dart   |  4 ++++
 .../booking_details/bloc/booking_details_bloc.dart |  1 +
 .../lib/booking_details/booking_details_page.dart  |  3 +++
 .../lib/housekeeping/housekeeping_cubit.dart       | 15 ++++++++++++++
 .../lib/housekeeping/housekeeping_page.dart        |  3 +++
 comwell_key_app/lib/key/key_page.dart              |  3 +++
 .../lib/login/components/azure_b2c_widget.dart     |  4 ++++
 comwell_key_app/lib/login/login_page.dart          | 12 +++++++++--
 comwell_key_app/lib/overview/overview_page.dart    |  4 +++-
 comwell_key_app/lib/profile/profile_page.dart      |  2 ++
 .../cubit/profile_settings_cubit.dart              |  4 ++++
 .../profile_settings/profile_settings_page.dart    |  8 ++++----
 .../interceptors/response_handle_interceptor.dart  | 12 ++++++++---
 comwell_key_app/lib/tracking/comwell_tracking.dart |  6 ++++++
 .../lib/tracking/trackers/firebase_tracker.dart    | 24 +++++++++++++++++-----
 18 files changed, 98 insertions(+), 22 deletions(-)

Diff

diff --git a/comwell_key_app/ios/Pods/Pods.xcodeproj/project.pbxproj b/comwell_key_app/ios/Pods/Pods.xcodeproj/project.pbxproj
index 5e5bc964..bec4afc2 100644
--- a/comwell_key_app/ios/Pods/Pods.xcodeproj/project.pbxproj
+++ b/comwell_key_app/ios/Pods/Pods.xcodeproj/project.pbxproj
@@ -733,9 +733,9 @@
5F5B132CE89EF82CB3ADE183D5A23226 /* ClientKeyResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 286015B4EF690FED4409C3FB3F6F5BE7 /* ClientKeyResponse.swift */; };
5F8E1FA958DBFA4EC243F7629BF5B8A8 /* SessionSetupRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE72D2AAB9CF0285617363BB6B3765A1 /* SessionSetupRequest.swift */; };
60C28ADA9E6B05B96D910E092780D1C4 /* FormPostalCodeItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCA4A6B9330ABA87E15A558C6C4AF239 /* FormPostalCodeItem.swift */; };
- 60CB128D2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60CB128C2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework */; };
- 60CB12902D649ABF00ED1EBA /* SeosMobileKeysSDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60CB128C2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework */; };
60D8608B76620DE5A39147735844EB6F /* SentryContinuousProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 661F430E8A9B0426A7637A3A3CC046FA /* SentryContinuousProfiler.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 60DC148F2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60DC148E2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework */; };
+ 60DC14922D65FACD00CCAE5A /* SeosMobileKeysSDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60DC148E2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework */; };
60E2C8A202B7E5C705A979284A28CB02 /* ShareableVoucherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D567CB25D18C66D8111FB5D68ED01CFE /* ShareableVoucherView.swift */; };
619B1B45A968881B707DA5C663F8EA5E /* SentryCrashStackCursor.c in Sources */ = {isa = PBXBuildFile; fileRef = 47C73AA9DCBD5CE86300E56DA1F35C0E /* SentryCrashStackCursor.c */; };
61F505730C11E1C8D63112B5BF6F9098 /* FIRInstallationsIIDTokenStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A5E66E66ECDCAD3106B5739B51EFD06 /* FIRInstallationsIIDTokenStore.h */; settings = {ATTRIBUTES = (Project, ); }; };
@@ -3350,7 +3350,7 @@
60A63B8D4DD00629E98151DE7192D74F /* FIRInstallationsStoredAuthToken.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FIRInstallationsStoredAuthToken.m; path = FirebaseInstallations/Source/Library/InstallationsStore/FIRInstallationsStoredAuthToken.m; sourceTree = "<group>"; };
60AABE5FF211AA5066A7EEC19007528A /* SentryCrashNSErrorUtil.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SentryCrashNSErrorUtil.h; path = Sources/SentryCrash/Recording/Tools/SentryCrashNSErrorUtil.h; sourceTree = "<group>"; };
60AC98597FF995C559447F42D532C8C4 /* SentryCrashCPU_arm.c */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.c; name = SentryCrashCPU_arm.c; path = Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm.c; sourceTree = "<group>"; };
- 60CB128C2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:333BNLD22V:ASSAABLOY AB"; lastKnownFileType = wrapper.xcframework; name = SeosMobileKeysSDK.xcframework; path = "/Users/nkl/Documents/GitHub/comwell-app/comwell_key_app/ios/../../mobilekeys_sdk_plugin/XCFrameworks/SeosMobileKeysSDK.xcframework"; sourceTree = "<absolute>"; };
+ 60DC148E2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:333BNLD22V:ASSAABLOY AB"; lastKnownFileType = wrapper.xcframework; name = SeosMobileKeysSDK.xcframework; path = "/Users/nkl/Documents/GitHub/comwell-app/comwell_key_app/ios/../../mobilekeys_sdk_plugin/XCFrameworks/SeosMobileKeysSDK.xcframework"; sourceTree = "<absolute>"; };
60E994C96645602372D2C13C1452A286 /* SentryDefaultRateLimits.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SentryDefaultRateLimits.h; path = Sources/Sentry/include/SentryDefaultRateLimits.h; sourceTree = "<group>"; };
60EDD25EA7762658952AB526CC3706D0 /* SentryThreadState.hpp */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.h; name = SentryThreadState.hpp; path = Sources/Sentry/include/SentryThreadState.hpp; sourceTree = "<group>"; };
61193B0198C25624BEBE1AE96CF70082 /* SentrySpanContext+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SentrySpanContext+Private.h"; path = "Sources/Sentry/include/SentrySpanContext+Private.h"; sourceTree = "<group>"; };
@@ -4789,7 +4789,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 60CB12902D649ABF00ED1EBA /* SeosMobileKeysSDK.xcframework in Frameworks */,
+ 60DC14922D65FACD00CCAE5A /* SeosMobileKeysSDK.xcframework in Frameworks */,
2673B1EF7149F26CCE2415DB95B659B1 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -4827,7 +4827,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 60CB128D2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework in Frameworks */,
+ 60DC148F2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework in Frameworks */,
1BA7E7CDE434910A21FD7A43B83763AD /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -9500,7 +9500,7 @@
B94D7768568A9992200DB461E8CF687F /* Frameworks */ = {
isa = PBXGroup;
children = (
- 60CB128C2D649AB400ED1EBA /* SeosMobileKeysSDK.xcframework */,
+ 60DC148E2D65FAC400CCAE5A /* SeosMobileKeysSDK.xcframework */,
68D0E262FF83215AD89592F4FDBDE96C /* iOS */,
);
name = Frameworks;
diff --git a/comwell_key_app/ios/Runner.xcodeproj/project.pbxproj b/comwell_key_app/ios/Runner.xcodeproj/project.pbxproj
index b791c8de..8ee17f0f 100644
--- a/comwell_key_app/ios/Runner.xcodeproj/project.pbxproj
+++ b/comwell_key_app/ios/Runner.xcodeproj/project.pbxproj
@@ -866,7 +866,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_TEAM = 88JMYVVGNH;
+ DEVELOPMENT_TEAM = 8RNV6AX4ZL;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Comwell Hotels";
diff --git a/comwell_key_app/ios/build/XCBuildData/8c3b049d5d268dd432fe7a1551a7b9ed.xcbuilddata/manifest.json b/comwell_key_app/ios/build/XCBuildData/8c3b049d5d268dd432fe7a1551a7b9ed.xcbuilddata/manifest.json
new file mode 100644
index 00000000..7391713b
--- /dev/null
+++ b/comwell_key_app/ios/build/XCBuildData/8c3b049d5d268dd432fe7a1551a7b9ed.xcbuilddata/manifest.json
@@ -0,0 +1 @@
+{"client":{"name":"basic","version":0,"file-system":"device-agnostic","perform-ownership-analysis":"no"},"targets":{"":["<all>"]},"commands":{"<all>":{"tool":"phony","inputs":["<WorkspaceHeaderMapVFSFilesWritten>"],"outputs":["<all>"]},"P0:::Gate WorkspaceHeaderMapVFSFilesWritten":{"tool":"phony","inputs":[],"outputs":["<WorkspaceHeaderMapVFSFilesWritten>"]}}}
\ No newline at end of file
diff --git a/comwell_key_app/lib/authentication/bloc/authentication_bloc.dart b/comwell_key_app/lib/authentication/bloc/authentication_bloc.dart
index aa04deec..d5e94721 100644
--- a/comwell_key_app/lib/authentication/bloc/authentication_bloc.dart
+++ b/comwell_key_app/lib/authentication/bloc/authentication_bloc.dart
@@ -1,6 +1,8 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/authentication/authentication_repository.dart';
import 'package:comwell_key_app/authentication/enum/authentication_status.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:equatable/equatable.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
@@ -26,6 +28,8 @@ class AuthenticationBloc
AuthenticationLogoutPressed event,
Emitter<AuthenticationState> emit,
) {
+ locator<ComwellTracking>().trackEvent(
+ 'logout');
authenticationRepository.logOut();
}
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
index 0fb9a515..4a39327d 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
@@ -1,5 +1,6 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/database/comwell_db.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
import 'package:comwell_key_app/utils/seos_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
diff --git a/comwell_key_app/lib/booking_details/booking_details_page.dart b/comwell_key_app/lib/booking_details/booking_details_page.dart
index 8a8043a3..72f1991a 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -6,6 +6,8 @@ import 'package:comwell_key_app/booking_details/components/housekeeping_button.d
import 'package:comwell_key_app/booking_details/components/practical_information_button.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -19,6 +21,7 @@ class BookingDetailsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ locator<ComwellTracking>().trackScreenView('booking_details_page',"/overview/booking_details");
return BlocConsumer<BookingDetailsBloc, BookingDetailsState>(
listener: (context, state) {},
builder: (context, state) {
diff --git a/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart b/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
index 12d5df3b..44ee0595 100644
--- a/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
+++ b/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
@@ -1,11 +1,15 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_state.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/tracking/models/analytics_event_item.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'components/housekeeping_service.dart';
import 'housekeeping_repository.dart';
class HouseKeepingCubit extends Cubit<HouseKeepingState> {
final houseKeepingRepository = HouseKeepingRepository();
+ final tracking = locator<ComwellTracking>();
HouseKeepingCubit() : super(HouseKeepingState.initial());
final Iterable<HouseKeepingService> servicesSupplies = [
@@ -37,5 +41,16 @@ class HouseKeepingCubit extends Cubit<HouseKeepingState> {
Future<void> onOrderHousekeepingClicked() async {
await houseKeepingRepository.saveHouseKeepingOrdered();
+ final analyticsEventItem = AnalyticsEventItem(
+ hotelName: "Comwell",// TODO: Add hotel name,
+ currency: "DKK",
+ value: 0,
+ placement: "housekeeping_page",
+ items: state.selectedServices,
+ itemId: "housekeeping",
+ itemName: "itemName",
+ price: 0,
+ quantity: 1);
+ tracking.trackAddToCart(analyticsEventItem);
}
}
diff --git a/comwell_key_app/lib/housekeeping/housekeeping_page.dart b/comwell_key_app/lib/housekeeping/housekeeping_page.dart
index 7c1ef992..2a866393 100644
--- a/comwell_key_app/lib/housekeeping/housekeeping_page.dart
+++ b/comwell_key_app/lib/housekeeping/housekeeping_page.dart
@@ -2,6 +2,8 @@ import 'package:comwell_key_app/housekeeping/components/housekeeping_service.dar
import 'package:comwell_key_app/housekeeping/components/selectable_service.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_cubit.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_state.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -19,6 +21,7 @@ class HousekeepingPage extends StatefulWidget {
class _HousekeepingPageState extends State<HousekeepingPage> {
@override
Widget build(BuildContext context) {
+ locator<ComwellTracking>().trackScreenView('order_housekeeping_page', "/overview//bookingsdetails/housekeeping");
return BlocProvider(
create: (context) => HouseKeepingCubit(),
child: BlocBuilder<HouseKeepingCubit, HouseKeepingState>(
diff --git a/comwell_key_app/lib/key/key_page.dart b/comwell_key_app/lib/key/key_page.dart
index 668013b2..53c549b6 100644
--- a/comwell_key_app/lib/key/key_page.dart
+++ b/comwell_key_app/lib/key/key_page.dart
@@ -1,5 +1,7 @@
import 'package:comwell_key_app/common/components/round_icon_button.dart';
import 'package:comwell_key_app/key/bloc/key_bloc.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -12,6 +14,7 @@ class KeyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ locator<ComwellTracking>().trackScreenView('Keycard - read', '/keycard/read');
context.read<KeyBloc>().add(const StartScanning());
return BlocBuilder<KeyBloc, KeyState>(builder: (context, state) {
//if (state.status == KeyStatus.scanning || state.status != KeyStatus.openClosestReaderSuccess) {
diff --git a/comwell_key_app/lib/login/components/azure_b2c_widget.dart b/comwell_key_app/lib/login/components/azure_b2c_widget.dart
index cb46c83c..c0d2d79c 100644
--- a/comwell_key_app/lib/login/components/azure_b2c_widget.dart
+++ b/comwell_key_app/lib/login/components/azure_b2c_widget.dart
@@ -1,6 +1,8 @@
import 'package:aad_b2c_webview/aad_b2c_webview.dart';
import 'package:comwell_key_app/authentication/bloc/authentication_bloc.dart';
import 'package:comwell_key_app/login/auth.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/secure_storage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
@@ -13,6 +15,7 @@ class AzureB2CWidget extends StatelessWidget {
final SecureStorage secureStorage = SecureStorage();
// final LoginCubit loginCubit = LoginCubit(authenticationRepository: AuthenticationRepository());
final AuthenticationBloc authBloc;
+ final _tracking = locator<ComwellTracking>();
AzureB2CWidget({
required this.authBloc,
required this.authEnum,
@@ -33,6 +36,7 @@ class AzureB2CWidget extends StatelessWidget {
},
onIDToken: (Token token) {
+ _tracking.trackLogin();
secureStorage.write(constants.accessToken, token.value);
debugPrint(JwtDecoder.decode(token.value).toString());
},
diff --git a/comwell_key_app/lib/login/login_page.dart b/comwell_key_app/lib/login/login_page.dart
index 3eccc530..79d50764 100644
--- a/comwell_key_app/lib/login/login_page.dart
+++ b/comwell_key_app/lib/login/login_page.dart
@@ -3,16 +3,20 @@ import 'package:comwell_key_app/login/auth.dart';
import 'package:comwell_key_app/login/components/create_user_button.dart';
import 'package:comwell_key_app/login/components/login_button.dart';
import 'package:comwell_key_app/login/components/azure_b2c_widget.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class LoginPage extends StatelessWidget {
+
const LoginPage({super.key});
@override
Widget build(BuildContext context) {
+ final tracking = locator<ComwellTracking>();
return Scaffold(
body: Container(
constraints: const BoxConstraints.expand(),
@@ -34,13 +38,17 @@ class LoginPage extends StatelessWidget {
const SizedBox(height: 32),
// Login Button
LoginButton(
- onPressed: () => openModal(context, Auth.login),
+ onPressed: () {
+ tracking.trackScreenView('Login - Form', '/login/form');
+ openModal(context, Auth.login);}
),
const SizedBox(height: 10),
// Create New User Button
CreateUserButton(
- onPressed: () => openModal(context, Auth.createUser),
+ onPressed: () {
+ tracking.trackScreenView('Create User - Form', '/create-user/form');
+ openModal(context, Auth.createUser);}
),
const SizedBox(height: 20),
],
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index f0c62962..06b73ceb 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -6,6 +6,8 @@ import 'package:comwell_key_app/overview/cubit/overview_cubit.dart';
import 'package:comwell_key_app/overview/models/bookings.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -39,7 +41,7 @@ class OverviewTabViewState extends State<OverviewPage>
@override
Widget build(BuildContext context) {
-
+ locator<ComwellTracking>().trackScreenView('overview_page',"/overview");
return BlocListener<OverviewCubit, OverviewState>(
listener: (context, state) {
if (state is OverviewNoBookingFound) {
diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index 648707cb..464709d3 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -4,6 +4,8 @@ import 'package:comwell_key_app/profile/components/profile_settings_item.dart';
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:comwell_key_app/utils/secure_storage.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
diff --git a/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart b/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
index 1bc4e762..c72dab6a 100644
--- a/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
+++ b/comwell_key_app/lib/profile_settings/cubit/profile_settings_cubit.dart
@@ -3,6 +3,8 @@ import 'package:comwell_key_app/authentication/authentication_repository.dart';
import 'package:comwell_key_app/profile_settings/model/address.dart';
import 'package:comwell_key_app/profile_settings/model/user.dart';
import 'package:comwell_key_app/profile_settings/repostiory/profile_settings_repository.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:equatable/equatable.dart';
part 'profile_settings_state.dart';
@@ -26,6 +28,8 @@ class ProfileSettingsCubit extends Cubit<ProfileSettingsState> {
void deleteProfile() async {
try {
await profileSettingsRepository.deleteProfile();
+ locator<ComwellTracking>().trackEvent(
+ 'delete_profile');
await authenticationRepository.logOut();
emit(ProfileSettingsDeleted());
} catch (e) {
diff --git a/comwell_key_app/lib/profile_settings/profile_settings_page.dart b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
index a6ce04cc..a612ded0 100644
--- a/comwell_key_app/lib/profile_settings/profile_settings_page.dart
+++ b/comwell_key_app/lib/profile_settings/profile_settings_page.dart
@@ -9,6 +9,8 @@ import 'package:comwell_key_app/profile_settings/components/text_field_with_trai
import 'package:comwell_key_app/profile_settings/cubit/profile_settings_cubit.dart';
import 'package:comwell_key_app/profile_settings/model/address.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:comwell_key_app/tracking/comwell_tracking.dart';
+import 'package:comwell_key_app/utils/locator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -122,6 +124,7 @@ class ProfileSettingsPage extends StatelessWidget {
Center(
child: OutlinedButton(
onPressed: () {
+
showDeleteProfileDialog(context);
},
style: OutlinedButton.styleFrom(
@@ -167,10 +170,7 @@ class ProfileSettingsPage extends StatelessWidget {
cancelButtonText: 'delete_profile_cancel'.tr(),
onConfirm: () => {
context.read<ProfileSettingsCubit>().deleteProfile(),
- context
- .read<AuthenticationBloc>()
- .add(AuthenticationLogoutPressed()),
- Navigator.of(context).pop()
+
},
onCancel: () => Navigator.of(context).pop());
},
diff --git a/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart b/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
index 18dc3e29..75393234 100644
--- a/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
+++ b/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
@@ -43,7 +43,12 @@ class ResponseHandleInterceptor extends Interceptor {
void onError(
DioException err, ErrorInterceptorHandler handler) async {
final response = err.response;
- if (response == null) throw Exception("Missing response");
+ if (response == null) {
+ return handler.next(DioException(
+ requestOptions: err.requestOptions,
+ error: 'Missing response',
+ ));
+ }
final statusCode = response.statusCode;
try {
if (response.data == null) {
@@ -60,7 +65,7 @@ class ResponseHandleInterceptor extends Interceptor {
final opts = Options(
method: response.requestOptions.method,
headers: response.requestOptions.headers);
- final retryRequest = await _dio.request<Response<dynamic>>(
+ final retryRequest = await _dio.request<dynamic>(
response.requestOptions.path,
options: opts,
data: response.requestOptions.data,
@@ -73,7 +78,8 @@ class ResponseHandleInterceptor extends Interceptor {
requestOptions: response.requestOptions,
error: 'HTTP request error, status code: ${response.statusCode}');
}
- } catch (e) {
+ } catch (e,stackTrace) {
+ debugPrint('Error: $stackTrace');
throw DioException(
requestOptions: response.requestOptions,
error: 'Failed to handle the response: $e');
diff --git a/comwell_key_app/lib/tracking/comwell_tracking.dart b/comwell_key_app/lib/tracking/comwell_tracking.dart
index e2fa5ad8..73aa0d31 100644
--- a/comwell_key_app/lib/tracking/comwell_tracking.dart
+++ b/comwell_key_app/lib/tracking/comwell_tracking.dart
@@ -19,4 +19,10 @@ class ComwellTracking {
void trackRemoveFromCart(AnalyticsEventItem analyticsEventItem) {
_firebaseTracking.trackRemoveFromCard(analyticsEventItem);
}
+ void trackLogin() {
+ _firebaseTracking.tracklogin();
+ }
+ void trackEvent(String name) {
+ _firebaseTracking.trackEvent(name);
+ }
}
diff --git a/comwell_key_app/lib/tracking/trackers/firebase_tracker.dart b/comwell_key_app/lib/tracking/trackers/firebase_tracker.dart
index d020a5e4..8c1efab5 100644
--- a/comwell_key_app/lib/tracking/trackers/firebase_tracker.dart
+++ b/comwell_key_app/lib/tracking/trackers/firebase_tracker.dart
@@ -6,10 +6,7 @@ class FirebaseTracker {
final _tracking = FirebaseAnalytics.instance;
void trackScreen({required String name, required String path}) {
- _track(_eventScreenView, {
- _paramScreenClass: name,
- _paramScreenName: path,
- });
+ _trackScreen( name, path);
}
void trackAddToCart(comwell.AnalyticsEventItem analyticsEventItem) {
@@ -23,8 +20,14 @@ class FirebaseTracker {
void trackBeginCheckout(comwell.AnalyticsEventItem analyticsEventItem) {
_track(_eventBeginCheckout, analyticsEventItem.toJson());
}
+ void tracklogin() {
+ _tracking.logLogin();
+ }
+ void trackEvent(String name) {
+ _track(name, null);
+ }
- void _track(String name, Map<String, dynamic> parameters) async {
+ void _track(String name, Map<String, dynamic>? parameters) async {
try {
await _tracking.logEvent(
name: name,
@@ -35,6 +38,17 @@ class FirebaseTracker {
}
}
+ void _trackScreen(String name, String screenClass) async {
+ try {
+ await _tracking.logScreenView(
+ screenName: name,
+ screenClass: screenClass
+ );
+ } catch (e, st) {
+ if (kDebugMode) print("err=$e, $st");
+
+ }
+ }
// event names
static const _eventScreenView = "screen_view";