Skip to content

Commit 1890158

Browse files
committed
ccsync tags fn added
1 parent 976b39d commit 1890158

File tree

8 files changed

+259
-190
lines changed

8 files changed

+259
-190
lines changed

lib/app/modules/home/views/home_page_app_bar.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class HomePageAppBar extends StatelessWidget implements PreferredSizeWidget {
157157
.homePageFetchingTasks,
158158
false);
159159
} catch (e) {
160+
debugPrint('Error refreshing tasks: $e');
160161
ScaffoldMessenger.of(context)
161162
.hideCurrentSnackBar();
162163
_showResultSnackBar(

lib/app/modules/home/views/show_details.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ class _TaskDetailsState extends State<TaskDetails> {
432432
priority,
433433
status,
434434
widget.task.uuid!,
435+
widget.task.id.toString(),
435436
);
436437
}
437438
}

lib/app/modules/taskc_details/controllers/taskc_details_controller.dart

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ class TaskcDetailsController extends GetxController {
4848
status = task.status.obs;
4949
priority = (task.priority ?? '-').obs;
5050
due = formatDate(task.due).obs;
51-
start = formatDate(task.start).obs;
52-
wait = formatDate(task.wait).obs;
53-
tags = (task.tags ?? []).obs;
54-
depends = (task.depends ?? []).obs;
55-
rtype = (task.rtype ?? '-').obs;
56-
recur = (task.recur ?? '-').obs;
57-
annotations = (task.annotations ?? []).obs;
51+
start = "".obs;
52+
wait = "".obs;
53+
tags = "".split(",").obs;
54+
depends = "".split(",").obs;
55+
rtype = "".obs;
56+
recur = "".obs;
57+
annotations = <Annotation>[].obs;
5858
}
5959

6060
String formatDate(String? dateString) {
@@ -86,30 +86,30 @@ class TaskcDetailsController extends GetxController {
8686
}
8787

8888
Future<void> saveTask() async {
89-
final updatedTask = TaskForC(
90-
id: initialTask.id,
91-
description: description.value,
92-
project: project.value == '-' ? null : project.value,
93-
status: status.value,
94-
uuid: initialTask.uuid,
95-
urgency: initialTask.urgency, // Urgency is typically calculated
96-
priority: priority.value == '-' ? null : priority.value,
97-
due: due.value == '-' ? null : due.value,
98-
start: start.value == '-' ? null : start.value,
99-
end: initialTask.end, // 'end' is usually set when completed
100-
entry: initialTask.entry, // 'entry' is static
101-
wait: wait.value == '-' ? null : wait.value,
102-
modified: DateFormat('yyyy-MM-dd HH:mm:ss')
103-
.format(DateTime.now()), // Update modified time
104-
tags: tags.isEmpty ? null : tags.toList(),
105-
depends: depends.isEmpty ? null : depends.toList(),
106-
rtype: rtype.value == '-' ? null : rtype.value,
107-
recur: recur.value == '-' ? null : recur.value,
108-
annotations: annotations.isEmpty ? null : annotations.toList(),
89+
if (tags.length == 1 && tags[0] == "") {
90+
tags.clear();
91+
}
92+
await taskDatabase.saveEditedTaskInDB(
93+
initialTask.uuid!,
94+
description.string,
95+
project.string,
96+
status.string,
97+
priority.string,
98+
due.string,
99+
tags.toList(),
109100
);
110-
await TaskDatabase().updateTask(updatedTask);
111101
hasChanges.value = false;
112-
await modifyTaskOnTaskwarrior(updatedTask);
102+
debugPrint('Task saved in local DB ${description.string}');
103+
await modifyTaskOnTaskwarrior(
104+
description.string,
105+
project.string,
106+
due.string,
107+
priority.string,
108+
status.string,
109+
initialTask.uuid!,
110+
initialTask.id.toString(),
111+
tags.toList(),
112+
);
113113
}
114114

115115
Future<bool> handleWillPop() async {

lib/app/modules/taskc_details/views/taskc_details_view.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ class TaskcDetailsView extends GetView<TaskcDetailsController> {
8484
controller.tags.join(', '),
8585
(value) => controller.updateListField(controller.tags, value),
8686
),
87-
_buildEditableDetail(
88-
context,
89-
'Depends:',
90-
controller.depends.join(', '),
91-
(value) =>
92-
controller.updateListField(controller.depends, value),
93-
),
9487
_buildEditableDetail(
9588
context,
9689
'Rtype:',
@@ -125,15 +118,6 @@ class TaskcDetailsView extends GetView<TaskcDetailsController> {
125118
'${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.detailPageModified}:',
126119
controller.formatDate(controller.initialTask.modified),
127120
),
128-
_buildDetail(
129-
context,
130-
'${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences}:',
131-
controller.annotations.isNotEmpty
132-
? controller.annotations
133-
.map((e) => e.description)
134-
.join('\n')
135-
: '-',
136-
),
137121
],
138122
),
139123
),

0 commit comments

Comments
 (0)