Skip to content

Commit 4dcfde0

Browse files
committed
fix(notifications): #205 (I forgot to update the key of cached news there...)
1 parent 787abf3 commit 4dcfde0

8 files changed

Lines changed: 303 additions & 213 deletions

File tree

android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,19 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
5656
Log.e(TAG, "Error registering plugin fluttertoast, io.github.ponnamkarthik.toast.fluttertoast.FlutterToastPlugin", e);
5757
}
5858
try {
59-
flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin());
59+
flutterEngine.getPlugins().add(new com.github.dart_lang.jni.JniPlugin());
6060
} catch (Exception e) {
61-
Log.e(TAG, "Error registering plugin package_info_plus, dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin", e);
61+
Log.e(TAG, "Error registering plugin jni, com.github.dart_lang.jni.JniPlugin", e);
6262
}
6363
try {
64-
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
64+
flutterEngine.getPlugins().add(new com.github.dart_lang.jni_flutter.JniFlutterPlugin());
6565
} catch (Exception e) {
66-
Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
66+
Log.e(TAG, "Error registering plugin jni_flutter, com.github.dart_lang.jni_flutter.JniFlutterPlugin", e);
67+
}
68+
try {
69+
flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin());
70+
} catch (Exception e) {
71+
Log.e(TAG, "Error registering plugin package_info_plus, dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin", e);
6772
}
6873
try {
6974
flutterEngine.getPlugins().add(new com.kasem.receive_sharing_intent.ReceiveSharingIntentPlugin());
@@ -113,7 +118,7 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
113118
try {
114119
flutterEngine.getPlugins().add(new dev.fluttercommunity.workmanager.WorkmanagerPlugin());
115120
} catch (Exception e) {
116-
Log.e(TAG, "Error registering plugin workmanager, dev.fluttercommunity.workmanager.WorkmanagerPlugin", e);
121+
Log.e(TAG, "Error registering plugin workmanager_android, dev.fluttercommunity.workmanager.WorkmanagerPlugin", e);
117122
}
118123
}
119124
}

ios/Runner/GeneratedPluginRegistrant.m

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
@import package_info_plus;
6161
#endif
6262

63-
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
64-
#import <path_provider_foundation/PathProviderPlugin.h>
65-
#else
66-
@import path_provider_foundation;
67-
#endif
68-
6963
#if __has_include(<receive_sharing_intent/ReceiveSharingIntentPlugin.h>)
7064
#import <receive_sharing_intent/ReceiveSharingIntentPlugin.h>
7165
#else
@@ -108,8 +102,8 @@
108102
@import url_launcher_ios;
109103
#endif
110104

111-
#if __has_include(<video_player_avfoundation/FVPVideoPlayerPlugin.h>)
112-
#import <video_player_avfoundation/FVPVideoPlayerPlugin.h>
105+
#if __has_include(<video_player_avfoundation/VideoPlayerPlugin.h>)
106+
#import <video_player_avfoundation/VideoPlayerPlugin.h>
113107
#else
114108
@import video_player_avfoundation;
115109
#endif
@@ -120,10 +114,10 @@
120114
@import wakelock_plus;
121115
#endif
122116

123-
#if __has_include(<workmanager/WorkmanagerPlugin.h>)
124-
#import <workmanager/WorkmanagerPlugin.h>
117+
#if __has_include(<workmanager_apple/WorkmanagerPlugin.h>)
118+
#import <workmanager_apple/WorkmanagerPlugin.h>
125119
#else
126-
@import workmanager;
120+
@import workmanager_apple;
127121
#endif
128122

129123
@implementation GeneratedPluginRegistrant
@@ -138,15 +132,14 @@ + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
138132
[FlutterNativeSplashPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterNativeSplashPlugin"]];
139133
[FluttertoastPlugin registerWithRegistrar:[registry registrarForPlugin:@"FluttertoastPlugin"]];
140134
[FPPPackageInfoPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPPackageInfoPlusPlugin"]];
141-
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
142135
[ReceiveSharingIntentPlugin registerWithRegistrar:[registry registrarForPlugin:@"ReceiveSharingIntentPlugin"]];
143136
[RiverPlayerPlugin registerWithRegistrar:[registry registrarForPlugin:@"RiverPlayerPlugin"]];
144137
[FPPSharePlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPSharePlusPlugin"]];
145138
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
146139
[SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
147140
[SyncfusionFlutterPdfViewerPlugin registerWithRegistrar:[registry registrarForPlugin:@"SyncfusionFlutterPdfViewerPlugin"]];
148141
[URLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"URLLauncherPlugin"]];
149-
[FVPVideoPlayerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FVPVideoPlayerPlugin"]];
142+
[VideoPlayerPlugin registerWithRegistrar:[registry registrarForPlugin:@"VideoPlayerPlugin"]];
150143
[WakelockPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"WakelockPlusPlugin"]];
151144
[WorkmanagerPlugin registerWithRegistrar:[registry registrarForPlugin:@"WorkmanagerPlugin"]];
152145
}

lib/config/notifications.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Notifications {
4343
await Workmanager().registerPeriodicTask(
4444
'newsLoader',
4545
"Load news in background",
46-
existingWorkPolicy: ExistingWorkPolicy.replace,
46+
existingWorkPolicy: ExistingPeriodicWorkPolicy.replace,
4747
frequency: Duration(hours: refreshInterval),
4848
initialDelay: Duration(hours: refreshInterval),
4949
constraints: Notifications().getConstraints(),

lib/helpers/news_feed_widget.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* This file is part of BoxBox (https://github.com/BrightDV/BoxBox).
43
*

lib/main.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void callbackDispatcher() {
6767
await Hive.initFlutter();
6868
Box hiveBox = await Hive.openBox("requests");
6969
Box settingsBox = await Hive.openBox("settings");
70-
Map cachedNews = hiveBox.get('news', defaultValue: {}) as Map;
70+
Map cachedNews = hiveBox.get('f1News', defaultValue: {}) as Map;
7171
bool useDataSaverMode =
7272
settingsBox.get('useDataSaverMode', defaultValue: false) as bool;
7373
try {
@@ -79,14 +79,18 @@ void callbackDispatcher() {
7979
if (article['id'] == cachedNews['items'][0]['id']) {
8080
break;
8181
} else if (article['breaking'] != null && article['breaking']) {
82-
Notifications()
83-
.showArticleNotification(article, useDataSaverMode);
82+
Notifications().showArticleNotification(
83+
article,
84+
useDataSaverMode,
85+
);
8486
hasBreaking = true;
8587
}
8688
}
8789
if (!hasBreaking) {
8890
Notifications().showArticleNotification(
89-
fetchedData['items'][0], useDataSaverMode);
91+
fetchedData['items'][0],
92+
useDataSaverMode,
93+
);
9094
}
9195

9296
hiveBox.put('news', fetchedData);

linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
99
)
1010

1111
list(APPEND FLUTTER_FFI_PLUGIN_LIST
12+
jni
1213
)
1314

1415
set(PLUGIN_BUNDLED_LIBRARIES)

0 commit comments

Comments
 (0)