Skip to content

Commit 2790205

Browse files
authored
Merge branch 'CCExtractor:main' into theme-refactor
2 parents c78e5ed + 7eaf8fd commit 2790205

27 files changed

+629
-546
lines changed

.github/workflows/flutterci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
# - run: flutter format -n --set-exit-if-changed .
3939

4040
# Step 7: Run tests using flutter test
41-
- run: flutter test
41+
# - run: flutter test
4242

4343
# Step 8: Build APK using flutter build apk
4444
- run: flutter build apk

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
**/.cxx/
1112

1213
# IntelliJ related
1314
*.iml

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"editor.tabSize": 4,
1515
"editor.codeActionsOnSave": {
1616
"source.fixAll": "explicit"
17-
}
17+
},
18+
"java.configuration.updateBuildConfiguration": "interactive"
1819
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ This project aims to build an app for Taskwarrior. It is your task management ap
9191
1. Clone the repository from GitHub:
9292

9393
```bash
94-
git clone https://github.com/NishantSinghal19/taskwarrior-flutter.git
94+
git clone https://github.com/CCExtractor/taskwarrior-flutter
9595
```
9696

9797
2. Navigate to the project's root directory:

android/app/build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,16 +22,14 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2725
def keystoreProperties = new Properties()
2826
def keystorePropertiesFile = rootProject.file('key.properties')
2927
if (keystorePropertiesFile.exists()) {
3028
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
3129
}
3230
android {
33-
compileSdkVersion 34
31+
namespace "com.ccextractor.taskwarriorflutter"
32+
compileSdkVersion 35
3433

3534
// compileSdkVersion flutter.compileSdkVersion
3635

@@ -78,5 +77,5 @@ flutter {
7877
}
7978

8079
dependencies {
81-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
80+
8281
}

android/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.9.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip

android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
23+
}
24+
25+
include ":app"

lib/app/models/storage/savefile.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import 'dart:io';
22
import 'dart:typed_data';
3-
4-
import 'package:file_picker_writable/file_picker_writable.dart';
53
import 'package:file_selector/file_selector.dart';
4+
import 'package:file_picker_writable/file_picker_writable.dart';
65

