Skip to content

Commit fac92be

Browse files
MaikuBrunner
and
runner
authored
[flutter_local_notifications] use melos 2.9.0 and fixed unit tests for zonedScheduled method (#1959)
* [flutter_local_notifications] fixed unit tests for zonedScheduled method * Swift Format * ignore example when running unit tests * have unit tests fail fast and specify to ignore example via yaml * attempt to specify scopes for unit tests to work on CI * Revert "attempt to specify scopes for unit tests to work on CI" This reverts commit ece6192. * remove --no-select when running tests * update cirrus unit tests script to run pwd command to narrow melos related issues * Revert "update cirrus unit tests script to run pwd command to narrow melos related issues" This reverts commit 52747e4. * have melos not run pub get in parallel * update pattern to find packages * made further changes to match updated melos 3 updates * update version constraints for min Flutter version to 3.3 and Dart SDK min of 2.18 * Revert "update version constraints for min Flutter version to 3.3 and Dart SDK min of 2.18" This reverts commit 026f577. * specify using melos 2.9.0 as using 3.0.0 would require bumping min Flutter SDK version constraint * use cirrus script from master * activate melos 2.9.0 * updated contribution guide to specify melos 2.9.0 is used * restore old melos script * use melos 2.9.0 for ios integration tests --------- Co-authored-by: runner <[email protected]>
1 parent c1f97e4 commit fac92be

8 files changed

+47
-39
lines changed

.cirrus.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ task:
55
pub_cache:
66
folder: ~/.pub-cache
77
install_melos_script:
8-
- dart pub global activate melos
8+
- dart pub global activate melos 2.9.0
99
build_script:
1010
- export PATH="$PATH":"$HOME/.pub-cache/bin"
1111
- melos bootstrap
@@ -18,7 +18,7 @@ task:
1818
pub_cache:
1919
folder: ~/.pub-cache
2020
install_melos_script:
21-
- dart pub global activate melos
21+
- dart pub global activate melos 2.9.0
2222
build_script:
2323
- export PATH="$PATH":"$HOME/.pub-cache/bin"
2424
- melos bootstrap
@@ -34,7 +34,7 @@ task:
3434
- flutter channel stable
3535
- flutter upgrade
3636
install_melos_script:
37-
- dart pub global activate melos
37+
- dart pub global activate melos 2.9.0
3838
build_script:
3939
- export PATH="$PATH":"$HOME/.pub-cache/bin"
4040
- melos bootstrap
@@ -52,7 +52,7 @@ task:
5252
setup_script:
5353
- flutter config --enable-macos-desktop
5454
install_melos_script:
55-
- dart pub global activate melos
55+
- dart pub global activate melos 2.9.0
5656
build_script:
5757
- export PATH="$PATH":"$HOME/.pub-cache/bin"
5858
- melos bootstrap
@@ -69,7 +69,7 @@ task:
6969
- apt install cmake ninja-build clang pkg-config libgtk-3-dev -y
7070
- flutter config --enable-linux-desktop
7171
install_melos_script:
72-
- dart pub global activate melos
72+
- dart pub global activate melos 2.9.0
7373
build_script:
7474
- export PATH="$PATH":"$HOME/.pub-cache/bin"
7575
- melos bootstrap
@@ -86,7 +86,7 @@ task:
8686
- apt install cmake ninja-build clang pkg-config libgtk-3-dev -y
8787
- flutter config --enable-linux-desktop
8888
install_melos_script:
89-
- dart pub global activate melos
89+
- dart pub global activate melos 2.9.0
9090
build_script:
9191
- export PATH="$PATH":"$HOME/.pub-cache/bin"
9292
- melos bootstrap
@@ -103,7 +103,7 @@ task:
103103
- apt install cmake ninja-build clang pkg-config libgtk-3-dev -y
104104
- flutter config --enable-linux-desktop
105105
install_melos_script:
106-
- dart pub global activate melos
106+
- dart pub global activate melos 2.9.0
107107
build_script:
108108
- export PATH="$PATH":"$HOME/.pub-cache/bin"
109109
- melos bootstrap
@@ -114,7 +114,7 @@ task:
114114
container:
115115
image: cirrusci/flutter:stable
116116
install_melos_script:
117-
- dart pub global activate melos
117+
- dart pub global activate melos 2.9.0
118118
test_script:
119119
- export PATH="$PATH":"$HOME/.pub-cache/bin"
120120
- melos bootstrap
@@ -125,7 +125,7 @@ task:
125125
container:
126126
image: cirrusci/flutter:stable
127127
install_melos_script:
128-
- dart pub global activate melos
128+
- dart pub global activate melos 2.9.0
129129
test_script:
130130
- export PATH="$PATH":"$HOME/.pub-cache/bin"
131131
- melos bootstrap
@@ -144,7 +144,7 @@ task:
144144
pub_cache:
145145
folder: ~/.pub-cache
146146
install_melos_script:
147-
- dart pub global activate melos
147+
- dart pub global activate melos 2.9.0
148148
install_images_script: sdkmanager "system-images;android-$EMULATOR_API_LEVEL;$ANDROID_ABI"
149149
install_emulator_script: sdkmanager emulator
150150
create_device_script:
@@ -180,7 +180,7 @@ task:
180180
- flutter channel stable
181181
- flutter upgrade
182182
install_melos_script:
183-
- dart pub global activate melos
183+
- dart pub global activate melos 2.9.0
184184
test_script:
185185
- export PATH="$PATH":"$HOME/.pub-cache/bin"
186186
- melos bootstrap

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ Contributions are welcome by submitting a PR for to be reviewed. If it's to add
88
Please ensure that no analysis issues are found and all tests continue to pass and add/update the tests as appropriate.
99
Most of the tests are around verifying the details sent via the platform channel.
1010

11-
For API docs, please try to adhere to the effective Dart documentation guidelines that can be found [here](https://dart.dev/guides/language/effective-dart/documentation).
11+
For API docs, please try to adhere to the effective Dart documentation guidelines that can be found [here](https://dart.dev/guides/language/effective-dart/documentation).
12+
13+
Managing the monorepo is through the use of [`melos`](https://melos.invertase.dev). Currently the minimum Flutter SDK version supported is 3.0 with a corresponding minimum Dart SDK version of 2.17. This isn't compatible with melos versions 3.0 or newer due to incompatible Dart SDK version constraints. To avoid bumping the plugin's minimum Flutter and Dart SDK version constraints just for the sake of being able to use newer versions of `melos`, version 2.9.0 used. For local development purposes you can activate 2.9.0 by running `dart pub global activate melos 2.9.0`. The cirrus build scripts run the same command to specify `melos` version 2.9.0

flutter_local_notifications/macos/Classes/FlutterLocalNotificationsPlugin.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public class FlutterLocalNotificationsPlugin: NSObject, FlutterPlugin, UNUserNot
413413
let timeZoneName = arguments[MethodCallArguments.timeZoneName] as! String
414414
let timeZone = TimeZone.init(identifier: timeZoneName)
415415
let dateFormatter = ISO8601DateFormatter()
416-
dateFormatter.formatOptions = [.withFractionalSeconds, .withInternetDateTime];
416+
dateFormatter.formatOptions = [.withFractionalSeconds, .withInternetDateTime]
417417
let date = dateFormatter.date(from: scheduledDateTime)!
418418
notification.deliveryDate = date
419419
notification.deliveryTimeZone = timeZone
@@ -553,7 +553,7 @@ public class FlutterLocalNotificationsPlugin: NSObject, FlutterPlugin, UNUserNot
553553
let timeZoneName = arguments[MethodCallArguments.timeZoneName] as! String
554554
let timeZone = TimeZone.init(identifier: timeZoneName)
555555
let dateFormatter = ISO8601DateFormatter()
556-
dateFormatter.formatOptions = [.withFractionalSeconds, .withInternetDateTime];
556+
dateFormatter.formatOptions = [.withFractionalSeconds, .withInternetDateTime]
557557
dateFormatter.timeZone = timeZone
558558
let date = dateFormatter.date(from: scheduledDateTime)!
559559
var calendar = Calendar.current

flutter_local_notifications/test/android_flutter_local_notifications_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,7 @@ void main() {
19551955
'payload': '',
19561956
'timeZoneName': 'Australia/Sydney',
19571957
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
1958+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
19581959
'platformSpecifics': <String, Object?>{
19591960
'scheduleMode': 'exactAllowWhileIdle',
19601961
'icon': null,
@@ -2049,6 +2050,7 @@ void main() {
20492050
'payload': '',
20502051
'timeZoneName': 'Australia/Sydney',
20512052
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
2053+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
20522054
'matchDateTimeComponents': DateTimeComponents.time.index,
20532055
'platformSpecifics': <String, Object?>{
20542056
'scheduleMode': 'exactAllowWhileIdle',
@@ -2144,6 +2146,7 @@ void main() {
21442146
'payload': '',
21452147
'timeZoneName': 'Australia/Sydney',
21462148
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
2149+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
21472150
'matchDateTimeComponents':
21482151
DateTimeComponents.dayOfWeekAndTime.index,
21492152
'platformSpecifics': <String, Object?>{

flutter_local_notifications/test/ios_flutter_local_notifications_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ void main() {
374374
'uiLocalNotificationDateInterpretation':
375375
UILocalNotificationDateInterpretation.absoluteTime.index,
376376
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
377+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
377378
'timeZoneName': 'Australia/Sydney',
378379
'platformSpecifics': <String, Object?>{
379380
'presentAlert': true,
@@ -441,6 +442,7 @@ void main() {
441442
'uiLocalNotificationDateInterpretation':
442443
UILocalNotificationDateInterpretation.absoluteTime.index,
443444
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
445+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
444446
'timeZoneName': 'Australia/Sydney',
445447
'matchDateTimeComponents': DateTimeComponents.time.index,
446448
'platformSpecifics': <String, Object?>{
@@ -509,6 +511,7 @@ void main() {
509511
'uiLocalNotificationDateInterpretation':
510512
UILocalNotificationDateInterpretation.absoluteTime.index,
511513
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
514+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
512515
'timeZoneName': 'Australia/Sydney',
513516
'matchDateTimeComponents':
514517
DateTimeComponents.dayOfWeekAndTime.index,

flutter_local_notifications/test/macos_flutter_local_notifications_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ void main() {
283283
'body': 'notification body',
284284
'payload': '',
285285
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
286+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
286287
'timeZoneName': 'Australia/Sydney',
287288
'platformSpecifics': <String, Object?>{
288289
'subtitle': null,
@@ -353,6 +354,7 @@ void main() {
353354
'body': 'notification body',
354355
'payload': '',
355356
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
357+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
356358
'timeZoneName': 'Australia/Sydney',
357359
'matchDateTimeComponents': DateTimeComponents.time.index,
358360
'platformSpecifics': <String, Object?>{
@@ -426,6 +428,7 @@ void main() {
426428
'body': 'notification body',
427429
'payload': '',
428430
'scheduledDateTime': convertDateToISO8601String(scheduledDate),
431+
'scheduledDateTimeISO8601': scheduledDate.toIso8601String(),
429432
'timeZoneName': 'Australia/Sydney',
430433
'matchDateTimeComponents':
431434
DateTimeComponents.dayOfWeekAndTime.index,

melos.yaml

+22-18
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,58 @@ scripts:
1919
description: Run dart analyzer in a specific package.
2020
test:unit:
2121
description: Run unit tests in a specific package.
22-
run: melos exec --concurrency=1 -- "flutter test"
23-
packageFilters:
24-
dirExists:
22+
run: melos exec -c 1 -- "flutter test"
23+
select-package:
24+
dir-exists:
2525
- test
2626
test:unit:android:
2727
description: Runs java unit tests
2828
run: melos exec -c 1 -- "flutter build apk --debug && cd android && ./gradlew flutter_local_notifications:testDebug"
29-
packageFilters:
29+
select-package:
3030
scope: "*example*"
3131
test:integration:
3232
run: melos exec -c 1 -- "flutter test integration_test"
3333
description: Run integration tests
34-
packageFilters:
35-
dirExists:
34+
select-package:
35+
dir-exists:
3636
- integration_test
3737
scope: "*example*"
3838
build:example_android:
3939
run: |
40-
melos exec -c 1 --scope="*example*" -- \
40+
melos exec -c 1 -- \
4141
"flutter build apk --debug"
4242
description: Build a specific example app for Android.
43-
packageFilters:
44-
dirExists:
43+
select-package:
44+
dir-exists:
4545
- android
46+
scope: "*example*"
4647
build:example_ios:
4748
run: |
48-
melos exec -c 1 --scope="*example*" -- \
49+
melos exec -c 1 -- \
4950
"flutter build ios --no-codesign --debug"
5051
description: Build a specific example app for iOS.
51-
packageFilters:
52-
dirExists:
52+
select-package:
53+
dir-exists:
5354
- ios
55+
scope: "*example*"
5456
build:example_macos:
5557
run: |
56-
melos exec -c 1 --scope="*example*" -- \
58+
melos exec -c 1 -- \
5759
"flutter build macos"
5860
description: Build a specific example app for macOS.
59-
packageFilters:
60-
dirExists:
61+
select-package:
62+
dir-exists:
6163
- macos
64+
scope: "*example*"
6265
build:example_linux:
6366
run: |
64-
melos exec -c 1 --scope="*example*" -- \
67+
melos exec -c 1 -- \
6568
"flutter build linux"
6669
description: Build a specific example app for Linux.
67-
packageFilters:
68-
dirExists:
70+
select-package:
71+
dir-exists:
6972
- linux
73+
scope: "*example*"
7074

7175
clean:
7276
run: git clean -x -d -f -q

pubspec.yaml

-7
This file was deleted.

0 commit comments

Comments
 (0)