Skip to content

Commit

Permalink
Fix some small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsRefsgaard committed Oct 3, 2023
1 parent 5b7c68b commit 4e50fbc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/carp_study_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class CarpStudyAppState extends State<CarpStudyApp> {
GoRoute(
path: '/login',
parentNavigatorKey: _rootNavigatorKey,
redirect: (context, state) => CarpService().authenticated ? '/' : null,
// redirect: (context, state) => CarpService().authenticated ? '/' : null,
builder: (context, state) => const LoginPage(),
),
GoRoute(
Expand Down
6 changes: 3 additions & 3 deletions lib/data/carp_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class CarpBackend {

String? get studyId => bloc.studyId;
set studyId(String? id) {
if (CarpService().isConfigured) CarpService().app!.studyId = id;
if (CarpService().isConfigured) CarpService().app.studyId = id;
}

String? get studyDeploymentId => bloc.studyDeploymentId;
set studyDeploymentId(String? id) {
if (CarpService().isConfigured) CarpService().app!.studyDeploymentId = id;
if (CarpService().isConfigured) CarpService().app.studyDeploymentId = id;
}

CarpBackend._() : super() {
Expand Down Expand Up @@ -126,7 +126,7 @@ class CarpBackend {
}

Future<void> signOut() async {
// if (CarpService().authenticated) await CarpService().signOut();
if (CarpService().authenticated) await CarpService().logout();
await LocalSettings().eraseAuthCredentials();
}
}
2 changes: 1 addition & 1 deletion lib/ui/pages/cans_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _LoginPageState extends State<LoginPage> {
await bloc.backend.authenticate();
if (bloc.backend.isAuthenticated) {
if (context.mounted) {
context.go('/');
context.go('/invitations');
}
}
},
Expand Down
7 changes: 7 additions & 0 deletions lib/ui/pages/invitation_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ class InvitationListPage extends StatelessWidget {
onStretchTrigger: () async {
await model.invitations;
},
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
bloc.backend.signOut();
context.go('/login');
},
),
),
child,
],
Expand Down
6 changes: 0 additions & 6 deletions lib/ui/widgets/carp_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ class CarpAppBar extends StatelessWidget {
tooltip: 'Profile',
onPressed: () {
context.push('/profile');
// Navigator.of(context).push(
// PageRouteBuilder(
// pageBuilder: (c, a1, a2) =>
// ProfilePage(bloc.data.profilePageViewModel),
// ),
// );
},
),
],
Expand Down
8 changes: 5 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,11 @@ packages:
carp_webservices:
dependency: "direct main"
description:
path: "../carp.sensing-flutter/backends/carp_webservices"
relative: true
source: path
path: "backends/carp_webservices"
ref: "LarsRefsgaard/openid-authentication"
resolved-ref: "2a1a41cd20c090c9f3861b8f873044e331b86389"
url: "https://github.com/cph-cachet/carp.sensing-flutter"
source: git
version: "1.3.0"
characters:
dependency: transitive
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ dependencies:
dependency_overrides:
uuid: 4.1.0
carp_webservices:
path: ../carp.sensing-flutter/backends/carp_webservices
git:
url: https://github.com/cph-cachet/carp.sensing-flutter
ref: LarsRefsgaard/openid-authentication
path: backends/carp_webservices

dev_dependencies:
# flutter_test:
Expand Down

0 comments on commit 4e50fbc

Please sign in to comment.