mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-29 04:30:02 +00:00
fix updateWidget
This commit is contained in:
parent
26532b4203
commit
31ee0b49f8
4 changed files with 21 additions and 7 deletions
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:flutter_timezone/flutter_timezone.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
@ -16,6 +17,8 @@ import 'package:rain/app/widgets/status/status_weather.dart';
|
|||
import 'package:rain/app/widgets/status/status_data.dart';
|
||||
import 'package:rain/main.dart';
|
||||
import 'package:timezone/standalone.dart' as tz;
|
||||
import 'package:timezone/data/latest_all.dart' as tz;
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:lat_lng_to_timezone/lat_lng_to_timezone.dart' as tzmap;
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
import 'package:workmanager/workmanager.dart';
|
||||
|
@ -482,6 +485,17 @@ class WeatherController extends GetxController {
|
|||
}
|
||||
|
||||
Future<bool> updateWidget() async {
|
||||
final timeZoneName = await FlutterTimezone.getLocalTimezone();
|
||||
tz.initializeTimeZones();
|
||||
tz.setLocalLocation(tz.getLocation(timeZoneName));
|
||||
|
||||
isar = await Isar.open([
|
||||
SettingsSchema,
|
||||
MainWeatherCacheSchema,
|
||||
LocationCacheSchema,
|
||||
WeatherCardSchema,
|
||||
], directory: (await getApplicationSupportDirectory()).path);
|
||||
|
||||
MainWeatherCache? mainWeatherCache;
|
||||
mainWeatherCache = isar.mainWeatherCaches.where().findFirstSync();
|
||||
if (mainWeatherCache == null) return false;
|
||||
|
|
|
@ -242,7 +242,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
: await flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermission();
|
||||
?.requestNotificationsPermission();
|
||||
if (result != null) {
|
||||
isar.writeTxnSync(() {
|
||||
settings.notifications = value;
|
||||
|
|
|
@ -314,10 +314,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_local_notifications
|
||||
sha256: "3002092e5b8ce2f86c3361422e52e6db6776c23ee21e0b2f71b892bf4259ef04"
|
||||
sha256: "916e2e8e594a0ef98b88662be55a1fbc95094473366afdd992c72a1695687f4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.1.1"
|
||||
version: "16.0.0+1"
|
||||
flutter_local_notifications_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -377,10 +377,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: geocoding
|
||||
sha256: b34c0501bbbaf3190b85bef3078b27cf66c28a8915c6d3af50d67f356aa7da31
|
||||
sha256: e1dc0ac56666d9ed1d5a9ae5543ce9eb5986db6209cc7600103487d09192059c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.1.1"
|
||||
geocoding_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -20,7 +20,7 @@ dependencies:
|
|||
shimmer: ^3.0.0
|
||||
iconsax: ^0.0.8
|
||||
timezone: ^0.9.2
|
||||
geocoding: ^2.1.0
|
||||
geocoding: ^2.1.1
|
||||
geolocator: ^10.1.0
|
||||
home_widget: ^0.3.0
|
||||
workmanager: ^0.5.2
|
||||
|
@ -37,7 +37,7 @@ dependencies:
|
|||
flutter_displaymode: ^0.6.0
|
||||
lat_lng_to_timezone: ^0.2.0
|
||||
scrollable_positioned_list: ^0.3.8
|
||||
flutter_local_notifications: ^15.1.1
|
||||
flutter_local_notifications: ^16.0.0+1
|
||||
|
||||
# Uncomment this for publishing FLOSS variant
|
||||
# dependency_overrides:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue