diff --git a/CHANGELOG.md b/CHANGELOG.md index 82997b1..92b831c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.4.2 +- aktualizace knihovny flutter_local_notifications +- lepší podpora pro Android 13 +- změna na adaptivní ikony na Androidu # 1.4.1 - aktualizovat knihovnu canteenlib - změnit odkaz na odeslání zpětné vazby diff --git a/android/app/build.gradle b/android/app/build.gradle index 6faf358..508c17f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -31,9 +31,12 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" } android { - compileSdkVersion flutter.compileSdkVersion + compileSdkVersion 33 compileOptions { + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true + // Sets Java compatibility to Java 8 sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -49,7 +52,7 @@ android { defaultConfig { applicationId "cz.hernikplays.opencanteen" minSdkVersion 18 - targetSdkVersion flutter.targetSdkVersion + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true @@ -78,4 +81,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:multidex:1.0.3' implementation 'androidx.appcompat:appcompat:1.3.1' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 58aa68e..ae6036b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4..3a8525f 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b7..9bd0a61 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d4391..3c05191 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..9eecb84 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..3de81dc 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..df90f3d --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #4f4685 + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 4256f91..73d46bc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:4.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index bc6a58a..939efa2 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/assets/fore.png b/assets/fore.png new file mode 100644 index 0000000..251db98 Binary files /dev/null and b/assets/fore.png differ diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4..57d7799 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -7,6 +7,14 @@ import Flutter _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + // This is required to make any communication available in the action isolate. + FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in + GeneratedPluginRegistrant.register(with: registry) + } + + if #available(iOS 10.0, *) { + UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate + } GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 0000000..6d71354 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 0000000..4a18719 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 0000000..23ee4a0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 0000000..5089415 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 0000000..3a8525f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 0000000..9eecb84 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png differ diff --git a/lib/main.dart b/lib/main.dart index cfc473a..7b3eee1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -79,9 +79,8 @@ void oznamitPredem(SharedPreferences prefs, tz.Location l) async { channelDescription: 'Oznámení o dnešním jídle', importance: Importance.max, priority: Priority.high, + styleInformation: BigTextStyleInformation(''), ticker: 'today meal'); - const IOSNotificationDetails iOSpec = - IOSNotificationDetails(presentAlert: true, presentBadge: true); // naplánovat await flutterLocalNotificationsPlugin.zonedSchedule( @@ -89,7 +88,7 @@ void oznamitPredem(SharedPreferences prefs, tz.Location l) async { title, "${jidlo.varianta} - ${jidlo.nazev}", tz.TZDateTime.from(cas, l), - const NotificationDetails(android: androidSpec, iOS: iOSpec), + const NotificationDetails(android: androidSpec), androidAllowWhileIdle: true, uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime); @@ -116,26 +115,10 @@ void main() async { const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('notif_icon'); - final IOSInitializationSettings initializationSettingsIOS = - IOSInitializationSettings(onDidReceiveLocalNotification: ( - int id, - String? title, - String? body, - String? payload, - ) async { - debugPrint(body); - }); - - final InitializationSettings initializationSettings = InitializationSettings( + const InitializationSettings initializationSettings = InitializationSettings( android: initializationSettingsAndroid, - iOS: initializationSettingsIOS, ); - await flutterLocalNotificationsPlugin.initialize(initializationSettings, - onSelectNotification: (String? payload) async { - if (payload != null) { - debugPrint('notification payload: $payload'); - } - }); + await flutterLocalNotificationsPlugin.initialize(initializationSettings); // spustit aplikaci runApp(const MyApp()); @@ -195,6 +178,12 @@ class _LoginPageState extends State { badge: true, sound: true, ); + } else if (Platform.isAndroid) { + // žádat o oprávnění na android + flutterLocalNotificationsPlugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin>() + ?.requestPermission(); } if (r != null) { // Automaticky přihlásit diff --git a/lib/okna/nastaveni.dart b/lib/okna/nastaveni.dart index 4839240..9bc6cbf 100644 --- a/lib/okna/nastaveni.dart +++ b/lib/okna/nastaveni.dart @@ -232,8 +232,6 @@ class _NastaveniState extends State { importance: Importance.max, priority: Priority.high, ticker: 'today meal'); - const IOSNotificationDetails iOSpec = - IOSNotificationDetails(presentAlert: true, presentBadge: true); var l = tz.getLocation(await FlutterNativeTimezone.getLocalTimezone()); if (!mounted) return; @@ -243,7 +241,7 @@ class _NastaveniState extends State { Languages.of(context)!.lunchNotif, "${jidlo.varianta} - ${jidlo.nazev}", tz.TZDateTime.from(den, l), - const NotificationDetails(android: androidSpec, iOS: iOSpec), + const NotificationDetails(android: androidSpec), androidAllowWhileIdle: true, uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime); diff --git a/package.json b/package.json index 7747bd2..ab7e87c 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,6 @@ "@commitlint/config-conventional": "^17.0.0", "cz-conventional-changelog": "^3.3.0" }, - "scripts": { - "prepare": "husky install" - }, "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog" diff --git a/pubspec.lock b/pubspec.lock index 1ba9b3e..48f9862 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.3.1" + version: "3.3.4" args: dependency: transitive description: @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.9.0" + version: "2.10.0" canteenlib: dependency: "direct main" description: @@ -36,6 +36,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" clock: dependency: transitive description: @@ -50,6 +64,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" crypto: dependency: transitive description: @@ -96,7 +117,7 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.9.3" + version: "0.11.0" flutter_lints: dependency: "direct dev" description: @@ -110,21 +131,21 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "9.5.3+1" + version: "12.0.3+1" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "2.0.0" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -197,14 +218,14 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.0.2" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" + version: "3.2.2" intl: dependency: "direct main" description: @@ -226,13 +247,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "4.7.0" lints: dependency: transitive description: name: lints url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" material_color_utilities: dependency: transitive description: @@ -281,7 +309,7 @@ packages: name: package_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.0.6" package_info_plus_windows: dependency: transitive description: @@ -309,7 +337,7 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.20" + version: "2.0.21" path_provider_ios: dependency: transitive description: @@ -337,7 +365,7 @@ packages: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" path_provider_windows: dependency: transitive description: @@ -351,7 +379,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "5.1.0" platform: dependency: transitive description: @@ -365,7 +393,14 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" + pointycastle: + dependency: transitive + description: + name: pointycastle + url: "https://pub.dartlang.org" + source: hosted + version: "3.6.2" process: dependency: transitive description: @@ -386,7 +421,7 @@ packages: name: shared_preferences_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.12" + version: "2.0.14" shared_preferences_ios: dependency: transitive description: @@ -447,7 +482,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: @@ -461,7 +496,7 @@ packages: name: timezone url: "https://pub.dartlang.org" source: hosted - version: "0.8.0" + version: "0.9.0" typed_data: dependency: transitive description: @@ -475,14 +510,14 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.1.5" + version: "6.1.6" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.17" + version: "6.0.21" url_launcher_ios: dependency: transitive description: @@ -510,7 +545,7 @@ packages: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" url_launcher_web: dependency: transitive description: @@ -538,7 +573,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.1" xdg_directories: dependency: transitive description: @@ -561,5 +596,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0 <3.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index b3b604b..ba796e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. -version: 1.4.1+20 +version: 1.4.2+22 environment: sdk: ">=2.16.1 <3.0.0" @@ -22,20 +22,22 @@ dependencies: path_provider: ^2.0.9 shared_preferences: ^2.0.13 introduction_screen: ^3.0.1 - flutter_local_notifications: 9.5.3+1 - timezone: ^0.8.0 + flutter_local_notifications: ^12.0.3+1 + timezone: ^0.9.0 flutter_native_timezone: ^2.0.0 intl: ^0.17.0 package_info_plus: ^1.4.3+1 dev_dependencies: flutter_lints: ^2.0.1 - flutter_launcher_icons: "^0.9.2" + flutter_launcher_icons: ^0.11.0 flutter_icons: - android: "launcher_icon" + android: true ios: true image_path: "assets/icon.jpg" + adaptive_icon_background: "#4f4685" + adaptive_icon_foreground: "assets/fore.png" flutter: uses-material-design: true