diff --git a/assets/lang/da.json b/assets/lang/da.json index e08855bb..1d44c86c 100644 --- a/assets/lang/da.json +++ b/assets/lang/da.json @@ -97,9 +97,9 @@ "pages.profile.device_role": "Engedsrolle", "pages.profile.contact": "Kontakt forsker", "pages.profile.privacy": "Fortrolighedspolitik", - "pages.profile.study_website": "Studiw Hjemmeside", + "pages.profile.study_website": "Hjemmeside for studiet", "pages.profile.leave_study": "Forlad studie", - "pages.profile.log_out": "Log ud", + "pages.profile.log_out": "Forlad studie & Log ud", "pages.profile.log_out.confirmation": "Du er ved at forlade dette studie og logge af. Operativsystemet vil åbne en browser for at logge dig ud. Er du sikker?", "pages.profile.leave_study.confirmation": "Du er ved at forlade studiet. Du vil ikke længere deltage i dette studie. Er du sikker?", "announcements": "Annonceringer", diff --git a/assets/lang/en.json b/assets/lang/en.json index aae2fb09..1dce60f2 100644 --- a/assets/lang/en.json +++ b/assets/lang/en.json @@ -110,9 +110,9 @@ "pages.profile.device_id": "Device ID", "pages.profile.contact": "Contact researcher", "pages.profile.privacy": "Privacy policy", - "pages.profile.study_website": "Study Website", + "pages.profile.study_website": "Study website", "pages.profile.leave_study": "Leave study", - "pages.profile.log_out": "Log out", + "pages.profile.log_out": "Leave study & Log out", "pages.profile.log_out.confirmation": "You are about to leave this study and log out. The operating system will open a browser to log you out. Are you sure?", "pages.profile.leave_study.confirmation": "You are about to leave the study. You will no longer participate in this study. Are you sure?", "announcements": "Announcements", @@ -244,4 +244,4 @@ "tasks.participant_data.phone_number.country": "Country code", "tasks.participant_data.phone_number.phone_number": "Phone No.", "tasks.participant_data.review.title": "Review" -} +} \ No newline at end of file diff --git a/assets/lang/es.json b/assets/lang/es.json index b4f811b1..b9bf74db 100644 --- a/assets/lang/es.json +++ b/assets/lang/es.json @@ -58,8 +58,9 @@ "pages.profile.account_id": "Id Usuario", "pages.profile.contact": "Contactar investigador", "pages.profile.privacy": "Política de privacidad", + "pages.profile.study_website": "Página web del estudio", "pages.profile.leave_study": "Abandonar el estudio", - "pages.profile.log_out": "Cerrar sesión", + "pages.profile.log_out": "Cerrar estudio & sesión", "pages.profile.log_out.confirmation": "Estás a punto de cerrar sesión et abandonar el estudio. ¿Estás seguro?", "pages.profile.leave_study.confirmation": "Estás a punto de abandonar el estudio. Dejarás de participar en el es estudio. ¿Estás seguro?", "announcement": "Anuncio", @@ -121,4 +122,4 @@ "pages.devices.connection.step.confirm.title": "está conectado!", "pages.devices.connection.step.confirm.1": "El", "pages.devices.connection.step.confirm.2": " ha sido connectado satisfactoriamente al estudio y está listo para empezar a detectar." -} +} \ No newline at end of file diff --git a/lib/blocs/app_bloc.dart b/lib/blocs/app_bloc.dart index 2f8a8377..3fd87f5c 100644 --- a/lib/blocs/app_bloc.dart +++ b/lib/blocs/app_bloc.dart @@ -481,14 +481,13 @@ class StudyAppBLoC extends ChangeNotifier { /// * resetting the informed consent flow /// * returning the user to select an invitation for another study /// - /// Note that study deployment information and data is not removed from the - /// phone. This is stored for later access. Or if the same deployment is - /// re-deployed on the phone, data from the previous deployment will be - /// available. + /// Note that study deployment information and data is removed from the + /// phone. If the same deployment is re-deployed on the phone, data from the + /// previous deployment will NOT be available. Future leaveStudy() async { - debug('$runtimeType --------- LEAVING STUDY ------------'); + info('Leaving study $study'); - // save and clear the UI data models + // clear the UI data models appViewModel.clear(); // stop sensing and remove all deployment info diff --git a/lib/ui/pages/devices_page.bluetooth_connection_page.dart b/lib/ui/pages/devices_page.bluetooth_connection_page.dart index 02b9db9d..ac0d0690 100644 --- a/lib/ui/pages/devices_page.bluetooth_connection_page.dart +++ b/lib/ui/pages/devices_page.bluetooth_connection_page.dart @@ -330,9 +330,9 @@ class _BluetoothConnectionPageState extends State { .entries .map( (bluetoothDevice) => StudiesMaterial( - // hasBorder: true, - backgroundColor: - Theme.of(context).extension()!.grey50!, + backgroundColor: Theme.of(context) + .extension()! + .grey50!, child: InkWell( child: ListTile( selected: bluetoothDevice.key == selected, diff --git a/lib/ui/pages/task_list_page.dart b/lib/ui/pages/task_list_page.dart index 1aec37ac..ddef55c6 100644 --- a/lib/ui/pages/task_list_page.dart +++ b/lib/ui/pages/task_list_page.dart @@ -45,7 +45,7 @@ class TaskListPageState extends State with TickerProviderStateMixin { late TabController _tabController; - bool? showParticipantDataCard = false; + bool showParticipantDataCard = false; @override void initState() { @@ -159,7 +159,7 @@ class TaskListPageState extends State ), ), ), - if (showParticipantDataCard!) + if (showParticipantDataCard) SliverToBoxAdapter( child: _buildParticipantDataCard(), ), diff --git a/lib/view_models/tasklist_page_model.dart b/lib/view_models/tasklist_page_model.dart index 1a03b570..258d5727 100644 --- a/lib/view_models/tasklist_page_model.dart +++ b/lib/view_models/tasklist_page_model.dart @@ -34,8 +34,14 @@ class TaskListPageViewModel extends ViewModel { Stream get userTaskEvents => AppTaskController().userTaskEvents; /// The number of days the user has been part of this study. - int get daysInStudy => (bloc.studyStartTimestamp != null) - ? DateTime.now().difference(bloc.studyStartTimestamp!).inDays + 1 + /// + /// This is calculated from the study deployment status creation date from the + /// [StudyDeploymentStatus]. + /// Returns 0 if the study deployment status is not available. + int get daysInStudy => (Sensing().studyDeploymentStatus != null) + ? DateTime.now() + .difference(Sensing().studyDeploymentStatus!.createdOn) + .inDays : 0; /// The number of tasks completed so far. diff --git a/lib/view_models/view_model.dart b/lib/view_models/view_model.dart index 447535f5..9585bb84 100644 --- a/lib/view_models/view_model.dart +++ b/lib/view_models/view_model.dart @@ -15,11 +15,12 @@ abstract class ViewModel extends ChangeNotifier { _controller = ctrl; } - /// Called when this view model is to clear its state (e.g., cached data). + /// Clear this view model, i.e. delete all data incl. cached data. @mustCallSuper void clear() {} - /// Called when this view model is disposed and no longer used. + /// Called when this view model is disposed. Typically on app exit, incl. when + /// closed by the OS. @override @mustCallSuper void dispose() { @@ -92,7 +93,7 @@ abstract class SerializableViewModel extends ViewModel { _filename = null; _persistenceTimer?.cancel(); _persistenceTimer = null; - save(); + delete(); } @override @@ -127,7 +128,7 @@ abstract class SerializableViewModel extends ViewModel { return success; } - /// Permanently delete the [model]. + /// Permanently delete the cached [model]. /// Returns true if successful, false otherwise. bool delete() { bool success = true;