6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 603b9a3c

AuthorMikkel Thygesen<mikkelet@gmail.com>
Date2026-02-12 15:47:52 +0100
Fixed google sign in on iOS, fixed log otu

Changed files

.../authentication/authentication_repository.dart  |  1 +
 comwell_key_app/lib/data/remote/msal_service.dart  | 16 +++++++---
 .../profile/components/logout_dialog_widget.dart   |  3 ++
 .../profile/components/profile_page_widget.dart    | 37 +++++++++++++---------
 4 files changed, 38 insertions(+), 19 deletions(-)

Diff

diff --git a/comwell_key_app/lib/authentication/authentication_repository.dart b/comwell_key_app/lib/authentication/authentication_repository.dart
index e9421050..49324776 100644
--- a/comwell_key_app/lib/authentication/authentication_repository.dart
+++ b/comwell_key_app/lib/authentication/authentication_repository.dart
@@ -37,6 +37,7 @@ class AuthenticationRepository {
Future<void> logOut() async {
_comwellTracking.trackEvent('logout');
+ await _msalService.logout();
await _seosRepository.terminateEndpoint();
await _database.deleteDatabase();
await secureStorage.deleteAll();
diff --git a/comwell_key_app/lib/data/remote/msal_service.dart b/comwell_key_app/lib/data/remote/msal_service.dart
index c53a7dca..9ce76f38 100644
--- a/comwell_key_app/lib/data/remote/msal_service.dart
+++ b/comwell_key_app/lib/data/remote/msal_service.dart
@@ -6,10 +6,9 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:msal_auth/msal_auth.dart';
class MSALService {
-
final scopes = dotenv.ENTRA_API_URL.split(',');
final authorityUrl = dotenv.ENTRA_ID_AUTHORITY_URL;
- late final PublicClientApplication msAuth;
+ late final SingleAccountPca msAuth;
late final String configFilePath;
MSALService();
@@ -35,7 +34,7 @@ class MSALService {
redirectUri: redirect,
),
appleConfig: AppleConfig(
- authorityType: AuthorityType.b2c,
+ authorityType: AuthorityType.aad,
broker: Broker.webView,
authority: authorityUrl,
),
@@ -47,7 +46,12 @@ class MSALService {
}
Future<void> openAuth(Prompt prompt) async {
- await msAuth.acquireToken(scopes: scopes, prompt: prompt);
+ await msAuth.acquireToken(
+ scopes: scopes,
+ prompt: prompt,
+ customWebViewConfig: const CustomWebViewConfig(),
+ authority: dotenv.ENTRA_ID_AUTHORITY_URL,
+ );
}
Future<String> acquireTokenSilent() async {
@@ -57,4 +61,8 @@ class MSALService {
);
return response.accessToken;
}
+
+ Future<void> logout() async {
+ await msAuth.signOut();
+ }
}
diff --git a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
index 9084f96e..ce370e15 100644
--- a/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
+++ b/comwell_key_app/lib/profile/components/logout_dialog_widget.dart
@@ -1,6 +1,8 @@
import 'package:comwell_key_app/profile/cubit/profile_cubit.dart';
+import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
class LogoutDialogWidget extends StatelessWidget {
final ProfileCubit cubit;
@@ -38,6 +40,7 @@ class LogoutDialogWidget extends StatelessWidget {
),
onPressed: () {
cubit.logOutPressed();
+ context.go(AppRoutes.login);
},
child: Text(
"logout_profile_menu".tr(),
diff --git a/comwell_key_app/lib/profile/components/profile_page_widget.dart b/comwell_key_app/lib/profile/components/profile_page_widget.dart
index c53eba46..097233af 100644
--- a/comwell_key_app/lib/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/profile_page_widget.dart
@@ -17,12 +17,13 @@ import 'package:url_launcher/url_launcher.dart';
class ProfilePageWidget extends StatelessWidget {
final ProfileCubit cubit;
+
const ProfilePageWidget({super.key, required this.cubit});
@override
Widget build(BuildContext context) {
final user = cubit.state.user;
- final isActive = cubit.state.user!.isClubMember;
+ final isActive = cubit.state.user?.isClubMember == true;
return Column(
children: [
@@ -31,11 +32,12 @@ class ProfilePageWidget extends StatelessWidget {
child: Container(
alignment: Alignment.centerRight,
child: RoundIconButton(
- icon: "assets/icons/close-icon.svg",
- color: Colors.white,
- onPressed: () {
- context.pop();
- }),
+ icon: "assets/icons/close-icon.svg",
+ color: Colors.white,
+ onPressed: () {
+ context.pop();
+ },
+ ),
),
),
Padding(
@@ -43,8 +45,9 @@ class ProfilePageWidget extends StatelessWidget {
child: Column(
children: [
ComwellCard(
- content: CardContentWidget(cubit: cubit, isActive: isActive),
- backgroundColor: isActive ? sandColor : sandColor[10]!),
+ content: CardContentWidget(cubit: cubit, isActive: isActive),
+ backgroundColor: isActive ? sandColor : sandColor[10]!,
+ ),
],
),
),
@@ -56,9 +59,12 @@ class ProfilePageWidget extends StatelessWidget {
children: [
const SizedBox(height: 10),
!isActive
- ? ComwellClubContainer(user: user!, onSignupClick: () {
- cubit.init();
- })
+ ? ComwellClubContainer(
+ user: user!,
+ onSignupClick: () {
+ cubit.init();
+ },
+ )
: const SizedBox(),
const SizedBox(height: 10),
profileSettingsItem(
@@ -81,8 +87,10 @@ class ProfilePageWidget extends StatelessWidget {
text: 'payment_card_profile_menu'.tr(),
trailingIcon: Icons.chevron_right,
onTap: () {
- context.pushNamed(AppRoutes.paymentCards.name,
- queryParameters: {needsScaffold: 'true'});
+ context.pushNamed(
+ AppRoutes.paymentCards.name,
+ queryParameters: {needsScaffold: 'true'},
+ );
},
),
const Padding(
@@ -143,8 +151,7 @@ class ProfilePageWidget extends StatelessWidget {
future: context.read<ProfileCubit>().getVersion(),
builder: (context, snapshot) {
if (snapshot.hasData) {
- return Text(snapshot.data!,
- style: TextStyle(color: Colors.grey[500]));
+ return Text(snapshot.requireData, style: TextStyle(color: Colors.grey[500]));
}
return const SizedBox.shrink();
},