12 Commits
Author SHA1 Message Date
MineTec b9cb6a8af1 chat search now lists local and server-side hits like the file search, and jumping to old messages pages in history with a progress banner and keeps the hit marked 2026-10-28 22:40:21 +01:00
MineTec fcfd21bb4d bumped version to 1.7.0+68 2026-10-28 22:16:12 +01:00
MineTec aa176c90e3 added a swipeable media gallery for chat and folder images and videos with server previews, on-demand originals and zoom, and marked document previews in chat so they no longer pass for photos 2026-10-28 22:15:57 +01:00
MineTec 952f916231 bumped version to 1.6.1+67 2026-10-19 09:51:20 +02:00
MineTec 9ea0eae53c Merge remote-tracking branch 'origin/develop' into develop 2026-10-19 09:49:31 +02:00
MineTec 4a4e101532 share extension now accepts raw image data and falls back to a file copy, so sharing from the markup editor no longer closes immediately 2026-10-19 09:49:23 +02:00
MineTec 23e4510bf8 fixed client-reported crashes in the pdf viewer, image picker and prosemirror images, mapped webdav errors to user messages and hardened keychain, cache and push stores against io failures 2026-10-12 17:00:14 +02:00
MineTecandClaude Opus 5.5 c5592f117b added automated App Store screenshots via iOS simulators and fastlane deliver
tool/screenshots_ios.sh runs the existing demo-login integration test on
iPhone 6.5" (iPhone 14 Plus) and iPad 13" simulators, stores the canonical PNGs
under materials/screenshots and mirrors alpha-free JPEGs to
ios/fastlane/screenshots for `fastlane upload_screenshots`.

Fixed the demo router answering timetable/custom-events with a week, which
crashed the inline iOS widget refresh after a demo login. The screenshot test
now skips the one-time Talk notification dialog and waits longer for the app
shell on cold simulators.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 16:58:29 +02:00
MineTec ada4d6a77c Merge remote-tracking branch 'origin/develop' into develop 2026-09-29 16:39:55 +02:00
MineTecandClaude Fable 5.1 cd88cc75fc required firebase_messaging 16.6 so AuthorizationStatus.deniedPermanently resolves
The push code references the value since the platform upgrade in September,
but the old constraint still allowed firebase_messaging_platform_interface
4.9.0, which lacks it; a stale local lockfile then failed analyze and eleven
test files.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrepDTL4qDe35TuS29sLW3
2026-09-29 16:35:41 +02:00
MineTecandClaude Fable 5.1 279b973e89 hardened API decoding against server fields the models did not expect
The Talk room list crashed for a new account because the server omits
lastMessage for rooms without a visible message and the model required it.
Beyond that single field, a review of the Talk models against the OpenAPI
spec of the installed version (23.0.8) found the same crash class in several
places: closed enums over open server values (inCall bitmask, rich-object
types, actor and message types), a deleted parent sent as {id, deleted},
and the autocomplete status arriving as an object.

- json_serializable `checked: true`: decode errors now name class and field
- lists (rooms, messages, participants, autocomplete) decode per entry;
  a malformed entry is skipped and reported via ClientErrorReporter
- unknownEnumValue fallbacks for all response enums of Talk and breakers
- lastMessage nullable; inCall as bitmask; deleted parent placeholder;
  autocomplete status object/string; fixed shareWithDisplayNameUnique key
- GetRoomParams no longer sends null query parameters

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrepDTL4qDe35TuS29sLW3
2026-09-29 16:35:41 +02:00
MineTec b90cda62da iOS build 2026-09-29 15:53:18 +02:00
185 changed files with 5727 additions and 1586 deletions

No files matched your search