76
Future<void> saveServerCert(String contents) async {
87
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
9-
// ignore: deprecated_member_use
10-
var path = await getSavePath(
8+
var saveLocation = await getSaveLocation(
119
suggestedName: 'server.cert.pem',
1210
);
13-
var data = Uint8List.fromList(contents.codeUnits);
14-
var file = XFile.fromData(
15-
data,
16-
);
17-
await file.saveTo(path!);
11+
12+
if (saveLocation != null) {
13+
var data = Uint8List.fromList(contents.codeUnits);
14+
var file = XFile.fromData(data);
15+
await file.saveTo(saveLocation.path);
16+
}
1817
} else {
1918
await FilePickerWritable().openFileForCreate(
2019
fileName: 'server.cert.pem',
@@ -28,15 +27,15 @@ Future<void> exportTasks({
2827
required String suggestedName,
2928
}) async {
3029
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
31-
// ignore: deprecated_member_use
32-
var path = await getSavePath(
30+
var saveLocation = await getSaveLocation(
3331
suggestedName: suggestedName,
3432
);
35-
var data = Uint8List.fromList(contents.codeUnits);
36-
var file = XFile.fromData(
37-
data,
38-
);
39-
await file.saveTo(path!);
33+
34+
if (saveLocation != null) {
35+
var data = Uint8List.fromList(contents.codeUnits);
36+
var file = XFile.fromData(data);
37+
await file.saveTo(saveLocation.path);
38+
}
4039
} else {
4140
await FilePickerWritable().openFileForCreate(
4241
fileName: suggestedName,

lib/app/modules/home/controllers/widget.controller.dart

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class WidgetController extends GetxController {
2020
final HomeController storageWidget = Get.find<HomeController>();
2121
late Storage storage;
2222
late final Filters filters; // Use RxList for observable list
23-
List<ChartSeries> dailyBurnDown = [];
23+
List<CartesianSeries> dailyBurnDown = [];
2424
Directory? baseDirectory;
2525
RxList<Task> allData = <Task>[].obs; // Use RxList for observable list
2626
bool stopTraver = false;
@@ -31,103 +31,108 @@ class WidgetController extends GetxController {
3131
// var currentProfile = ProfilesWidget.of(context!).currentProfile;
3232
var currentProfile = Get.find<SplashController>().currentProfile.value;
3333
baseDirectory = Get.find<SplashController>().baseDirectory();
34-
storage =
34+
storage =
3535
Storage(Directory('${baseDirectory!.path}/profiles/$currentProfile'));
3636
allData.assignAll(storage.data.allData());
3737
sendAndUpdate();
3838
}
3939
}
40+
4041
Future<void> sendAndUpdate() async {
4142
await sendData();
4243
await updateWidget();
4344
}
44-
45+
4546
Future<void> sendData() async {
4647
final HomeController taskController = Get.find<HomeController>();
4748
int lengthBeforeFilters = allData.length;
4849
List<Task> tasks = allData;
49-
debugPrint('Tasks: ${tasks.length}, ${taskController.projectFilter}, ${taskController.pendingFilter.value}, ${taskController.selectedSort.value}');
50-
if (taskController.projectFilter.value != 'All Projects'&&taskController.projectFilter.toString().isNotEmpty) {
51-
tasks = tasks.where((task) => task.project == taskController.projectFilter.value).toList();
50+
debugPrint(
51+
'Tasks: ${tasks.length}, ${taskController.projectFilter}, ${taskController.pendingFilter.value}, ${taskController.selectedSort.value}');
52+
if (taskController.projectFilter.value != 'All Projects' &&
53+
taskController.projectFilter.toString().isNotEmpty) {
54+
tasks = tasks
55+
.where((task) => task.project == taskController.projectFilter.value)
56+
.toList();
57+
} else {
58+
tasks = List<Task>.from(tasks);
59+
}
60+
61+
// Apply other filters and sorting
62+
tasks.sort((a, b) => a.id!.compareTo(b.id!));
63+
64+
tasks = tasks.where((task) {
65+
if (taskController.pendingFilter.value) {
66+
return task.status == 'pending';
5267
} else {
53-
tasks = List<Task>.from(tasks);
68+
return task.status == 'completed';
5469
}
70+
}).toList();
5571

56-
// Apply other filters and sorting
57-
tasks.sort((a, b) => a.id!.compareTo(b.id!));
58-
59-
tasks = tasks.where((task) {
60-
if (taskController.pendingFilter.value) {
61-
return task.status == 'pending';
62-
} else {
63-
return task.status == 'completed';
72+
tasks = tasks.where((task) {
73+
var tags = task.tags?.toSet() ?? {};
74+
if (taskController.tagUnion.value) {
75+
if (taskController.selectedTags.isEmpty) {
76+
return true;
6477
}
65-
}).toList();
78+
return taskController.selectedTags.any((tag) => (tag.startsWith('+'))
79+
? tags.contains(tag.substring(1))
80+
: !tags.contains(tag.substring(1)));
81+
} else {
82+
return taskController.selectedTags.every((tag) => (tag.startsWith('+'))
83+
? tags.contains(tag.substring(1))
84+
: !tags.contains(tag.substring(1)));
85+
}
86+
}).toList();
6687

67-
tasks = tasks.where((task) {
68-
var tags = task.tags?.toSet() ?? {};
69-
if (taskController.tagUnion.value) {
70-
if (taskController.selectedTags.isEmpty) {
71-
return true;
72-
}
73-
return taskController.selectedTags.any((tag) => (tag.startsWith('+'))
74-
? tags.contains(tag.substring(1))
75-
: !tags.contains(tag.substring(1)));
76-
} else {
77-
return taskController.selectedTags.every((tag) => (tag.startsWith('+'))
78-
? tags.contains(tag.substring(1))
79-
: !tags.contains(tag.substring(1)));
80-
}
81-
}).toList();
82-
83-
// Apply sorting based on selectedSort
84-
tasks.sort((a, b) {
85-
switch (taskController.selectedSort.value) {
86-
case 'Created+':
87-
return a.entry.compareTo(b.entry);
88-
case 'Created-':
89-
return b.entry.compareTo(a.entry);
90-
case 'Modified+':
91-
return a.modified!.compareTo(b.modified!);
92-
case 'Modified-':
93-
return b.modified!.compareTo(a.modified!);
94-
case 'Due till+':
95-
return a.due!.compareTo(b.due!);
96-
case 'Due till-':
97-
return b.due!.compareTo(a.due!);
98-
case 'Priority-':
99-
return a.priority!.compareTo(b.priority!);
100-
case 'Priority+':
101-
return b.priority!.compareTo(a.priority!);
102-
case 'Project+':
103-
return a.project!.compareTo(b.project!);
104-
case 'Project-':
105-
return b.project!.compareTo(a.project!);
106-
case 'Urgency-':
107-
return b.urgency!.compareTo(a.urgency!);
108-
case 'Urgency+':
109-
return a.urgency!.compareTo(b.urgency!);
110-
default:
111-
return 0;
112-
}
113-
});
88+
// Apply sorting based on selectedSort
89+
tasks.sort((a, b) {
90+
switch (taskController.selectedSort.value) {
91+
case 'Created+':
92+
return a.entry.compareTo(b.entry);
93+
case 'Created-':
94+
return b.entry.compareTo(a.entry);
95+
case 'Modified+':
96+
return a.modified!.compareTo(b.modified!);
97+
case 'Modified-':
98+
return b.modified!.compareTo(a.modified!);
99+
case 'Due till+':
100+
return a.due!.compareTo(b.due!);
101+
case 'Due till-':
102+
return b.due!.compareTo(a.due!);
103+
case 'Priority-':
104+
return a.priority!.compareTo(b.priority!);
105+
case 'Priority+':
106+
return b.priority!.compareTo(a.priority!);
107+
case 'Project+':
108+
return a.project!.compareTo(b.project!);
109+
case 'Project-':
110+
return b.project!.compareTo(a.project!);
111+
case 'Urgency-':
112+
return b.urgency!.compareTo(a.urgency!);
113+
case 'Urgency+':
114+
return a.urgency!.compareTo(b.urgency!);
115+
default:
116+
return 0;
117+
}
118+
});
114119
List<Map<String, String>> l = [];
115120
for (var task in tasks) {
116-
l.add({
117-
"description": task.description,
118-
"urgency": 'urgencyLevel : ${urgency(task)}',
119-
"uuid": task.uuid,
120-
"priority": task.priority ?? "N"
121-
});
121+
l.add({
122+
"description": task.description,
123+
"urgency": 'urgencyLevel : ${urgency(task)}',
124+
"uuid": task.uuid,
125+
"priority": task.priority ?? "N"
126+
});
122127
}
123-
if (l.isEmpty&&lengthBeforeFilters>0) {
128+
if (l.isEmpty && lengthBeforeFilters > 0) {
124129
l.add({
125130
"description": "No tasks found because of filter",
126131
"urgency": "urgencyLevel : 0",
127132
"priority": "2",
128133
"uuid": "NO_TASK"
129134
});
130-
}else if(l.isEmpty&&lengthBeforeFilters==0){
135+
} else if (l.isEmpty && lengthBeforeFilters == 0) {
131136
l.add({
132137
"description": "No tasks found",
133138
"urgency": "urgencyLevel : 0",

0 commit comments

Comments
 (0)