diff --git a/changelog.md b/changelog.md index dae1171..27503ed 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ What's new: +- fail warning +- Widget +- fix sent messages +- fix ios live activities - Hibajavítások 🐛 - **Megérkezett a Filc Premium!** ✨ diff --git a/filcnaplo/assets/fonts/FilcIcons.ttf b/filcnaplo/assets/fonts/FilcIcons.ttf index 77d2759..b54e2bc 100644 Binary files a/filcnaplo/assets/fonts/FilcIcons.ttf and b/filcnaplo/assets/fonts/FilcIcons.ttf differ diff --git a/filcnaplo/assets/images/desktop_icon.svg b/filcnaplo/assets/images/desktop_icon.svg new file mode 100644 index 0000000..547426f --- /dev/null +++ b/filcnaplo/assets/images/desktop_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/github.svg b/filcnaplo/assets/images/github.svg new file mode 100644 index 0000000..849d5c6 --- /dev/null +++ b/filcnaplo/assets/images/github.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/goal_icon.svg b/filcnaplo/assets/images/goal_icon.svg new file mode 100644 index 0000000..a4bd0e5 --- /dev/null +++ b/filcnaplo/assets/images/goal_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/heart.png b/filcnaplo/assets/images/heart.png new file mode 100644 index 0000000..a219089 Binary files /dev/null and b/filcnaplo/assets/images/heart.png differ diff --git a/filcnaplo/assets/images/kupak.svg b/filcnaplo/assets/images/kupak.svg new file mode 100644 index 0000000..9a7c0df --- /dev/null +++ b/filcnaplo/assets/images/kupak.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/logo.png b/filcnaplo/assets/images/logo.png new file mode 100644 index 0000000..20b717e Binary files /dev/null and b/filcnaplo/assets/images/logo.png differ diff --git a/filcnaplo/assets/images/nickname_icon.svg b/filcnaplo/assets/images/nickname_icon.svg new file mode 100644 index 0000000..90269de --- /dev/null +++ b/filcnaplo/assets/images/nickname_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/premium_desktop_showcase.png b/filcnaplo/assets/images/premium_desktop_showcase.png new file mode 100644 index 0000000..4ce21cc Binary files /dev/null and b/filcnaplo/assets/images/premium_desktop_showcase.png differ diff --git a/filcnaplo/assets/images/premium_goal_showcase.png b/filcnaplo/assets/images/premium_goal_showcase.png new file mode 100644 index 0000000..f3a58cf Binary files /dev/null and b/filcnaplo/assets/images/premium_goal_showcase.png differ diff --git a/filcnaplo/assets/images/premium_nickname_showcase.png b/filcnaplo/assets/images/premium_nickname_showcase.png new file mode 100644 index 0000000..9b3d50e Binary files /dev/null and b/filcnaplo/assets/images/premium_nickname_showcase.png differ diff --git a/filcnaplo/assets/images/premium_stats_showcase.png b/filcnaplo/assets/images/premium_stats_showcase.png new file mode 100644 index 0000000..4b6d7e2 Binary files /dev/null and b/filcnaplo/assets/images/premium_stats_showcase.png differ diff --git a/filcnaplo/assets/images/premium_theme_showcase.png b/filcnaplo/assets/images/premium_theme_showcase.png new file mode 100644 index 0000000..021ec95 Binary files /dev/null and b/filcnaplo/assets/images/premium_theme_showcase.png differ diff --git a/filcnaplo/assets/images/premium_timetable_showcase.png b/filcnaplo/assets/images/premium_timetable_showcase.png new file mode 100644 index 0000000..84f456f Binary files /dev/null and b/filcnaplo/assets/images/premium_timetable_showcase.png differ diff --git a/filcnaplo/assets/images/premium_widget_showcase.png b/filcnaplo/assets/images/premium_widget_showcase.png new file mode 100644 index 0000000..e7a07dd Binary files /dev/null and b/filcnaplo/assets/images/premium_widget_showcase.png differ diff --git a/filcnaplo/assets/images/stats_icon.svg b/filcnaplo/assets/images/stats_icon.svg new file mode 100644 index 0000000..8bb9e56 --- /dev/null +++ b/filcnaplo/assets/images/stats_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/theme_icon.svg b/filcnaplo/assets/images/theme_icon.svg new file mode 100644 index 0000000..0cb9a51 --- /dev/null +++ b/filcnaplo/assets/images/theme_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/timetable_icon.svg b/filcnaplo/assets/images/timetable_icon.svg new file mode 100644 index 0000000..f77b745 --- /dev/null +++ b/filcnaplo/assets/images/timetable_icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/filcnaplo/assets/images/tinta.svg b/filcnaplo/assets/images/tinta.svg new file mode 100644 index 0000000..29fbd76 --- /dev/null +++ b/filcnaplo/assets/images/tinta.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/assets/images/widget_icon.svg b/filcnaplo/assets/images/widget_icon.svg new file mode 100644 index 0000000..73e4782 --- /dev/null +++ b/filcnaplo/assets/images/widget_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/filcnaplo/ios/Podfile.lock b/filcnaplo/ios/Podfile.lock index e3689f0..cd0d96f 100644 --- a/filcnaplo/ios/Podfile.lock +++ b/filcnaplo/ios/Podfile.lock @@ -1,4 +1,6 @@ PODS: + - app_group_directory (1.0.0): + - Flutter - connectivity_plus (0.0.1): - Flutter - ReachabilitySwift @@ -39,13 +41,32 @@ PODS: - Flutter (1.0.0) - flutter_custom_tabs (0.0.1): - Flutter + - flutter_image_compress (1.0.0): + - Flutter + - Mantle + - SDWebImage + - SDWebImageWebPCoder + - flutter_native_image (0.0.1): + - Flutter - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - home_widget (0.0.1): - Flutter + - libwebp (1.2.4): + - libwebp/demux (= 1.2.4) + - libwebp/mux (= 1.2.4) + - libwebp/webp (= 1.2.4) + - libwebp/demux (1.2.4): + - libwebp/webp + - libwebp/mux (1.2.4): + - libwebp/demux + - libwebp/webp (1.2.4) - live_activities (0.0.1): - Flutter + - Mantle (2.2.0): + - Mantle/extobjc (= 2.2.0) + - Mantle/extobjc (2.2.0) - open_file (0.0.1): - Flutter - path_provider_ios (0.0.1): @@ -58,6 +79,9 @@ PODS: - SDWebImage (5.13.2): - SDWebImage/Core (= 5.13.2) - SDWebImage/Core (5.13.2) + - SDWebImageWebPCoder (0.9.1): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.13) - share_plus (0.0.1): - Flutter - sqflite (0.0.2): @@ -72,11 +96,14 @@ PODS: - Flutter DEPENDENCIES: + - app_group_directory (from `.symlinks/plugins/app_group_directory/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - DKImagePickerController/PhotoGallery (from `https://github.com/zhangao0086/DKImagePickerController.git`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - flutter_custom_tabs (from `.symlinks/plugins/flutter_custom_tabs/ios`) + - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) + - flutter_native_image (from `.symlinks/plugins/flutter_native_image/ios`) - home_widget (from `.symlinks/plugins/home_widget/ios`) - live_activities (from `.symlinks/plugins/live_activities/ios`) - open_file (from `.symlinks/plugins/open_file/ios`) @@ -93,11 +120,16 @@ SPEC REPOS: trunk: - DKPhotoGallery - FMDB + - libwebp + - Mantle - ReachabilitySwift - SDWebImage + - SDWebImageWebPCoder - SwiftyGif EXTERNAL SOURCES: + app_group_directory: + :path: ".symlinks/plugins/app_group_directory/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" DKImagePickerController: @@ -108,6 +140,10 @@ EXTERNAL SOURCES: :path: Flutter flutter_custom_tabs: :path: ".symlinks/plugins/flutter_custom_tabs/ios" + flutter_image_compress: + :path: ".symlinks/plugins/flutter_image_compress/ios" + flutter_native_image: + :path: ".symlinks/plugins/flutter_native_image/ios" home_widget: :path: ".symlinks/plugins/home_widget/ios" live_activities: @@ -137,21 +173,27 @@ CHECKOUT OPTIONS: :git: https://github.com/zhangao0086/DKImagePickerController.git SPEC CHECKSUMS: + app_group_directory: 7bf9f8f9819ead554de29da7c25fb7a680d6a9a0 connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_custom_tabs: 7a10a08686955cb748e5d26e0ae586d30689bf89 + flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433 + flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a home_widget: 2829415127ee92e876f816cbbe44c0b6601b8a37 + libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef live_activities: 9ff56a06a2d43ecd68f56deeed13b18a8304789c + Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce - quick_actions_ios: 56c03753992beabaa6c598e470e12d430d6e5e2f + quick_actions_ios: d211ffc5d7619ace7e9fb1800540b14a1aafe940 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 + SDWebImageWebPCoder: 18503de6621dd2c420d680e33d46bf8e1d5169b0 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 diff --git a/filcnaplo/ios/Runner.xcodeproj/project.pbxproj b/filcnaplo/ios/Runner.xcodeproj/project.pbxproj index 4092ea3..bf864ef 100644 --- a/filcnaplo/ios/Runner.xcodeproj/project.pbxproj +++ b/filcnaplo/ios/Runner.xcodeproj/project.pbxproj @@ -71,6 +71,7 @@ 3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.intentdefinition; path = livecard.intentdefinition; sourceTree = ""; }; 3127F7A528EAEE5900C2EFB3 /* livecard.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = livecard.swift; sourceTree = ""; tabWidth = 2; }; 3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = lesson_model.swift; sourceTree = ""; }; + 317DE77A294F6FFB002E323E /* livecard.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = livecard.entitlements; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 707F8089D970F81C480F73C4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -111,6 +112,7 @@ 3127F78F28EAEDE200C2EFB3 /* livecard */ = { isa = PBXGroup; children = ( + 317DE77A294F6FFB002E323E /* livecard.entitlements */, 3127F7A728EAEE8500C2EFB3 /* lesson_model.swift */, 3127F7A328EAEE3D00C2EFB3 /* livecard.intentdefinition */, 3127F79728EAEDE300C2EFB3 /* Assets.xcassets */, @@ -498,6 +500,7 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -539,6 +542,7 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -578,6 +582,7 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = livecard/livecard.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; diff --git a/filcnaplo/ios/Runner/Runner.entitlements b/filcnaplo/ios/Runner/Runner.entitlements index da95ee4..cfbd1dd 100644 --- a/filcnaplo/ios/Runner/Runner.entitlements +++ b/filcnaplo/ios/Runner/Runner.entitlements @@ -8,5 +8,9 @@ applinks:api.filcnaplo.hu + com.apple.security.application-groups + + group.filcnaplo.livecard + diff --git a/filcnaplo/ios/livecard/Info.plist b/filcnaplo/ios/livecard/Info.plist index 0f118fb..3aa7c09 100644 --- a/filcnaplo/ios/livecard/Info.plist +++ b/filcnaplo/ios/livecard/Info.plist @@ -7,5 +7,7 @@ NSExtensionPointIdentifier com.apple.widgetkit-extension + NSSupportsLiveActivities + diff --git a/filcnaplo/ios/livecard/lesson_model.swift b/filcnaplo/ios/livecard/lesson_model.swift index 81671f1..7eddba8 100644 --- a/filcnaplo/ios/livecard/lesson_model.swift +++ b/filcnaplo/ios/livecard/lesson_model.swift @@ -12,16 +12,18 @@ class LessonData { var nextSubject: String var nextRoom: String - init?(JSONData data:[String: String]) { - self.icon = data["icon"]! - self.index = data["index"]! - self.title = data["title"]! - self.subtitle = data["subtitle"]! - self.description = data["description"]! - self.startDate = Date(timeIntervalSince1970: Double(data["startDate"]!)! / 1000) - self.endDate = Date(timeIntervalSince1970: Double(data["endDate"]!)! / 1000) + init?() { + let sharedDefault = UserDefaults(suiteName: "group.filcnaplo.livecard")! + + self.icon = sharedDefault.string(forKey: "icon")! + self.index = sharedDefault.string(forKey: "index")! + self.title = sharedDefault.string(forKey: "title")! + self.subtitle = sharedDefault.string(forKey: "subtitle")! + self.description = sharedDefault.string(forKey: "description")! + self.startDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "startDate")!)! / 1000) + self.endDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "endDate")!)! / 1000) date = self.startDate...self.endDate - self.nextSubject = data["nextSubject"]! - self.nextRoom = data["nextRoom"]! + self.nextSubject = sharedDefault.string(forKey: "nextSubject")! + self.nextRoom = sharedDefault.string(forKey: "nextRoom")! } } diff --git a/filcnaplo/ios/livecard/livecard.entitlements b/filcnaplo/ios/livecard/livecard.entitlements new file mode 100644 index 0000000..36a4458 --- /dev/null +++ b/filcnaplo/ios/livecard/livecard.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.filcnaplo.livecard + + + diff --git a/filcnaplo/ios/livecard/livecard.swift b/filcnaplo/ios/livecard/livecard.swift index 51ef346..d3e5d23 100644 --- a/filcnaplo/ios/livecard/livecard.swift +++ b/filcnaplo/ios/livecard/livecard.swift @@ -13,11 +13,7 @@ struct Widgets: WidgetBundle { // We need to redefined live activities pipe struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable { - public typealias LiveDeliveryData = ContentState - - public struct ContentState: Codable, Hashable { - var data: Dictionary - } + public struct ContentState: Codable, Hashable { } var id = UUID() } @@ -27,7 +23,7 @@ struct LiveCardWidget: Widget { var body: some WidgetConfiguration { /// Live Activity Notification ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in - let lesson = LessonData(JSONData: context.state.data) + let lesson = LessonData() HStack(alignment: .center) { Image(systemName: lesson!.icon) @@ -66,7 +62,7 @@ struct LiveCardWidget: Widget { }.padding(12) /// Dynamic Island } dynamicIsland: { context in - let lesson = LessonData(JSONData: context.state.data) + let lesson = LessonData() /// Expanded return DynamicIsland { diff --git a/filcnaplo/lib/api/client.dart b/filcnaplo/lib/api/client.dart index b4f9fbb..a45cb6c 100644 --- a/filcnaplo/lib/api/client.dart +++ b/filcnaplo/lib/api/client.dart @@ -1,5 +1,3 @@ -// ignore_for_file: avoid_print - import 'dart:convert'; import 'dart:developer'; @@ -16,7 +14,7 @@ class FilcAPI { // Public API static const schoolList = "https://filcnaplo.hu/v2/school_list.json"; static const news = "https://filcnaplo.hu/v2/news.json"; - static const supporters = "https://filcnaplo.hu/v2/supporters.json"; + static const supporters = "https://api.filcnaplo.hu/sponsors"; // Private API static const config = "https://api.filcnaplo.hu/config"; @@ -45,8 +43,8 @@ class FilcAPI { } else { throw "HTTP ${res.statusCode}: ${res.body}"; } - } catch (error) { - print("ERROR: FilcAPI.getSchools: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.getSchools: $error $stacktrace"); } return null; } @@ -72,8 +70,8 @@ class FilcAPI { if (res.statusCode == 200) return Config.fromJson(jsonDecode(res.body)); } throw "HTTP ${res.statusCode}: ${res.body}"; - } catch (error) { - print("ERROR: FilcAPI.getConfig: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.getConfig: $error $stacktrace"); } return null; } @@ -87,8 +85,8 @@ class FilcAPI { } else { throw "HTTP ${res.statusCode}: ${res.body}"; } - } catch (error) { - print("ERROR: FilcAPI.getNews: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.getNews: $error $stacktrace"); } return null; } @@ -102,8 +100,8 @@ class FilcAPI { } else { throw "HTTP ${res.statusCode}: ${res.body}"; } - } catch (error) { - print("ERROR: FilcAPI.getSupporters: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.getSupporters: $error $stacktrace"); } return null; } @@ -117,8 +115,8 @@ class FilcAPI { } else { throw "HTTP ${res.statusCode}: ${res.body}"; } - } catch (error) { - print("ERROR: FilcAPI.getReleases: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.getReleases: $error $stacktrace"); } return null; } @@ -128,8 +126,8 @@ class FilcAPI { var client = http.Client(); var request = http.Request('GET', Uri.parse(release.url)); return client.send(request); - } catch (error) { - print("ERROR: FilcAPI.downloadRelease: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.downloadRelease: $error $stacktrace"); return Future.value(null); } } @@ -146,8 +144,8 @@ class FilcAPI { if (res.statusCode != 200) { throw "HTTP ${res.statusCode}: ${res.body}"; } - } catch (error) { - print("ERROR: FilcAPI.sendReport: $error"); + } on Exception catch (error, stacktrace) { + log("ERROR: FilcAPI.sendReport: $error $stacktrace"); } } } diff --git a/filcnaplo/lib/api/providers/live_card_provider.dart b/filcnaplo/lib/api/providers/live_card_provider.dart index 0aebae0..2d76b2f 100644 --- a/filcnaplo/lib/api/providers/live_card_provider.dart +++ b/filcnaplo/lib/api/providers/live_card_provider.dart @@ -36,6 +36,7 @@ class LiveCardProvider extends ChangeNotifier { required SettingsProvider settings, }) : _timetable = timetable, _settings = settings { + _liveActivitiesPlugin.init(appGroupId: "group.filcnaplo.livecard"); _timer = Timer.periodic(const Duration(seconds: 1), (timer) => update()); timetable.restore().then((_) => update()); _delay = settings.bellDelayEnabled ? Duration(seconds: settings.bellDelay) : Duration.zero; @@ -115,7 +116,7 @@ class LiveCardProvider extends ChangeNotifier { if (cmap != _lastActivity) { _lastActivity = cmap; - if (_lastActivity != {}) { + if (_lastActivity.isNotEmpty) { if (_latestActivityId == null) { _liveActivitiesPlugin.createActivity(_lastActivity).then((value) => _latestActivityId = value); } else { diff --git a/filcnaplo/lib/api/providers/user_provider.dart b/filcnaplo/lib/api/providers/user_provider.dart index 64cb7a8..ae09d41 100644 --- a/filcnaplo/lib/api/providers/user_provider.dart +++ b/filcnaplo/lib/api/providers/user_provider.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:filcnaplo/models/settings.dart'; import 'package:filcnaplo/models/user.dart'; import 'package:filcnaplo_kreta_api/models/student.dart'; @@ -28,7 +30,7 @@ class UserProvider with ChangeNotifier { void setUser(String userId) async { _selectedUserId = userId; await _settings.update(lastAccountId: userId); - updateWidget(); + if (Platform.isAndroid) updateWidget(); notifyListeners(); } @@ -57,7 +59,7 @@ class UserProvider with ChangeNotifier { } else { await _settings.update(lastAccountId: ""); } - updateWidget(); + if (Platform.isAndroid) updateWidget(); notifyListeners(); } diff --git a/filcnaplo/lib/icons/filc_icons.dart b/filcnaplo/lib/icons/filc_icons.dart index e1528fb..c62b206 100644 --- a/filcnaplo/lib/icons/filc_icons.dart +++ b/filcnaplo/lib/icons/filc_icons.dart @@ -19,4 +19,10 @@ class FilcIcons { /// premium static const IconData premium = IconData(0x04, fontFamily: iconFontFamily); + + /// tinta + static const IconData tinta = IconData(0x05, fontFamily: iconFontFamily); + + /// kupak + static const IconData kupak = IconData(0x06, fontFamily: iconFontFamily); } diff --git a/filcnaplo/lib/models/supporter.dart b/filcnaplo/lib/models/supporter.dart index 6cda2b7..968313f 100644 --- a/filcnaplo/lib/models/supporter.dart +++ b/filcnaplo/lib/models/supporter.dart @@ -1,38 +1,47 @@ -class Supporter { - String name; - String amount; - String platform; +enum DonationType { once, monthly } - Supporter(this.name, this.amount, this.platform); +class Supporter { + final String avatar; + final String name; + final String comment; + final int price; + final DonationType type; + + const Supporter({required this.avatar, required this.name, this.comment = "", this.price = 0, this.type = DonationType.once}); factory Supporter.fromJson(Map json) { return Supporter( - (json["name"] ?? "").trim(), - json["amount"] ?? "", - json["platform"] ?? "", + avatar: json["avatar"] ?? "", + name: json["name"] ?? "Unknown", + comment: json["comment"] ?? "", + price: json["price"].toInt() ?? 0, + type: DonationType.values.asNameMap()[json["type"] ?? "once"] ?? DonationType.once, ); } } class Supporters { - List top; - List all; - int progress; - int max; + final double progress; + final double max; + final String description; + final List github; + final List patreon; Supporters({ - required this.top, - required this.all, required this.progress, required this.max, + required this.description, + required this.github, + required this.patreon, }); factory Supporters.fromJson(Map json) { return Supporters( - max: (json["progress"] ?? {})["max"] ?? 1, - progress: (json["progress"] ?? {})["value"] ?? 0, - all: ((json["all"] ?? []) as List).cast().map((e) => Supporter.fromJson(e)).toList(), - top: ((json["top"] ?? []) as List).cast().map((e) => Supporter.fromJson(e)).toList(), + progress: json["percentage"].toDouble() ?? 100.0, + max: json["target"].toDouble() ?? 1.0, + description: json["description"] ?? "", + github: json["sponsors"]["github"].map((e) => Supporter.fromJson(e)).cast().toList(), + patreon: json["sponsors"]["patreon"].map((e) => Supporter.fromJson(e)).cast().toList(), ); } } diff --git a/filcnaplo/lib/theme/theme.dart b/filcnaplo/lib/theme/theme.dart index 9e52e17..292fe87 100644 --- a/filcnaplo/lib/theme/theme.dart +++ b/filcnaplo/lib/theme/theme.dart @@ -35,7 +35,7 @@ class AppTheme { Color backgroundColor = accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundLight(palette) ?? lightColors.background; - Color highlighColor = + Color highlightColor = accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightLight(palette) ?? lightColors.highlight; return ThemeData( @@ -43,25 +43,25 @@ class AppTheme { useMaterial3: false, fontFamily: _fontFamily, scaffoldBackgroundColor: backgroundColor, - backgroundColor: highlighColor, + backgroundColor: highlightColor, primaryColor: lightColors.filc, dividerColor: const Color(0x00000000), colorScheme: ColorScheme.fromSwatch( accentColor: accent, backgroundColor: backgroundColor, brightness: Brightness.light, - cardColor: highlighColor, + cardColor: highlightColor, errorColor: lightColors.red, primaryColorDark: lightColors.filc, ), - shadowColor: highlighColor.withOpacity(.5), //lightColors.shadow, + shadowColor: highlightColor.withOpacity(.5), //lightColors.shadow, appBarTheme: AppBarTheme(backgroundColor: backgroundColor), indicatorColor: accent, iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)), navigationBarTheme: NavigationBarThemeData( indicatorColor: accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8), iconTheme: MaterialStateProperty.all(IconThemeData(color: lightColors.text)), - backgroundColor: highlighColor, + backgroundColor: highlightColor, labelTextStyle: MaterialStateProperty.all(TextStyle( fontSize: 13.0, fontWeight: FontWeight.w500, @@ -75,6 +75,7 @@ class AppTheme { ), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent), + cardColor: highlightColor, ); } @@ -133,6 +134,11 @@ class AppTheme { ), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent), + cardColor: highlightColor, + chipTheme: ChipThemeData( + backgroundColor: accent.withOpacity(.2), + elevation: 1, + ), ); } } diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml index 7960600..82c2dde 100644 --- a/filcnaplo/pubspec.yaml +++ b/filcnaplo/pubspec.yaml @@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez" homepage: https://filcnaplo.hu publish_to: "none" -version: 3.4.2+173 +version: 3.4.3-beta.3+176 environment: sdk: ">=2.16.0-80.1.beta <3.0.0" @@ -62,6 +62,7 @@ dependencies: uni_links: ^0.5.1 url_launcher: ^6.1.6 workmanager: ^0.5.1 + flutter_svg: ^1.1.6 dev_dependencies: flutter_lints: ^2.0.1 @@ -76,6 +77,7 @@ flutter: - assets/icons/ic_launcher.png - assets/icons/ic_splash.png - assets/animations/ + - assets/images/ fonts: - family: FilcIcons