-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bardram/responsive-refactor-#212
- Loading branch information
Showing
9 changed files
with
197 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#include? "../Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | ||
#include "Generated.xcconfig" | ||
#include? "Generated.xcconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#include "../Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||
#include "Generated.xcconfig" | ||
#include? "../Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||
#include? "Generated.xcconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
part of carp_study_app; | ||
|
||
/// Enumeration of different types of deployments on the CARP Web Service (CAWS). | ||
enum DeploymentMode { | ||
/// Use the CARP production server to get the study deployment and store data. | ||
production, | ||
|
||
/// Use the CARP staging server to get the study deployment and store data. | ||
staging, | ||
|
||
/// Use the CARP testing server to get the study deployment and store data. | ||
test, | ||
|
||
/// Use the CARP development server to get the study deployment and store data. | ||
dev, | ||
} | ||
|
||
/// Enumeration of of different user authentication states. | ||
enum LoginStatus { | ||
/// No invitation selected (tap outside the invitation box). | ||
/// Navigate to login screen. | ||
noSelection, | ||
|
||
/// Informed Consent not accepted. | ||
/// Navigate to message screen or login. | ||
noConsent, | ||
|
||
/// User registered but no current ongoing studies. | ||
/// Navigate to message screen. | ||
noInvitation, | ||
|
||
/// User temporary blocked based on 3 wrongly login credentials. | ||
/// Navigate to message screen. | ||
temporaryBlock, | ||
|
||
/// Successful login. | ||
/// Navigate to home page. | ||
successful, | ||
} | ||
|
||
enum ProcessStatus { | ||
done, | ||
error, | ||
other, | ||
} | ||
|
||
/// Enumeration of different app states. | ||
enum StudiesAppState { | ||
initialized, | ||
authenticating, | ||
accessTokenRetrieved, | ||
configuring, | ||
loading, | ||
loaded, | ||
error, | ||
} | ||
|
||
extension StringExtension on String { | ||
String truncateTo(int maxLength) => | ||
(length <= maxLength) ? this : '${substring(0, maxLength)}...'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
part of carp_study_app; | ||
|
||
class LoginPage extends StatefulWidget { | ||
const LoginPage({super.key}); | ||
|
||
@override | ||
State<LoginPage> createState() => _LoginPageState(); | ||
} | ||
|
||
class _LoginPageState extends State<LoginPage> { | ||
final GlobalKey webViewKey = GlobalKey(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
RPLocalizations locale = RPLocalizations.of(context)!; | ||
return Scaffold( | ||
body: SafeArea( | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Expanded( | ||
child: Container( | ||
margin: | ||
const EdgeInsets.symmetric(vertical: 32, horizontal: 56), | ||
child: Image.asset( | ||
'assets/carp_logo.png', | ||
fit: BoxFit.contain, | ||
), | ||
), | ||
), | ||
Container( | ||
margin: | ||
const EdgeInsets.symmetric(vertical: 16, horizontal: 64), | ||
width: MediaQuery.of(context).size.width, | ||
height: 56, | ||
decoration: BoxDecoration( | ||
color: const Color( | ||
0xff006398, | ||
), | ||
borderRadius: BorderRadius.circular( | ||
100, | ||
), | ||
), | ||
child: TextButton( | ||
onPressed: () async { | ||
await bloc.backend.authenticate(); | ||
if (bloc.backend.isAuthenticated) { | ||
if (context.mounted) { | ||
context.push('/invitations').then((value) { | ||
setState(() {}); | ||
}); | ||
} | ||
} | ||
}, | ||
child: Text( | ||
locale.translate("pages.login.login"), | ||
style: const TextStyle( | ||
color: Color( | ||
0xffffffff, | ||
), | ||
fontSize: 22, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
), | ||
), | ||
if (CarpService().authenticated) | ||
TextButton( | ||
onPressed: () { | ||
showDialog( | ||
context: context, | ||
builder: (context) { | ||
return const LogoutMessage(); | ||
}, | ||
).then((value) async { | ||
if (value == true) { | ||
await bloc.backend.signOut(); | ||
setState(() {}); | ||
} | ||
}); | ||
}, | ||
child: Text( | ||
locale.translate('pages.login.endsession'), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |