Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
5 changes: 3 additions & 2 deletions assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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."
}
}
11 changes: 5 additions & 6 deletions lib/blocs/app_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> 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
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/pages/devices_page.bluetooth_connection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ class _BluetoothConnectionPageState extends State<BluetoothConnectionPage> {
.entries
.map(
(bluetoothDevice) => StudiesMaterial(
// hasBorder: true,
backgroundColor:
Theme.of(context).extension<RPColors>()!.grey50!,
backgroundColor: Theme.of(context)
.extension<RPColors>()!
.grey50!,
child: InkWell(
child: ListTile(
selected: bluetoothDevice.key == selected,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/pages/task_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TaskListPageState extends State<TaskListPage>
with TickerProviderStateMixin {
late TabController _tabController;

bool? showParticipantDataCard = false;
bool showParticipantDataCard = false;

@override
void initState() {
Expand Down Expand Up @@ -159,7 +159,7 @@ class TaskListPageState extends State<TaskListPage>
),
),
),
if (showParticipantDataCard!)
if (showParticipantDataCard)
SliverToBoxAdapter(
child: _buildParticipantDataCard(),
),
Expand Down
10 changes: 8 additions & 2 deletions lib/view_models/tasklist_page_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ class TaskListPageViewModel extends ViewModel {
Stream<UserTask> 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.
Expand Down
9 changes: 5 additions & 4 deletions lib/view_models/view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -92,7 +93,7 @@ abstract class SerializableViewModel<D extends DataModel> extends ViewModel {
_filename = null;
_persistenceTimer?.cancel();
_persistenceTimer = null;
save();
delete();
}

@override
Expand Down Expand Up @@ -127,7 +128,7 @@ abstract class SerializableViewModel<D extends DataModel> extends ViewModel {
return success;
}

/// Permanently delete the [model].
/// Permanently delete the cached [model].
/// Returns true if successful, false otherwise.
bool delete() {
bool success = true;
Expand Down