Skip to content

Commit d3a3893

Browse files
committed
chore: fix snapcraft, add macos icon (#19)
1 parent 61f88a4 commit d3a3893

File tree

14 files changed

+396
-85
lines changed

14 files changed

+396
-85
lines changed

assets/pulse.png

55.8 KB
Loading

lib/register_dependencies.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void registerDependencies() {
1818

1919
const apiKey = String.fromEnvironment('API_KEY', defaultValue: '');
2020

21-
if (apiKey.isNotEmpty) {
21+
if (apiKey.trim().isNotEmpty) {
2222
flutterSecureStorage.write(key: SettingKeys.apiKey, value: apiKey);
2323
}
2424
return flutterSecureStorage;
@@ -51,10 +51,11 @@ void registerDependencies() {
5151
)
5252
..registerSingletonWithDependencies(
5353
() => WeatherModel(
54+
settingsService: di<SettingsService>(),
5455
locationsService: di<LocationsService>(),
5556
openWeather: di<OpenWeather>(),
5657
),
57-
dependsOn: [OpenWeather],
58+
dependsOn: [OpenWeather, SettingsService],
5859
dispose: (s) => s.dispose(),
5960
)
6061
..registerLazySingleton(AppModel.new);

lib/weather/weather_model.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:safe_change_notifier/safe_change_notifier.dart';
1212
import 'package:watch_it/watch_it.dart';
1313

1414
import '../locations/locations_service.dart';
15+
import '../settings/settings_service.dart';
1516
import 'weather_data_x.dart';
1617
import 'weekday.dart';
1718
import 'package:http/http.dart' as http;
@@ -20,18 +21,26 @@ class WeatherModel extends SafeChangeNotifier {
2021
WeatherModel({
2122
required OpenWeather openWeather,
2223
required LocationsService locationsService,
24+
required SettingsService settingsService,
2325
}) : _openWeather = openWeather,
24-
_locationsService = locationsService;
26+
_locationsService = locationsService,
27+
_settingsService = settingsService;
2528

2629
OpenWeather _openWeather;
2730
void setApiKeyAndLoadWeather(String apiKey) {
31+
_settingsService.setString(
32+
key: SettingKeys.apiKey,
33+
value: apiKey,
34+
secure: true,
35+
);
2836
di
2937
..unregister<OpenWeather>()
3038
..registerSingleton<OpenWeather>(OpenWeather(apiKey: apiKey));
3139
_openWeather = di<OpenWeather>();
3240
loadWeather();
3341
}
3442

43+
final SettingsService _settingsService;
3544
final LocationsService _locationsService;
3645
StreamSubscription<bool>? _propertiesChangedSub;
3746

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
{
2-
"images" : [
3-
{
4-
"size" : "16x16",
5-
"idiom" : "mac",
6-
"filename" : "app_icon_16.png",
7-
"scale" : "1x"
2+
"info": {
3+
"version": 1,
4+
"author": "xcode"
85
},
9-
{
10-
"size" : "16x16",
11-
"idiom" : "mac",
12-
"filename" : "app_icon_32.png",
13-
"scale" : "2x"
14-
},
15-
{
16-
"size" : "32x32",
17-
"idiom" : "mac",
18-
"filename" : "app_icon_32.png",
19-
"scale" : "1x"
20-
},
21-
{
22-
"size" : "32x32",
23-
"idiom" : "mac",
24-
"filename" : "app_icon_64.png",
25-
"scale" : "2x"
26-
},
27-
{
28-
"size" : "128x128",
29-
"idiom" : "mac",
30-
"filename" : "app_icon_128.png",
31-
"scale" : "1x"
32-
},
33-
{
34-
"size" : "128x128",
35-
"idiom" : "mac",
36-
"filename" : "app_icon_256.png",
37-
"scale" : "2x"
38-
},
39-
{
40-
"size" : "256x256",
41-
"idiom" : "mac",
42-
"filename" : "app_icon_256.png",
43-
"scale" : "1x"
44-
},
45-
{
46-
"size" : "256x256",
47-
"idiom" : "mac",
48-
"filename" : "app_icon_512.png",
49-
"scale" : "2x"
50-
},
51-
{
52-
"size" : "512x512",
53-
"idiom" : "mac",
54-
"filename" : "app_icon_512.png",
55-
"scale" : "1x"
56-
},
57-
{
58-
"size" : "512x512",
59-
"idiom" : "mac",
60-
"filename" : "app_icon_1024.png",
61-
"scale" : "2x"
62-
}
63-
],
64-
"info" : {
65-
"version" : 1,
66-
"author" : "xcode"
67-
}
68-
}
6+
"images": [
7+
{
8+
"size": "16x16",
9+
"idiom": "mac",
10+
"filename": "app_icon_16.png",
11+
"scale": "1x"
12+
},
13+
{
14+
"size": "16x16",
15+
"idiom": "mac",
16+
"filename": "app_icon_32.png",
17+
"scale": "2x"
18+
},
19+
{
20+
"size": "32x32",
21+
"idiom": "mac",
22+
"filename": "app_icon_32.png",
23+
"scale": "1x"
24+
},
25+
{
26+
"size": "32x32",
27+
"idiom": "mac",
28+
"filename": "app_icon_64.png",
29+
"scale": "2x"
30+
},
31+
{
32+
"size": "128x128",
33+
"idiom": "mac",
34+
"filename": "app_icon_128.png",
35+
"scale": "1x"
36+
},
37+
{
38+
"size": "128x128",
39+
"idiom": "mac",
40+
"filename": "app_icon_256.png",
41+
"scale": "2x"
42+
},
43+
{
44+
"size": "256x256",
45+
"idiom": "mac",
46+
"filename": "app_icon_256.png",
47+
"scale": "1x"
48+
},
49+
{
50+
"size": "256x256",
51+
"idiom": "mac",
52+
"filename": "app_icon_512.png",
53+
"scale": "2x"
54+
},
55+
{
56+
"size": "512x512",
57+
"idiom": "mac",
58+
"filename": "app_icon_512.png",
59+
"scale": "1x"
60+
},
61+
{
62+
"size": "512x512",
63+
"idiom": "mac",
64+
"filename": "app_icon_1024.png",
65+
"scale": "2x"
66+
}
67+
]
68+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)