Skip to content

Commit e4daee9

Browse files
authored
🔀 Merge pull request #21 from Cynnexis/dev
Ready to release first version
2 parents db2efb8 + b6a48b7 commit e4daee9

8 files changed

+38
-205
lines changed

.github/workflows/main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,21 @@ jobs:
2626
id: zephyr_test
2727
with:
2828
args: "test"
29+
30+
release:
31+
runs-on: ubuntu-18.04
32+
name: Create a release
33+
needs: [lint, test]
34+
if: github.event_name == 'push' && github.ref == 'master' || contains(github.ref, 'cicd/')
35+
steps:
36+
- name: Create a release for Zéphyr
37+
id: create_release
38+
uses: actions/create-release@latest
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ github.sha }}
43+
release_name: ${{ github.sha }}
44+
body: "Ref: ${{ github.ref }} SHA: ${{ github.sha }}"
45+
draft: true
46+
prerelease: false

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The app should be running now.
4444
* [flutter_typeahead][flutter_typeahead]
4545
* [diacritic][diacritic]
4646
* [flutter_launcher_icons][flutter_launcher_icons]
47+
* [notifiable_iterables][notifiable_iterables]
4748

4849
## Contributing
4950

@@ -68,5 +69,6 @@ for more detail (it's a really fascinating story written in there!)
6869
[flutter_typeahead]: https://pub.dev/packages/flutter_typeahead
6970
[diacritic]: https://pub.dev/packages/diacritic
7071
[flutter_launcher_icons]: https://pub.dev/packages/flutter_launcher_icons
72+
[notifiable_iterables]: https://pub.dev/packages/notifiable_iterables
7173
[cynnexis]: https://github.com/Cynnexis
7274
[license]: https://github.com/Cynnexis/zephyr/blob/master/LICENSE.txt

docker-entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function print_help() {
66
echo "The commands are:"
77
echo " lint - Check if the Dart syntax of the code is correct."
88
echo " fix-lint - Fix the Dart syntax of the code."
9-
echo " test - Run the test."
9+
echo " test - Run the tests."
1010
}
1111

1212
if [[ $# == 0 ]]; then

lib/model/abstract_notifier_set.dart

-190
This file was deleted.

lib/model/favorites.dart

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import 'package:flutter/widgets.dart';
2-
import 'package:zephyr/model/abstract_notifier_set.dart';
2+
import 'package:notifiable_iterables/notifiable_iterables.dart';
33
import 'package:zephyr/model/sign.dart';
44
import 'package:zephyr/service/preferences.dart';
55

66
/// List of favorites signs. It is also a [ChangeNotifier] that notifies all its listeners every time the list is
77
/// modified.
8-
class Favorites extends AbstractNotifierSet<Sign> {
8+
class Favorites extends NotifiableSet<Sign> {
99
/// Default constructors for [Favorites].
1010
///
1111
/// Construct a list of favorites signs from [signs]. The listeners will be notify at the end.
1212
Favorites([dynamic signs]) {
13-
if (signs != null) this.values = signs;
13+
if (signs != null) addAll(signs);
1414
}
1515

1616
/// Construct a copy of [favorites].
1717
Favorites.from(Favorites favorites) {
18-
this.values = favorites.values;
18+
addAll(favorites);
1919
}
2020

2121
/// Create a [Favorites] instance by loading the value from the internal storage. Note that this operations is
@@ -27,7 +27,8 @@ class Favorites extends AbstractNotifierSet<Sign> {
2727
/// instead). Finally, [onComplete] will be called at the end of the operation.
2828
Favorites.load([void Function(Favorites) onSuccess, void Function(Error) onError, void Function() onComplete]) {
2929
loadFavorites().then((fav) {
30-
this.values = fav.values;
30+
clear();
31+
addAll(fav);
3132
if (onSuccess != null) onSuccess(this);
3233
}).catchError((e) {
3334
if (onError != null)

lib/model/history.dart

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import 'package:flutter/widgets.dart';
2-
import 'package:zephyr/model/abstract_notifier_set.dart';
2+
import 'package:notifiable_iterables/notifiable_iterables.dart';
33
import 'package:zephyr/service/preferences.dart';
44

55
import 'keywords.dart';
66

77
/// List of keywords. It is also a [ChangeNotifier] that notifies all its listeners every time the list is
88
/// modified.
9-
class History extends AbstractNotifierSet<Keywords> {
9+
class History extends NotifiableSet<Keywords> {
1010
/// Default constructors for [History].
1111
///
1212
/// Construct a list of keywords from [keywords]. The listeners will be notify at the end.
1313
History([dynamic keywords]) {
14-
if (keywords != null) this.values = keywords;
14+
if (keywords != null) addAll(keywords);
1515
}
1616

1717
/// Construct a copy of [History].
1818
History.from(History history) {
19-
this.values = history.values;
19+
addAll(history);
2020
}
2121

2222
/// Create a [History] instance by loading the value from the internal storage. Note that this operations is
@@ -28,7 +28,8 @@ class History extends AbstractNotifierSet<Keywords> {
2828
/// instead). Finally, [onComplete] will be called at the end of the operation.
2929
History.load([void Function(History) onSuccess, void Function(Error) onError, void Function() onComplete]) {
3030
loadHistory().then((history) {
31-
this.values = history.values;
31+
clear();
32+
addAll(history);
3233
if (onSuccess != null) onSuccess(this);
3334
}).catchError((e) {
3435
if (onError != null)

pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies:
4040
provider: 4.3.1
4141
flutter_typeahead: 1.8.6
4242
json_serializable: 3.3.0
43+
notifiable_iterables: 1.0.0
4344

4445
dev_dependencies:
4546
flutter_driver:

test/preferences_test.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ void main() {
6060
test("Saving & Loading Favorites", () async {
6161
await saveFavorites(signs);
6262
final Favorites loadedSigns = await loadFavorites();
63-
expect(signs, equals(loadedSigns.values));
63+
expect(signs, equals(loadedSigns.toSet()));
6464
});
6565

6666
test("Saving & Loading History", () async {
6767
await saveHistory(keywordsSet);
6868
final History loadedHistory = await loadHistory();
69-
expect(keywordsSet, equals(loadedHistory.values));
69+
expect(keywordsSet, equals(loadedHistory.toSet()));
7070
});
7171

7272
test("Append Favorites", () async {
@@ -88,7 +88,7 @@ void main() {
8888

8989
await saveFavorites(newSigns, append: true);
9090

91-
final Set<Sign> loadedSigns = Set<Sign>.of((await loadFavorites()).values);
91+
final Set<Sign> loadedSigns = (await loadFavorites()).toSet();
9292
expect(allSigns, equals(loadedSigns));
9393
});
9494

@@ -114,7 +114,7 @@ void main() {
114114

115115
await saveFavorites(newSigns, append: true);
116116

117-
final Set<Sign> loadedSigns = Set<Sign>.of((await loadFavorites()).values);
117+
final Set<Sign> loadedSigns = (await loadFavorites()).toSet();
118118
expect(allSigns, equals(loadedSigns));
119119
});
120120
});

0 commit comments

Comments
 (0)