Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsRefsgaard committed Sep 29, 2023
1 parent c738ba9 commit 4f6f221
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 19 deletions.
19 changes: 17 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
PODS:
- app_settings (5.1.1):
- Flutter
- AppAuth (1.6.2):
- AppAuth/Core (= 1.6.2)
- AppAuth/ExternalUserAgent (= 1.6.2)
- AppAuth/Core (1.6.2)
- AppAuth/ExternalUserAgent (1.6.2):
- AppAuth/Core
- audio_session (0.0.1):
- Flutter
- audio_streamer (0.0.1):
Expand All @@ -23,6 +29,9 @@ PODS:
- Flutter (1.0.0)
- flutter_activity_recognition (0.0.1):
- Flutter
- flutter_appauth (0.0.1):
- AppAuth (= 1.6.2)
- Flutter
- flutter_blue_plus (0.0.1):
- Flutter
- flutter_inappwebview (0.0.1):
Expand Down Expand Up @@ -101,6 +110,7 @@ DEPENDENCIES:
- esense_flutter (from `.symlinks/plugins/esense_flutter/ios`)
- Flutter (from `Flutter`)
- flutter_activity_recognition (from `.symlinks/plugins/flutter_activity_recognition/ios`)
- flutter_appauth (from `.symlinks/plugins/flutter_appauth/ios`)
- flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
Expand All @@ -126,6 +136,7 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- AppAuth
- ESense
- flutter_sound_core
- FMDB
Expand Down Expand Up @@ -158,6 +169,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_activity_recognition:
:path: ".symlinks/plugins/flutter_activity_recognition/ios"
flutter_appauth:
:path: ".symlinks/plugins/flutter_appauth/ios"
flutter_blue_plus:
:path: ".symlinks/plugins/flutter_blue_plus/ios"
flutter_inappwebview:
Expand Down Expand Up @@ -205,6 +218,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
audio_streamer: af49e73eb66f71c4eeabb4bbcb05f122d03a6709
audiofileplayer: 4aaff759a721ec3a850a682e0d9ec554e5f9e86f
Expand All @@ -216,8 +230,9 @@ SPEC CHECKSUMS:
esense_flutter: 8bfadfdefe7b51d6f78366e43b2b64ec9b6144b6
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_activity_recognition: 5c3b026997742b01e82424ef257db9640822ad77
flutter_appauth: cf9b928962105b2a64a9802585d1c8adaf3e0f46
flutter_blue_plus: 5cb46a0d66c6cacebf7551e0e5a6bfa345ccc224
flutter_inappwebview: 50b55a88f5dddadc9e741a7caf72f378116e2156
flutter_inappwebview: 0fd654db805825eae42bd8ee7c428890cdaf7ff1
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
Expand Down Expand Up @@ -248,4 +263,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 42054b155feb53182d53e51787077e2e6389a1c1

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
3 changes: 1 addition & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
<string>cans.cachet.dk</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
<string>carp.studies</string>
<string>studies</string>
<string>carp.studies</string>
<string>carp-studies</string>
</array>
</dict>
Expand Down
3 changes: 1 addition & 2 deletions ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<array>
<string>webcredentials:cachet.dk</string>
<string>webcredentials:cans.cachet.dk</string>
<string>applinks:cachet.dk</string>
<string>applinks:cans.cachet.dk</string>
<string>applinks:carp.computerome.dk</string>
</array>
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
<true/>
Expand Down
1 change: 1 addition & 0 deletions ios/Runner/RunnerRelease.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<array>
<string>webcredentials:cachet.dk</string>
<string>webcredentials:cans.cachet.dk</string>
<string>webcredentials:example.com</string>
</array>
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
<true/>
Expand Down
18 changes: 18 additions & 0 deletions lib/carp_study_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ class CarpStudyAppState extends State<CarpStudyApp> {
bloc.data.taskListPageViewModel,
),
),
GoRoute(
path: '/studies',
builder: (context, state) {
return const ErrorPage();
},
),
GoRoute(
path: '/auth',
builder: (context, state) {
return const ErrorPage();
},
),
GoRoute(
path: '//auth',
builder: (context, state) {
return const ErrorPage();
},
),
],
debugLogDiagnostics: true,
);
Expand Down
32 changes: 27 additions & 5 deletions lib/data/carp_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,32 @@ class CarpBackend {
Future<void> initialize() async {
app = CarpApp(
name: "CAWS @ DTU",
uri: uri,
oauth: OAuthEndPoint(clientID: clientId, clientSecret: clientSecret),
uri: Uri(
scheme: 'https', host: 'carp.computerome.dk', pathSegments: ['dev']),
authURL: Uri(
scheme: 'https',
host: 'carp.computerome.dk',
pathSegments: ['auth', 'dev', 'realms', 'Carp'],
),
clientId: 'carp-webservices-dart',
redirectURI: Uri.parse('study-app://auth'),
discoveryURL: Uri(
scheme: 'https',
host: 'carp.computerome.dk',
pathSegments: ['auth', 'dev', 'realms', 'Carp', '.well-known', 'openid-configuration'],
),
// Uri(
// scheme: 'https',
// host: 'carp.computerome.dk',
// pathSegments: ['callback', 'study-app'],
// ),
studyId: studyId,
studyDeploymentId: studyDeploymentId,
);

CarpService().configure(app!);
// var response = CarpService().authenticate();
// print(response);

if (oauthToken != null) {
// if we have a token, we can authenticate the user
Expand All @@ -97,8 +116,11 @@ class CarpBackend {

Future<CarpUser?> authenticateWithRefreshToken(String refreshToken) async {
try {
CarpUser user =
await CarpService().authenticateWithRefreshToken(refreshToken);
var response = CarpService().authenticate();

print(response);

CarpUser user = CarpUser();

info('User authenticated - user: $user');

Expand Down Expand Up @@ -139,7 +161,7 @@ class CarpBackend {
}

Future<void> signOut() async {
if (CarpService().authenticated) await CarpService().signOut();
// if (CarpService().authenticated) await CarpService().signOut();
await LocalSettings().eraseAuthCredentials();
}
}
6 changes: 5 additions & 1 deletion lib/ui/pages/cans_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class LoginPage extends StatefulWidget {
@override
State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
final GlobalKey webViewKey = GlobalKey();

Expand Down Expand Up @@ -51,6 +50,11 @@ class _LoginPageState extends State<LoginPage> {
var width = MediaQuery.of(context).size.width;
var height = MediaQuery.of(context).size.height;
return Scaffold(
floatingActionButton: FloatingActionButton(onPressed: () async {
var response = await CarpService().authenticate();

print(response);
}),
body: SafeArea(
child: Center(
child: Column(
Expand Down
27 changes: 21 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,9 @@ packages:
carp_webservices:
dependency: "direct main"
description:
name: carp_webservices
sha256: "279297af415a4232df364cf0d4b2b8be188ff6811836f40a93f3f9a7b3854671"
url: "https://pub.dev"
source: hosted
path: "../carp.sensing-flutter/backends/carp_webservices"
relative: true
source: path
version: "1.3.0"
characters:
dependency: transitive
Expand Down Expand Up @@ -534,6 +533,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_appauth:
dependency: transitive
description:
name: flutter_appauth
sha256: "19031ea2438a513762e64ec7b58ae1f00cad6fb87f818e405325cd183dfb9fec"
url: "https://pub.dev"
source: hosted
version: "6.0.2"
flutter_appauth_platform_interface:
dependency: transitive
description:
name: flutter_appauth_platform_interface
sha256: "44feaa7058191b5d3cd7c9ff195262725773643121bcada172d49c2ddcff71cb"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
flutter_blue_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1686,10 +1701,10 @@ packages:
dependency: "direct overridden"
description:
name: uuid
sha256: e03928880bdbcbf496fb415573f5ab7b1ea99b9b04f669c01104d085893c3134
sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "4.1.0"
vector_graphics:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ dependencies:
flutter_blue_plus: ^1.15.5

dependency_overrides:
uuid: 4.0.0
uuid: 4.1.0
carp_webservices:
path: ../carp.sensing-flutter/backends/carp_webservices

dev_dependencies:
# flutter_test:
Expand Down

0 comments on commit 4f6f221

Please sign in to comment.