+6
View File
@@ -362,3 +362,9 @@ android/fastlane/README.md.bak
# Screenshots unter materials/screenshots/. Nur die leeren Ordner (.gitkeep)
# bleiben eingecheckt, damit supply die Struktur vorfindet.
android/fastlane/metadata/android/**/images/**/*.png
# Fastlane (App-Store-Upload)
ios/fastlane/report.xml
ios/fastlane/Preview.html
ios/fastlane/app-store-connect-api-key.json
ios/fastlane/screenshots/**/*.jpg
+1
View File
@@ -4,4 +4,5 @@ targets:
json_serializable:
options:
explicit_to_json: false
checked: true
generic_argument_factories: true
+21 -2
View File
@@ -17,7 +17,8 @@ import 'package:marianum_mobile/view/pages/talk/widgets/chat_tile.dart';
/// Stundenplan (hell + dunkel), Talk-Liste, Talk-Chat, Dateien, „Mehr"-Bereich
/// und Einstellungen. Ausgeführt über `flutter drive` mit
/// test_driver/integration_test.dart, orchestriert von tool/screenshots.sh
/// (Phone / 7″ / 10″).
/// (Android: Phone / 7″ / 10″) bzw. tool/screenshots_ios.sh (iPhone 6,5″ /
/// iPad 13″).
///
/// Kein Netzwerk: der Demo-Modus beantwortet allen Backend-Verkehr aus
/// Fixtures, daher ist der Lauf deterministisch.
@@ -42,11 +43,13 @@ Future<void> main() async {
_log('Login');
await _login(tester);
// Großzügig: auf einem frisch angelegten iOS-Simulator dauert der erste
// Post-Login-Aufbau deutlich länger als 20s.
_log('warte auf App-Shell');
await _pumpUntil(
tester,
find.byType(App),
timeout: const Duration(seconds: 20),
timeout: const Duration(seconds: 60),
);
_log('warte auf Post-Login-Splash-Ende');
await _pumpUntilGone(
@@ -64,6 +67,12 @@ Future<void> main() async {
await binding.convertFlutterSurfaceToImage();
}
// Den einmaligen Benachrichtigungs-Dialog beim ersten Talk-Besuch
// unterdrücken. Auf Android erteilt tool/screenshots.sh die Permission
// vorab, auf iOS lässt sie sich im Simulator nicht vorab erteilen – der
// Dialog würde sonst über der Talk-Liste liegen.
_markTalkPermissionPromptShown(tester);
// 1 + 2: Stundenplan in beiden Themes.
await _goTo(tester, Modules.timetable);
_setTheme(tester, ThemeMode.light);
@@ -129,6 +138,16 @@ void _setTheme(WidgetTester tester, ThemeMode mode) {
context.read<SettingsCubit>().val(write: true).appTheme = mode;
}
void _markTalkPermissionPromptShown(WidgetTester tester) {
final context = tester.element(find.byType(App));
context
.read<SettingsCubit>()
.val(write: true)
.notificationSettings
.talkPermissionPromptShown =
true;
}
/// Navigiert zu [module] – über den Bottom-Tab, wenn er in der Leiste liegt,
/// sonst als Vollbild-Push. Größenunabhängig, da die Tab-Anzahl je Gerät variiert.
Future<void> _goTo(WidgetTester tester, Modules module) async {
+2 -8
View File
@@ -12,8 +12,6 @@ PODS:
- PhoneNumberKit/PhoneNumberKitCore (3.7.11)
- PhoneNumberKit/UIKit (3.7.11):
- PhoneNumberKit/PhoneNumberKitCore
- workmanager_apple (0.0.1):
- Flutter
DEPENDENCIES:
- eraser (from `.symlinks/plugins/eraser/ios`)
@@ -21,7 +19,6 @@ DEPENDENCIES:
- flutter_app_badge (from `.symlinks/plugins/flutter_app_badge/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- PhoneNumberKit (~> 3.7.6)
- workmanager_apple (from `.symlinks/plugins/workmanager_apple/ios`)
SPEC REPOS:
trunk:
@@ -36,17 +33,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_app_badge/ios"
open_filex:
:path: ".symlinks/plugins/open_filex/ios"
workmanager_apple:
:path: ".symlinks/plugins/workmanager_apple/ios"
SPEC CHECKSUMS:
eraser: 83a4b06985f3702aa3d8dec816f9693266012937
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
Flutter: 71a624a5bc0c04062bf19101d501e466baf2fb47
flutter_app_badge: ca742dd659a157c1090ef7cd881cb78f48f3bcdf
open_filex: 432f3cd11432da3e39f47fcc0df2b1603854eff1
PhoneNumberKit: 9ff0c5ae9fe4770193b68a3d3e6c938fe976788c
workmanager_apple: 904529ae31e97fc5be632cf628507652294a0778
PODFILE CHECKSUM: 087d168982f24fb137e2d46f893b771b4b9955c6
COCOAPODS: 1.16.2
COCOAPODS: 1.17.0
+5 -6
View File
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 70;
objects = {
/* Begin PBXBuildFile section */
@@ -77,19 +77,19 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
12B96C78930441C73F123636 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = Info.plist; path = Info.plist; sourceTree = "<group>"; };
12B96C78930441C73F123636 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
17E2EE012C4361AC05DCA4C9 /* NotificationServiceExtension-Release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "NotificationServiceExtension-Release.xcconfig"; path = "Flutter/NotificationServiceExtension-Release.xcconfig"; sourceTree = "<group>"; };
2960F029246C39E2A03F6D87 /* NotificationService.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationService.swift; path = NotificationService.swift; sourceTree = "<group>"; };
2960F029246C39E2A03F6D87 /* NotificationService.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
3321F8052FB1C00C0011C712 /* Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
33FDB0972EE9ABDC000B2391 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
36C6C71327C68B43F522F5B2 /* NotificationServiceExtension-Debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "NotificationServiceExtension-Debug.xcconfig"; path = "Flutter/NotificationServiceExtension-Debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4509EC31CB08BA9BF367AF6C /* 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 = "<group>"; };
4F2428AC5384E0EF8DAB462A /* Pods_Share_Extension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Share_Extension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
509DCCD474353408FE5806C5 /* PEM.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PEM.swift; path = PEM.swift; sourceTree = "<group>"; };
5C2F4C79DD573778092882AB /* NotificationServiceExtension.entitlements */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.entitlements; name = NotificationServiceExtension.entitlements; path = NotificationServiceExtension.entitlements; sourceTree = "<group>"; };
509DCCD474353408FE5806C5 /* PEM.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PEM.swift; sourceTree = "<group>"; };
5C2F4C79DD573778092882AB /* NotificationServiceExtension.entitlements */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.entitlements; path = NotificationServiceExtension.entitlements; sourceTree = "<group>"; };
60E1803A3FB28FCC6F435E99 /* Pods-Share Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Share Extension.release.xcconfig"; path = "Target Support Files/Pods-Share Extension/Pods-Share Extension.release.xcconfig"; sourceTree = "<group>"; };
64801C012A9112D500E8B558 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -222,7 +222,6 @@
12B96C78930441C73F123636 /* Info.plist */,
5C2F4C79DD573778092882AB /* NotificationServiceExtension.entitlements */,
);
name = NotificationServiceExtension;
path = NotificationServiceExtension;
sourceTree = SOURCE_ROOT;
};
@@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "3e33dd27dd4c69bd81c7c81fe61d8ccf58846902",
"version" : "11.3.1"
"revision" : "97f7d74dd0e8f3d0fe5fc75cc8957aa73bdc948a",
"version" : "11.3.2"
}
},
{
@@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "42e81d245e30e49ea6a5830cf2842d44a1591270",
"version" : "12.15.0"
"revision" : "27eaab3918e0bf78711cf1abf240577176326432",
"version" : "12.19.0"
}
},
{
@@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk",
"state" : {
"revision" : "dc39082d8881109d35b94b1c122164c0e8d08a55",
"version" : "3.6.1"
"revision" : "0208e2681ec81f8a9c81084696f60fcce26cb7ee",
"version" : "3.7.0"
}
},
{
@@ -68,8 +68,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "144855f40d8668927f256a3045f7fdc4c3f4338b",
"version" : "12.15.0"
"revision" : "b8455dd2ff55cc269fda7a4f9eac6c1e3588c53f",
"version" : "12.19.2"
}
},
{
@@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
"version" : "10.1.0"
"revision" : "ba3358d3c3dbae8ef230b58a46b97ad65e84e974",
"version" : "10.1.1"
}
},
{
@@ -86,8 +86,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "9f183ae842be978784f2963a343682e0c46d8fb3",
"version" : "8.1.2"
"revision" : "92c8f6dc3ac375d6febdfcb3db68bc3d10633db3",
"version" : "8.1.3"
}
},
{
@@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "c0ac7575d70050c2973ba2318bd5af47f8e8153a",
"version" : "5.3.0"
"revision" : "724a52eea6329b7e12d3ad8300d76ca9f3895fcc",
"version" : "5.3.1"
}
},
{
@@ -50,8 +50,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "42e81d245e30e49ea6a5830cf2842d44a1591270",
"version" : "12.15.0"
"revision" : "27eaab3918e0bf78711cf1abf240577176326432",
"version" : "12.19.0"
}
},
{
@@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk",
"state" : {
"revision" : "9bfcc6cf435b2e7c5562c1900b8680c594fa9a64",
"version" : "3.6.0"
"revision" : "0208e2681ec81f8a9c81084696f60fcce26cb7ee",
"version" : "3.7.0"
}
},
{
@@ -68,8 +68,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "144855f40d8668927f256a3045f7fdc4c3f4338b",
"version" : "12.15.0"
"revision" : "b8455dd2ff55cc269fda7a4f9eac6c1e3588c53f",
"version" : "12.19.2"
}
},
{
@@ -86,8 +86,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "c46e5f8b7c23265f17c24ca7f9fa1b13ded7a822",
"version" : "8.1.1"
"revision" : "92c8f6dc3ac375d6febdfcb3db68bc3d10633db3",
"version" : "8.1.3"
}
},
{
+86 -86
View File
@@ -1,94 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppGroupId</key>
<string>$(CUSTOM_GROUP_ID)</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Marianum Fulda</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>client</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Um Fotos direkt aus der App aufnehmen und teilen zu können wird Zugriff auf die Kamera benötigt.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Um Medien mit anderen zu teilen wird Zugriff zu deine Dateien benötigt.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>AppGroupId</key>
<string>$(CUSTOM_GROUP_ID)</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>eu.mhsl.marianum.widget.refresh</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Marianum Fulda</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>client</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>eu.mhsl.marianum.widget.refresh</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Um Fotos direkt aus der App aufnehmen und teilen zu können wird Zugriff auf die Kamera benötigt.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Um Medien mit anderen zu teilen wird Zugriff zu deine Dateien benötigt.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
+90 -17
View File
@@ -107,20 +107,58 @@ final class ShareViewController: UIViewController {
(UTType.url.identifier, .url),
(UTType.data.identifier, .file),
]
for (typeId, kind) in order {
if provider.hasItemConformingToTypeIdentifier(typeId) {
provider.loadItem(forTypeIdentifier: typeId) { [weak self] data, error in
guard let self else { completion(nil); return }
if error != nil { completion(nil); return }
completion(self.toSharedFile(data: data, kind: kind))
for (typeId, kind) in order where provider.hasItemConformingToTypeIdentifier(typeId) {
// Konkreter Typ (z. B. public.png statt public.image) für Dateiendung
// und MIME-Type, falls die Quelle nur rohe Daten liefert.
let concrete = concreteType(of: provider, conformingTo: typeId)
provider.loadItem(forTypeIdentifier: typeId) { [weak self] data, error in
guard let self else { completion(nil); return }
if error == nil,
let file = self.toSharedFile(data: data, kind: kind,
concrete: concrete, provider: provider) {
completion(file)
return
}
return
// Manche Quellen (z. B. der Screenshot-/Markup-Editor) liefern über
// loadItem nichts Verwertbares oder eine URL außerhalb unserer
// Sandbox. loadFileRepresentation stellt eine lesbare Kopie bereit.
self.loadFileFallback(provider: provider, kind: kind,
concrete: concrete, completion: completion)
}
return
}
completion(nil)
}
private func toSharedFile(data: Any?, kind: SharedMediaType) -> SharedMediaFile? {
private func concreteType(of provider: NSItemProvider, conformingTo typeId: String) -> UTType? {
guard let base = UTType(typeId) else { return nil }
return provider.registeredTypeIdentifiers
.compactMap { UTType($0) }
.first { $0.conforms(to: base) } ?? base
}
private func loadFileFallback(provider: NSItemProvider, kind: SharedMediaType,
concrete: UTType?,
completion: @escaping (SharedMediaFile?) -> Void) {
guard kind == .image || kind == .video || kind == .file, let concrete else {
completion(nil)
return
}
provider.loadFileRepresentation(forTypeIdentifier: concrete.identifier) { [weak self] url, _ in
// Die URL ist nur innerhalb dieses Callbacks gültig — sofort kopieren.
guard let self, let url, let dst = self.copyIntoAppGroup(src: url) else {
completion(nil)
return
}
let mime = self.mime(for: url) ?? concrete.preferredMIMEType
let duration = kind == .video ? self.videoDurationMs(url: dst) : nil
completion(SharedMediaFile(path: self.pathString(for: dst), mimeType: mime,
thumbnail: nil, duration: duration, message: nil, type: kind))
}
}
private func toSharedFile(data: Any?, kind: SharedMediaType, concrete: UTType?,
provider: NSItemProvider) -> SharedMediaFile? {
switch kind {
case .text:
guard let s = data as? String else { return nil }
@@ -139,6 +177,10 @@ final class ShareViewController: UIViewController {
return SharedMediaFile(path: pathString(for: dst), mimeType: "image/png",
thumbnail: nil, duration: nil, message: nil, type: .image)
}
if let d = data as? Data, let dst = writeData(d, type: concrete, provider: provider) {
return SharedMediaFile(path: pathString(for: dst), mimeType: concrete?.preferredMIMEType,
thumbnail: nil, duration: nil, message: nil, type: .image)
}
return nil
case .video:
guard let u = data as? URL, let dst = copyIntoAppGroup(src: u) else { return nil }
@@ -146,9 +188,15 @@ final class ShareViewController: UIViewController {
thumbnail: nil, duration: videoDurationMs(url: u),
message: nil, type: .video)
case .file:
guard let u = data as? URL, let dst = copyIntoAppGroup(src: u) else { return nil }
return SharedMediaFile(path: pathString(for: dst), mimeType: mime(for: u),
thumbnail: nil, duration: nil, message: nil, type: .file)
if let u = data as? URL, let dst = copyIntoAppGroup(src: u) {
return SharedMediaFile(path: pathString(for: dst), mimeType: mime(for: u),
thumbnail: nil, duration: nil, message: nil, type: .file)
}
if let d = data as? Data, let dst = writeData(d, type: concrete, provider: provider) {
return SharedMediaFile(path: pathString(for: dst), mimeType: concrete?.preferredMIMEType,
thumbnail: nil, duration: nil, message: nil, type: .file)
}
return nil
}
}
@@ -192,13 +240,11 @@ final class ShareViewController: UIViewController {
}
private func copyIntoShareDir(src: URL) -> URL? {
guard let dir = shareDir else { return nil }
let name = src.lastPathComponent.isEmpty ? UUID().uuidString : src.lastPathComponent
var dst = dir.appendingPathComponent(name)
// Mehrfachauswahl mit gleichem Namen innerhalb eines Shares.
if FileManager.default.fileExists(atPath: dst.path) {
dst = dir.appendingPathComponent("\(UUID().uuidString.prefix(8))-\(name)")
}
guard let dst = uniqueDestination(name: name) else { return nil }
// Security-scoped URLs (z. B. aus "Dateien") sind sonst nicht lesbar.
let scoped = src.startAccessingSecurityScopedResource()
defer { if scoped { src.stopAccessingSecurityScopedResource() } }
do {
try FileManager.default.copyItem(at: src, to: dst)
return dst
@@ -207,6 +253,33 @@ final class ShareViewController: UIViewController {
}
}
// Nur auf fileQueue aufrufen.
private func uniqueDestination(name: String) -> URL? {
guard let dir = shareDir else { return nil }
let dst = dir.appendingPathComponent(name)
// Mehrfachauswahl mit gleichem Namen innerhalb eines Shares.
if FileManager.default.fileExists(atPath: dst.path) {
return dir.appendingPathComponent("\(UUID().uuidString.prefix(8))-\(name)")
}
return dst
}
private func writeData(_ data: Data, type: UTType?, provider: NSItemProvider) -> URL? {
let ext = type?.preferredFilenameExtension ?? "bin"
var base = (provider.suggestedName ?? UUID().uuidString)
.replacingOccurrences(of: "/", with: "-")
if (base as NSString).pathExtension.lowercased() == ext.lowercased() {
base = (base as NSString).deletingPathExtension
}
// Namenswahl und Schreiben zusammen seriell, sonst können zwei Anhänge
// mit gleichem suggestedName denselben Pfad bekommen.
return fileQueue.sync {
guard let dst = uniqueDestination(name: "\(base).\(ext)"),
(try? data.write(to: dst)) != nil else { return nil }
return dst
}
}
private func writePng(image: UIImage) -> URL? {
guard let data = image.pngData(),
let dir = fileQueue.sync(execute: { shareDir }) else { return nil }
+2
View File
@@ -0,0 +1,2 @@
app_identifier("eu.mhsl.marianum.mobile.client")
team_id("MY55VF3KPG")
+27
View File
@@ -0,0 +1,27 @@
default_platform(:ios)
# App-Store-Auslieferung über fastlane deliver. Die Screenshots erzeugt
# ../tool/screenshots_ios.sh (Demo-Login + integration_test) direkt in
# screenshots/de-DE/; deliver ordnet sie anhand der Pixelgröße iPhone 6,5″ bzw.
# iPad 13″ zu.
#
# Authentifizierung über einen App-Store-Connect-API-Key (JSON im fastlane-
# Format, siehe README.md). Pfad per APP_STORE_CONNECT_API_KEY setzen; die Datei
# selbst wird per .gitignore nicht eingecheckt.
platform :ios do
desc "Nur Screenshots hochladen (ersetzt die vorhandenen, verändert keine Texte/Binaries)"
lane :upload_screenshots do
upload_to_app_store(
api_key_path: ENV["APP_STORE_CONNECT_API_KEY"] || "fastlane/app-store-connect-api-key.json",
skip_binary_upload: true,
skip_metadata: true,
skip_app_version_update: true,
skip_screenshots: false,
overwrite_screenshots: true,
screenshots_path: "./fastlane/screenshots",
precheck_include_in_app_purchases: false,
run_precheck_before_submit: false,
force: true, # kein HTML-Vorschau-Bestätigungsschritt
)
end
end
+49
View File
@@ -0,0 +1,49 @@
# Fastlane – App-Store-Screenshots & Upload
iOS-Gegenstück zu `android/fastlane`. Die App muss dafür **nicht** neu gebaut
werden – der Demo-Modus (`demo@`-Login) liefert die kompletten Inhalte aus
Fixtures.
## 1. Screenshots aufnehmen
Aus dem **Client**-Wurzelverzeichnis:
```bash
tool/screenshots_ios.sh
```
Fährt „iPhone 14 Plus“ (6,5″, 1284×2778) und „iPad Pro 13-inch (M5)“
(13″, 2064×2752) nacheinander durch und legt die PNGs in
`materials/screenshots/{ios/6-5-inch,ipados/13-inch}/` sowie als JPEG-Upload-Kopie
(App Store Connect lehnt Alpha-Kanäle ab) in `screenshots/de-DE/` ab. Fehlende
Simulatoren legt das Skript selbst an.
- Nur eine Größe: `PROFILES="iphone" tool/screenshots_ios.sh`
- Andere Simulatoren: `IPHONE_SIM="iPhone 11 Pro Max" IPAD_SIM="…" tool/screenshots_ios.sh`
App und Schlüsselbund der verwendeten Simulatoren werden dabei zurückgesetzt.
## 2. Hochladen
fastlane installieren (`brew install fastlane`), in App Store Connect unter
*Benutzer und Zugriff → Integrationen → App Store Connect API* einen Key mit
Rolle *App-Manager* anlegen und als JSON ablegen:
```json
{
"key_id": "ABC123XYZ",
"issuer_id": "00000000-0000-0000-0000-000000000000",
"key": "-----BEGIN PRIVATE KEY-----\n…\n-----END PRIVATE KEY-----",
"in_house": false
}
```
```bash
export APP_STORE_CONNECT_API_KEY=/pfad/zu/app-store-connect-api-key.json
cd ios
fastlane upload_screenshots
```
Die Screenshots landen in der aktuell bearbeitbaren App-Store-Version
(„Vorbereitung für Einreichung“); vorhandene Screenshots werden ersetzt. Der
API-Key wird **nicht** eingecheckt (siehe `.gitignore`).
Whitespace-only changes.
+5
View File
@@ -7,4 +7,9 @@ abstract class ApiResponse {
@JsonKey(includeIfNull: false)
Map<String, String>? headers;
/// Entries the decoder skipped (see `decodeListLenient`), reported by the
/// API layer once the response is back on the main isolate.
@JsonKey(includeFromJson: false, includeToJson: false)
List<String> parseWarnings = const [];
}
+10 -4
View File
@@ -52,10 +52,16 @@ class CacheStore {
Future<Directory> _directory() {
final name = directoryName(SessionManager().activeAccount?.namespace);
return _dirs[name] ??= () async {
final base = await getApplicationCacheDirectory();
final dir = Directory('${base.path}/$name');
await dir.create(recursive: true);
return dir;
try {
final base = await getApplicationCacheDirectory();
final dir = Directory('${base.path}/$name');
await dir.create(recursive: true);
return dir;
} on Object {
// Not memoized (disk full at launch): the next call tries again.
unawaited(_dirs.remove(name));
rethrow;
}
}();
}
+2
View File
@@ -32,6 +32,8 @@ class DemoMarianumConnect {
return DemoTimetable.timegrid().result.map((e) => e.toJson()).toList();
case 'timetable/holidays':
return DemoTimetable.holidays().result.map((e) => e.toJson()).toList();
case 'timetable/custom-events':
return DemoTimetable.customEvents().toJson();
case 'holidays':
return DemoHolidays.upcoming().map((e) => e.toJson()).toList();
case 'users/search':
+50
View File
@@ -54,11 +54,61 @@ AppException? _dioToAppException(DioException error) {
}
}
final RegExp _davException = RegExp(
r'<s:exception>\s*([^<]*?)\s*</s:exception>',
);
final RegExp _davMessage = RegExp(r'<s:message>\s*([^<]*?)\s*</s:message>');
/// The Sabre DAV error body of a failed WebDAV request: the exception class
/// (without its `Sabre\DAV\Exception\` namespace) and the server's message.
/// The class says what actually went wrong where the status is ambiguous —
/// MKCOL on an existing folder is a plain 405.
({String exception, String message})? parseDavError(String body) {
final exception = _davException.firstMatch(body)?.group(1);
if (exception == null || exception.isEmpty) return null;
return (
exception: exception.split('\\').last,
message: _davMessage.firstMatch(body)?.group(1) ?? '',
);
}
AppException? _davToAppException(
int status,
({String exception, String message}) dav,
String detail,
) {
final userMessage = switch (dav.exception) {
'MethodNotAllowed' when status == 405 =>
'Ein Ordner oder eine Datei mit diesem Namen existiert bereits.',
'PreconditionFailed' =>
'Am Zielort existiert bereits ein Eintrag mit diesem Namen.',
'Conflict' => 'Der übergeordnete Ordner existiert nicht mehr.',
'Locked' =>
'Der Eintrag wird gerade bearbeitet. Bitte versuche es gleich erneut.',
'InsufficientStorage' =>
'Der verfügbare Speicherplatz reicht dafür nicht aus.',
_ => null,
};
if (userMessage == null) return null;
return ServerException(
statusCode: status,
userMessage: userMessage,
technicalDetails: detail,
allowRetry: dav.exception == 'Locked',
);
}
/// The nextcloud/dynamite clients throw [DynamiteApiException] on non-2xx.
/// Its toString() dumps every response header, so the details keep only the
/// status plus a trimmed body preview (same format as the Talk API errors).
AppException _dynamiteToAppException(DynamiteApiException error) {
final status = error.statusCode;
final dav = parseDavError(error.body);
if (dav != null) {
final detail = 'HTTP $status ${dav.exception}: ${dav.message}';
return _davToAppException(status, dav, detail) ??
exceptionForStatus(status, detail);
}
final preview = previewBody(error.body);
final detail = preview.isEmpty
? 'HTTP $status'
+1 -1
View File
@@ -7,6 +7,7 @@ class ServerException extends AppException {
required this.statusCode,
String? userMessage,
super.technicalDetails,
super.allowRetry,
}) : super(
// Status code intentionally not in the user message — it lives in
// technicalDetails behind "Details anzeigen".
@@ -14,6 +15,5 @@ class ServerException extends AppException {
userMessage ??
'Der Server konnte die Anfrage gerade nicht verarbeiten. '
'Bitte versuche es in einem Moment erneut.',
allowRetry: true,
);
}
+46
View File
@@ -0,0 +1,46 @@
import 'package:json_annotation/json_annotation.dart';
/// Decodes server lists element by element so one entry the model cannot map
/// (a field the server dropped, an enum value it added) is skipped and
/// recorded instead of failing the whole response and with it the screen.
///
/// Skipped entries are collected per isolate; the API layer drains them with
/// [drainDecodeWarnings] and reports them, so a drift in the server's format
/// still reaches us without taking the feature down for the user.
final List<String> _warnings = [];
List<T> decodeListLenient<T>(
Object? raw,
T Function(Map<String, dynamic>) fromJson, {
required String what,
}) {
final items = <T>[];
if (raw is! List<dynamic>) {
throw FormatException(
'expected a list of ${what}s, got ${raw.runtimeType}',
);
}
for (final entry in raw) {
try {
items.add(fromJson(entry as Map<String, dynamic>));
} on CheckedFromJsonException catch (e) {
_warnings.add('$what: $e');
} on TypeError catch (e) {
_warnings.add('$what: $e');
}
}
return items;
}
Set<T> decodeSetLenient<T>(
Object? raw,
T Function(Map<String, dynamic>) fromJson, {
required String what,
}) => decodeListLenient(raw, fromJson, what: what).toSet();
/// Returns and clears the entries skipped since the last call.
List<String> drainDecodeWarnings() {
final out = List<String>.of(_warnings);
_warnings.clear();
return out;
}
@@ -5,6 +5,8 @@ import 'package:http/http.dart' as http;
import '../../../model/endpoint_data.dart';
import '../../errors/server_exception.dart';
import '../../http_errors.dart';
import '../../json_lenient.dart';
import '../../marianumconnect/queries/report_client_error/client_error_reporter.dart';
import '../nextcloud_ocs.dart';
import 'autocomplete_response.dart';
@@ -43,6 +45,13 @@ class AutocompleteApi {
technicalDetails: 'core/autocomplete/get: ${response.body}',
);
}
return AutocompleteResponse.fromJson(NextcloudOcs.decode(response.body));
final result = AutocompleteResponse.fromJson(
NextcloudOcs.decode(response.body),
);
ClientErrorReporter.reportDecodeWarnings(
'Autocomplete',
drainDecodeWarnings(),
);
return result;
}
}
@@ -1,5 +1,6 @@
import 'package:json_annotation/json_annotation.dart';
import '../../json_lenient.dart';
import '../files_sharing/queries/share/share.dart';
part 'autocomplete_response.g.dart';
@@ -14,6 +15,7 @@ int shareTypeFromSource(String? source) {
@JsonSerializable(explicitToJson: true)
class AutocompleteResponse {
@JsonKey(fromJson: _entriesFromJson)
List<AutocompleteResponseObject> data;
AutocompleteResponse(this.data);
@@ -23,15 +25,31 @@ class AutocompleteResponse {
Map<String, dynamic> toJson() => _$AutocompleteResponseToJson(this);
}
List<AutocompleteResponseObject> _entriesFromJson(Object? raw) =>
decodeListLenient(
raw,
AutocompleteResponseObject.fromJson,
what: 'autocomplete entry',
);
/// The server sends a user-status object for users that have one and an empty
/// string otherwise; only the status string itself is kept.
String? _statusFromJson(Object? raw) => switch (raw) {
Map<String, dynamic> status => status['status']?.toString(),
String status when status.isNotEmpty => status,
_ => null,
};
@JsonSerializable()
class AutocompleteResponseObject {
String id;
String label;
String? icon;
String? source;
@JsonKey(fromJson: _statusFromJson)
String? status;
String? subline;
String? shareWithDisplayNameUniqe;
String? shareWithDisplayNameUnique;
AutocompleteResponseObject(
this.id,
@@ -40,7 +58,7 @@ class AutocompleteResponseObject {
this.source,
this.status,
this.subline,
this.shareWithDisplayNameUniqe,
this.shareWithDisplayNameUnique,
);
factory AutocompleteResponseObject.fromJson(Map<String, dynamic> json) =>
@@ -8,13 +8,12 @@ part of 'autocomplete_response.dart';
AutocompleteResponse _$AutocompleteResponseFromJson(
Map<String, dynamic> json,
) => AutocompleteResponse(
(json['data'] as List<dynamic>)
.map(
(e) => AutocompleteResponseObject.fromJson(e as Map<String, dynamic>),
)
.toList(),
);
) => $checkedCreate('AutocompleteResponse', json, ($checkedConvert) {
final val = AutocompleteResponse(
$checkedConvert('data', (v) => _entriesFromJson(v)),
);
return val;
});
Map<String, dynamic> _$AutocompleteResponseToJson(
AutocompleteResponse instance,
@@ -22,15 +21,18 @@ Map<String, dynamic> _$AutocompleteResponseToJson(
AutocompleteResponseObject _$AutocompleteResponseObjectFromJson(
Map<String, dynamic> json,
) => AutocompleteResponseObject(
json['id'] as String,
json['label'] as String,
json['icon'] as String?,
json['source'] as String?,
json['status'] as String?,
json['subline'] as String?,
json['shareWithDisplayNameUniqe'] as String?,
);
) => $checkedCreate('AutocompleteResponseObject', json, ($checkedConvert) {
final val = AutocompleteResponseObject(
$checkedConvert('id', (v) => v as String),
$checkedConvert('label', (v) => v as String),
$checkedConvert('icon', (v) => v as String?),
$checkedConvert('source', (v) => v as String?),
$checkedConvert('status', (v) => _statusFromJson(v)),
$checkedConvert('subline', (v) => v as String?),
$checkedConvert('shareWithDisplayNameUnique', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$AutocompleteResponseObjectToJson(
AutocompleteResponseObject instance,
@@ -41,5 +43,5 @@ Map<String, dynamic> _$AutocompleteResponseObjectToJson(
'source': instance.source,
'status': instance.status,
'subline': instance.subline,
'shareWithDisplayNameUniqe': instance.shareWithDisplayNameUniqe,
'shareWithDisplayNameUnique': instance.shareWithDisplayNameUnique,
};
@@ -8,16 +8,19 @@ part of 'file_sharing_api_params.dart';
FileSharingApiParams _$FileSharingApiParamsFromJson(
Map<String, dynamic> json,
) => FileSharingApiParams(
shareType: (json['shareType'] as num).toInt(),
shareWith: json['shareWith'] as String,
path: json['path'] as String,
referenceId: json['referenceId'] as String?,
talkMetaData: json['talkMetaData'] as String?,
permissions: (json['permissions'] as num?)?.toInt(),
password: json['password'] as String?,
expireDate: json['expireDate'] as String?,
);
) => $checkedCreate('FileSharingApiParams', json, ($checkedConvert) {
final val = FileSharingApiParams(
shareType: $checkedConvert('shareType', (v) => (v as num).toInt()),
shareWith: $checkedConvert('shareWith', (v) => v as String),
path: $checkedConvert('path', (v) => v as String),
referenceId: $checkedConvert('referenceId', (v) => v as String?),
talkMetaData: $checkedConvert('talkMetaData', (v) => v as String?),
permissions: $checkedConvert('permissions', (v) => (v as num?)?.toInt()),
password: $checkedConvert('password', (v) => v as String?),
expireDate: $checkedConvert('expireDate', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$FileSharingApiParamsToJson(
FileSharingApiParams instance,
@@ -0,0 +1,37 @@
import 'dart:io';
import 'package:http/http.dart' as http;
import '../nextcloud_ocs.dart';
import 'search_chat_messages_response.dart';
/// Wraps Talk's `talk-message-current` search provider, which searches the
/// whole server-side history of one conversation. The conversation is picked
/// via `from`, the route the provider would be opened from in the web UI.
class SearchChatMessages {
Future<SearchChatMessagesResponse> run({
required String chatToken,
required String term,
int limit = 25,
Object? cursor,
}) async {
final endpoint = NextcloudOcs.uri(
'search/providers/talk-message-current/search',
queryParameters: {
'term': term,
'from': '/call/$chatToken',
'limit': limit.toString(),
if (cursor != null) 'cursor': cursor.toString(),
},
);
final response = await http.get(endpoint, headers: NextcloudOcs.headers());
if (response.statusCode != HttpStatus.ok) {
throw Exception(
'Chat search failed with ${response.statusCode}: ${response.body}',
);
}
final data =
NextcloudOcs.decode(response.body)['data'] as Map<String, dynamic>;
return SearchChatMessagesResponse.fromJson(data, term: term);
}
}
@@ -0,0 +1,94 @@
/// Parsed page of Talk's `talk-message-current` search provider.
class SearchChatMessagesResponse {
final List<SearchChatMessagesEntry> entries;
/// Opaque pagination cursor; `null` when the provider has no further page.
final Object? cursor;
const SearchChatMessagesResponse({required this.entries, this.cursor});
factory SearchChatMessagesResponse.fromJson(
Map<String, dynamic> json, {
required String term,
}) {
final rawEntries = json['entries'];
final entries = rawEntries is List
? rawEntries
.whereType<Map<String, dynamic>>()
.map((e) => SearchChatMessagesEntry.fromJson(e, term: term))
.whereType<SearchChatMessagesEntry>()
.toList()
: const <SearchChatMessagesEntry>[];
final paginated = json['isPaginated'] == true;
final cursor = json['cursor'];
return SearchChatMessagesResponse(
entries: entries,
cursor: paginated && entries.isNotEmpty && cursor != null ? cursor : null,
);
}
}
class SearchChatMessagesEntry {
final int messageId;
final String? actorId;
final String? actorDisplayName;
/// Server-built excerpt of the message, placeholders already resolved.
final String excerpt;
final DateTime? sentAt;
const SearchChatMessagesEntry({
required this.messageId,
required this.excerpt,
this.actorId,
this.actorDisplayName,
this.sentAt,
});
/// Returns `null` for entries without a recognisable message id.
static SearchChatMessagesEntry? fromJson(
Map<String, dynamic> json, {
required String term,
}) {
final attributes = json['attributes'];
final attrs = attributes is Map ? attributes : const {};
final messageId =
_parseInt(attrs['messageId']) ??
_parseInt(
RegExp(
r'#message_(\d+)',
).firstMatch(json['resourceUrl']?.toString() ?? '')?.group(1),
);
if (messageId == null) return null;
// Title and subline have swapped roles across Talk versions (author vs.
// excerpt); the one containing the search term is the excerpt.
final title = json['title']?.toString() ?? '';
final subline = json['subline']?.toString() ?? '';
final q = term.trim().toLowerCase();
final titleIsExcerpt =
q.isNotEmpty &&
title.toLowerCase().contains(q) &&
!subline.toLowerCase().contains(q);
final excerpt = titleIsExcerpt ? title : subline;
final author = titleIsExcerpt ? subline : title;
final timestamp = _parseInt(attrs['timestamp']);
final actorId = attrs['actorId']?.toString();
return SearchChatMessagesEntry(
messageId: messageId,
excerpt: excerpt,
actorId: actorId == null || actorId.isEmpty ? null : actorId,
actorDisplayName: author.isEmpty ? null : author,
sentAt: timestamp == null
? null
: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000),
);
}
static int? _parseInt(Object? raw) => switch (raw) {
final int v => v,
final String v => int.tryParse(v),
_ => null,
};
}
@@ -7,14 +7,20 @@ part of 'search_files_response.dart';
// **************************************************************************
SearchFilesResponse _$SearchFilesResponseFromJson(Map<String, dynamic> json) =>
SearchFilesResponse(
name: json['name'] as String,
isPaginated: json['isPaginated'] as bool,
cursor: (json['cursor'] as num?)?.toInt(),
entries: (json['entries'] as List<dynamic>)
.map((e) => SearchFilesEntry.fromJson(e as Map<String, dynamic>))
.toList(),
);
$checkedCreate('SearchFilesResponse', json, ($checkedConvert) {
final val = SearchFilesResponse(
name: $checkedConvert('name', (v) => v as String),
isPaginated: $checkedConvert('isPaginated', (v) => v as bool),
cursor: $checkedConvert('cursor', (v) => (v as num?)?.toInt()),
entries: $checkedConvert(
'entries',
(v) => (v as List<dynamic>)
.map((e) => SearchFilesEntry.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
return val;
});
Map<String, dynamic> _$SearchFilesResponseToJson(
SearchFilesResponse instance,
@@ -26,13 +32,19 @@ Map<String, dynamic> _$SearchFilesResponseToJson(
};
SearchFilesEntry _$SearchFilesEntryFromJson(Map<String, dynamic> json) =>
SearchFilesEntry(
title: json['title'] as String,
subline: json['subline'] as String?,
icon: json['icon'] as String?,
resourceUrl: json['resourceUrl'] as String?,
attributes: json['attributes'] as Map<String, dynamic>?,
);
$checkedCreate('SearchFilesEntry', json, ($checkedConvert) {
final val = SearchFilesEntry(
title: $checkedConvert('title', (v) => v as String),
subline: $checkedConvert('subline', (v) => v as String?),
icon: $checkedConvert('icon', (v) => v as String?),
resourceUrl: $checkedConvert('resourceUrl', (v) => v as String?),
attributes: $checkedConvert(
'attributes',
(v) => v as Map<String, dynamic>?,
),
);
return val;
});
Map<String, dynamic> _$SearchFilesEntryToJson(SearchFilesEntry instance) =>
<String, dynamic>{
@@ -7,24 +7,33 @@ part of 'get_chat_params.dart';
// **************************************************************************
GetChatParams _$GetChatParamsFromJson(Map<String, dynamic> json) =>
GetChatParams(
lookIntoFuture: $enumDecode(
_$GetChatParamsSwitchEnumMap,
json['lookIntoFuture'],
),
limit: (json['limit'] as num?)?.toInt(),
lastKnownMessageId: (json['lastKnownMessageId'] as num?)?.toInt(),
lastCommonReadId: (json['lastCommonReadId'] as num?)?.toInt(),
timeout: (json['timeout'] as num?)?.toInt(),
setReadMarker: $enumDecodeNullable(
_$GetChatParamsSwitchEnumMap,
json['setReadMarker'],
),
includeLastKnown: $enumDecodeNullable(
_$GetChatParamsSwitchEnumMap,
json['includeLastKnown'],
),
);
$checkedCreate('GetChatParams', json, ($checkedConvert) {
final val = GetChatParams(
lookIntoFuture: $checkedConvert(
'lookIntoFuture',
(v) => $enumDecode(_$GetChatParamsSwitchEnumMap, v),
),
limit: $checkedConvert('limit', (v) => (v as num?)?.toInt()),
lastKnownMessageId: $checkedConvert(
'lastKnownMessageId',
(v) => (v as num?)?.toInt(),
),
lastCommonReadId: $checkedConvert(
'lastCommonReadId',
(v) => (v as num?)?.toInt(),
),
timeout: $checkedConvert('timeout', (v) => (v as num?)?.toInt()),
setReadMarker: $checkedConvert(
'setReadMarker',
(v) => $enumDecodeNullable(_$GetChatParamsSwitchEnumMap, v),
),
includeLastKnown: $checkedConvert(
'includeLastKnown',
(v) => $enumDecodeNullable(_$GetChatParamsSwitchEnumMap, v),
),
);
return val;
});
Map<String, dynamic> _$GetChatParamsToJson(
GetChatParams instance,
@@ -2,12 +2,14 @@ import 'package:json_annotation/json_annotation.dart';
import '../../../../extensions/date_time.dart';
import '../../../api_response.dart';
import '../../../json_lenient.dart';
import '../room/get_room_response.dart';
part 'get_chat_response.g.dart';
@JsonSerializable(explicitToJson: true)
class GetChatResponse extends ApiResponse {
@JsonKey(fromJson: _messagesFromJson)
Set<GetChatResponseObject> data;
GetChatResponse(this.data);
@@ -23,15 +25,20 @@ class GetChatResponse extends ApiResponse {
}
}
Set<GetChatResponseObject> _messagesFromJson(Object? raw) =>
decodeSetLenient(raw, GetChatResponseObject.fromJson, what: 'message');
@JsonSerializable(explicitToJson: true)
class GetChatResponseObject {
int id;
String token;
@JsonKey(unknownEnumValue: GetRoomResponseObjectMessageActorType.unknown)
GetRoomResponseObjectMessageActorType actorType;
String actorId;
String actorDisplayName;
int timestamp;
String systemMessage;
@JsonKey(unknownEnumValue: GetRoomResponseObjectMessageType.unknown)
GetRoomResponseObjectMessageType messageType;
bool isReplyable;
String referenceId;
@@ -40,6 +47,11 @@ class GetChatResponseObject {
List<String>? reactionsSelf;
@JsonKey(fromJson: _fromJson)
Map<String, RichObjectString>? messageParameters;
/// The quoted message. When the original is no longer available (expired,
/// purged) the server only sends `{id, deleted: true}`; that becomes a
/// deleted-comment placeholder so the quote still renders.
@JsonKey(fromJson: _parentFromJson)
GetChatResponseObject? parent;
/// Whether the server flagged this message to be rendered as Markdown
@@ -73,11 +85,29 @@ class GetChatResponseObject {
/// [timestamp] is in seconds.
DateTime get sentAt => DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
static GetChatResponseObject getDateDummy(int timestamp) =>
getTextDummy(
DateTime.fromMillisecondsSinceEpoch(
timestamp * 1000,
).formatDateRelativeShort(),
static GetChatResponseObject getDateDummy(int timestamp) => getTextDummy(
DateTime.fromMillisecondsSinceEpoch(
timestamp * 1000,
).formatDateRelativeShort(),
);
static GetChatResponseObject deletedPlaceholder(int id) =>
GetChatResponseObject(
id,
'',
GetRoomResponseObjectMessageActorType.user,
'',
'',
0,
'',
GetRoomResponseObjectMessageType.deletedComment,
false,
'',
'Nachricht wurde gelöscht',
null,
null,
null,
null,
);
static GetChatResponseObject getTextDummy(String text) =>
@@ -100,14 +130,24 @@ class GetChatResponseObject {
);
}
GetChatResponseObject? _parentFromJson(Object? json) {
if (json is! Map<String, dynamic>) return null;
if (json['deleted'] == true) {
return GetChatResponseObject.deletedPlaceholder(
(json['id'] as num?)?.toInt() ?? 0,
);
}
return GetChatResponseObject.fromJson(json);
}
Map<String, RichObjectString>? _fromJson(dynamic json) {
if (json is Map<String, dynamic>) {
final data = <String, RichObjectString>{};
for (final element in json.keys) {
data.putIfAbsent(
element,
() => RichObjectString.fromJson(json[element] as Map<String, dynamic>),
);
for (final entry in json.entries) {
final value = entry.value;
if (value is Map<String, dynamic>) {
data[entry.key] = RichObjectString.fromJson(value);
}
}
return data;
}
@@ -117,6 +157,7 @@ Map<String, RichObjectString>? _fromJson(dynamic json) {
@JsonSerializable(explicitToJson: true)
class RichObjectString {
@JsonKey(unknownEnumValue: RichObjectStringObjectType.unknown)
RichObjectStringObjectType type;
String id;
String name;
@@ -124,7 +165,17 @@ class RichObjectString {
String? path;
String? link;
RichObjectString(this.type, this.id, this.name, this.path, this.link);
/// Only set for `file` objects.
String? mimetype;
RichObjectString(
this.type,
this.id,
this.name,
this.path,
this.link, [
this.mimetype,
]);
factory RichObjectString.fromJson(Map<String, dynamic> json) =>
_$RichObjectStringFromJson(json);
@@ -148,4 +199,14 @@ enum RichObjectStringObjectType {
geoLocation,
@JsonValue('call')
call,
@JsonValue('user-group')
userGroup,
@JsonValue('circle')
circle,
@JsonValue('email')
email,
/// Anything else (deck cards, contacts, calendar events, ...); the
/// placeholder still resolves to the object's name.
unknown,
}
@@ -7,16 +7,18 @@ part of 'get_chat_response.dart';
// **************************************************************************
GetChatResponse _$GetChatResponseFromJson(Map<String, dynamic> json) =>
GetChatResponse(
(json['data'] as List<dynamic>)
.map(
(e) => GetChatResponseObject.fromJson(e as Map<String, dynamic>),
)
.toSet(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('GetChatResponse', json, ($checkedConvert) {
final val = GetChatResponse(
$checkedConvert('data', (v) => _messagesFromJson(v)),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
<String, dynamic>{
@@ -26,31 +28,49 @@ Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
GetChatResponseObject _$GetChatResponseObjectFromJson(
Map<String, dynamic> json,
) => GetChatResponseObject(
(json['id'] as num).toInt(),
json['token'] as String,
$enumDecode(
_$GetRoomResponseObjectMessageActorTypeEnumMap,
json['actorType'],
),
json['actorId'] as String,
json['actorDisplayName'] as String,
(json['timestamp'] as num).toInt(),
json['systemMessage'] as String,
$enumDecode(_$GetRoomResponseObjectMessageTypeEnumMap, json['messageType']),
json['isReplyable'] as bool,
json['referenceId'] as String,
json['message'] as String,
_fromJson(json['messageParameters']),
(json['reactions'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, (e as num).toInt()),
),
(json['reactionsSelf'] as List<dynamic>?)?.map((e) => e as String).toList(),
json['parent'] == null
? null
: GetChatResponseObject.fromJson(json['parent'] as Map<String, dynamic>),
json['markdown'] as bool? ?? false,
);
) => $checkedCreate('GetChatResponseObject', json, ($checkedConvert) {
final val = GetChatResponseObject(
$checkedConvert('id', (v) => (v as num).toInt()),
$checkedConvert('token', (v) => v as String),
$checkedConvert(
'actorType',
(v) => $enumDecode(
_$GetRoomResponseObjectMessageActorTypeEnumMap,
v,
unknownValue: GetRoomResponseObjectMessageActorType.unknown,
),
),
$checkedConvert('actorId', (v) => v as String),
$checkedConvert('actorDisplayName', (v) => v as String),
$checkedConvert('timestamp', (v) => (v as num).toInt()),
$checkedConvert('systemMessage', (v) => v as String),
$checkedConvert(
'messageType',
(v) => $enumDecode(
_$GetRoomResponseObjectMessageTypeEnumMap,
v,
unknownValue: GetRoomResponseObjectMessageType.unknown,
),
),
$checkedConvert('isReplyable', (v) => v as bool),
$checkedConvert('referenceId', (v) => v as String),
$checkedConvert('message', (v) => v as String),
$checkedConvert('messageParameters', (v) => _fromJson(v)),
$checkedConvert(
'reactions',
(v) => (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, (e as num).toInt()),
),
),
$checkedConvert(
'reactionsSelf',
(v) => (v as List<dynamic>?)?.map((e) => e as String).toList(),
),
$checkedConvert('parent', (v) => _parentFromJson(v)),
$checkedConvert('markdown', (v) => v as bool? ?? false),
);
return val;
});
Map<String, dynamic> _$GetChatResponseObjectToJson(
GetChatResponseObject instance,
@@ -83,6 +103,12 @@ const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
GetRoomResponseObjectMessageActorType.guest: 'guests',
GetRoomResponseObjectMessageActorType.bot: 'bots',
GetRoomResponseObjectMessageActorType.bridge: 'bridged',
GetRoomResponseObjectMessageActorType.group: 'groups',
GetRoomResponseObjectMessageActorType.email: 'emails',
GetRoomResponseObjectMessageActorType.circle: 'circles',
GetRoomResponseObjectMessageActorType.federatedUser: 'federated_users',
GetRoomResponseObjectMessageActorType.phone: 'phones',
GetRoomResponseObjectMessageActorType.unknown: 'unknown',
};
const _$GetRoomResponseObjectMessageTypeEnumMap = {
@@ -91,16 +117,28 @@ const _$GetRoomResponseObjectMessageTypeEnumMap = {
GetRoomResponseObjectMessageType.deletedComment: 'comment_deleted',
GetRoomResponseObjectMessageType.system: 'system',
GetRoomResponseObjectMessageType.command: 'command',
GetRoomResponseObjectMessageType.unknown: 'unknown',
};
RichObjectString _$RichObjectStringFromJson(Map<String, dynamic> json) =>
RichObjectString(
$enumDecode(_$RichObjectStringObjectTypeEnumMap, json['type']),
json['id'] as String,
json['name'] as String,
json['path'] as String?,
json['link'] as String?,
);
$checkedCreate('RichObjectString', json, ($checkedConvert) {
final val = RichObjectString(
$checkedConvert(
'type',
(v) => $enumDecode(
_$RichObjectStringObjectTypeEnumMap,
v,
unknownValue: RichObjectStringObjectType.unknown,
),
),
$checkedConvert('id', (v) => v as String),
$checkedConvert('name', (v) => v as String),
$checkedConvert('path', (v) => v as String?),
$checkedConvert('link', (v) => v as String?),
$checkedConvert('mimetype', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$RichObjectStringToJson(RichObjectString instance) =>
<String, dynamic>{
@@ -109,6 +147,7 @@ Map<String, dynamic> _$RichObjectStringToJson(RichObjectString instance) =>
'name': instance.name,
'path': instance.path,
'link': instance.link,
'mimetype': instance.mimetype,
};
const _$RichObjectStringObjectTypeEnumMap = {
@@ -120,4 +159,8 @@ const _$RichObjectStringObjectTypeEnumMap = {
RichObjectStringObjectType.talkPoll: 'talk-poll',
RichObjectStringObjectType.geoLocation: 'geo-location',
RichObjectStringObjectType.call: 'call',
RichObjectStringObjectType.userGroup: 'user-group',
RichObjectStringObjectType.circle: 'circle',
RichObjectStringObjectType.email: 'email',
RichObjectStringObjectType.unknown: 'unknown',
};
@@ -7,14 +7,18 @@ part of 'create_poll_params.dart';
// **************************************************************************
CreatePollParams _$CreatePollParamsFromJson(Map<String, dynamic> json) =>
CreatePollParams(
question: json['question'] as String,
options: (json['options'] as List<dynamic>)
.map((e) => e as String)
.toList(),
resultMode: (json['resultMode'] as num).toInt(),
maxVotes: (json['maxVotes'] as num).toInt(),
);
$checkedCreate('CreatePollParams', json, ($checkedConvert) {
final val = CreatePollParams(
question: $checkedConvert('question', (v) => v as String),
options: $checkedConvert(
'options',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
resultMode: $checkedConvert('resultMode', (v) => (v as num).toInt()),
maxVotes: $checkedConvert('maxVotes', (v) => (v as num).toInt()),
);
return val;
});
Map<String, dynamic> _$CreatePollParamsToJson(CreatePollParams instance) =>
<String, dynamic>{
@@ -7,14 +7,17 @@ part of 'create_room_params.dart';
// **************************************************************************
CreateRoomParams _$CreateRoomParamsFromJson(Map<String, dynamic> json) =>
CreateRoomParams(
roomType: (json['roomType'] as num).toInt(),
invite: json['invite'] as String,
source: json['source'] as String?,
roomName: json['roomName'] as String?,
objectType: json['objectType'] as String?,
objectId: json['objectId'] as String?,
);
$checkedCreate('CreateRoomParams', json, ($checkedConvert) {
final val = CreateRoomParams(
roomType: $checkedConvert('roomType', (v) => (v as num).toInt()),
invite: $checkedConvert('invite', (v) => v as String),
source: $checkedConvert('source', (v) => v as String?),
roomName: $checkedConvert('roomName', (v) => v as String?),
objectType: $checkedConvert('objectType', (v) => v as String?),
objectId: $checkedConvert('objectId', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$CreateRoomParamsToJson(CreateRoomParams instance) =>
<String, dynamic>{
@@ -7,12 +7,21 @@ part of 'create_room_response.dart';
// **************************************************************************
CreateRoomResponse _$CreateRoomResponseFromJson(Map<String, dynamic> json) =>
CreateRoomResponse(
CreateRoomResponseData.fromJson(json['data'] as Map<String, dynamic>),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('CreateRoomResponse', json, ($checkedConvert) {
final val = CreateRoomResponse(
$checkedConvert(
'data',
(v) => CreateRoomResponseData.fromJson(v as Map<String, dynamic>),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$CreateRoomResponseToJson(CreateRoomResponse instance) =>
<String, dynamic>{
@@ -22,7 +31,12 @@ Map<String, dynamic> _$CreateRoomResponseToJson(CreateRoomResponse instance) =>
CreateRoomResponseData _$CreateRoomResponseDataFromJson(
Map<String, dynamic> json,
) => CreateRoomResponseData(json['token'] as String);
) => $checkedCreate('CreateRoomResponseData', json, ($checkedConvert) {
final val = CreateRoomResponseData(
$checkedConvert('token', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$CreateRoomResponseDataToJson(
CreateRoomResponseData instance,
@@ -8,7 +8,12 @@ part of 'delete_react_message_params.dart';
DeleteReactMessageParams _$DeleteReactMessageParamsFromJson(
Map<String, dynamic> json,
) => DeleteReactMessageParams(json['reaction'] as String);
) => $checkedCreate('DeleteReactMessageParams', json, ($checkedConvert) {
final val = DeleteReactMessageParams(
$checkedConvert('reaction', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$DeleteReactMessageParamsToJson(
DeleteReactMessageParams instance,
@@ -1,11 +1,13 @@
import 'package:json_annotation/json_annotation.dart';
import '../../../api_response.dart';
import '../../../json_lenient.dart';
part 'get_participants_response.g.dart';
@JsonSerializable(explicitToJson: true)
class GetParticipantsResponse extends ApiResponse {
@JsonKey(fromJson: _participantsFromJson)
Set<GetParticipantsResponseObject> data;
GetParticipantsResponse(this.data);
@@ -15,15 +17,25 @@ class GetParticipantsResponse extends ApiResponse {
Map<String, dynamic> toJson() => _$GetParticipantsResponseToJson(this);
}
Set<GetParticipantsResponseObject> _participantsFromJson(Object? raw) =>
decodeSetLenient(
raw,
GetParticipantsResponseObject.fromJson,
what: 'participant',
);
@JsonSerializable(explicitToJson: true)
class GetParticipantsResponseObject {
int attendeeId;
String actorType;
String actorId;
String displayName;
@JsonKey(unknownEnumValue: GetParticipantsResponseObjectParticipantType.user)
GetParticipantsResponseObjectParticipantType participantType;
int lastPing;
GetParticipantsResponseObjectParticipantsInCallFlags inCall;
/// Bitmask: 1 = in call, 2 = with audio, 4 = with video, 8 = via phone.
int inCall;
int permissions;
int attendeePermissions;
String? sessionId;
@@ -54,6 +66,11 @@ class GetParticipantsResponseObject {
factory GetParticipantsResponseObject.fromJson(Map<String, dynamic> json) =>
_$GetParticipantsResponseObjectFromJson(json);
Map<String, dynamic> toJson() => _$GetParticipantsResponseObjectToJson(this);
bool get isInCall => inCall & 1 != 0;
bool get inCallWithAudio => inCall & 2 != 0;
bool get inCallWithVideo => inCall & 4 != 0;
bool get inCallViaPhone => inCall & 8 != 0;
}
enum GetParticipantsResponseObjectParticipantType {
@@ -73,16 +90,3 @@ enum GetParticipantsResponseObjectParticipantType {
const GetParticipantsResponseObjectParticipantType(this.prettyName);
final String prettyName;
}
enum GetParticipantsResponseObjectParticipantsInCallFlags {
@JsonValue(0)
disconnected,
@JsonValue(1)
inCall,
@JsonValue(2)
providesAudio,
@JsonValue(3)
providesVideo,
@JsonValue(4)
usesSipDialIn,
}
@@ -8,19 +8,18 @@ part of 'get_participants_response.dart';
GetParticipantsResponse _$GetParticipantsResponseFromJson(
Map<String, dynamic> json,
) =>
GetParticipantsResponse(
(json['data'] as List<dynamic>)
.map(
(e) => GetParticipantsResponseObject.fromJson(
e as Map<String, dynamic>,
),
)
.toSet(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('GetParticipantsResponse', json, ($checkedConvert) {
final val = GetParticipantsResponse(
$checkedConvert('data', (v) => _participantsFromJson(v)),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetParticipantsResponseToJson(
GetParticipantsResponse instance,
@@ -31,29 +30,36 @@ Map<String, dynamic> _$GetParticipantsResponseToJson(
GetParticipantsResponseObject _$GetParticipantsResponseObjectFromJson(
Map<String, dynamic> json,
) => GetParticipantsResponseObject(
(json['attendeeId'] as num).toInt(),
json['actorType'] as String,
json['actorId'] as String,
json['displayName'] as String,
$enumDecode(
_$GetParticipantsResponseObjectParticipantTypeEnumMap,
json['participantType'],
),
(json['lastPing'] as num).toInt(),
$enumDecode(
_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap,
json['inCall'],
),
(json['permissions'] as num).toInt(),
(json['attendeePermissions'] as num).toInt(),
json['sessionId'] as String?,
(json['sessionIds'] as List<dynamic>).map((e) => e as String).toList(),
json['status'] as String?,
json['statusIcon'] as String?,
json['statusMessage'] as String?,
json['roomToken'] as String?,
);
) => $checkedCreate('GetParticipantsResponseObject', json, ($checkedConvert) {
final val = GetParticipantsResponseObject(
$checkedConvert('attendeeId', (v) => (v as num).toInt()),
$checkedConvert('actorType', (v) => v as String),
$checkedConvert('actorId', (v) => v as String),
$checkedConvert('displayName', (v) => v as String),
$checkedConvert(
'participantType',
(v) => $enumDecode(
_$GetParticipantsResponseObjectParticipantTypeEnumMap,
v,
unknownValue: GetParticipantsResponseObjectParticipantType.user,
),
),
$checkedConvert('lastPing', (v) => (v as num).toInt()),
$checkedConvert('inCall', (v) => (v as num).toInt()),
$checkedConvert('permissions', (v) => (v as num).toInt()),
$checkedConvert('attendeePermissions', (v) => (v as num).toInt()),
$checkedConvert('sessionId', (v) => v as String?),
$checkedConvert(
'sessionIds',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
$checkedConvert('status', (v) => v as String?),
$checkedConvert('statusIcon', (v) => v as String?),
$checkedConvert('statusMessage', (v) => v as String?),
$checkedConvert('roomToken', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$GetParticipantsResponseObjectToJson(
GetParticipantsResponseObject instance,
@@ -66,9 +72,7 @@ Map<String, dynamic> _$GetParticipantsResponseObjectToJson(
_$GetParticipantsResponseObjectParticipantTypeEnumMap[instance
.participantType]!,
'lastPing': instance.lastPing,
'inCall':
_$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap[instance
.inCall]!,
'inCall': instance.inCall,
'permissions': instance.permissions,
'attendeePermissions': instance.attendeePermissions,
'sessionId': instance.sessionId,
@@ -87,11 +91,3 @@ const _$GetParticipantsResponseObjectParticipantTypeEnumMap = {
GetParticipantsResponseObjectParticipantType.userFollowingPublicLink: 5,
GetParticipantsResponseObjectParticipantType.guestWithModeratorPermissions: 6,
};
const _$GetParticipantsResponseObjectParticipantsInCallFlagsEnumMap = {
GetParticipantsResponseObjectParticipantsInCallFlags.disconnected: 0,
GetParticipantsResponseObjectParticipantsInCallFlags.inCall: 1,
GetParticipantsResponseObjectParticipantsInCallFlags.providesAudio: 2,
GetParticipantsResponseObjectParticipantsInCallFlags.providesVideo: 3,
GetParticipantsResponseObjectParticipantsInCallFlags.usesSipDialIn: 4,
};
@@ -8,15 +8,21 @@ part of 'get_poll_state_response.dart';
GetPollStateResponse _$GetPollStateResponseFromJson(
Map<String, dynamic> json,
) =>
GetPollStateResponse(
GetPollStateResponseObject.fromJson(
json['data'] as Map<String, dynamic>,
),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('GetPollStateResponse', json, ($checkedConvert) {
final val = GetPollStateResponse(
$checkedConvert(
'data',
(v) => GetPollStateResponseObject.fromJson(v as Map<String, dynamic>),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetPollStateResponseToJson(
GetPollStateResponse instance,
@@ -27,21 +33,30 @@ Map<String, dynamic> _$GetPollStateResponseToJson(
GetPollStateResponseObject _$GetPollStateResponseObjectFromJson(
Map<String, dynamic> json,
) => GetPollStateResponseObject(
(json['id'] as num).toInt(),
json['question'] as String,
(json['options'] as List<dynamic>).map((e) => e as String).toList(),
json['votes'],
json['actorType'] as String,
json['actorId'] as String,
json['actorDisplayName'] as String,
(json['status'] as num).toInt(),
(json['resultMode'] as num).toInt(),
(json['maxVotes'] as num).toInt(),
(json['votedSelf'] as List<dynamic>).map((e) => (e as num).toInt()).toList(),
(json['numVoters'] as num?)?.toInt(),
json['details'] as List<dynamic>?,
);
) => $checkedCreate('GetPollStateResponseObject', json, ($checkedConvert) {
final val = GetPollStateResponseObject(
$checkedConvert('id', (v) => (v as num).toInt()),
$checkedConvert('question', (v) => v as String),
$checkedConvert(
'options',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
$checkedConvert('votes', (v) => v),
$checkedConvert('actorType', (v) => v as String),
$checkedConvert('actorId', (v) => v as String),
$checkedConvert('actorDisplayName', (v) => v as String),
$checkedConvert('status', (v) => (v as num).toInt()),
$checkedConvert('resultMode', (v) => (v as num).toInt()),
$checkedConvert('maxVotes', (v) => (v as num).toInt()),
$checkedConvert(
'votedSelf',
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
),
$checkedConvert('numVoters', (v) => (v as num?)?.toInt()),
$checkedConvert('details', (v) => v as List<dynamic>?),
);
return val;
});
Map<String, dynamic> _$GetPollStateResponseObjectToJson(
GetPollStateResponseObject instance,
@@ -17,6 +17,7 @@ class GetReactionsResponse extends ApiResponse {
@JsonSerializable()
class GetReactionsResponseObject {
@JsonKey(unknownEnumValue: GetReactionsResponseObjectActorType.unknown)
GetReactionsResponseObjectActorType actorType;
String actorId;
String actorDisplayName;
@@ -39,4 +40,11 @@ enum GetReactionsResponseObjectActorType {
guests,
@JsonValue('users')
users,
@JsonValue('emails')
emails,
@JsonValue('bots')
bots,
@JsonValue('federated_users')
federatedUsers,
unknown,
}
@@ -8,24 +8,32 @@ part of 'get_reactions_response.dart';
GetReactionsResponse _$GetReactionsResponseFromJson(
Map<String, dynamic> json,
) =>
GetReactionsResponse(
(json['data'] as Map<String, dynamic>).map(
(k, e) => MapEntry(
k,
(e as List<dynamic>)
.map(
(e) => GetReactionsResponseObject.fromJson(
e as Map<String, dynamic>,
),
)
.toList(),
),
) => $checkedCreate('GetReactionsResponse', json, ($checkedConvert) {
final val = GetReactionsResponse(
$checkedConvert(
'data',
(v) => (v as Map<String, dynamic>).map(
(k, e) => MapEntry(
k,
(e as List<dynamic>)
.map(
(e) => GetReactionsResponseObject.fromJson(
e as Map<String, dynamic>,
),
)
.toList(),
),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetReactionsResponseToJson(
GetReactionsResponse instance,
@@ -38,12 +46,22 @@ Map<String, dynamic> _$GetReactionsResponseToJson(
GetReactionsResponseObject _$GetReactionsResponseObjectFromJson(
Map<String, dynamic> json,
) => GetReactionsResponseObject(
$enumDecode(_$GetReactionsResponseObjectActorTypeEnumMap, json['actorType']),
json['actorId'] as String,
json['actorDisplayName'] as String,
(json['timestamp'] as num).toInt(),
);
) => $checkedCreate('GetReactionsResponseObject', json, ($checkedConvert) {
final val = GetReactionsResponseObject(
$checkedConvert(
'actorType',
(v) => $enumDecode(
_$GetReactionsResponseObjectActorTypeEnumMap,
v,
unknownValue: GetReactionsResponseObjectActorType.unknown,
),
),
$checkedConvert('actorId', (v) => v as String),
$checkedConvert('actorDisplayName', (v) => v as String),
$checkedConvert('timestamp', (v) => (v as num).toInt()),
);
return val;
});
Map<String, dynamic> _$GetReactionsResponseObjectToJson(
GetReactionsResponseObject instance,
@@ -58,4 +76,8 @@ Map<String, dynamic> _$GetReactionsResponseObjectToJson(
const _$GetReactionsResponseObjectActorTypeEnumMap = {
GetReactionsResponseObjectActorType.guests: 'guests',
GetReactionsResponseObjectActorType.users: 'users',
GetReactionsResponseObjectActorType.emails: 'emails',
GetReactionsResponseObjectActorType.bots: 'bots',
GetReactionsResponseObjectActorType.federatedUsers: 'federated_users',
GetReactionsResponseObjectActorType.unknown: 'unknown',
};
@@ -7,7 +7,12 @@ part of 'react_message_params.dart';
// **************************************************************************
ReactMessageParams _$ReactMessageParamsFromJson(Map<String, dynamic> json) =>
ReactMessageParams(json['reaction'] as String);
$checkedCreate('ReactMessageParams', json, ($checkedConvert) {
final val = ReactMessageParams(
$checkedConvert('reaction', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$ReactMessageParamsToJson(ReactMessageParams instance) =>
<String, dynamic>{'reaction': instance.reaction};
@@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import '../../../json_lenient.dart';
import '../../nextcloud_ocs.dart';
import '../talk_api.dart';
import 'get_room_params.dart';
@@ -19,4 +20,5 @@ class GetRoom extends TalkApi<GetRoomResponse> {
}
GetRoomResponse _parseRooms(String raw) =>
GetRoomResponse.fromJson(NextcloudOcs.decode(raw));
GetRoomResponse.fromJson(NextcloudOcs.decode(raw))
..parseWarnings = drainDecodeWarnings();
@@ -4,7 +4,7 @@ import '../../../api_params.dart';
part 'get_room_params.g.dart';
@JsonSerializable(explicitToJson: true)
@JsonSerializable(explicitToJson: true, includeIfNull: false)
class GetRoomParams extends ApiParams {
GetRoomParamsStatusUpdate? noStatusUpdate;
@JsonKey(toJson: _format)
@@ -7,22 +7,28 @@ part of 'get_room_params.dart';
// **************************************************************************
GetRoomParams _$GetRoomParamsFromJson(Map<String, dynamic> json) =>
GetRoomParams(
noStatusUpdate: $enumDecodeNullable(
_$GetRoomParamsStatusUpdateEnumMap,
json['noStatusUpdate'],
),
includeStatus: json['includeStatus'] as bool?,
modifiedSince: (json['modifiedSince'] as num?)?.toInt(),
);
$checkedCreate('GetRoomParams', json, ($checkedConvert) {
final val = GetRoomParams(
noStatusUpdate: $checkedConvert(
'noStatusUpdate',
(v) => $enumDecodeNullable(_$GetRoomParamsStatusUpdateEnumMap, v),
),
includeStatus: $checkedConvert('includeStatus', (v) => v as bool?),
modifiedSince: $checkedConvert(
'modifiedSince',
(v) => (v as num?)?.toInt(),
),
);
return val;
});
Map<String, dynamic> _$GetRoomParamsToJson(
GetRoomParams instance,
) => <String, dynamic>{
'noStatusUpdate': _$GetRoomParamsStatusUpdateEnumMap[instance.noStatusUpdate],
'includeStatus': GetRoomParams._format(instance.includeStatus),
'modifiedSince': instance.modifiedSince,
};
Map<String, dynamic> _$GetRoomParamsToJson(GetRoomParams instance) =>
<String, dynamic>{
'noStatusUpdate':
?_$GetRoomParamsStatusUpdateEnumMap[instance.noStatusUpdate],
'includeStatus': GetRoomParams._format(instance.includeStatus),
'modifiedSince': ?instance.modifiedSince,
};
const _$GetRoomParamsStatusUpdateEnumMap = {
GetRoomParamsStatusUpdate.defaults: 0,
@@ -1,12 +1,14 @@
import 'package:json_annotation/json_annotation.dart';
import '../../../api_response.dart';
import '../../../json_lenient.dart';
import '../chat/get_chat_response.dart';
part 'get_room_response.g.dart';
@JsonSerializable(explicitToJson: true)
class GetRoomResponse extends ApiResponse {
@JsonKey(fromJson: _roomsFromJson)
Set<GetRoomResponseObject> data;
GetRoomResponse(this.data);
@@ -33,10 +35,14 @@ class GetRoomResponse extends ApiResponse {
}
}
Set<GetRoomResponseObject> _roomsFromJson(Object? raw) =>
decodeSetLenient(raw, GetRoomResponseObject.fromJson, what: 'room');
@JsonSerializable(explicitToJson: true)
class GetRoomResponseObject {
int id;
String token;
@JsonKey(unknownEnumValue: GetRoomResponseObjectConversationType.unknown)
GetRoomResponseObjectConversationType type;
String name;
String displayName;
@@ -55,13 +61,20 @@ class GetRoomResponseObject {
bool canLeaveConversation;
int lastActivity;
bool isFavorite;
@JsonKey(
unknownEnumValue:
GetRoomResponseObjectParticipantNotificationLevel.defaultLevel,
)
GetRoomResponseObjectParticipantNotificationLevel notificationLevel;
int unreadMessages;
bool unreadMention;
bool unreadMentionDirect;
int lastReadMessage;
int lastCommonReadMessage;
GetChatResponseObject lastMessage;
/// Omitted by the server for rooms without a visible message (empty room,
/// last message expired or hidden from this user, federated conversation).
GetChatResponseObject? lastMessage;
String? status;
String? statusIcon;
String? statusMessage;
@@ -117,6 +130,9 @@ enum GetRoomResponseObjectConversationType {
deleted,
@JsonValue(6)
noteToSelf,
/// Fallback for types this app does not know yet; treated like a group.
unknown,
}
enum GetRoomResponseObjectParticipantNotificationLevel {
@@ -147,6 +163,17 @@ enum GetRoomResponseObjectMessageActorType {
bot,
@JsonValue('bridged')
bridge,
@JsonValue('groups')
group,
@JsonValue('emails')
email,
@JsonValue('circles')
circle,
@JsonValue('federated_users')
federatedUser,
@JsonValue('phones')
phone,
unknown,
}
enum GetRoomResponseObjectMessageType {
@@ -160,4 +187,8 @@ enum GetRoomResponseObjectMessageType {
system,
@JsonValue('command')
command,
/// Fallback for types this app does not know yet (e.g. call recordings);
/// rendered like a plain comment.
unknown,
}
@@ -7,16 +7,18 @@ part of 'get_room_response.dart';
// **************************************************************************
GetRoomResponse _$GetRoomResponseFromJson(Map<String, dynamic> json) =>
GetRoomResponse(
(json['data'] as List<dynamic>)
.map(
(e) => GetRoomResponseObject.fromJson(e as Map<String, dynamic>),
)
.toSet(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('GetRoomResponse', json, ($checkedConvert) {
final val = GetRoomResponse(
$checkedConvert('data', (v) => _roomsFromJson(v)),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
<String, dynamic>{
@@ -26,41 +28,61 @@ Map<String, dynamic> _$GetRoomResponseToJson(GetRoomResponse instance) =>
GetRoomResponseObject _$GetRoomResponseObjectFromJson(
Map<String, dynamic> json,
) => GetRoomResponseObject(
(json['id'] as num).toInt(),
json['token'] as String,
$enumDecode(_$GetRoomResponseObjectConversationTypeEnumMap, json['type']),
json['name'] as String,
json['displayName'] as String,
json['description'] as String,
(json['participantType'] as num).toInt(),
(json['participantFlags'] as num).toInt(),
(json['readOnly'] as num).toInt(),
(json['listable'] as num).toInt(),
(json['lastPing'] as num).toInt(),
json['sessionId'] as String,
json['hasPassword'] as bool,
json['hasCall'] as bool,
(json['callFlag'] as num).toInt(),
json['canStartCall'] as bool,
json['canDeleteConversation'] as bool,
json['canLeaveConversation'] as bool,
(json['lastActivity'] as num).toInt(),
json['isFavorite'] as bool,
$enumDecode(
_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
json['notificationLevel'],
),
(json['unreadMessages'] as num).toInt(),
json['unreadMention'] as bool,
json['unreadMentionDirect'] as bool,
(json['lastReadMessage'] as num).toInt(),
(json['lastCommonReadMessage'] as num).toInt(),
GetChatResponseObject.fromJson(json['lastMessage'] as Map<String, dynamic>),
json['status'] as String?,
json['statusIcon'] as String?,
json['statusMessage'] as String?,
);
) => $checkedCreate('GetRoomResponseObject', json, ($checkedConvert) {
final val = GetRoomResponseObject(
$checkedConvert('id', (v) => (v as num).toInt()),
$checkedConvert('token', (v) => v as String),
$checkedConvert(
'type',
(v) => $enumDecode(
_$GetRoomResponseObjectConversationTypeEnumMap,
v,
unknownValue: GetRoomResponseObjectConversationType.unknown,
),
),
$checkedConvert('name', (v) => v as String),
$checkedConvert('displayName', (v) => v as String),
$checkedConvert('description', (v) => v as String),
$checkedConvert('participantType', (v) => (v as num).toInt()),
$checkedConvert('participantFlags', (v) => (v as num).toInt()),
$checkedConvert('readOnly', (v) => (v as num).toInt()),
$checkedConvert('listable', (v) => (v as num).toInt()),
$checkedConvert('lastPing', (v) => (v as num).toInt()),
$checkedConvert('sessionId', (v) => v as String),
$checkedConvert('hasPassword', (v) => v as bool),
$checkedConvert('hasCall', (v) => v as bool),
$checkedConvert('callFlag', (v) => (v as num).toInt()),
$checkedConvert('canStartCall', (v) => v as bool),
$checkedConvert('canDeleteConversation', (v) => v as bool),
$checkedConvert('canLeaveConversation', (v) => v as bool),
$checkedConvert('lastActivity', (v) => (v as num).toInt()),
$checkedConvert('isFavorite', (v) => v as bool),
$checkedConvert(
'notificationLevel',
(v) => $enumDecode(
_$GetRoomResponseObjectParticipantNotificationLevelEnumMap,
v,
unknownValue:
GetRoomResponseObjectParticipantNotificationLevel.defaultLevel,
),
),
$checkedConvert('unreadMessages', (v) => (v as num).toInt()),
$checkedConvert('unreadMention', (v) => v as bool),
$checkedConvert('unreadMentionDirect', (v) => v as bool),
$checkedConvert('lastReadMessage', (v) => (v as num).toInt()),
$checkedConvert('lastCommonReadMessage', (v) => (v as num).toInt()),
$checkedConvert(
'lastMessage',
(v) => v == null
? null
: GetChatResponseObject.fromJson(v as Map<String, dynamic>),
),
$checkedConvert('status', (v) => v as String?),
$checkedConvert('statusIcon', (v) => v as String?),
$checkedConvert('statusMessage', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$GetRoomResponseObjectToJson(
GetRoomResponseObject instance,
@@ -93,7 +115,7 @@ Map<String, dynamic> _$GetRoomResponseObjectToJson(
'unreadMentionDirect': instance.unreadMentionDirect,
'lastReadMessage': instance.lastReadMessage,
'lastCommonReadMessage': instance.lastCommonReadMessage,
'lastMessage': instance.lastMessage.toJson(),
'lastMessage': instance.lastMessage?.toJson(),
'status': instance.status,
'statusIcon': instance.statusIcon,
'statusMessage': instance.statusMessage,
@@ -106,6 +128,7 @@ const _$GetRoomResponseObjectConversationTypeEnumMap = {
GetRoomResponseObjectConversationType.changelog: 4,
GetRoomResponseObjectConversationType.deleted: 5,
GetRoomResponseObjectConversationType.noteToSelf: 6,
GetRoomResponseObjectConversationType.unknown: 'unknown',
};
const _$GetRoomResponseObjectParticipantNotificationLevelEnumMap = {
@@ -7,10 +7,13 @@ part of 'send_message_params.dart';
// **************************************************************************
SendMessageParams _$SendMessageParamsFromJson(Map<String, dynamic> json) =>
SendMessageParams(
json['message'] as String,
replyTo: json['replyTo'] as String?,
);
$checkedCreate('SendMessageParams', json, ($checkedConvert) {
final val = SendMessageParams(
$checkedConvert('message', (v) => v as String),
replyTo: $checkedConvert('replyTo', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$SendMessageParamsToJson(SendMessageParams instance) =>
<String, dynamic>{
@@ -7,9 +7,15 @@ part of 'set_read_marker_params.dart';
// **************************************************************************
SetReadMarkerParams _$SetReadMarkerParamsFromJson(Map<String, dynamic> json) =>
SetReadMarkerParams(
lastReadMessage: (json['lastReadMessage'] as num?)?.toInt(),
);
$checkedCreate('SetReadMarkerParams', json, ($checkedConvert) {
final val = SetReadMarkerParams(
lastReadMessage: $checkedConvert(
'lastReadMessage',
(v) => (v as num?)?.toInt(),
),
);
return val;
});
Map<String, dynamic> _$SetReadMarkerParamsToJson(
SetReadMarkerParams instance,
+10 -3
View File
@@ -8,6 +8,8 @@ import '../../errors/network_exception.dart';
import '../../errors/parse_exception.dart';
import '../../errors/talk_exception.dart';
import '../../http_errors.dart';
import '../../json_lenient.dart';
import '../../marianumconnect/queries/report_client_error/client_error_reporter.dart';
import '../nextcloud_ocs.dart';
import 'talk_error.dart';
@@ -73,12 +75,17 @@ abstract class TalkApi<T extends ApiResponse?> {
throwForStatus(status, detail);
}
final T assembled;
try {
final assembled = await assembleAsync(data.body);
assembled?.headers = data.headers;
return assembled;
assembled = await assembleAsync(data.body);
} catch (e) {
throw ParseException(technicalDetails: 'Talk $endpoint assemble: $e');
}
assembled?.headers = data.headers;
ClientErrorReporter.reportDecodeWarnings('Talk $path', [
...?assembled?.parseWarnings,
...drainDecodeWarnings(),
]);
return assembled;
}
}
@@ -7,11 +7,15 @@ part of 'vote_poll_params.dart';
// **************************************************************************
VotePollParams _$VotePollParamsFromJson(Map<String, dynamic> json) =>
VotePollParams(
optionIds: (json['optionIds'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList(),
);
$checkedCreate('VotePollParams', json, ($checkedConvert) {
final val = VotePollParams(
optionIds: $checkedConvert(
'optionIds',
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
),
);
return val;
});
Map<String, dynamic> _$VotePollParamsToJson(VotePollParams instance) =>
<String, dynamic>{'optionIds': instance.optionIds};
@@ -7,23 +7,28 @@ part of 'cacheable_file.dart';
// **************************************************************************
CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
CacheableFile(
path: json['path'] as String,
isDirectory: json['isDirectory'] as bool,
name: json['name'] as String,
mimeType: json['mimeType'] as String?,
size: (json['size'] as num?)?.toInt(),
eTag: json['eTag'] as String?,
createdAt: json['createdAt'] == null
? null
: DateTime.parse(json['createdAt'] as String),
modifiedAt: json['modifiedAt'] == null
? null
: DateTime.parse(json['modifiedAt'] as String),
fileId: (json['fileId'] as num?)?.toInt(),
hasPreview: json['hasPreview'] as bool?,
isSharedWithMe: json['isSharedWithMe'] as bool?,
);
$checkedCreate('CacheableFile', json, ($checkedConvert) {
final val = CacheableFile(
path: $checkedConvert('path', (v) => v as String),
isDirectory: $checkedConvert('isDirectory', (v) => v as bool),
name: $checkedConvert('name', (v) => v as String),
mimeType: $checkedConvert('mimeType', (v) => v as String?),
size: $checkedConvert('size', (v) => (v as num?)?.toInt()),
eTag: $checkedConvert('eTag', (v) => v as String?),
createdAt: $checkedConvert(
'createdAt',
(v) => v == null ? null : DateTime.parse(v as String),
),
modifiedAt: $checkedConvert(
'modifiedAt',
(v) => v == null ? null : DateTime.parse(v as String),
),
fileId: $checkedConvert('fileId', (v) => (v as num?)?.toInt()),
hasPreview: $checkedConvert('hasPreview', (v) => v as bool?),
isSharedWithMe: $checkedConvert('isSharedWithMe', (v) => v as bool?),
);
return val;
});
Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
<String, dynamic>{
@@ -7,7 +7,10 @@ part of 'list_files_params.dart';
// **************************************************************************
ListFilesParams _$ListFilesParamsFromJson(Map<String, dynamic> json) =>
ListFilesParams(json['path'] as String);
$checkedCreate('ListFilesParams', json, ($checkedConvert) {
final val = ListFilesParams($checkedConvert('path', (v) => v as String));
return val;
});
Map<String, dynamic> _$ListFilesParamsToJson(ListFilesParams instance) =>
<String, dynamic>{'path': instance.path};
@@ -7,14 +7,23 @@ part of 'list_files_response.dart';
// **************************************************************************
ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
ListFilesResponse(
(json['files'] as List<dynamic>)
.map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
.toSet(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('ListFilesResponse', json, ($checkedConvert) {
final val = ListFilesResponse(
$checkedConvert(
'files',
(v) => (v as List<dynamic>)
.map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
.toSet(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
<String, dynamic>{
@@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../../../storage/keychain_write.dart';
import '../../errors/auth_exception.dart';
/// `first_unlock` accessibility so the token can be read during background
@@ -52,9 +53,9 @@ class MarianumConnectTokenStorage {
required String tokenId,
required DateTime? expiresAt,
}) async {
await _storage.write(key: _tokenKey, value: token);
await _storage.write(key: _tokenIdKey, value: tokenId);
await _storage.write(
await _storage.writeRetrying(key: _tokenKey, value: token);
await _storage.writeRetrying(key: _tokenIdKey, value: tokenId);
await _storage.writeRetrying(
key: _expiresAtKey,
value: expiresAt?.toIso8601String() ?? '',
);
@@ -75,7 +76,7 @@ class MarianumConnectTokenStorage {
if (value == null) {
await _storage.delete(key: key);
} else {
await _storage.write(key: key, value: value);
await _storage.writeRetrying(key: key, value: value);
}
}
}
@@ -6,12 +6,22 @@ part of 'mc_holiday.dart';
// JsonSerializableGenerator
// **************************************************************************
McHoliday _$McHolidayFromJson(Map<String, dynamic> json) => McHoliday(
shortName: json['shortName'] as String,
longName: json['longName'] as String,
startDate: McHoliday._dateFromJson(json['startDate'] as String),
endDate: McHoliday._dateFromJson(json['endDate'] as String),
);
McHoliday _$McHolidayFromJson(Map<String, dynamic> json) =>
$checkedCreate('McHoliday', json, ($checkedConvert) {
final val = McHoliday(
shortName: $checkedConvert('shortName', (v) => v as String),
longName: $checkedConvert('longName', (v) => v as String),
startDate: $checkedConvert(
'startDate',
(v) => McHoliday._dateFromJson(v as String),
),
endDate: $checkedConvert(
'endDate',
(v) => McHoliday._dateFromJson(v as String),
),
);
return val;
});
Map<String, dynamic> _$McHolidayToJson(McHoliday instance) => <String, dynamic>{
'shortName': instance.shortName,
@@ -8,12 +8,15 @@ part of 'absence_prefill_response.dart';
AbsencePrefillResponse _$AbsencePrefillResponseFromJson(
Map<String, dynamic> json,
) => AbsencePrefillResponse(
firstName: json['firstName'] as String? ?? '',
lastName: json['lastName'] as String? ?? '',
className: json['className'] as String? ?? '',
phone: json['phone'] as String? ?? '',
);
) => $checkedCreate('AbsencePrefillResponse', json, ($checkedConvert) {
final val = AbsencePrefillResponse(
firstName: $checkedConvert('firstName', (v) => v as String? ?? ''),
lastName: $checkedConvert('lastName', (v) => v as String? ?? ''),
className: $checkedConvert('className', (v) => v as String? ?? ''),
phone: $checkedConvert('phone', (v) => v as String? ?? ''),
);
return val;
});
Map<String, dynamic> _$AbsencePrefillResponseToJson(
AbsencePrefillResponse instance,
@@ -7,14 +7,17 @@ part of 'auth_login_response.dart';
// **************************************************************************
AuthLoginUser _$AuthLoginUserFromJson(Map<String, dynamic> json) =>
AuthLoginUser(
id: json['id'] as String,
username: json['username'] as String,
firstName: json['firstName'] as String,
lastName: json['lastName'] as String,
userType: json['userType'] as String?,
className: json['className'] as String?,
);
$checkedCreate('AuthLoginUser', json, ($checkedConvert) {
final val = AuthLoginUser(
id: $checkedConvert('id', (v) => v as String),
username: $checkedConvert('username', (v) => v as String),
firstName: $checkedConvert('firstName', (v) => v as String),
lastName: $checkedConvert('lastName', (v) => v as String),
userType: $checkedConvert('userType', (v) => v as String?),
className: $checkedConvert('className', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$AuthLoginUserToJson(AuthLoginUser instance) =>
<String, dynamic>{
@@ -27,12 +30,21 @@ Map<String, dynamic> _$AuthLoginUserToJson(AuthLoginUser instance) =>
};
AuthLoginResponse _$AuthLoginResponseFromJson(Map<String, dynamic> json) =>
AuthLoginResponse(
token: json['token'] as String,
tokenId: json['tokenId'] as String,
expiresAt: AuthLoginResponse._expiresFromJson(json['expiresAt']),
user: AuthLoginUser.fromJson(json['user'] as Map<String, dynamic>),
);
$checkedCreate('AuthLoginResponse', json, ($checkedConvert) {
final val = AuthLoginResponse(
token: $checkedConvert('token', (v) => v as String),
tokenId: $checkedConvert('tokenId', (v) => v as String),
expiresAt: $checkedConvert(
'expiresAt',
(v) => AuthLoginResponse._expiresFromJson(v),
),
user: $checkedConvert(
'user',
(v) => AuthLoginUser.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$AuthLoginResponseToJson(AuthLoginResponse instance) =>
<String, dynamic>{
@@ -25,6 +25,7 @@ class GetBreakersResponse extends ApiResponse {
@JsonSerializable()
class BreakerRule {
@JsonKey(unknownEnumValue: BreakerArea.unknown)
List<BreakerArea> areas;
String message;
@@ -69,4 +70,7 @@ enum BreakerArea {
feedback,
@JsonValue('MORE')
more,
/// An area the backend added after this build; no module maps to it.
unknown,
}
@@ -7,15 +7,25 @@ part of 'get_breakers_response.dart';
// **************************************************************************
GetBreakersResponse _$GetBreakersResponseFromJson(Map<String, dynamic> json) =>
GetBreakersResponse(
(json['rules'] as List<dynamic>?)
?.map((e) => BreakerRule.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('GetBreakersResponse', json, ($checkedConvert) {
final val = GetBreakersResponse(
$checkedConvert(
'rules',
(v) =>
(v as List<dynamic>?)
?.map((e) => BreakerRule.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetBreakersResponseToJson(
GetBreakersResponse instance,
@@ -24,13 +34,26 @@ Map<String, dynamic> _$GetBreakersResponseToJson(
'rules': instance.rules.map((e) => e.toJson()).toList(),
};
BreakerRule _$BreakerRuleFromJson(Map<String, dynamic> json) => BreakerRule(
(json['areas'] as List<dynamic>)
.map((e) => $enumDecode(_$BreakerAreaEnumMap, e))
.toList(),
json['message'] as String,
(json['maxBuild'] as num?)?.toInt(),
);
BreakerRule _$BreakerRuleFromJson(Map<String, dynamic> json) =>
$checkedCreate('BreakerRule', json, ($checkedConvert) {
final val = BreakerRule(
$checkedConvert(
'areas',
(v) => (v as List<dynamic>)
.map(
(e) => $enumDecode(
_$BreakerAreaEnumMap,
e,
unknownValue: BreakerArea.unknown,
),
)
.toList(),
),
$checkedConvert('message', (v) => v as String),
$checkedConvert('maxBuild', (v) => (v as num?)?.toInt()),
);
return val;
});
Map<String, dynamic> _$BreakerRuleToJson(BreakerRule instance) =>
<String, dynamic>{
@@ -52,4 +75,5 @@ const _$BreakerAreaEnumMap = {
BreakerArea.dates: 'DATES',
BreakerArea.feedback: 'FEEDBACK',
BreakerArea.more: 'MORE',
BreakerArea.unknown: 'unknown',
};
@@ -8,13 +8,28 @@ part of 'get_capabilities_response.dart';
CapabilitiesResponse _$CapabilitiesResponseFromJson(
Map<String, dynamic> json,
) => CapabilitiesResponse(
viewForeignTimetables: json['viewForeignTimetables'] as bool? ?? false,
pushNotifications: json['pushNotifications'] as bool? ?? false,
timetablePastDays: (json['timetablePastDays'] as num?)?.toInt(),
timetableFutureDays: (json['timetableFutureDays'] as num?)?.toInt(),
userType: json['userType'] as String?,
);
) => $checkedCreate('CapabilitiesResponse', json, ($checkedConvert) {
final val = CapabilitiesResponse(
viewForeignTimetables: $checkedConvert(
'viewForeignTimetables',
(v) => v as bool? ?? false,
),
pushNotifications: $checkedConvert(
'pushNotifications',
(v) => v as bool? ?? false,
),
timetablePastDays: $checkedConvert(
'timetablePastDays',
(v) => (v as num?)?.toInt(),
),
timetableFutureDays: $checkedConvert(
'timetableFutureDays',
(v) => (v as num?)?.toInt(),
),
userType: $checkedConvert('userType', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$CapabilitiesResponseToJson(
CapabilitiesResponse instance,
@@ -7,14 +7,20 @@ part of 'get_ticker_response.dart';
// **************************************************************************
TickerResponse _$TickerResponseFromJson(Map<String, dynamic> json) =>
TickerResponse(
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
available: json['available'] as bool? ?? false,
hash: json['hash'] as String?,
publishedAt: json['publishedAt'] as String?,
webUrl: json['webUrl'] as String? ?? '/ticker',
content: json['content'] as Map<String, dynamic>?,
);
$checkedCreate('TickerResponse', json, ($checkedConvert) {
final val = TickerResponse(
schemaVersion: $checkedConvert(
'schemaVersion',
(v) => (v as num?)?.toInt() ?? 1,
),
available: $checkedConvert('available', (v) => v as bool? ?? false),
hash: $checkedConvert('hash', (v) => v as String?),
publishedAt: $checkedConvert('publishedAt', (v) => v as String?),
webUrl: $checkedConvert('webUrl', (v) => v as String? ?? '/ticker'),
content: $checkedConvert('content', (v) => v as Map<String, dynamic>?),
);
return val;
});
Map<String, dynamic> _$TickerResponseToJson(TickerResponse instance) =>
<String, dynamic>{
@@ -7,15 +7,26 @@ part of 'get_ticker_nav_response.dart';
// **************************************************************************
TickerNavResponse _$TickerNavResponseFromJson(Map<String, dynamic> json) =>
TickerNavResponse(
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
navHash: json['navHash'] as String? ?? '',
sections:
(json['sections'] as List<dynamic>?)
?.map((e) => TickerNavSection.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
);
$checkedCreate('TickerNavResponse', json, ($checkedConvert) {
final val = TickerNavResponse(
schemaVersion: $checkedConvert(
'schemaVersion',
(v) => (v as num?)?.toInt() ?? 1,
),
navHash: $checkedConvert('navHash', (v) => v as String? ?? ''),
sections: $checkedConvert(
'sections',
(v) =>
(v as List<dynamic>?)
?.map(
(e) => TickerNavSection.fromJson(e as Map<String, dynamic>),
)
.toList() ??
[],
),
);
return val;
});
Map<String, dynamic> _$TickerNavResponseToJson(TickerNavResponse instance) =>
<String, dynamic>{
@@ -25,14 +36,22 @@ Map<String, dynamic> _$TickerNavResponseToJson(TickerNavResponse instance) =>
};
TickerNavSection _$TickerNavSectionFromJson(Map<String, dynamic> json) =>
TickerNavSection(
title: json['title'] as String? ?? '',
pages:
(json['pages'] as List<dynamic>?)
?.map((e) => TickerNavPage.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
);
$checkedCreate('TickerNavSection', json, ($checkedConvert) {
final val = TickerNavSection(
title: $checkedConvert('title', (v) => v as String? ?? ''),
pages: $checkedConvert(
'pages',
(v) =>
(v as List<dynamic>?)
?.map(
(e) => TickerNavPage.fromJson(e as Map<String, dynamic>),
)
.toList() ??
[],
),
);
return val;
});
Map<String, dynamic> _$TickerNavSectionToJson(TickerNavSection instance) =>
<String, dynamic>{
@@ -41,15 +60,21 @@ Map<String, dynamic> _$TickerNavSectionToJson(TickerNavSection instance) =>
};
TickerNavPage _$TickerNavPageFromJson(Map<String, dynamic> json) =>
TickerNavPage(
title: json['title'] as String? ?? '',
slug: json['slug'] as String? ?? '',
kind: json['kind'] as String? ?? 'CONTENT',
hash: json['hash'] as String?,
externalUrl: json['externalUrl'] as String?,
externalUrlNewTab: json['externalUrlNewTab'] as bool?,
fileUrl: json['fileUrl'] as String?,
);
$checkedCreate('TickerNavPage', json, ($checkedConvert) {
final val = TickerNavPage(
title: $checkedConvert('title', (v) => v as String? ?? ''),
slug: $checkedConvert('slug', (v) => v as String? ?? ''),
kind: $checkedConvert('kind', (v) => v as String? ?? 'CONTENT'),
hash: $checkedConvert('hash', (v) => v as String?),
externalUrl: $checkedConvert('externalUrl', (v) => v as String?),
externalUrlNewTab: $checkedConvert(
'externalUrlNewTab',
(v) => v as bool?,
),
fileUrl: $checkedConvert('fileUrl', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$TickerNavPageToJson(TickerNavPage instance) =>
<String, dynamic>{
@@ -7,22 +7,31 @@ part of 'get_ticker_page_response.dart';
// **************************************************************************
TickerPageResponse _$TickerPageResponseFromJson(Map<String, dynamic> json) =>
TickerPageResponse(
schemaVersion: (json['schemaVersion'] as num?)?.toInt() ?? 1,
slug: json['slug'] as String?,
title: json['title'] as String?,
kind: json['kind'] as String? ?? 'CONTENT',
content: json['content'] as Map<String, dynamic>?,
externalUrl: json['externalUrl'] as String?,
externalUrlNewTab: json['externalUrlNewTab'] as bool?,
fileUrl: json['fileUrl'] as String?,
contentType: json['contentType'] as String?,
filename: json['filename'] as String?,
hash: json['hash'] as String?,
webUrl: json['webUrl'] as String?,
publishedAt: json['publishedAt'] as String?,
fileFetchedAt: json['fileFetchedAt'] as String?,
);
$checkedCreate('TickerPageResponse', json, ($checkedConvert) {
final val = TickerPageResponse(
schemaVersion: $checkedConvert(
'schemaVersion',
(v) => (v as num?)?.toInt() ?? 1,
),
slug: $checkedConvert('slug', (v) => v as String?),
title: $checkedConvert('title', (v) => v as String?),
kind: $checkedConvert('kind', (v) => v as String? ?? 'CONTENT'),
content: $checkedConvert('content', (v) => v as Map<String, dynamic>?),
externalUrl: $checkedConvert('externalUrl', (v) => v as String?),
externalUrlNewTab: $checkedConvert(
'externalUrlNewTab',
(v) => v as bool?,
),
fileUrl: $checkedConvert('fileUrl', (v) => v as String?),
contentType: $checkedConvert('contentType', (v) => v as String?),
filename: $checkedConvert('filename', (v) => v as String?),
hash: $checkedConvert('hash', (v) => v as String?),
webUrl: $checkedConvert('webUrl', (v) => v as String?),
publishedAt: $checkedConvert('publishedAt', (v) => v as String?),
fileFetchedAt: $checkedConvert('fileFetchedAt', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$TickerPageResponseToJson(TickerPageResponse instance) =>
<String, dynamic>{
@@ -36,6 +36,15 @@ class ClientErrorReporter {
);
}
/// Server entries the decoder could not map (see `decodeListLenient`): the
/// app keeps working without them, the report says which field drifted.
static void reportDecodeWarnings(String context, Iterable<String> warnings) {
for (final warning in warnings) {
log('$context: skipped entry: $warning');
_report(errorType: 'decode', message: warning, context: context);
}
}
static void _report({
required String errorType,
required String message,
@@ -1,5 +1,6 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../../../../storage/keychain_write.dart';
import '../../../../utils/random_id.dart';
/// A stable, anonymous per-install identifier for telemetry. Generated once on
@@ -22,7 +23,7 @@ class TelemetryDeviceId {
return existing;
}
final generated = randomHexId();
await _storage.write(key: _key, value: generated);
await _storage.writeRetrying(key: _key, value: generated);
_cached = generated;
return generated;
}
@@ -7,11 +7,14 @@ part of 'timetable_get_classes_response.dart';
// **************************************************************************
McTimetableClass _$McTimetableClassFromJson(Map<String, dynamic> json) =>
McTimetableClass(
id: (json['id'] as num).toInt(),
shortName: json['shortName'] as String,
longName: json['longName'] as String,
);
$checkedCreate('McTimetableClass', json, ($checkedConvert) {
final val = McTimetableClass(
id: $checkedConvert('id', (v) => (v as num).toInt()),
shortName: $checkedConvert('shortName', (v) => v as String),
longName: $checkedConvert('longName', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
<String, dynamic>{
@@ -22,15 +25,23 @@ Map<String, dynamic> _$McTimetableClassToJson(McTimetableClass instance) =>
TimetableGetClassesResponse _$TimetableGetClassesResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetClassesResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McTimetableClass.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetClassesResponse', json, ($checkedConvert) {
final val = TimetableGetClassesResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McTimetableClass.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetClassesResponseToJson(
TimetableGetClassesResponse instance,
@@ -8,15 +8,23 @@ part of 'timetable_get_holidays_response.dart';
TimetableGetHolidaysResponse _$TimetableGetHolidaysResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetHolidaysResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetHolidaysResponse', json, ($checkedConvert) {
final val = TimetableGetHolidaysResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetHolidaysResponseToJson(
TimetableGetHolidaysResponse instance,
@@ -6,11 +6,15 @@ part of 'timetable_get_rooms_response.dart';
// JsonSerializableGenerator
// **************************************************************************
McRoom _$McRoomFromJson(Map<String, dynamic> json) => McRoom(
id: (json['id'] as num).toInt(),
shortName: json['shortName'] as String,
longName: json['longName'] as String,
);
McRoom _$McRoomFromJson(Map<String, dynamic> json) =>
$checkedCreate('McRoom', json, ($checkedConvert) {
final val = McRoom(
id: $checkedConvert('id', (v) => (v as num).toInt()),
shortName: $checkedConvert('shortName', (v) => v as String),
longName: $checkedConvert('longName', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$McRoomToJson(McRoom instance) => <String, dynamic>{
'id': instance.id,
@@ -20,15 +24,23 @@ Map<String, dynamic> _$McRoomToJson(McRoom instance) => <String, dynamic>{
TimetableGetRoomsResponse _$TimetableGetRoomsResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetRoomsResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McRoom.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetRoomsResponse', json, ($checkedConvert) {
final val = TimetableGetRoomsResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McRoom.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetRoomsResponseToJson(
TimetableGetRoomsResponse instance,
@@ -8,20 +8,27 @@ part of 'timetable_get_schoolyear_response.dart';
TimetableGetSchoolyearResponse _$TimetableGetSchoolyearResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetSchoolyearResponse(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
startDate: TimetableGetSchoolyearResponse._dateFromJson(
json['startDate'] as String,
),
endDate: TimetableGetSchoolyearResponse._dateFromJson(
json['endDate'] as String,
),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetSchoolyearResponse', json, ($checkedConvert) {
final val = TimetableGetSchoolyearResponse(
id: $checkedConvert('id', (v) => (v as num).toInt()),
name: $checkedConvert('name', (v) => v as String),
startDate: $checkedConvert(
'startDate',
(v) => TimetableGetSchoolyearResponse._dateFromJson(v as String),
),
endDate: $checkedConvert(
'endDate',
(v) => TimetableGetSchoolyearResponse._dateFromJson(v as String),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetSchoolyearResponseToJson(
TimetableGetSchoolyearResponse instance,
@@ -7,12 +7,15 @@ part of 'timetable_get_students_response.dart';
// **************************************************************************
McTimetableStudent _$McTimetableStudentFromJson(Map<String, dynamic> json) =>
McTimetableStudent(
id: (json['id'] as num).toInt(),
firstName: json['firstName'] as String,
lastName: json['lastName'] as String,
displayName: json['displayName'] as String,
);
$checkedCreate('McTimetableStudent', json, ($checkedConvert) {
final val = McTimetableStudent(
id: $checkedConvert('id', (v) => (v as num).toInt()),
firstName: $checkedConvert('firstName', (v) => v as String),
lastName: $checkedConvert('lastName', (v) => v as String),
displayName: $checkedConvert('displayName', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
<String, dynamic>{
@@ -24,15 +27,23 @@ Map<String, dynamic> _$McTimetableStudentToJson(McTimetableStudent instance) =>
TimetableGetStudentsResponse _$TimetableGetStudentsResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetStudentsResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetStudentsResponse', json, ($checkedConvert) {
final val = TimetableGetStudentsResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McTimetableStudent.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetStudentsResponseToJson(
TimetableGetStudentsResponse instance,
@@ -6,12 +6,16 @@ part of 'timetable_get_subjects_response.dart';
// JsonSerializableGenerator
// **************************************************************************
McSubject _$McSubjectFromJson(Map<String, dynamic> json) => McSubject(
id: (json['id'] as num).toInt(),
shortName: json['shortName'] as String,
longName: json['longName'] as String,
color: json['color'] as String?,
);
McSubject _$McSubjectFromJson(Map<String, dynamic> json) =>
$checkedCreate('McSubject', json, ($checkedConvert) {
final val = McSubject(
id: $checkedConvert('id', (v) => (v as num).toInt()),
shortName: $checkedConvert('shortName', (v) => v as String),
longName: $checkedConvert('longName', (v) => v as String),
color: $checkedConvert('color', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$McSubjectToJson(McSubject instance) => <String, dynamic>{
'id': instance.id,
@@ -22,15 +26,23 @@ Map<String, dynamic> _$McSubjectToJson(McSubject instance) => <String, dynamic>{
TimetableGetSubjectsResponse _$TimetableGetSubjectsResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetSubjectsResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McSubject.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetSubjectsResponse', json, ($checkedConvert) {
final val = TimetableGetSubjectsResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McSubject.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetSubjectsResponseToJson(
TimetableGetSubjectsResponse instance,
@@ -8,11 +8,14 @@ part of 'timetable_get_teachers_response.dart';
McTimetableTeacherElement _$McTimetableTeacherElementFromJson(
Map<String, dynamic> json,
) => McTimetableTeacherElement(
id: (json['id'] as num).toInt(),
shortName: json['shortName'] as String,
displayName: json['displayName'] as String,
);
) => $checkedCreate('McTimetableTeacherElement', json, ($checkedConvert) {
final val = McTimetableTeacherElement(
id: $checkedConvert('id', (v) => (v as num).toInt()),
shortName: $checkedConvert('shortName', (v) => v as String),
displayName: $checkedConvert('displayName', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$McTimetableTeacherElementToJson(
McTimetableTeacherElement instance,
@@ -24,18 +27,26 @@ Map<String, dynamic> _$McTimetableTeacherElementToJson(
TimetableGetTeachersResponse _$TimetableGetTeachersResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetTeachersResponse(
result: (json['result'] as List<dynamic>)
.map(
(e) =>
McTimetableTeacherElement.fromJson(e as Map<String, dynamic>),
)
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetTeachersResponse', json, ($checkedConvert) {
final val = TimetableGetTeachersResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map(
(e) =>
McTimetableTeacherElement.fromJson(e as Map<String, dynamic>),
)
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetTeachersResponseToJson(
TimetableGetTeachersResponse instance,
@@ -7,12 +7,24 @@ part of 'timetable_get_timegrid_response.dart';
// **************************************************************************
McTimegridUnit _$McTimegridUnitFromJson(Map<String, dynamic> json) =>
McTimegridUnit(
dayOfWeek: _dayFromJson(json['dayOfWeek'] as String),
label: json['label'] as String,
startTime: McTimegridUnit._timeFromJson(json['startTime'] as String),
endTime: McTimegridUnit._timeFromJson(json['endTime'] as String),
);
$checkedCreate('McTimegridUnit', json, ($checkedConvert) {
final val = McTimegridUnit(
dayOfWeek: $checkedConvert(
'dayOfWeek',
(v) => _dayFromJson(v as String),
),
label: $checkedConvert('label', (v) => v as String),
startTime: $checkedConvert(
'startTime',
(v) => McTimegridUnit._timeFromJson(v as String),
),
endTime: $checkedConvert(
'endTime',
(v) => McTimegridUnit._timeFromJson(v as String),
),
);
return val;
});
Map<String, dynamic> _$McTimegridUnitToJson(McTimegridUnit instance) =>
<String, dynamic>{
@@ -24,15 +36,23 @@ Map<String, dynamic> _$McTimegridUnitToJson(McTimegridUnit instance) =>
TimetableGetTimegridResponse _$TimetableGetTimegridResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetTimegridResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McTimegridUnit.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetTimegridResponse', json, ($checkedConvert) {
final val = TimetableGetTimegridResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map((e) => McTimegridUnit.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetTimegridResponseToJson(
TimetableGetTimegridResponse instance,
@@ -7,14 +7,23 @@ part of 'timetable_get_week_response.dart';
// **************************************************************************
McTimetableTeacher _$McTimetableTeacherFromJson(Map<String, dynamic> json) =>
McTimetableTeacher(
shortName: json['shortName'] as String,
displayName: json['displayName'] as String,
originalShortName: json['originalShortName'] as String?,
originalDisplayName: json['originalDisplayName'] as String?,
id: (json['id'] as num?)?.toInt(),
originalId: (json['originalId'] as num?)?.toInt(),
);
$checkedCreate('McTimetableTeacher', json, ($checkedConvert) {
final val = McTimetableTeacher(
shortName: $checkedConvert('shortName', (v) => v as String),
displayName: $checkedConvert('displayName', (v) => v as String),
originalShortName: $checkedConvert(
'originalShortName',
(v) => v as String?,
),
originalDisplayName: $checkedConvert(
'originalDisplayName',
(v) => v as String?,
),
id: $checkedConvert('id', (v) => (v as num?)?.toInt()),
originalId: $checkedConvert('originalId', (v) => (v as num?)?.toInt()),
);
return val;
});
Map<String, dynamic> _$McTimetableTeacherToJson(McTimetableTeacher instance) =>
<String, dynamic>{
@@ -26,31 +35,53 @@ Map<String, dynamic> _$McTimetableTeacherToJson(McTimetableTeacher instance) =>
'originalId': instance.originalId,
};
McTimetableEntry _$McTimetableEntryFromJson(Map<String, dynamic> json) =>
McTimetableEntry(
id: (json['id'] as num).toInt(),
date: McTimetableEntry._dateFromJson(json['date'] as String),
startTime: McTimetableEntry._timeFromJson(json['startTime'] as String),
endTime: McTimetableEntry._timeFromJson(json['endTime'] as String),
subjects: (json['subjects'] as List<dynamic>)
.map((e) => e as String)
.toList(),
teachers: (json['teachers'] as List<dynamic>)
McTimetableEntry _$McTimetableEntryFromJson(
Map<String, dynamic> json,
) => $checkedCreate('McTimetableEntry', json, ($checkedConvert) {
final val = McTimetableEntry(
id: $checkedConvert('id', (v) => (v as num).toInt()),
date: $checkedConvert(
'date',
(v) => McTimetableEntry._dateFromJson(v as String),
),
startTime: $checkedConvert(
'startTime',
(v) => McTimetableEntry._timeFromJson(v as String),
),
endTime: $checkedConvert(
'endTime',
(v) => McTimetableEntry._timeFromJson(v as String),
),
subjects: $checkedConvert(
'subjects',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
teachers: $checkedConvert(
'teachers',
(v) => (v as List<dynamic>)
.map((e) => McTimetableTeacher.fromJson(e as Map<String, dynamic>))
.toList(),
rooms: (json['rooms'] as List<dynamic>).map((e) => e as String).toList(),
classNames: (json['classNames'] as List<dynamic>)
.map((e) => e as String)
.toList(),
lessonType: json['lessonType'] as String,
status: json['status'] as String,
substitutionText: json['substitutionText'] as String?,
lessonText: json['lessonText'] as String?,
infoText: json['infoText'] as String?,
classIds: (json['classIds'] as List<dynamic>?)
?.map((e) => (e as num).toInt())
.toList(),
);
),
rooms: $checkedConvert(
'rooms',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
classNames: $checkedConvert(
'classNames',
(v) => (v as List<dynamic>).map((e) => e as String).toList(),
),
lessonType: $checkedConvert('lessonType', (v) => v as String),
status: $checkedConvert('status', (v) => v as String),
substitutionText: $checkedConvert('substitutionText', (v) => v as String?),
lessonText: $checkedConvert('lessonText', (v) => v as String?),
infoText: $checkedConvert('infoText', (v) => v as String?),
classIds: $checkedConvert(
'classIds',
(v) => (v as List<dynamic>?)?.map((e) => (e as num).toInt()).toList(),
),
);
return val;
});
Map<String, dynamic> _$McTimetableEntryToJson(McTimetableEntry instance) =>
<String, dynamic>{
@@ -72,17 +103,31 @@ Map<String, dynamic> _$McTimetableEntryToJson(McTimetableEntry instance) =>
TimetableGetWeekResponse _$TimetableGetWeekResponseFromJson(
Map<String, dynamic> json,
) =>
TimetableGetWeekResponse(
from: McTimetableEntry._dateFromJson(json['from'] as String),
until: McTimetableEntry._dateFromJson(json['until'] as String),
entries: (json['entries'] as List<dynamic>)
.map((e) => McTimetableEntry.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('TimetableGetWeekResponse', json, ($checkedConvert) {
final val = TimetableGetWeekResponse(
from: $checkedConvert(
'from',
(v) => McTimetableEntry._dateFromJson(v as String),
),
until: $checkedConvert(
'until',
(v) => McTimetableEntry._dateFromJson(v as String),
),
entries: $checkedConvert(
'entries',
(v) => (v as List<dynamic>)
.map((e) => McTimetableEntry.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableGetWeekResponseToJson(
TimetableGetWeekResponse instance,
@@ -7,13 +7,16 @@ part of 'user_search_response.dart';
// **************************************************************************
McUserSearchResult _$McUserSearchResultFromJson(Map<String, dynamic> json) =>
McUserSearchResult(
username: json['username'] as String,
firstName: json['firstName'] as String,
lastName: json['lastName'] as String,
userType: json['userType'] as String,
className: json['className'] as String?,
);
$checkedCreate('McUserSearchResult', json, ($checkedConvert) {
final val = McUserSearchResult(
username: $checkedConvert('username', (v) => v as String),
firstName: $checkedConvert('firstName', (v) => v as String),
lastName: $checkedConvert('lastName', (v) => v as String),
userType: $checkedConvert('userType', (v) => v as String),
className: $checkedConvert('className', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$McUserSearchResultToJson(McUserSearchResult instance) =>
<String, dynamic>{
@@ -25,14 +28,25 @@ Map<String, dynamic> _$McUserSearchResultToJson(McUserSearchResult instance) =>
};
UserSearchResponse _$UserSearchResponseFromJson(Map<String, dynamic> json) =>
UserSearchResponse(
result: (json['result'] as List<dynamic>)
.map((e) => McUserSearchResult.fromJson(e as Map<String, dynamic>))
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
$checkedCreate('UserSearchResponse', json, ($checkedConvert) {
final val = UserSearchResponse(
result: $checkedConvert(
'result',
(v) => (v as List<dynamic>)
.map(
(e) => McUserSearchResult.fromJson(e as Map<String, dynamic>),
)
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$UserSearchResponseToJson(UserSearchResponse instance) =>
<String, dynamic>{
@@ -8,18 +8,33 @@ part of 'custom_timetable_event.dart';
CustomTimetableEvent _$CustomTimetableEventFromJson(
Map<String, dynamic> json,
) => CustomTimetableEvent(
id: json['id'] as String,
title: json['title'] as String,
description: json['description'] as String,
startDate: CustomTimetableEvent._dateFromJson(json['startDate'] as String),
endDate: CustomTimetableEvent._dateFromJson(json['endDate'] as String),
color: json['color'] as String?,
rrule: json['rrule'] as String,
skipHolidays: json['skipHolidays'] as bool? ?? false,
createdAt: CustomTimetableEvent._dateFromJson(json['createdAt'] as String),
updatedAt: CustomTimetableEvent._dateFromJson(json['updatedAt'] as String),
);
) => $checkedCreate('CustomTimetableEvent', json, ($checkedConvert) {
final val = CustomTimetableEvent(
id: $checkedConvert('id', (v) => v as String),
title: $checkedConvert('title', (v) => v as String),
description: $checkedConvert('description', (v) => v as String),
startDate: $checkedConvert(
'startDate',
(v) => CustomTimetableEvent._dateFromJson(v as String),
),
endDate: $checkedConvert(
'endDate',
(v) => CustomTimetableEvent._dateFromJson(v as String),
),
color: $checkedConvert('color', (v) => v as String?),
rrule: $checkedConvert('rrule', (v) => v as String),
skipHolidays: $checkedConvert('skipHolidays', (v) => v as bool? ?? false),
createdAt: $checkedConvert(
'createdAt',
(v) => CustomTimetableEvent._dateFromJson(v as String),
),
updatedAt: $checkedConvert(
'updatedAt',
(v) => CustomTimetableEvent._dateFromJson(v as String),
),
);
return val;
});
Map<String, dynamic> _$CustomTimetableEventToJson(
CustomTimetableEvent instance,
@@ -8,7 +8,12 @@ part of 'get_custom_timetable_event_params.dart';
GetCustomTimetableEventParams _$GetCustomTimetableEventParamsFromJson(
Map<String, dynamic> json,
) => GetCustomTimetableEventParams(json['user'] as String);
) => $checkedCreate('GetCustomTimetableEventParams', json, ($checkedConvert) {
final val = GetCustomTimetableEventParams(
$checkedConvert('user', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$GetCustomTimetableEventParamsToJson(
GetCustomTimetableEventParams instance,
@@ -8,17 +8,23 @@ part of 'get_custom_timetable_event_response.dart';
GetCustomTimetableEventResponse _$GetCustomTimetableEventResponseFromJson(
Map<String, dynamic> json,
) =>
GetCustomTimetableEventResponse(
(json['events'] as List<dynamic>)
.map(
(e) => CustomTimetableEvent.fromJson(e as Map<String, dynamic>),
)
.toList(),
)
..headers = (json['headers'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
);
) => $checkedCreate('GetCustomTimetableEventResponse', json, ($checkedConvert) {
final val = GetCustomTimetableEventResponse(
$checkedConvert(
'events',
(v) => (v as List<dynamic>)
.map((e) => CustomTimetableEvent.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
$checkedConvert(
'headers',
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
return val;
});
Map<String, dynamic> _$GetCustomTimetableEventResponseToJson(
GetCustomTimetableEventResponse instance,
@@ -8,7 +8,13 @@ part of 'remove_custom_timetable_event_params.dart';
RemoveCustomTimetableEventParams _$RemoveCustomTimetableEventParamsFromJson(
Map<String, dynamic> json,
) => RemoveCustomTimetableEventParams(json['id'] as String);
) =>
$checkedCreate('RemoveCustomTimetableEventParams', json, ($checkedConvert) {
final val = RemoveCustomTimetableEventParams(
$checkedConvert('id', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$RemoveCustomTimetableEventParamsToJson(
RemoveCustomTimetableEventParams instance,
+2
View File
@@ -18,6 +18,7 @@ import '../share_intent/share_intent_listener.dart';
import '../utils/app_paths.dart';
import '../utils/downloads/download_manager.dart';
import '../utils/file_clipboard.dart';
import '../widget/media_gallery/gallery_cache.dart';
import '../widget_data/widget_sync.dart';
/// Removes what an account leaves on the device outside its own storage (see
@@ -55,6 +56,7 @@ abstract final class SessionWipe {
final dir = await DownloadManager.downloadsDirectory();
if (dir.existsSync()) await dir.delete(recursive: true);
});
await _stepAsync('gallery originals', GalleryOriginals.instance.clear);
await _stepAsync(
'notification tray',
NotificationService().flutterLocalNotificationsPlugin.cancelAll,
+4 -2
View File
@@ -17,9 +17,11 @@ class NotificationService {
Future<void> initializeNotifications() async {
// Dedicated monochrome status-bar icon: launcher mipmaps are unusable as
// small icons because Android renders only their alpha silhouette (a
// solid circle in the status bar).
// solid circle in the status bar). Bare resource name: the plugin resolves
// it via getIdentifier(name, "drawable", ...), and not every ROM strips a
// leading "@drawable/" there (reported as invalid_icon on some devices).
const androidSettings = AndroidInitializationSettings(
'@drawable/ic_stat_notification',
'ic_stat_notification',
);
// iOS Talk category mirrors the Android inline reply + mark-as-read actions
+10 -2
View File
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:localstore/localstore.dart';
/// Maximum messages kept per chat thread — enough for a messenger-style
@@ -190,8 +191,15 @@ class ChatThreadStore {
DocumentRef _doc(String chatToken) =>
_db.collection(_collection).doc(docIdForToken(chatToken));
Future<void> _write(String chatToken, List<ThreadMessage> messages) =>
_doc(chatToken).set({
/// Best effort: a full disk must not keep the notification from being
/// shown; the thread just restarts from the next push.
Future<void> _write(String chatToken, List<ThreadMessage> messages) async {
try {
await _doc(chatToken).set({
'messages': [for (final m in messages) m.toJson()],
});
} on Object catch (e) {
debugPrint('ChatThreadStore.write($chatToken) failed: $e');
}
}
}
+10 -2
View File
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:localstore/localstore.dart';
/// A rendered notification's bookkeeping, keyed by the Nextcloud notification
@@ -40,8 +41,15 @@ class NidStore {
NidStore({Localstore? db}) : _db = db ?? Localstore.instance;
Future<void> put(NidEntry entry) =>
_db.collection(_collection).doc('${entry.nid}').set(entry.toJson());
/// Best effort: a full disk must not keep the notification itself from
/// being shown — only a later delete-push would then miss the mapping.
Future<void> put(NidEntry entry) async {
try {
await _db.collection(_collection).doc('${entry.nid}').set(entry.toJson());
} on Object catch (e) {
debugPrint('NidStore.put(${entry.nid}) failed: $e');
}
}
Future<NidEntry?> get(int nid) async {
final data = await _db.collection(_collection).doc('$nid').get();
+4 -1
View File
@@ -1,4 +1,5 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../storage/keychain_write.dart';
/// Keychain access group shared between the Runner and the (Phase 3) iOS
/// Notification Service Extension so the NSE can read the RSA private key,
@@ -48,7 +49,9 @@ class PushSecureStorage implements FlutterSecureStorageLike {
@override
Future<void> write({required String key, required String? value}) =>
pushSecureStorage.write(key: key, value: value);
value == null
? pushSecureStorage.delete(key: key)
: pushSecureStorage.writeRetrying(key: key, value: value);
@override
Future<void> delete({required String key}) =>
+16 -1
View File
@@ -47,6 +47,8 @@ import '../widget/debug/cache_view.dart';
import '../widget/debug/json_viewer.dart';
import '../widget/file_viewer.dart';
import '../widget/large_profile_picture_view.dart';
import '../widget/media_gallery/gallery_source.dart';
import '../widget/media_gallery/media_gallery_viewer.dart';
import '../widget/user_avatar.dart';
/// Single entry point for full-page navigations. Dialogs and bottom sheets
@@ -97,6 +99,19 @@ class AppRoutes {
);
}
/// Swipeable full-screen gallery; the viewer takes ownership of [source].
static void openMediaGallery(
BuildContext context, {
required GallerySource source,
required String initialKey,
}) {
pushScreen(
context,
withNavBar: false,
screen: MediaGalleryViewer(source: source, initialKey: initialKey),
);
}
static void openCustomEvents(BuildContext context) {
pushScreen(context, withNavBar: false, screen: const CustomEventsView());
}
@@ -407,7 +422,7 @@ class AppRoutes {
// would race the fresh one and could regress the server cursor.
context.read<ChatListBloc>().markRoomAsRead(
room.token,
room.lastMessage.id,
room.lastMessage?.id ?? room.lastReadMessage,
);
NotificationTasks.clearNotificationsForChat(room.token);
TalkNavigator.pushSplitView(
+16 -9
View File
@@ -8,6 +8,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import '../api/marianumconnect/auth/token_storage.dart';
import '../push/push_secure_storage.dart';
import '../storage/keychain_write.dart';
import '../utils/exponential_backoff.dart';
import '../utils/random_id.dart';
import 'account_codec.dart';
@@ -165,7 +166,7 @@ class SessionManager {
...sessionVaultFields(session),
...await _tokenStorage.readAll(),
};
await _secureStorage.write(
await _secureStorage.writeRetrying(
key: _vaultKey(entry.id),
value: encodeVault(fields),
);
@@ -209,7 +210,7 @@ class SessionManager {
Future<void> _saveIndex(AccountIndex index) async {
accounts.value = index;
await _secureStorage.write(key: _indexKey, value: index.encode());
await _secureStorage.writeRetrying(key: _indexKey, value: index.encode());
}
static int _now() => DateTime.now().millisecondsSinceEpoch;
@@ -234,7 +235,10 @@ class SessionManager {
await setAppPassword(appPassword);
await clearAppPasswordTalk();
_updateNextcloud((nc) => nc.copyWith(usesLoginFlow: true));
await _secureStorage.write(key: SessionKeys.loginFlow, value: 'true');
await _secureStorage.writeRetrying(
key: SessionKeys.loginFlow,
value: 'true',
);
}
Future<void> setAppPasswordTalk(String appPassword) async {
@@ -258,7 +262,7 @@ class SessionManager {
Future<void> _writeSecret(String key, String? value) => value == null
? _secureStorage.delete(key: key)
: _secureStorage.write(key: key, value: value);
: _secureStorage.writeRetrying(key: key, value: value);
// App passwords live in the push-shared (group-scoped) keystore so the iOS
// Notification Service Extension can authenticate Nextcloud calls too. That
@@ -269,7 +273,7 @@ class SessionManager {
if (value == null) {
await pushSecureStorage.delete(key: key);
} else {
await pushSecureStorage.write(key: key, value: value);
await pushSecureStorage.writeRetrying(key: key, value: value);
}
} on Object {
// ignore — see above
@@ -362,7 +366,10 @@ class SessionManager {
namespace: index.accounts.isEmpty ? '' : null,
now: _now(),
);
await _secureStorage.write(key: _indexKey, value: index.encode());
await _secureStorage.writeRetrying(
key: _indexKey,
value: index.encode(),
);
}
accounts.value = index;
return;
@@ -385,11 +392,11 @@ class SessionManager {
final hasSecure =
(await _secureStorage.read(key: SessionKeys.username)) != null;
if (!hasSecure) {
await _secureStorage.write(
await _secureStorage.writeRetrying(
key: SessionKeys.username,
value: legacyUsername,
);
await _secureStorage.write(
await _secureStorage.writeRetrying(
key: SessionKeys.password,
value: legacyPassword,
);
@@ -408,7 +415,7 @@ class SessionManager {
if (value == null) continue;
// Same account+service: the legacy item has to go before the re-add.
await _legacySecureStorage.delete(key: field);
await _secureStorage.write(key: field, value: value);
await _secureStorage.writeRetrying(key: field, value: value);
}
}
}
@@ -7,7 +7,12 @@ part of 'loadable_save_context.dart';
// **************************************************************************
_LoadableSaveContext _$LoadableSaveContextFromJson(Map<String, dynamic> json) =>
_LoadableSaveContext(timestamp: (json['timestamp'] as num).toInt());
$checkedCreate('_LoadableSaveContext', json, ($checkedConvert) {
final val = _LoadableSaveContext(
timestamp: $checkedConvert('timestamp', (v) => (v as num).toInt()),
);
return val;
});
Map<String, dynamic> _$LoadableSaveContextToJson(
_LoadableSaveContext instance,
@@ -7,13 +7,17 @@ part of 'breaker_state.dart';
// **************************************************************************
_BreakerState _$BreakerStateFromJson(Map<String, dynamic> json) =>
_BreakerState(
response: json['response'] == null
? null
: GetBreakersResponse.fromJson(
json['response'] as Map<String, dynamic>,
),
);
$checkedCreate('_BreakerState', json, ($checkedConvert) {
final val = _BreakerState(
response: $checkedConvert(
'response',
(v) => v == null
? null
: GetBreakersResponse.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$BreakerStateToJson(_BreakerState instance) =>
<String, dynamic>{'response': instance.response};
@@ -7,14 +7,29 @@ part of 'capabilities_state.dart';
// **************************************************************************
_CapabilitiesState _$CapabilitiesStateFromJson(Map<String, dynamic> json) =>
_CapabilitiesState(
viewForeignTimetables: json['viewForeignTimetables'] as bool? ?? false,
pushNotifications: json['pushNotifications'] as bool? ?? false,
timetablePastDays: (json['timetablePastDays'] as num?)?.toInt(),
timetableFutureDays: (json['timetableFutureDays'] as num?)?.toInt(),
userType: json['userType'] as String?,
loaded: json['loaded'] as bool? ?? false,
);
$checkedCreate('_CapabilitiesState', json, ($checkedConvert) {
final val = _CapabilitiesState(
viewForeignTimetables: $checkedConvert(
'viewForeignTimetables',
(v) => v as bool? ?? false,
),
pushNotifications: $checkedConvert(
'pushNotifications',
(v) => v as bool? ?? false,
),
timetablePastDays: $checkedConvert(
'timetablePastDays',
(v) => (v as num?)?.toInt(),
),
timetableFutureDays: $checkedConvert(
'timetableFutureDays',
(v) => (v as num?)?.toInt(),
),
userType: $checkedConvert('userType', (v) => v as String?),
loaded: $checkedConvert('loaded', (v) => v as bool? ?? false),
);
return val;
});
Map<String, dynamic> _$CapabilitiesStateToJson(_CapabilitiesState instance) =>
<String, dynamic>{
@@ -180,6 +180,48 @@ class ChatBloc
}
}
/// Pages in older history until [messageId] is held. Returns false when the
/// history ends (or a page brings no progress) before reaching it, or when
/// [isCancelled] or a chat switch aborts the walk. [onProgress] reports the
/// send time of the oldest held message after every page.
Future<bool> loadOlderUntil(
int messageId, {
required bool Function() isCancelled,
ValueChanged<DateTime>? onProgress,
}) async {
final token = innerState?.currentToken ?? '';
while (true) {
final state = innerState;
final response = state?.chatResponse;
if (isClosed || isCancelled() || state == null || response == null) {
return false;
}
if (state.currentToken != token) return false;
if (response.data.any((m) => m.id == messageId)) return true;
final oldestId = _minMessageId(response);
if (oldestId > 0 && oldestId < messageId) return false;
if (!state.hasMoreOld) return false;
await loadOlder();
// A load started by the scroll listener makes loadOlder() a no-op, and
// its result is merged by a queued event — wait until it has landed.
if (innerState?.isLoadingOlder ?? false) {
try {
await stream.firstWhere((s) => !(s.data?.isLoadingOlder ?? false));
} on StateError {
return false; // bloc closed meanwhile
}
}
final after = innerState?.chatResponse;
if (after == null || _minMessageId(after) == oldestId) {
if (innerState?.hasMoreOld ?? false) return false;
} else {
final oldest = after.data.where((m) => m.id == _minMessageId(after));
if (oldest.isNotEmpty) onProgress?.call(oldest.first.sentAt);
}
}
}
Future<void> sendServerReadMarker(String token, int messageId) async {
try {
await SetReadMarker(
@@ -411,6 +453,7 @@ class ChatBloc
case GetRoomResponseObjectMessageType.deletedComment:
case GetRoomResponseObjectMessageType.system:
case GetRoomResponseObjectMessageType.command:
case GetRoomResponseObjectMessageType.unknown:
break;
}
}
@@ -6,14 +6,30 @@ part of 'chat_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_ChatState _$ChatStateFromJson(Map<String, dynamic> json) => _ChatState(
currentToken: json['currentToken'] as String? ?? '',
chatResponse: json['chatResponse'] == null
? null
: GetChatResponse.fromJson(json['chatResponse'] as Map<String, dynamic>),
referenceMessageId: (json['referenceMessageId'] as num?)?.toInt(),
hasMoreOld: json['hasMoreOld'] as bool? ?? true,
isLoadingOlder: json['isLoadingOlder'] as bool? ?? false,
_ChatState _$ChatStateFromJson(Map<String, dynamic> json) => $checkedCreate(
'_ChatState',
json,
($checkedConvert) {
final val = _ChatState(
currentToken: $checkedConvert('currentToken', (v) => v as String? ?? ''),
chatResponse: $checkedConvert(
'chatResponse',
(v) => v == null
? null
: GetChatResponse.fromJson(v as Map<String, dynamic>),
),
referenceMessageId: $checkedConvert(
'referenceMessageId',
(v) => (v as num?)?.toInt(),
),
hasMoreOld: $checkedConvert('hasMoreOld', (v) => v as bool? ?? true),
isLoadingOlder: $checkedConvert(
'isLoadingOlder',
(v) => v as bool? ?? false,
),
);
return val;
},
);
Map<String, dynamic> _$ChatStateToJson(_ChatState instance) =>
@@ -187,16 +187,18 @@ class ChatListBloc
/// Clears unread too — long-poll only feeds this in for an actively-open chat.
void applyIncomingMessage(String token, GetChatResponseObject message) {
_mutateRoom(token, (r) {
final wasRead =
r.unreadMessages == 0 && r.lastReadMessage >= message.id;
final hasNewer = r.lastMessage.id >= message.id;
final wasRead = r.unreadMessages == 0 && r.lastReadMessage >= message.id;
final lastId = r.lastMessage?.id ?? 0;
final hasNewer = lastId >= message.id;
if (wasRead && hasNewer) return false;
r.unreadMessages = 0;
r.unreadMention = false;
r.unreadMentionDirect = false;
if (message.id > r.lastReadMessage) r.lastReadMessage = message.id;
if (message.id > r.lastMessage.id) r.lastMessage = message;
if (message.timestamp > r.lastActivity) r.lastActivity = message.timestamp;
if (message.id > lastId) r.lastMessage = message;
if (message.timestamp > r.lastActivity) {
r.lastActivity = message.timestamp;
}
return true;
});
}
@@ -7,11 +7,17 @@ part of 'chat_list_state.dart';
// **************************************************************************
_ChatListState _$ChatListStateFromJson(Map<String, dynamic> json) =>
_ChatListState(
rooms: json['rooms'] == null
? null
: GetRoomResponse.fromJson(json['rooms'] as Map<String, dynamic>),
);
$checkedCreate('_ChatListState', json, ($checkedConvert) {
final val = _ChatListState(
rooms: $checkedConvert(
'rooms',
(v) => v == null
? null
: GetRoomResponse.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$ChatListStateToJson(_ChatListState instance) =>
<String, dynamic>{'rooms': instance.rooms};
@@ -6,16 +6,24 @@ part of 'files_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_FilesState _$FilesStateFromJson(Map<String, dynamic> json) => _FilesState(
currentPath:
(json['currentPath'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const <String>[],
listing: json['listing'] == null
? null
: ListFilesResponse.fromJson(json['listing'] as Map<String, dynamic>),
);
_FilesState _$FilesStateFromJson(Map<String, dynamic> json) =>
$checkedCreate('_FilesState', json, ($checkedConvert) {
final val = _FilesState(
currentPath: $checkedConvert(
'currentPath',
(v) =>
(v as List<dynamic>?)?.map((e) => e as String).toList() ??
const <String>[],
),
listing: $checkedConvert(
'listing',
(v) => v == null
? null
: ListFilesResponse.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$FilesStateToJson(_FilesState instance) =>
<String, dynamic>{
@@ -7,15 +7,19 @@ part of 'grade_averages_state.dart';
// **************************************************************************
_GradeAveragesState _$GradeAveragesStateFromJson(Map<String, dynamic> json) =>
_GradeAveragesState(
gradingSystem: $enumDecode(
_$GradeAveragesGradingSystemEnumMap,
json['gradingSystem'],
),
grades: (json['grades'] as List<dynamic>)
.map((e) => (e as num).toInt())
.toList(),
);
$checkedCreate('_GradeAveragesState', json, ($checkedConvert) {
final val = _GradeAveragesState(
gradingSystem: $checkedConvert(
'gradingSystem',
(v) => $enumDecode(_$GradeAveragesGradingSystemEnumMap, v),
),
grades: $checkedConvert(
'grades',
(v) => (v as List<dynamic>).map((e) => (e as num).toInt()).toList(),
),
);
return val;
});
Map<String, dynamic> _$GradeAveragesStateToJson(
_GradeAveragesState instance,
@@ -7,13 +7,19 @@ part of 'holidays_state.dart';
// **************************************************************************
_HolidaysState _$HolidaysStateFromJson(Map<String, dynamic> json) =>
_HolidaysState(
showPastHolidays: json['showPastHolidays'] as bool,
showDisclaimer: json['showDisclaimer'] as bool,
holidays: (json['holidays'] as List<dynamic>)
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
.toList(),
);
$checkedCreate('_HolidaysState', json, ($checkedConvert) {
final val = _HolidaysState(
showPastHolidays: $checkedConvert('showPastHolidays', (v) => v as bool),
showDisclaimer: $checkedConvert('showDisclaimer', (v) => v as bool),
holidays: $checkedConvert(
'holidays',
(v) => (v as List<dynamic>)
.map((e) => McHoliday.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
return val;
});
Map<String, dynamic> _$HolidaysStateToJson(_HolidaysState instance) =>
<String, dynamic>{
@@ -7,12 +7,18 @@ part of 'marianum_dates_state.dart';
// **************************************************************************
_MarianumDatesState _$MarianumDatesStateFromJson(Map<String, dynamic> json) =>
_MarianumDatesState(
showPastEvents: json['showPastEvents'] as bool,
events: (json['events'] as List<dynamic>)
.map((e) => MarianumDate.fromJson(e as Map<String, dynamic>))
.toList(),
);
$checkedCreate('_MarianumDatesState', json, ($checkedConvert) {
final val = _MarianumDatesState(
showPastEvents: $checkedConvert('showPastEvents', (v) => v as bool),
events: $checkedConvert(
'events',
(v) => (v as List<dynamic>)
.map((e) => MarianumDate.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
return val;
});
Map<String, dynamic> _$MarianumDatesStateToJson(_MarianumDatesState instance) =>
<String, dynamic>{
@@ -21,14 +27,17 @@ Map<String, dynamic> _$MarianumDatesStateToJson(_MarianumDatesState instance) =>
};
_MarianumDate _$MarianumDateFromJson(Map<String, dynamic> json) =>
_MarianumDate(
uid: json['uid'] as String,
title: json['title'] as String,
description: json['description'] as String?,
start: DateTime.parse(json['start'] as String),
end: DateTime.parse(json['end'] as String),
isAllDay: json['isAllDay'] as bool,
);
$checkedCreate('_MarianumDate', json, ($checkedConvert) {
final val = _MarianumDate(
uid: $checkedConvert('uid', (v) => v as String),
title: $checkedConvert('title', (v) => v as String),
description: $checkedConvert('description', (v) => v as String?),
start: $checkedConvert('start', (v) => DateTime.parse(v as String)),
end: $checkedConvert('end', (v) => DateTime.parse(v as String)),
isAllDay: $checkedConvert('isAllDay', (v) => v as bool),
);
return val;
});
Map<String, dynamic> _$MarianumDateToJson(_MarianumDate instance) =>
<String, dynamic>{
@@ -8,36 +8,49 @@ part of 'marianum_message_state.dart';
_MarianumMessageState _$MarianumMessageStateFromJson(
Map<String, dynamic> json,
) => _MarianumMessageState(
messageList: MarianumMessageList.fromJson(
json['messageList'] as Map<String, dynamic>,
),
);
) => $checkedCreate('_MarianumMessageState', json, ($checkedConvert) {
final val = _MarianumMessageState(
messageList: $checkedConvert(
'messageList',
(v) => MarianumMessageList.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$MarianumMessageStateToJson(
_MarianumMessageState instance,
) => <String, dynamic>{'messageList': instance.messageList};
_MarianumMessageList _$MarianumMessageListFromJson(Map<String, dynamic> json) =>
_MarianumMessageList(
base: json['base'] as String,
messages: (json['messages'] as List<dynamic>)
.map((e) => MarianumMessage.fromJson(e as Map<String, dynamic>))
.toList(),
);
$checkedCreate('_MarianumMessageList', json, ($checkedConvert) {
final val = _MarianumMessageList(
base: $checkedConvert('base', (v) => v as String),
messages: $checkedConvert(
'messages',
(v) => (v as List<dynamic>)
.map((e) => MarianumMessage.fromJson(e as Map<String, dynamic>))
.toList(),
),
);
return val;
});
Map<String, dynamic> _$MarianumMessageListToJson(
_MarianumMessageList instance,
) => <String, dynamic>{'base': instance.base, 'messages': instance.messages};
_MarianumMessage _$MarianumMessageFromJson(Map<String, dynamic> json) =>
_MarianumMessage(
id: json['id'] as String? ?? '',
name: json['name'] as String,
date: json['date'] as String,
description: json['description'] as String? ?? '',
url: json['url'] as String,
);
$checkedCreate('_MarianumMessage', json, ($checkedConvert) {
final val = _MarianumMessage(
id: $checkedConvert('id', (v) => v as String? ?? ''),
name: $checkedConvert('name', (v) => v as String),
date: $checkedConvert('date', (v) => v as String),
description: $checkedConvert('description', (v) => v as String? ?? ''),
url: $checkedConvert('url', (v) => v as String),
);
return val;
});
Map<String, dynamic> _$MarianumMessageToJson(_MarianumMessage instance) =>
<String, dynamic>{
@@ -8,24 +8,56 @@ part of 'nextcloud_capabilities_state.dart';
_NextcloudCapabilitiesState _$NextcloudCapabilitiesStateFromJson(
Map<String, dynamic> json,
) => _NextcloudCapabilitiesState(
apiEnabled: json['apiEnabled'] as bool? ?? false,
publicEnabled: json['publicEnabled'] as bool? ?? false,
publicMultipleLinks: json['publicMultipleLinks'] as bool? ?? false,
publicUploadEnabled: json['publicUploadEnabled'] as bool? ?? false,
publicPasswordEnforced: json['publicPasswordEnforced'] as bool? ?? false,
publicExpireEnabled: json['publicExpireEnabled'] as bool? ?? false,
publicExpireDays: (json['publicExpireDays'] as num?)?.toInt(),
publicExpireEnforced: json['publicExpireEnforced'] as bool? ?? false,
groupEnabled: json['groupEnabled'] as bool? ?? false,
resharing: json['resharing'] as bool? ?? false,
passwordMinLength: (json['passwordMinLength'] as num?)?.toInt(),
passwordEnforceUpperLower:
json['passwordEnforceUpperLower'] as bool? ?? false,
passwordEnforceNumeric: json['passwordEnforceNumeric'] as bool? ?? false,
passwordEnforceSpecial: json['passwordEnforceSpecial'] as bool? ?? false,
loaded: json['loaded'] as bool? ?? false,
);
) => $checkedCreate('_NextcloudCapabilitiesState', json, ($checkedConvert) {
final val = _NextcloudCapabilitiesState(
apiEnabled: $checkedConvert('apiEnabled', (v) => v as bool? ?? false),
publicEnabled: $checkedConvert('publicEnabled', (v) => v as bool? ?? false),
publicMultipleLinks: $checkedConvert(
'publicMultipleLinks',
(v) => v as bool? ?? false,
),
publicUploadEnabled: $checkedConvert(
'publicUploadEnabled',
(v) => v as bool? ?? false,
),
publicPasswordEnforced: $checkedConvert(
'publicPasswordEnforced',
(v) => v as bool? ?? false,
),
publicExpireEnabled: $checkedConvert(
'publicExpireEnabled',
(v) => v as bool? ?? false,
),
publicExpireDays: $checkedConvert(
'publicExpireDays',
(v) => (v as num?)?.toInt(),
),
publicExpireEnforced: $checkedConvert(
'publicExpireEnforced',
(v) => v as bool? ?? false,
),
groupEnabled: $checkedConvert('groupEnabled', (v) => v as bool? ?? false),
resharing: $checkedConvert('resharing', (v) => v as bool? ?? false),
passwordMinLength: $checkedConvert(
'passwordMinLength',
(v) => (v as num?)?.toInt(),
),
passwordEnforceUpperLower: $checkedConvert(
'passwordEnforceUpperLower',
(v) => v as bool? ?? false,
),
passwordEnforceNumeric: $checkedConvert(
'passwordEnforceNumeric',
(v) => v as bool? ?? false,
),
passwordEnforceSpecial: $checkedConvert(
'passwordEnforceSpecial',
(v) => v as bool? ?? false,
),
loaded: $checkedConvert('loaded', (v) => v as bool? ?? false),
);
return val;
});
Map<String, dynamic> _$NextcloudCapabilitiesStateToJson(
_NextcloudCapabilitiesState instance,
@@ -7,11 +7,17 @@ part of 'ticker_page_state.dart';
// **************************************************************************
_TickerPageState _$TickerPageStateFromJson(Map<String, dynamic> json) =>
_TickerPageState(
page: json['page'] == null
? null
: TickerPageResponse.fromJson(json['page'] as Map<String, dynamic>),
);
$checkedCreate('_TickerPageState', json, ($checkedConvert) {
final val = _TickerPageState(
page: $checkedConvert(
'page',
(v) => v == null
? null
: TickerPageResponse.fromJson(v as Map<String, dynamic>),
),
);
return val;
});
Map<String, dynamic> _$TickerPageStateToJson(_TickerPageState instance) =>
<String, dynamic>{'page': instance.page};
@@ -6,15 +6,25 @@ part of 'ticker_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_TickerState _$TickerStateFromJson(Map<String, dynamic> json) => _TickerState(
ticker: json['ticker'] == null
? null
: TickerResponse.fromJson(json['ticker'] as Map<String, dynamic>),
nav: json['nav'] == null
? null
: TickerNavResponse.fromJson(json['nav'] as Map<String, dynamic>),
selectedSlug: json['selectedSlug'] as String?,
);
_TickerState _$TickerStateFromJson(Map<String, dynamic> json) =>
$checkedCreate('_TickerState', json, ($checkedConvert) {
final val = _TickerState(
ticker: $checkedConvert(
'ticker',
(v) => v == null
? null
: TickerResponse.fromJson(v as Map<String, dynamic>),
),
nav: $checkedConvert(
'nav',
(v) => v == null
? null
: TickerNavResponse.fromJson(v as Map<String, dynamic>),
),
selectedSlug: $checkedConvert('selectedSlug', (v) => v as String?),
);
return val;
});
Map<String, dynamic> _$TickerStateToJson(_TickerState instance) =>
<String, dynamic>{
@@ -6,56 +6,74 @@ part of 'timetable_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_TimetableState _$TimetableStateFromJson(Map<String, dynamic> json) =>
_TimetableState(
weekCache:
(json['weekCache'] as Map<String, dynamic>?)?.map(
_TimetableState _$TimetableStateFromJson(
Map<String, dynamic> json,
) => $checkedCreate('_TimetableState', json, ($checkedConvert) {
final val = _TimetableState(
weekCache: $checkedConvert(
'weekCache',
(v) =>
(v as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
k,
TimetableGetWeekResponse.fromJson(e as Map<String, dynamic>),
),
) ??
const <String, TimetableGetWeekResponse>{},
rooms: json['rooms'] == null
),
rooms: $checkedConvert(
'rooms',
(v) => v == null
? null
: TimetableGetRoomsResponse.fromJson(
json['rooms'] as Map<String, dynamic>,
),
subjects: json['subjects'] == null
: TimetableGetRoomsResponse.fromJson(v as Map<String, dynamic>),
),
subjects: $checkedConvert(
'subjects',
(v) => v == null
? null
: TimetableGetSubjectsResponse.fromJson(
json['subjects'] as Map<String, dynamic>,
),
schoolHolidays: json['schoolHolidays'] == null
: TimetableGetSubjectsResponse.fromJson(v as Map<String, dynamic>),
),
schoolHolidays: $checkedConvert(
'schoolHolidays',
(v) => v == null
? null
: TimetableGetHolidaysResponse.fromJson(
json['schoolHolidays'] as Map<String, dynamic>,
),
schoolyear: json['schoolyear'] == null
: TimetableGetHolidaysResponse.fromJson(v as Map<String, dynamic>),
),
schoolyear: $checkedConvert(
'schoolyear',
(v) => v == null
? null
: TimetableGetSchoolyearResponse.fromJson(
json['schoolyear'] as Map<String, dynamic>,
),
timegrid: json['timegrid'] == null
: TimetableGetSchoolyearResponse.fromJson(v as Map<String, dynamic>),
),
timegrid: $checkedConvert(
'timegrid',
(v) => v == null
? null
: TimetableGetTimegridResponse.fromJson(
json['timegrid'] as Map<String, dynamic>,
),
customEvents: json['customEvents'] == null
: TimetableGetTimegridResponse.fromJson(v as Map<String, dynamic>),
),
customEvents: $checkedConvert(
'customEvents',
(v) => v == null
? null
: GetCustomTimetableEventResponse.fromJson(
json['customEvents'] as Map<String, dynamic>,
),
startDate: DateTime.parse(json['startDate'] as String),
endDate: DateTime.parse(json['endDate'] as String),
dataVersion: (json['dataVersion'] as num?)?.toInt() ?? 0,
accessibleStartDate: json['accessibleStartDate'] == null
? null
: DateTime.parse(json['accessibleStartDate'] as String),
accessibleEndDate: json['accessibleEndDate'] == null
? null
: DateTime.parse(json['accessibleEndDate'] as String),
);
: GetCustomTimetableEventResponse.fromJson(v as Map<String, dynamic>),
),
startDate: $checkedConvert('startDate', (v) => DateTime.parse(v as String)),
endDate: $checkedConvert('endDate', (v) => DateTime.parse(v as String)),
dataVersion: $checkedConvert(
'dataVersion',
(v) => (v as num?)?.toInt() ?? 0,
),
accessibleStartDate: $checkedConvert(
'accessibleStartDate',
(v) => v == null ? null : DateTime.parse(v as String),
),
accessibleEndDate: $checkedConvert(
'accessibleEndDate',
(v) => v == null ? null : DateTime.parse(v as String),
),
);
return val;
});
Map<String, dynamic> _$TimetableStateToJson(_TimetableState instance) =>
<String, dynamic>{
Loaded 100 of 185 files, more files were not shown because too many files have changed in this diff. Show more