Skip to content

Commit 7eaf8fd

Browse files
authored
Merge pull request #453 from Mastermind-sap/migrateToDSL
fix: Upgrading from deprecated imperative apply of gradle's plugin to plugin DSL
2 parents fd596b8 + e23a4d8 commit 7eaf8fd

17 files changed

+207
-177
lines changed

.gitignore

+1
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

+2-1
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
}

android/app/build.gradle

+9-10
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

-13
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

+1-1
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

+22-8
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/modules/home/controllers/widget.controller.dart

+76-71
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",

lib/app/modules/reports/views/burn_down_weekly.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ class BurnDownWeekly extends StatelessWidget {
4343
),
4444
primaryYAxis: NumericAxis(
4545
title: AxisTitle(
46-
text: SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.reportsPageTasks,
46+
text: SentenceManager(
47+
currentLanguage: AppSettings.selectedLanguage)
48+
.sentences
49+
.reportsPageTasks,
4750
textStyle: TextStyle(
4851
fontFamily: FontFamily.poppins,
4952
fontWeight: TaskWarriorFonts.bold,

lib/app/services/notification_services.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class NotificationService {
106106
notificationDetails,
107107
uiLocalNotificationDateInterpretation:
108108
UILocalNotificationDateInterpretation.absoluteTime,
109-
// ignore: deprecated_member_use
110-
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle)
109+
androidScheduleMode: AndroidScheduleMode.alarmClock)
111110
.then((value) {
112111
if (kDebugMode) {
113112
print('Notification scheduled successfully');

linux/flutter/generated_plugin_registrant.cc

+4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <file_selector_linux/file_selector_plugin.h>
10+
#include <flutter_timezone/flutter_timezone_plugin.h>
1011
#include <url_launcher_linux/url_launcher_plugin.h>
1112

1213
void fl_register_plugins(FlPluginRegistry* registry) {
1314
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
1415
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
1516
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
17+
g_autoptr(FlPluginRegistrar) flutter_timezone_registrar =
18+
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterTimezonePlugin");
19+
flutter_timezone_plugin_register_with_registrar(flutter_timezone_registrar);
1620
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
1721
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
1822
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

linux/flutter/generated_plugins.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
file_selector_linux
7+
flutter_timezone
78
url_launcher_linux
89
)
910

macos/Flutter/GeneratedPluginRegistrant.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import file_picker
1010
import file_picker_writable
1111
import file_selector_macos
1212
import flutter_local_notifications
13-
import flutter_native_timezone
13+
import flutter_timezone
1414
import package_info_plus
1515
import path_provider_foundation
16-
import permission_handler_apple
1716
import shared_preferences_foundation
1817
import sqflite_darwin
1918
import url_launcher_macos
@@ -24,10 +23,9 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
2423
FilePickerWritablePlugin.register(with: registry.registrar(forPlugin: "FilePickerWritablePlugin"))
2524
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
2625
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
27-
FlutterNativeTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterNativeTimezonePlugin"))
26+
FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin"))
2827
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
2928
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
30-
PermissionHandlerPlugin.register(with: registry.registrar(forPlugin: "PermissionHandlerPlugin"))
3129
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
3230
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
3331
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

0 commit comments

Comments
 (0)