Compare commits
108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f572f5b462
|
|||
|
a02f2fe3c6
|
|||
|
bc4fddc164
|
|||
|
3d7e7951a2
|
|||
|
41df5f3907
|
|||
|
6487a1ff65
|
|||
|
2e90d243de
|
|||
|
|
1eca95fa78 | ||
|
|
96b87f75f9 | ||
|
e832f3fd93
|
|||
|
aeea90226a
|
|||
|
c36a5eaa73
|
|||
|
6840054a41
|
|||
|
6a0f351114
|
|||
|
c5d667ecf3
|
|||
|
09767e113f
|
|||
|
9ca5c63afd
|
|||
|
fd3c08e054
|
|||
|
72f23a504e
|
|||
|
4898825124
|
|||
|
387d19d85c
|
|||
|
f7b991663f
|
|||
|
3a57f4265b
|
|||
|
d1ee2e5160
|
|||
|
bcd6753ed2
|
|||
|
321ea4458b
|
|||
|
8ad31dad58
|
|||
|
269c17d068
|
|||
|
a9abd777e1
|
|||
|
e24b1fc135
|
|||
|
d5feea52fa
|
|||
|
491252bba9
|
|||
|
4f569fbefd
|
|||
|
476da28b5e
|
|||
|
d639df7623
|
|||
|
e1fc5311d2
|
|||
|
d0e4fde6c2
|
|||
|
9437339b0f
|
|||
|
dd7696132c
|
|||
|
95daa3c28d
|
|||
|
ac5193e1f6
|
|||
|
0328a7736a
|
|||
|
03b332f677
|
|||
|
91b2797fb9
|
|||
|
b66640c6df
|
|||
|
4ac10706ae
|
|||
|
bf2844162d
|
|||
|
23c11a2fbd
|
|||
|
2b99f54bc5
|
|||
|
ab2fc1013b
|
|||
|
|
9a41ff26ef | ||
|
63a55658ab
|
|||
|
|
3122ae4cc2 | ||
|
00e063e99f
|
|||
|
532bb30c6a
|
|||
|
d8c33b576f
|
|||
|
a984cba2fa
|
|||
|
b7d5aa5dfb
|
|||
|
826238a374
|
|||
|
88c4d648d5
|
|||
|
bf59108569
|
|||
|
eec181da55
|
|||
|
c93b543da9
|
|||
|
2fd93246c7
|
|||
|
1b2620e957
|
|||
|
d443343052
|
|||
|
9957905212
|
|||
|
e36d694397
|
|||
|
3847581f1f
|
|||
|
64903bf1f3
|
|||
|
a449fbb58a
|
|||
|
6a4a50b81a
|
|||
|
5e328b736f
|
|||
|
d44e481a0d
|
|||
|
e6fb38572c
|
|||
|
64c5ee0fe9
|
|||
|
9cba568e47
|
|||
|
38fc4e969f
|
|||
|
0e100c3e64
|
|||
|
735724ae4d
|
|||
|
6c31337fbc
|
|||
|
d2806fdc3a
|
|||
|
4ebbda1b14
|
|||
|
3e7007f58f
|
|||
|
d96629a7f1
|
|||
|
1b6ccccf32
|
|||
|
910dafaa43
|
|||
|
c6fd342072
|
|||
|
757f1b880c
|
|||
|
67805b413e
|
|||
|
e1eb0f705e
|
|||
|
1e8e785e5f
|
|||
|
d9dfea6b8b
|
|||
|
d29f0b1170
|
|||
|
479a79c7f6
|
|||
|
1a74f2b3e9
|
|||
|
97a5e951e1
|
|||
|
9071ac44fe
|
|||
|
6abee8d8bd
|
|||
|
8cf03683dc
|
|||
|
f34d80b7d4
|
|||
|
b6d7e52148
|
|||
|
978b7b32fd
|
|||
|
35a9c9ff4b
|
|||
|
e5cb296367
|
|||
|
cf3a2b6340
|
|||
|
f568baf14d
|
|||
|
703335429a
|
@@ -17,6 +17,7 @@
|
|||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||||
|
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="Solian"
|
android:label="Solian"
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import io.flutter.embedding.android.FlutterActivity
|
|||||||
import io.flutter.embedding.engine.FlutterEngine
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
import io.flutter.plugin.common.MethodChannel
|
import io.flutter.plugin.common.MethodChannel
|
||||||
import io.flutter.plugins.sharedpreferences.LegacySharedPreferencesPlugin
|
import io.flutter.plugins.sharedpreferences.LegacySharedPreferencesPlugin
|
||||||
|
import io.flutter.embedding.android.FlutterFragmentActivity
|
||||||
|
|
||||||
class MainActivity : FlutterActivity()
|
class MainActivity : FlutterFragmentActivity()
|
||||||
{
|
{
|
||||||
private val CHANNEL = "dev.solsynth.solian/notifications"
|
private val CHANNEL = "dev.solsynth.solian/notifications"
|
||||||
|
|
||||||
|
|||||||
BIN
assets/audio/messages.mp3
Normal file
BIN
assets/audio/messages.mp3
Normal file
Binary file not shown.
BIN
assets/audio/notification.mp3
Normal file
BIN
assets/audio/notification.mp3
Normal file
Binary file not shown.
@@ -283,14 +283,17 @@
|
|||||||
"relationshipStatusBlocked": "Blocked",
|
"relationshipStatusBlocked": "Blocked",
|
||||||
"blockUser": "Block User",
|
"blockUser": "Block User",
|
||||||
"unblockUser": "Unblock User",
|
"unblockUser": "Unblock User",
|
||||||
|
"forgotRelationship": "Forgot Relationship",
|
||||||
|
"forgotRelationshipConfirm": "Are you sure you want to forget your relationship with {}? This only changes your relationship status with she / her, she / her might not able to see your friend only posts and use other friend only features. But they can send the friend request again.",
|
||||||
|
"relationshipDeleted": "Relationship deleted",
|
||||||
"friendRequestAccepted": "Accepted friend request from {}",
|
"friendRequestAccepted": "Accepted friend request from {}",
|
||||||
"friendRequestDeclined": "Declined friend request from {}",
|
"friendRequestDeclined": "Declined friend request from {}",
|
||||||
"requestExpiredIn": "Expired in {}",
|
"requestExpiredIn": "Expired in {}",
|
||||||
"friendSentRequest": "Sent Friend Requests",
|
"friendRequests": "Friend Requests",
|
||||||
"friendSentRequestEmpty": "No sent friend requests",
|
"friendRequestsEmpty": "No related friend requests",
|
||||||
"friendSentRequestHint": {
|
"friendRequestsHint": {
|
||||||
"one": "{} friend request sent",
|
"one": "{} friend request",
|
||||||
"other": "{} friend requests sent"
|
"other": "{} friend requests"
|
||||||
},
|
},
|
||||||
"levelingProgress": "Leveling Progress",
|
"levelingProgress": "Leveling Progress",
|
||||||
"levelingProgressExperience": "{} EXP",
|
"levelingProgressExperience": "{} EXP",
|
||||||
@@ -1357,6 +1360,32 @@
|
|||||||
"orCreateWith": "Or\ncreate with",
|
"orCreateWith": "Or\ncreate with",
|
||||||
"unindexedFiles": "Unindexed files",
|
"unindexedFiles": "Unindexed files",
|
||||||
"folder": "Folder",
|
"folder": "Folder",
|
||||||
|
"rootDirectory": "Root Directory",
|
||||||
|
"pathSeparator": " / ",
|
||||||
|
"selectAll": "Select All",
|
||||||
|
"deselectAll": "Deselect All",
|
||||||
|
"createDirectory": "Create Directory",
|
||||||
|
"thisDirectoryIsEmpty": "This directory is empty",
|
||||||
|
"emptyDirectoryHint": "Upload files or create subdirectories to populate this path.\nDirectories are created implicitly when you upload files to them.",
|
||||||
|
"noUnindexedFiles": "No unindexed files",
|
||||||
|
"noUnindexedFilesHint": "All files have been assigned to paths.\nFiles without paths will appear here.",
|
||||||
|
"clearAllRecycledFiles": "Clear All Recycled Files",
|
||||||
|
"clearRecycledFilesDescription": "Permanently delete all marked recycled files to free up space.",
|
||||||
|
"allFiles": "All files",
|
||||||
|
"confirmDeleteSelectedFiles": "Are you sure you want to delete the selected files?",
|
||||||
|
"deleteSelectedFiles": "Delete Selected Files",
|
||||||
|
"confirmClearRecycledFiles": "Are you sure you want to clear all recycled files?",
|
||||||
|
"clearRecycledFiles": "Clear Recycled Files",
|
||||||
|
"failedToUploadFile": "Failed to upload file: {}",
|
||||||
|
"deletedFilesCount": "Deleted {} files.",
|
||||||
|
"failedToDeleteSelectedFiles": "Failed to delete selected files.",
|
||||||
|
"clearedRecycledFilesCount": "Cleared {} recycled files.",
|
||||||
|
"failedToClearRecycledFiles": "Failed to clear recycled files.",
|
||||||
|
"root": "Root",
|
||||||
|
"searchFiles": "Search files...",
|
||||||
|
"selectedCount": "{} selected",
|
||||||
|
"filesSelected": "{} files selected",
|
||||||
|
"fileSelected": "{} file selected",
|
||||||
"clearCompleted": "Clear Completed",
|
"clearCompleted": "Clear Completed",
|
||||||
"uploadSuccess": "Upload successful!",
|
"uploadSuccess": "Upload successful!",
|
||||||
"wouldYouLikeToViewFile": "Would you like to view the file?",
|
"wouldYouLikeToViewFile": "Would you like to view the file?",
|
||||||
@@ -1584,5 +1613,44 @@
|
|||||||
"fediversePostDescribe": "Post from the Fediverse Network",
|
"fediversePostDescribe": "Post from the Fediverse Network",
|
||||||
"settingsShowFediverseContent": "Show Fediverse Content",
|
"settingsShowFediverseContent": "Show Fediverse Content",
|
||||||
"universalSearch": "Universal Search",
|
"universalSearch": "Universal Search",
|
||||||
"universalSearchDescription": "Search content across the Solar Network and the fediverse network."
|
"universalSearchDescription": "Search content across the Solar Network and the fediverse network.",
|
||||||
|
"tasks": "Tasks",
|
||||||
|
"tasksCount": {
|
||||||
|
"one": "{} task",
|
||||||
|
"other": "{} tasks"
|
||||||
|
},
|
||||||
|
"setAsThumbnail": "Set as thumbnail",
|
||||||
|
"unsetAsThumbnail": "Unset as thumbnail",
|
||||||
|
"sidebar": "Sidebar",
|
||||||
|
"dropFilesHere": "Drop your files here",
|
||||||
|
"dragAndDropToAttach": "Drag your files here to attach it",
|
||||||
|
"customize": "Customize",
|
||||||
|
"dashboardCustomizeTitle": "Customize Dashboard",
|
||||||
|
"dashboardTabVertical": "Vertical",
|
||||||
|
"dashboardTabHorizontal": "Horizontal",
|
||||||
|
"dashboardLayoutVertical": "Vertical Layout",
|
||||||
|
"dashboardLayoutHorizontal": "Horizontal Layout",
|
||||||
|
"dashboardAvailableCards": "Available Cards",
|
||||||
|
"dashboardDisplaySettings": "Display Settings",
|
||||||
|
"dashboardShowSearchBar": "Show Search Bar",
|
||||||
|
"dashboardShowClockAndCountdown": "Show Clock and Countdown",
|
||||||
|
"dashboardResetToDefaults": "Reset to Defaults",
|
||||||
|
"dashboardResetToDefaultsSubtitle": "Restore default dashboard layout and settings",
|
||||||
|
"dashboardResetConfirmMessage": "This will restore the dashboard to its default layout and settings. This action cannot be undone.",
|
||||||
|
"dashboardResetConfirmTitle": "Reset Dashboard",
|
||||||
|
"dashboardCardCheckIn": "Check In",
|
||||||
|
"dashboardCardFortuneGraph": "Fortune Graph",
|
||||||
|
"dashboardCardFortune": "Fortune",
|
||||||
|
"dashboardCardFeaturedPosts": "Featured Posts",
|
||||||
|
"dashboardCardFriends": "Friends",
|
||||||
|
"dashboardCardNotifications": "Notifications",
|
||||||
|
"dashboardCardChats": "Chats",
|
||||||
|
"dashboardCardActivityColumn": "Activity Column",
|
||||||
|
"dashboardCardPostsColumn": "Posts Column",
|
||||||
|
"dashboardCardSocialColumn": "Social Column",
|
||||||
|
"dashboardCardChatsColumn": "Chats Column",
|
||||||
|
"dashboardCardActivityColumnDescription": "Check In, Fortune Graph & Fortune",
|
||||||
|
"dashboardCardPostsColumnDescription": "Featured Posts",
|
||||||
|
"dashboardCardSocialColumnDescription": "Friends & Notifications",
|
||||||
|
"dashboardCardChatsColumnDescription": "Recent Chats"
|
||||||
}
|
}
|
||||||
@@ -265,6 +265,9 @@
|
|||||||
"relationshipStatusBlocked": "Blocked",
|
"relationshipStatusBlocked": "Blocked",
|
||||||
"blockUser": "Block User",
|
"blockUser": "Block User",
|
||||||
"unblockUser": "Unblock User",
|
"unblockUser": "Unblock User",
|
||||||
|
"forgotRelationship": "Olvidar Relación",
|
||||||
|
"forgotRelationshipConfirm": "¿Estás seguro de que quieres olvidar tu relación con {}?",
|
||||||
|
"relationshipDeleted": "Relación eliminada",
|
||||||
"friendRequestAccepted": "Accepted friend request from {}",
|
"friendRequestAccepted": "Accepted friend request from {}",
|
||||||
"friendRequestDeclined": "Declined friend request from {}",
|
"friendRequestDeclined": "Declined friend request from {}",
|
||||||
"requestExpiredIn": "Expired in {}",
|
"requestExpiredIn": "Expired in {}",
|
||||||
|
|||||||
@@ -265,6 +265,9 @@
|
|||||||
"relationshipStatusBlocked": "Blocked",
|
"relationshipStatusBlocked": "Blocked",
|
||||||
"blockUser": "Block User",
|
"blockUser": "Block User",
|
||||||
"unblockUser": "Unblock User",
|
"unblockUser": "Unblock User",
|
||||||
|
"forgotRelationship": "関係を忘れる",
|
||||||
|
"forgotRelationshipConfirm": "{} との関係を忘れてもよろしいですか?",
|
||||||
|
"relationshipDeleted": "関係が削除されました",
|
||||||
"friendRequestAccepted": "Accepted friend request from {}",
|
"friendRequestAccepted": "Accepted friend request from {}",
|
||||||
"friendRequestDeclined": "Declined friend request from {}",
|
"friendRequestDeclined": "Declined friend request from {}",
|
||||||
"requestExpiredIn": "Expired in {}",
|
"requestExpiredIn": "Expired in {}",
|
||||||
|
|||||||
@@ -265,6 +265,9 @@
|
|||||||
"relationshipStatusBlocked": "Blocked",
|
"relationshipStatusBlocked": "Blocked",
|
||||||
"blockUser": "Block User",
|
"blockUser": "Block User",
|
||||||
"unblockUser": "Unblock User",
|
"unblockUser": "Unblock User",
|
||||||
|
"forgotRelationship": "관계 잊기",
|
||||||
|
"forgotRelationshipConfirm": "{}와의 관계를 잊으시겠습니까?",
|
||||||
|
"relationshipDeleted": "관계가 삭제되었습니다",
|
||||||
"friendRequestAccepted": "Accepted friend request from {}",
|
"friendRequestAccepted": "Accepted friend request from {}",
|
||||||
"friendRequestDeclined": "Declined friend request from {}",
|
"friendRequestDeclined": "Declined friend request from {}",
|
||||||
"requestExpiredIn": "Expired in {}",
|
"requestExpiredIn": "Expired in {}",
|
||||||
|
|||||||
@@ -265,6 +265,9 @@
|
|||||||
"relationshipStatusBlocked": "已屏蔽",
|
"relationshipStatusBlocked": "已屏蔽",
|
||||||
"blockUser": "屏蔽用户",
|
"blockUser": "屏蔽用户",
|
||||||
"unblockUser": "解除屏蔽用户",
|
"unblockUser": "解除屏蔽用户",
|
||||||
|
"forgotRelationship": "忘记关系",
|
||||||
|
"forgotRelationshipConfirm": "确定要忘记与 {} 的关系吗?这只会改变您对他/她的关系,他可能看到不到您的友限帖,但是您仍然可以看到他/她的。他/她也可以再次提出好友申请。",
|
||||||
|
"relationshipDeleted": "关系已删除",
|
||||||
"friendRequestAccepted": "已接受 {} 的好友请求",
|
"friendRequestAccepted": "已接受 {} 的好友请求",
|
||||||
"friendRequestDeclined": "已拒绝 {} 的好友请求",
|
"friendRequestDeclined": "已拒绝 {} 的好友请求",
|
||||||
"requestExpiredIn": "{} 后过期",
|
"requestExpiredIn": "{} 后过期",
|
||||||
@@ -455,6 +458,7 @@
|
|||||||
"checkInResultT2": "中平",
|
"checkInResultT2": "中平",
|
||||||
"checkInResultT3": "吉",
|
"checkInResultT3": "吉",
|
||||||
"checkInResultT4": "大吉",
|
"checkInResultT4": "大吉",
|
||||||
|
"checkInResultT5": "特殊",
|
||||||
"accountProfileView": "查看个人资料",
|
"accountProfileView": "查看个人资料",
|
||||||
"unspecified": "未指定",
|
"unspecified": "未指定",
|
||||||
"added": "已添加",
|
"added": "已添加",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -265,6 +265,9 @@
|
|||||||
"relationshipStatusBlocked": "已屏蔽",
|
"relationshipStatusBlocked": "已屏蔽",
|
||||||
"blockUser": "屏蔽用戶",
|
"blockUser": "屏蔽用戶",
|
||||||
"unblockUser": "解除屏蔽用戶",
|
"unblockUser": "解除屏蔽用戶",
|
||||||
|
"forgotRelationship": "忘記關係",
|
||||||
|
"forgotRelationshipConfirm": "確定要忘記與 {} 的關係嗎?",
|
||||||
|
"relationshipDeleted": "關係已刪除",
|
||||||
"friendRequestAccepted": "已接受 {} 的好友請求",
|
"friendRequestAccepted": "已接受 {} 的好友請求",
|
||||||
"friendRequestDeclined": "已拒絕 {} 的好友請求",
|
"friendRequestDeclined": "已拒絕 {} 的好友請求",
|
||||||
"requestExpiredIn": "{} 後過期",
|
"requestExpiredIn": "{} 後過期",
|
||||||
@@ -455,6 +458,7 @@
|
|||||||
"checkInResultT2": "中平",
|
"checkInResultT2": "中平",
|
||||||
"checkInResultT3": "吉",
|
"checkInResultT3": "吉",
|
||||||
"checkInResultT4": "大吉",
|
"checkInResultT4": "大吉",
|
||||||
|
"checkInResultT5": "特殊",
|
||||||
"accountProfileView": "查看個人資料",
|
"accountProfileView": "查看個人資料",
|
||||||
"unspecified": "未指定",
|
"unspecified": "未指定",
|
||||||
"added": "已添加",
|
"added": "已添加",
|
||||||
|
|||||||
BIN
assets/midi/never-gonna-give-you-up.mid
Normal file
BIN
assets/midi/never-gonna-give-you-up.mid
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
platform :ios, '15.0'
|
platform :ios, '16.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- Alamofire (5.11.0)
|
- Alamofire (5.11.0)
|
||||||
|
- audio_session (0.0.1):
|
||||||
|
- Flutter
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- croppy (0.0.1):
|
- croppy (0.0.1):
|
||||||
@@ -217,6 +219,9 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- irondash_engine_context (0.0.1):
|
- irondash_engine_context (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- just_audio (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- KeychainAccess (4.2.2)
|
- KeychainAccess (4.2.2)
|
||||||
- Kingfisher (8.6.2)
|
- Kingfisher (8.6.2)
|
||||||
- KingfisherWebP (1.7.2):
|
- KingfisherWebP (1.7.2):
|
||||||
@@ -257,9 +262,6 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- pasteboard (0.0.1):
|
- pasteboard (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- path_provider_foundation (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- FlutterMacOS
|
|
||||||
- permission_handler_apple (9.3.0):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- pointer_interceptor_ios (0.0.1):
|
- pointer_interceptor_ios (0.0.1):
|
||||||
@@ -269,6 +271,8 @@ PODS:
|
|||||||
- PromisesObjC (= 2.4.0)
|
- PromisesObjC (= 2.4.0)
|
||||||
- protocol_handler_ios (0.0.1):
|
- protocol_handler_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- quick_actions_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
- receive_sharing_intent (1.8.1):
|
- receive_sharing_intent (1.8.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- record_ios (1.1.0):
|
- record_ios (1.1.0):
|
||||||
@@ -320,12 +324,16 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- video_thumbnail (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- libwebp
|
||||||
- wakelock_plus (0.0.1):
|
- wakelock_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- WebRTC-SDK (137.7151.04)
|
- WebRTC-SDK (137.7151.04)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- Alamofire
|
- Alamofire
|
||||||
|
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
- croppy (from `.symlinks/plugins/croppy/ios`)
|
- croppy (from `.symlinks/plugins/croppy/ios`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
@@ -349,6 +357,7 @@ DEPENDENCIES:
|
|||||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||||
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
|
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
|
||||||
- irondash_engine_context (from `.symlinks/plugins/irondash_engine_context/ios`)
|
- irondash_engine_context (from `.symlinks/plugins/irondash_engine_context/ios`)
|
||||||
|
- just_audio (from `.symlinks/plugins/just_audio/darwin`)
|
||||||
- Kingfisher (~> 8.0)
|
- Kingfisher (~> 8.0)
|
||||||
- KingfisherWebP
|
- KingfisherWebP
|
||||||
- livekit_client (from `.symlinks/plugins/livekit_client/ios`)
|
- livekit_client (from `.symlinks/plugins/livekit_client/ios`)
|
||||||
@@ -358,10 +367,10 @@ DEPENDENCIES:
|
|||||||
- native_exif (from `.symlinks/plugins/native_exif/ios`)
|
- native_exif (from `.symlinks/plugins/native_exif/ios`)
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
||||||
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
||||||
|
- quick_actions_ios (from `.symlinks/plugins/quick_actions_ios/ios`)
|
||||||
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
|
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
|
||||||
- record_ios (from `.symlinks/plugins/record_ios/ios`)
|
- record_ios (from `.symlinks/plugins/record_ios/ios`)
|
||||||
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
|
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
|
||||||
@@ -373,6 +382,7 @@ DEPENDENCIES:
|
|||||||
- super_native_extensions (from `.symlinks/plugins/super_native_extensions/ios`)
|
- super_native_extensions (from `.symlinks/plugins/super_native_extensions/ios`)
|
||||||
- syncfusion_flutter_pdfviewer (from `.symlinks/plugins/syncfusion_flutter_pdfviewer/ios`)
|
- syncfusion_flutter_pdfviewer (from `.symlinks/plugins/syncfusion_flutter_pdfviewer/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
- video_thumbnail (from `.symlinks/plugins/video_thumbnail/ios`)
|
||||||
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
|
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
@@ -408,6 +418,8 @@ SPEC REPOS:
|
|||||||
- WebRTC-SDK
|
- WebRTC-SDK
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
|
audio_session:
|
||||||
|
:path: ".symlinks/plugins/audio_session/ios"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
croppy:
|
croppy:
|
||||||
@@ -454,6 +466,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/in_app_review/ios"
|
:path: ".symlinks/plugins/in_app_review/ios"
|
||||||
irondash_engine_context:
|
irondash_engine_context:
|
||||||
:path: ".symlinks/plugins/irondash_engine_context/ios"
|
:path: ".symlinks/plugins/irondash_engine_context/ios"
|
||||||
|
just_audio:
|
||||||
|
:path: ".symlinks/plugins/just_audio/darwin"
|
||||||
livekit_client:
|
livekit_client:
|
||||||
:path: ".symlinks/plugins/livekit_client/ios"
|
:path: ".symlinks/plugins/livekit_client/ios"
|
||||||
local_auth_darwin:
|
local_auth_darwin:
|
||||||
@@ -468,14 +482,14 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||||
pasteboard:
|
pasteboard:
|
||||||
:path: ".symlinks/plugins/pasteboard/ios"
|
:path: ".symlinks/plugins/pasteboard/ios"
|
||||||
path_provider_foundation:
|
|
||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
pointer_interceptor_ios:
|
pointer_interceptor_ios:
|
||||||
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
||||||
protocol_handler_ios:
|
protocol_handler_ios:
|
||||||
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
||||||
|
quick_actions_ios:
|
||||||
|
:path: ".symlinks/plugins/quick_actions_ios/ios"
|
||||||
receive_sharing_intent:
|
receive_sharing_intent:
|
||||||
:path: ".symlinks/plugins/receive_sharing_intent/ios"
|
:path: ".symlinks/plugins/receive_sharing_intent/ios"
|
||||||
record_ios:
|
record_ios:
|
||||||
@@ -498,11 +512,14 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/syncfusion_flutter_pdfviewer/ios"
|
:path: ".symlinks/plugins/syncfusion_flutter_pdfviewer/ios"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
video_thumbnail:
|
||||||
|
:path: ".symlinks/plugins/video_thumbnail/ios"
|
||||||
wakelock_plus:
|
wakelock_plus:
|
||||||
:path: ".symlinks/plugins/wakelock_plus/ios"
|
:path: ".symlinks/plugins/wakelock_plus/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
Alamofire: bd5e7b23a1a750975288482c1831d71e74415f86
|
Alamofire: bd5e7b23a1a750975288482c1831d71e74415f86
|
||||||
|
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
|
||||||
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
|
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
|
||||||
croppy: 979e8ddc254f4642bffe7d52dc7193354b27ba30
|
croppy: 979e8ddc254f4642bffe7d52dc7193354b27ba30
|
||||||
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
|
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
|
||||||
@@ -542,6 +559,7 @@ SPEC CHECKSUMS:
|
|||||||
image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326
|
image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326
|
||||||
in_app_review: 7dd1ea365263f834b8464673f9df72c80c17c937
|
in_app_review: 7dd1ea365263f834b8464673f9df72c80c17c937
|
||||||
irondash_engine_context: 8e58ca8e0212ee9d1c7dc6a42121849986c88486
|
irondash_engine_context: 8e58ca8e0212ee9d1c7dc6a42121849986c88486
|
||||||
|
just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed
|
||||||
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
|
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
|
||||||
Kingfisher: 23d18f54677d973b713e54ce6a8f5eef6e7056ba
|
Kingfisher: 23d18f54677d973b713e54ce6a8f5eef6e7056ba
|
||||||
KingfisherWebP: 38b9721821947f547afb78f933f75f4f9e0ae402
|
KingfisherWebP: 38b9721821947f547afb78f933f75f4f9e0ae402
|
||||||
@@ -555,12 +573,12 @@ SPEC CHECKSUMS:
|
|||||||
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
|
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
|
||||||
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
||||||
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
||||||
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
|
|
||||||
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
|
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
|
||||||
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
|
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
||||||
protocol_handler_ios: 59f23ee71f3ec602d67902ca7f669a80957888d5
|
protocol_handler_ios: 59f23ee71f3ec602d67902ca7f669a80957888d5
|
||||||
|
quick_actions_ios: 500fcc11711d9f646739093395c4ae8eec25f779
|
||||||
receive_sharing_intent: 222384f00ffe7e952bbfabaa9e3967cb87e5fe00
|
receive_sharing_intent: 222384f00ffe7e952bbfabaa9e3967cb87e5fe00
|
||||||
record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374
|
record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374
|
||||||
SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838
|
SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838
|
||||||
@@ -575,9 +593,10 @@ SPEC CHECKSUMS:
|
|||||||
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
||||||
syncfusion_flutter_pdfviewer: 90dc48305d2e33d4aa20681d1e98ddeda891bc14
|
syncfusion_flutter_pdfviewer: 90dc48305d2e33d4aa20681d1e98ddeda891bc14
|
||||||
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
|
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
|
||||||
|
video_thumbnail: b637e0ad5f588ca9945f6e2c927f73a69a661140
|
||||||
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
|
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
|
||||||
WebRTC-SDK: 40d4f5ba05cadff14e4db5614aec402a633f007e
|
WebRTC-SDK: 40d4f5ba05cadff14e4db5614aec402a633f007e
|
||||||
|
|
||||||
PODFILE CHECKSUM: 585198f58dca90ac6492607c83a8d17045ab3852
|
PODFILE CHECKSUM: 5a3652182a0f0e1093d3ac36dcabc72f6cc46b3a
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
@@ -11,7 +11,14 @@
|
|||||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
5D8143680678FCD1D1827271 /* Pods_Solian_Watch_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9C046CF867AE03DC170F861 /* Pods_Solian_Watch_App.framework */; };
|
5D8143680678FCD1D1827271 /* Pods_Solian_Watch_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9C046CF867AE03DC170F861 /* Pods_Solian_Watch_App.framework */; };
|
||||||
|
7301DB032F08D99C008390F3 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7301DB022F08D99C008390F3 /* WidgetKit.framework */; };
|
||||||
|
7301DB052F08D99C008390F3 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7301DB042F08D99C008390F3 /* SwiftUI.framework */; };
|
||||||
|
7301DB102F08D99D008390F3 /* SolianWidgetExtensionExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7301DB012F08D99C008390F3 /* SolianWidgetExtensionExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
7310A7DF2EB10963002C0FD3 /* Solian Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 7310A7D42EB10962002C0FD3 /* Solian Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
7310A7DF2EB10963002C0FD3 /* Solian Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 7310A7D42EB10962002C0FD3 /* Solian Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
|
73595B1B2F17FF8000AAD53C /* SfxMessage.caf in Resources */ = {isa = PBXBuildFile; fileRef = 73595B162F17FF8000AAD53C /* SfxMessage.caf */; };
|
||||||
|
73595B1C2F17FF8000AAD53C /* SfxNotification.caf in Resources */ = {isa = PBXBuildFile; fileRef = 73595B172F17FF8000AAD53C /* SfxNotification.caf */; };
|
||||||
|
73595B832F1803D300AAD53C /* SfxNotification.caf in Resources */ = {isa = PBXBuildFile; fileRef = 73595B172F17FF8000AAD53C /* SfxNotification.caf */; };
|
||||||
|
73595B842F1803D300AAD53C /* SfxMessage.caf in Resources */ = {isa = PBXBuildFile; fileRef = 73595B162F17FF8000AAD53C /* SfxMessage.caf */; };
|
||||||
73ACDFAD2E3D0E6100B63535 /* ReplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */; };
|
73ACDFAD2E3D0E6100B63535 /* ReplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */; };
|
||||||
73ACDFC32E3D0E6100B63535 /* SolianBroadcastExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
73ACDFC32E3D0E6100B63535 /* SolianBroadcastExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
73C305D82E0BE878009035B9 /* SolianShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73C305CE2E0BE878009035B9 /* SolianShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
73C305D82E0BE878009035B9 /* SolianShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73C305CE2E0BE878009035B9 /* SolianShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
@@ -36,6 +43,13 @@
|
|||||||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||||
remoteInfo = Runner;
|
remoteInfo = Runner;
|
||||||
};
|
};
|
||||||
|
7301DB0E2F08D99D008390F3 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 7301DB002F08D99C008390F3;
|
||||||
|
remoteInfo = SolianWidgetExtensionExtension;
|
||||||
|
};
|
||||||
73ACDFC12E3D0E6100B63535 /* PBXContainerItemProxy */ = {
|
73ACDFC12E3D0E6100B63535 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
@@ -77,6 +91,7 @@
|
|||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 13;
|
dstSubfolderSpec = 13;
|
||||||
files = (
|
files = (
|
||||||
|
7301DB102F08D99D008390F3 /* SolianWidgetExtensionExtension.appex in Embed Foundation Extensions */,
|
||||||
73ACDFC32E3D0E6100B63535 /* SolianBroadcastExtension.appex in Embed Foundation Extensions */,
|
73ACDFC32E3D0E6100B63535 /* SolianBroadcastExtension.appex in Embed Foundation Extensions */,
|
||||||
73C305D82E0BE878009035B9 /* SolianShareExtension.appex in Embed Foundation Extensions */,
|
73C305D82E0BE878009035B9 /* SolianShareExtension.appex in Embed Foundation Extensions */,
|
||||||
73CDD6812DEC00480059D95D /* SolianNotificationService.appex in Embed Foundation Extensions */,
|
73CDD6812DEC00480059D95D /* SolianNotificationService.appex in Embed Foundation Extensions */,
|
||||||
@@ -117,7 +132,13 @@
|
|||||||
39FE4CC6223F0D3C0E1FFD04 /* Pods_SolianNotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SolianNotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
39FE4CC6223F0D3C0E1FFD04 /* Pods_SolianNotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SolianNotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
3A1C47BD29CC6AC2587D4DBE /* 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>"; };
|
3A1C47BD29CC6AC2587D4DBE /* 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>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
|
7301DB012F08D99C008390F3 /* SolianWidgetExtensionExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolianWidgetExtensionExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
7301DB022F08D99C008390F3 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||||
|
7301DB042F08D99C008390F3 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||||
|
7301DB162F08D9A5008390F3 /* SolianWidgetExtensionExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SolianWidgetExtensionExtension.entitlements; sourceTree = "<group>"; };
|
||||||
7310A7D42EB10962002C0FD3 /* Solian Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Solian Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
7310A7D42EB10962002C0FD3 /* Solian Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Solian Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
73595B162F17FF8000AAD53C /* SfxMessage.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SfxMessage.caf; sourceTree = "<group>"; };
|
||||||
|
73595B172F17FF8000AAD53C /* SfxNotification.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SfxNotification.caf; sourceTree = "<group>"; };
|
||||||
737E920B2DB6A9FF00BE9CDB /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
737E920B2DB6A9FF00BE9CDB /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||||
73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolianBroadcastExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolianBroadcastExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
|
73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
|
||||||
@@ -151,6 +172,13 @@
|
|||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
7301DB142F08D99D008390F3 /* Exceptions for "SolianWidgetExtension" folder in "SolianWidgetExtensionExtension" target */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||||
|
membershipExceptions = (
|
||||||
|
Info.plist,
|
||||||
|
);
|
||||||
|
target = 7301DB002F08D99C008390F3 /* SolianWidgetExtensionExtension */;
|
||||||
|
};
|
||||||
73ACDFCA2E3D0E6100B63535 /* Exceptions for "SolianBroadcastExtension" folder in "SolianBroadcastExtension" target */ = {
|
73ACDFCA2E3D0E6100B63535 /* Exceptions for "SolianBroadcastExtension" folder in "SolianBroadcastExtension" target */ = {
|
||||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||||
membershipExceptions = (
|
membershipExceptions = (
|
||||||
@@ -177,12 +205,21 @@
|
|||||||
membershipExceptions = (
|
membershipExceptions = (
|
||||||
CloudFile.swift,
|
CloudFile.swift,
|
||||||
DataExchange.swift,
|
DataExchange.swift,
|
||||||
|
GroupDefaultSync.swift,
|
||||||
);
|
);
|
||||||
target = 73CDD6792DEC00480059D95D /* SolianNotificationService */;
|
target = 73CDD6792DEC00480059D95D /* SolianNotificationService */;
|
||||||
};
|
};
|
||||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
7301DB062F08D99C008390F3 /* SolianWidgetExtension */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
|
exceptions = (
|
||||||
|
7301DB142F08D99D008390F3 /* Exceptions for "SolianWidgetExtension" folder in "SolianWidgetExtensionExtension" target */,
|
||||||
|
);
|
||||||
|
path = SolianWidgetExtension;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
7310A7D52EB10962002C0FD3 /* Solian Watch App */ = {
|
7310A7D52EB10962002C0FD3 /* Solian Watch App */ = {
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
exceptions = (
|
exceptions = (
|
||||||
@@ -233,6 +270,15 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
7301DAFE2F08D99C008390F3 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
7301DB052F08D99C008390F3 /* SwiftUI.framework in Frameworks */,
|
||||||
|
7301DB032F08D99C008390F3 /* WidgetKit.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
7310A7D12EB10962002C0FD3 /* Frameworks */ = {
|
7310A7D12EB10962002C0FD3 /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -295,6 +341,8 @@
|
|||||||
73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */,
|
73ACDFAC2E3D0E6100B63535 /* ReplayKit.framework */,
|
||||||
73ACDFB82E3D0E6100B63535 /* UIKit.framework */,
|
73ACDFB82E3D0E6100B63535 /* UIKit.framework */,
|
||||||
C9C046CF867AE03DC170F861 /* Pods_Solian_Watch_App.framework */,
|
C9C046CF867AE03DC170F861 /* Pods_Solian_Watch_App.framework */,
|
||||||
|
7301DB022F08D99C008390F3 /* WidgetKit.framework */,
|
||||||
|
7301DB042F08D99C008390F3 /* SwiftUI.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -341,17 +389,21 @@
|
|||||||
97C146E51CF9000F007C117D = {
|
97C146E51CF9000F007C117D = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
7301DB162F08D9A5008390F3 /* SolianWidgetExtensionExtension.entitlements */,
|
||||||
9740EEB11CF90186004384FC /* Flutter */,
|
9740EEB11CF90186004384FC /* Flutter */,
|
||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
73CDD67B2DEC00480059D95D /* SolianNotificationService */,
|
73CDD67B2DEC00480059D95D /* SolianNotificationService */,
|
||||||
73C305CF2E0BE878009035B9 /* SolianShareExtension */,
|
73C305CF2E0BE878009035B9 /* SolianShareExtension */,
|
||||||
73ACDFAE2E3D0E6100B63535 /* SolianBroadcastExtension */,
|
73ACDFAE2E3D0E6100B63535 /* SolianBroadcastExtension */,
|
||||||
7310A7D52EB10962002C0FD3 /* Solian Watch App */,
|
7310A7D52EB10962002C0FD3 /* Solian Watch App */,
|
||||||
|
7301DB062F08D99C008390F3 /* SolianWidgetExtension */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||||
91E124CE95BCB4DCD890160D /* Pods */,
|
91E124CE95BCB4DCD890160D /* Pods */,
|
||||||
498A09270B73B217F0279168 /* Frameworks */,
|
498A09270B73B217F0279168 /* Frameworks */,
|
||||||
9AE244813FCDFAA941430393 /* GoogleService-Info.plist */,
|
9AE244813FCDFAA941430393 /* GoogleService-Info.plist */,
|
||||||
|
73595B162F17FF8000AAD53C /* SfxMessage.caf */,
|
||||||
|
73595B172F17FF8000AAD53C /* SfxNotification.caf */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -364,6 +416,7 @@
|
|||||||
73C305CE2E0BE878009035B9 /* SolianShareExtension.appex */,
|
73C305CE2E0BE878009035B9 /* SolianShareExtension.appex */,
|
||||||
73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */,
|
73ACDFAB2E3D0E6100B63535 /* SolianBroadcastExtension.appex */,
|
||||||
7310A7D42EB10962002C0FD3 /* Solian Watch App.app */,
|
7310A7D42EB10962002C0FD3 /* Solian Watch App.app */,
|
||||||
|
7301DB012F08D99C008390F3 /* SolianWidgetExtensionExtension.appex */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -408,6 +461,26 @@
|
|||||||
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
|
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
|
||||||
productType = "com.apple.product-type.bundle.unit-test";
|
productType = "com.apple.product-type.bundle.unit-test";
|
||||||
};
|
};
|
||||||
|
7301DB002F08D99C008390F3 /* SolianWidgetExtensionExtension */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 7301DB152F08D99D008390F3 /* Build configuration list for PBXNativeTarget "SolianWidgetExtensionExtension" */;
|
||||||
|
buildPhases = (
|
||||||
|
7301DAFD2F08D99C008390F3 /* Sources */,
|
||||||
|
7301DAFE2F08D99C008390F3 /* Frameworks */,
|
||||||
|
7301DAFF2F08D99C008390F3 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
fileSystemSynchronizedGroups = (
|
||||||
|
7301DB062F08D99C008390F3 /* SolianWidgetExtension */,
|
||||||
|
);
|
||||||
|
name = SolianWidgetExtensionExtension;
|
||||||
|
productName = SolianWidgetExtensionExtension;
|
||||||
|
productReference = 7301DB012F08D99C008390F3 /* SolianWidgetExtensionExtension.appex */;
|
||||||
|
productType = "com.apple.product-type.app-extension";
|
||||||
|
};
|
||||||
7310A7D32EB10962002C0FD3 /* Solian Watch App */ = {
|
7310A7D32EB10962002C0FD3 /* Solian Watch App */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 7310A7E32EB10963002C0FD3 /* Build configuration list for PBXNativeTarget "Solian Watch App" */;
|
buildConfigurationList = 7310A7E32EB10963002C0FD3 /* Build configuration list for PBXNativeTarget "Solian Watch App" */;
|
||||||
@@ -515,6 +588,7 @@
|
|||||||
73CDD6802DEC00480059D95D /* PBXTargetDependency */,
|
73CDD6802DEC00480059D95D /* PBXTargetDependency */,
|
||||||
73C305D72E0BE878009035B9 /* PBXTargetDependency */,
|
73C305D72E0BE878009035B9 /* PBXTargetDependency */,
|
||||||
73ACDFC22E3D0E6100B63535 /* PBXTargetDependency */,
|
73ACDFC22E3D0E6100B63535 /* PBXTargetDependency */,
|
||||||
|
7301DB0F2F08D99D008390F3 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
fileSystemSynchronizedGroups = (
|
fileSystemSynchronizedGroups = (
|
||||||
73268D272DEB012A0076E970 /* Services */,
|
73268D272DEB012A0076E970 /* Services */,
|
||||||
@@ -531,7 +605,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
BuildIndependentTargetsInParallel = YES;
|
BuildIndependentTargetsInParallel = YES;
|
||||||
LastSwiftUpdateCheck = 2600;
|
LastSwiftUpdateCheck = 2620;
|
||||||
LastUpgradeCheck = 1510;
|
LastUpgradeCheck = 1510;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
@@ -539,6 +613,9 @@
|
|||||||
CreatedOnToolsVersion = 14.0;
|
CreatedOnToolsVersion = 14.0;
|
||||||
TestTargetID = 97C146ED1CF9000F007C117D;
|
TestTargetID = 97C146ED1CF9000F007C117D;
|
||||||
};
|
};
|
||||||
|
7301DB002F08D99C008390F3 = {
|
||||||
|
CreatedOnToolsVersion = 26.2;
|
||||||
|
};
|
||||||
7310A7D32EB10962002C0FD3 = {
|
7310A7D32EB10962002C0FD3 = {
|
||||||
CreatedOnToolsVersion = 26.0.1;
|
CreatedOnToolsVersion = 26.0.1;
|
||||||
};
|
};
|
||||||
@@ -563,6 +640,11 @@
|
|||||||
knownRegions = (
|
knownRegions = (
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
|
"zh-Hans",
|
||||||
|
es,
|
||||||
|
ja,
|
||||||
|
ko,
|
||||||
|
"zh-Hant",
|
||||||
);
|
);
|
||||||
mainGroup = 97C146E51CF9000F007C117D;
|
mainGroup = 97C146E51CF9000F007C117D;
|
||||||
preferredProjectObjectVersion = 77;
|
preferredProjectObjectVersion = 77;
|
||||||
@@ -576,6 +658,7 @@
|
|||||||
73C305CD2E0BE878009035B9 /* SolianShareExtension */,
|
73C305CD2E0BE878009035B9 /* SolianShareExtension */,
|
||||||
73ACDFAA2E3D0E6100B63535 /* SolianBroadcastExtension */,
|
73ACDFAA2E3D0E6100B63535 /* SolianBroadcastExtension */,
|
||||||
7310A7D32EB10962002C0FD3 /* Solian Watch App */,
|
7310A7D32EB10962002C0FD3 /* Solian Watch App */,
|
||||||
|
7301DB002F08D99C008390F3 /* SolianWidgetExtensionExtension */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@@ -588,6 +671,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
7301DAFF2F08D99C008390F3 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
7310A7D22EB10962002C0FD3 /* Resources */ = {
|
7310A7D22EB10962002C0FD3 /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -613,6 +703,8 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
73595B1B2F17FF8000AAD53C /* SfxMessage.caf in Resources */,
|
||||||
|
73595B1C2F17FF8000AAD53C /* SfxNotification.caf in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -621,6 +713,8 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||||
|
73595B832F1803D300AAD53C /* SfxNotification.caf in Resources */,
|
||||||
|
73595B842F1803D300AAD53C /* SfxMessage.caf in Resources */,
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||||
@@ -852,6 +946,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
7301DAFD2F08D99C008390F3 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
7310A7D02EB10962002C0FD3 /* Sources */ = {
|
7310A7D02EB10962002C0FD3 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -898,6 +999,11 @@
|
|||||||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
7301DB0F2F08D99D008390F3 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 7301DB002F08D99C008390F3 /* SolianWidgetExtensionExtension */;
|
||||||
|
targetProxy = 7301DB0E2F08D99D008390F3 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
73ACDFC22E3D0E6100B63535 /* PBXTargetDependency */ = {
|
73ACDFC22E3D0E6100B63535 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 73ACDFAA2E3D0E6100B63535 /* SolianBroadcastExtension */;
|
target = 73ACDFAA2E3D0E6100B63535 /* SolianBroadcastExtension */;
|
||||||
@@ -1002,7 +1108,7 @@
|
|||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1080,6 +1186,138 @@
|
|||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
};
|
};
|
||||||
|
7301DB112F08D99D008390F3 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = SolianWidgetExtensionExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = SolianWidgetExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = SolianWidgetExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianWidgetExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
7301DB122F08D99D008390F3 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = SolianWidgetExtensionExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = SolianWidgetExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = SolianWidgetExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianWidgetExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
7301DB132F08D99D008390F3 /* Profile */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = SolianWidgetExtensionExtension.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_FILE = SolianWidgetExtension/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = SolianWidgetExtension;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@executable_path/../../Frameworks",
|
||||||
|
);
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianWidgetExtension;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Profile;
|
||||||
|
};
|
||||||
7310A7E02EB10963002C0FD3 /* Debug */ = {
|
7310A7E02EB10963002C0FD3 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 31EA49B10397BD4145AD765E /* Pods-Solian Watch App.debug.xcconfig */;
|
baseConfigurationReference = 31EA49B10397BD4145AD765E /* Pods-Solian Watch App.debug.xcconfig */;
|
||||||
@@ -1371,7 +1609,7 @@
|
|||||||
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1416,7 +1654,7 @@
|
|||||||
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1458,7 +1696,7 @@
|
|||||||
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
INFOPLIST_FILE = SolianShareExtension/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
INFOPLIST_KEY_CFBundleDisplayName = SolianShareExtension;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1724,7 +1962,7 @@
|
|||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1755,7 +1993,7 @@
|
|||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1785,6 +2023,16 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
|
7301DB152F08D99D008390F3 /* Build configuration list for PBXNativeTarget "SolianWidgetExtensionExtension" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
7301DB112F08D99D008390F3 /* Debug */,
|
||||||
|
7301DB122F08D99D008390F3 /* Release */,
|
||||||
|
7301DB132F08D99D008390F3 /* Profile */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
7310A7E32EB10963002C0FD3 /* Build configuration list for PBXNativeTarget "Solian Watch App" */ = {
|
7310A7E32EB10963002C0FD3 /* Build configuration list for PBXNativeTarget "Solian Watch App" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "2620"
|
||||||
|
version = "1.7">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "7310A7D32EB10962002C0FD3"
|
||||||
|
BuildableName = "Solian Watch App.app"
|
||||||
|
BlueprintName = "Solian Watch App"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "7310A7D32EB10962002C0FD3"
|
||||||
|
BuildableName = "Solian Watch App.app"
|
||||||
|
BlueprintName = "Solian Watch App"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "7310A7D32EB10962002C0FD3"
|
||||||
|
BuildableName = "Solian Watch App.app"
|
||||||
|
BlueprintName = "Solian Watch App"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "2620"
|
||||||
|
version = "2.0">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "73ACDFAA2E3D0E6100B63535"
|
||||||
|
BuildableName = "SolianBroadcastExtension.appex"
|
||||||
|
BlueprintName = "SolianBroadcastExtension"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = ""
|
||||||
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
|
launchStyle = "0"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "2620"
|
||||||
|
version = "2.0">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "73CDD6792DEC00480059D95D"
|
||||||
|
BuildableName = "SolianNotificationService.appex"
|
||||||
|
BlueprintName = "SolianNotificationService"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = ""
|
||||||
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
|
launchStyle = "0"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "2620"
|
||||||
|
wasCreatedForAppExtension = "YES"
|
||||||
|
version = "2.0">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "73C305CD2E0BE878009035B9"
|
||||||
|
BuildableName = "SolianShareExtension.appex"
|
||||||
|
BlueprintName = "SolianShareExtension"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = ""
|
||||||
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
|
launchStyle = "0"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "2620"
|
||||||
|
wasCreatedForAppExtension = "YES"
|
||||||
|
version = "2.0">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "7301DB002F08D99C008390F3"
|
||||||
|
BuildableName = "SolianWidgetExtensionExtension.appex"
|
||||||
|
BlueprintName = "SolianWidgetExtensionExtension"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "7310A7D32EB10962002C0FD3"
|
||||||
|
BuildableName = "Solian Watch App.app"
|
||||||
|
BlueprintName = "Solian Watch App"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = ""
|
||||||
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
|
launchStyle = "0"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "_XCWidgetKind"
|
||||||
|
value = ""
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "_XCWidgetDefaultView"
|
||||||
|
value = "timeline"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "_XCWidgetFamily"
|
||||||
|
value = "systemMedium"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
askForAppToLaunch = "Yes"
|
||||||
|
launchAutomaticallySubstyle = "2">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import Flutter
|
import Flutter
|
||||||
|
import WidgetKit
|
||||||
import UIKit
|
import UIKit
|
||||||
import WatchConnectivity
|
import WatchConnectivity
|
||||||
|
import AppIntents
|
||||||
|
|
||||||
@main
|
@main
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
@@ -11,6 +13,9 @@ import WatchConnectivity
|
|||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
|
syncDefaultsToGroup()
|
||||||
|
WidgetCenter.shared.reloadAllTimelines()
|
||||||
|
|
||||||
UNUserNotificationCenter.current().delegate = notifyDelegate
|
UNUserNotificationCenter.current().delegate = notifyDelegate
|
||||||
|
|
||||||
let replyableMessageCategory = UNNotificationCategory(
|
let replyableMessageCategory = UNNotificationCategory(
|
||||||
@@ -29,7 +34,8 @@ import WatchConnectivity
|
|||||||
|
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
|
|
||||||
// Always initialize and retain a strong reference
|
setupWidgetSyncChannel()
|
||||||
|
|
||||||
if WCSession.isSupported() {
|
if WCSession.isSupported() {
|
||||||
AppDelegate.sharedWatchConnectivityService = WatchConnectivityService.shared
|
AppDelegate.sharedWatchConnectivityService = WatchConnectivityService.shared
|
||||||
} else {
|
} else {
|
||||||
@@ -38,6 +44,30 @@ import WatchConnectivity
|
|||||||
|
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func setupWidgetSyncChannel() {
|
||||||
|
let controller = window?.rootViewController as? FlutterViewController
|
||||||
|
let channel = FlutterMethodChannel(name: "dev.solsynth.solian/widget", binaryMessenger: controller!.binaryMessenger)
|
||||||
|
|
||||||
|
channel.setMethodCallHandler { [weak self] (call, result) in
|
||||||
|
if call.method == "syncToWidget" {
|
||||||
|
syncDefaultsToGroup()
|
||||||
|
WidgetCenter.shared.reloadAllTimelines()
|
||||||
|
result(true)
|
||||||
|
} else {
|
||||||
|
result(FlutterMethodNotImplemented)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override func applicationDidEnterBackground(_ application: UIApplication) {
|
||||||
|
syncDefaultsToGroup()
|
||||||
|
WidgetCenter.shared.reloadAllTimelines()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func applicationWillTerminate(_ application: UIApplication) {
|
||||||
|
syncDefaultsToGroup()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class WatchConnectivityService: NSObject, WCSessionDelegate {
|
final class WatchConnectivityService: NSObject, WCSessionDelegate {
|
||||||
@@ -51,8 +81,6 @@ final class WatchConnectivityService: NSObject, WCSessionDelegate {
|
|||||||
session.activate()
|
session.activate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - WCSessionDelegate
|
|
||||||
|
|
||||||
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
|
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
|
||||||
if let error = error {
|
if let error = error {
|
||||||
print("[iOS] WCSession activation failed: \(error.localizedDescription)")
|
print("[iOS] WCSession activation failed: \(error.localizedDescription)")
|
||||||
@@ -76,7 +104,7 @@ final class WatchConnectivityService: NSObject, WCSessionDelegate {
|
|||||||
let token = UserDefaults.standard.getFlutterToken()
|
let token = UserDefaults.standard.getFlutterToken()
|
||||||
let serverUrl = UserDefaults.standard.getServerUrl()
|
let serverUrl = UserDefaults.standard.getServerUrl()
|
||||||
|
|
||||||
var data: [String: Any] = ["serverUrl": serverUrl ?? ""]
|
var data: [String: Any] = ["serverUrl": serverUrl]
|
||||||
if let token = token {
|
if let token = token {
|
||||||
data["token"] = token
|
data["token"] = token
|
||||||
}
|
}
|
||||||
@@ -94,7 +122,7 @@ final class WatchConnectivityService: NSObject, WCSessionDelegate {
|
|||||||
let token = UserDefaults.standard.getFlutterToken()
|
let token = UserDefaults.standard.getFlutterToken()
|
||||||
let serverUrl = UserDefaults.standard.getServerUrl()
|
let serverUrl = UserDefaults.standard.getServerUrl()
|
||||||
|
|
||||||
var data: [String: Any] = ["serverUrl": serverUrl ?? ""]
|
var data: [String: Any] = ["serverUrl": serverUrl]
|
||||||
if let token = token {
|
if let token = token {
|
||||||
data["token"] = token
|
data["token"] = token
|
||||||
}
|
}
|
||||||
|
|||||||
6
ios/Runner/Assets.xcassets/Contents.json
Normal file
6
ios/Runner/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,18 @@
|
|||||||
<string>Allow the Solar Network verify your ownership of the logged in account and continue your action quickly.</string>
|
<string>Allow the Solar Network verify your ownership of the logged in account and continue your action quickly.</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>Grant access to Microphone will allow Solian record audio for your post.</string>
|
<string>Grant access to Microphone will allow Solian record audio for your post.</string>
|
||||||
|
<key>NSSpeechRecognitionUsageDescription</key>
|
||||||
|
<string>Solian uses speech recognition for Siri integration</string>
|
||||||
|
<key>NSAppIntentsConfiguration</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAppIntentsPackage</key>
|
||||||
|
<string>dev.solsynth.solian</string>
|
||||||
|
</dict>
|
||||||
|
<key>NSAppIntentsMetadata</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAppIntentsSupported</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
<string>Grant access to Photo Library will allow Solian download photo to album for you.</string>
|
<string>Grant access to Photo Library will allow Solian download photo to album for you.</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
|||||||
84
ios/Runner/Services/AppIntentConfiguration.swift
Normal file
84
ios/Runner/Services/AppIntentConfiguration.swift
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
//
|
||||||
|
// AppIntentConfiguration.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/16.
|
||||||
|
//
|
||||||
|
|
||||||
|
import AppIntents
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct AppShortcuts: AppShortcutsProvider {
|
||||||
|
@AppShortcutsBuilder static var appShortcuts: [AppShortcut] {
|
||||||
|
AppShortcut(
|
||||||
|
intent: OpenChatIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Open chat with \(.applicationName)",
|
||||||
|
"Go to chat using \(.applicationName)",
|
||||||
|
"Show chat in \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: OpenPostIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Open post with \(.applicationName)",
|
||||||
|
"Show post using \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: OpenComposeIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Open compose with \(.applicationName)",
|
||||||
|
"New post using \(.applicationName)",
|
||||||
|
"Write post in \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: SearchContentIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Search in \(.applicationName)",
|
||||||
|
"Find content using \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: CheckNotificationsIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Check notifications with \(.applicationName)",
|
||||||
|
"Get notifications using \(.applicationName)",
|
||||||
|
"Do I have notifications in \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: SendMessageIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Send message with \(.applicationName)",
|
||||||
|
"Post message using \(.applicationName)",
|
||||||
|
"Send text using \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: ReadMessagesIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Read messages with \(.applicationName)",
|
||||||
|
"Get chat using \(.applicationName)",
|
||||||
|
"Show messages with \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: CheckUnreadChatsIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Check unread chats with \(.applicationName)",
|
||||||
|
"Do I have messages using \(.applicationName)",
|
||||||
|
"Get unread messages with \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
AppShortcut(
|
||||||
|
intent: MarkNotificationsReadIntent(),
|
||||||
|
phrases: [
|
||||||
|
"Mark notifications read with \(.applicationName)",
|
||||||
|
"Clear notifications using \(.applicationName)",
|
||||||
|
"Mark all read with \(.applicationName)"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
296
ios/Runner/Services/AppIntentHandlers.swift
Normal file
296
ios/Runner/Services/AppIntentHandlers.swift
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
//
|
||||||
|
// AppIntentHandlers.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/16.
|
||||||
|
//
|
||||||
|
|
||||||
|
import AppIntents
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct OpenChatIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_open_chat_title"
|
||||||
|
static var description = IntentDescription("intent_open_chat_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
@Parameter(title: "Channel ID")
|
||||||
|
var channelId: String?
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
guard let channelId = channelId, !channelId.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Channel ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://chat/\(channelId)")!)
|
||||||
|
|
||||||
|
return .result(value: "Opening chat \(channelId)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct OpenPostIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_open_post_title"
|
||||||
|
static var description = IntentDescription("intent_open_post_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
@Parameter(title: "Post ID")
|
||||||
|
var postId: String?
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
guard let postId = postId, !postId.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Post ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://posts/\(postId)")!)
|
||||||
|
|
||||||
|
return .result(value: "Opening post \(postId)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct OpenComposeIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_open_compose_title"
|
||||||
|
static var description = IntentDescription("intent_open_compose_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://compose")!)
|
||||||
|
|
||||||
|
return .result(value: "Opening compose screen")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct ComposePostIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_compose_post_title"
|
||||||
|
static var description = IntentDescription("intent_compose_post_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://compose")!)
|
||||||
|
|
||||||
|
return .result(value: "Opening compose screen")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct SearchContentIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_search_title"
|
||||||
|
static var description = IntentDescription("intent_search_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
@Parameter(title: "Search Query")
|
||||||
|
var query: String?
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
guard let query = query, !query.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Search Query")
|
||||||
|
}
|
||||||
|
|
||||||
|
let encodedQuery = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? query
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://search?q=\(encodedQuery)")!)
|
||||||
|
|
||||||
|
return .result(value: "Searching for \"\(query)\"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct ViewNotificationsIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_notifications_title"
|
||||||
|
static var description = IntentDescription("intent_notifications_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = true
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & OpensIntent {
|
||||||
|
DeepLinkHandler.shared.handle(url: URL(string: "solian://notifications")!)
|
||||||
|
|
||||||
|
return .result(value: "Opening notifications")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct CheckNotificationsIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_check_notifications_title"
|
||||||
|
static var description = IntentDescription("intent_check_notifications_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = false
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ProvidesDialog {
|
||||||
|
do {
|
||||||
|
let count = try await NetworkService.shared.getNotificationCount()
|
||||||
|
|
||||||
|
let message: String
|
||||||
|
if count == 0 {
|
||||||
|
message = "You have no new notifications"
|
||||||
|
} else if count == 1 {
|
||||||
|
message = "You have 1 new notification"
|
||||||
|
} else {
|
||||||
|
message = "You have \(count) new notifications"
|
||||||
|
}
|
||||||
|
|
||||||
|
return .result(
|
||||||
|
value: message,
|
||||||
|
dialog: "\(message)"
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
throw AppIntentError.networkError("Failed to check notifications: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct SendMessageIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_send_message_title"
|
||||||
|
static var description = IntentDescription("intent_send_message_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = false
|
||||||
|
|
||||||
|
@Parameter(title: "Channel ID")
|
||||||
|
var channelId: String?
|
||||||
|
|
||||||
|
@Parameter(title: "Message Content")
|
||||||
|
var content: String?
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ProvidesDialog {
|
||||||
|
guard let channelId = channelId, !channelId.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Channel ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let content = content, !content.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Message Content")
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
try await NetworkService.shared.sendMessage(channelId: channelId, content: content)
|
||||||
|
|
||||||
|
return .result(
|
||||||
|
value: "Message sent to channel \(channelId)",
|
||||||
|
dialog: "Message sent successfully"
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
throw AppIntentError.networkError("Failed to send message: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct ReadMessagesIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_read_messages_title"
|
||||||
|
static var description = IntentDescription("intent_read_messages_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = false
|
||||||
|
|
||||||
|
@Parameter(title: "Channel ID")
|
||||||
|
var channelId: String?
|
||||||
|
|
||||||
|
@Parameter(title: "Number of Messages", default: "5")
|
||||||
|
var limit: String?
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ProvidesDialog {
|
||||||
|
guard let channelId = channelId, !channelId.isEmpty else {
|
||||||
|
throw AppIntentError.requiredParameter("Channel ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
let limitValue = Int(limit ?? "5") ?? 5
|
||||||
|
let safeLimit = max(1, min(20, limitValue))
|
||||||
|
|
||||||
|
do {
|
||||||
|
let messages = try await NetworkService.shared.getMessages(
|
||||||
|
channelId: channelId,
|
||||||
|
offset: 0,
|
||||||
|
take: safeLimit
|
||||||
|
)
|
||||||
|
|
||||||
|
if messages.isEmpty {
|
||||||
|
return .result(
|
||||||
|
value: "No messages found in channel \(channelId)",
|
||||||
|
dialog: "No messages found"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
let formattedMessages = messages.compactMap { message -> String? in
|
||||||
|
let senderName = message.sender?.account?.name ?? "Unknown"
|
||||||
|
let content = message.content ?? ""
|
||||||
|
return "\(senderName): \(content)"
|
||||||
|
}.joined(separator: "\n")
|
||||||
|
|
||||||
|
return .result(
|
||||||
|
value: formattedMessages,
|
||||||
|
dialog: "Found \(messages.count) messages"
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
throw AppIntentError.networkError("Failed to read messages: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct CheckUnreadChatsIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_unread_chats_title"
|
||||||
|
static var description = IntentDescription("intent_unread_chats_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = false
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ProvidesDialog {
|
||||||
|
do {
|
||||||
|
let count = try await NetworkService.shared.getUnreadChatsCount()
|
||||||
|
|
||||||
|
let message: String
|
||||||
|
if count == 0 {
|
||||||
|
message = "You have no unread messages"
|
||||||
|
} else if count == 1 {
|
||||||
|
message = "You have 1 unread message"
|
||||||
|
} else {
|
||||||
|
message = "You have \(count) unread messages"
|
||||||
|
}
|
||||||
|
|
||||||
|
return .result(
|
||||||
|
value: message,
|
||||||
|
dialog: "\(message)"
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
throw AppIntentError.networkError("Failed to check unread chats: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct MarkNotificationsReadIntent: AppIntent {
|
||||||
|
static var title: LocalizedStringResource = "intent_mark_read_title"
|
||||||
|
static var description = IntentDescription("intent_mark_read_desc")
|
||||||
|
static var isDiscoverable = true
|
||||||
|
static var openAppWhenRun = false
|
||||||
|
|
||||||
|
func perform() async throws -> some IntentResult & ProvidesDialog {
|
||||||
|
do {
|
||||||
|
try await NetworkService.shared.markNotificationsRead()
|
||||||
|
|
||||||
|
return .result(
|
||||||
|
value: "All notifications marked as read",
|
||||||
|
dialog: "All notifications marked as read"
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
throw AppIntentError.networkError("Failed to mark notifications: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AppIntentError: Error, CustomLocalizedStringResourceConvertible {
|
||||||
|
case requiredParameter(String)
|
||||||
|
case networkError(String)
|
||||||
|
|
||||||
|
var localizedStringResource: LocalizedStringResource {
|
||||||
|
switch self {
|
||||||
|
case .requiredParameter(let param):
|
||||||
|
return "\(param) is required"
|
||||||
|
case .networkError(let message):
|
||||||
|
return "Network error: \(message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
103
ios/Runner/Services/DeepLinkHandler.swift
Normal file
103
ios/Runner/Services/DeepLinkHandler.swift
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
//
|
||||||
|
// DeepLinkHandler.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/16.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
final class DeepLinkHandler {
|
||||||
|
static let shared = DeepLinkHandler()
|
||||||
|
|
||||||
|
private init() {}
|
||||||
|
|
||||||
|
func handle(url: URL) -> Bool {
|
||||||
|
guard url.scheme == SharedConstants.urlScheme else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
let host = url.host ?? ""
|
||||||
|
let path = url.path
|
||||||
|
let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems
|
||||||
|
|
||||||
|
switch host {
|
||||||
|
case "chat":
|
||||||
|
if let channelId = url.pathComponents.count > 1 ? url.pathComponents[1] : nil {
|
||||||
|
openUrl("solian://chat/\(channelId)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
case "posts":
|
||||||
|
if let postId = url.pathComponents.count > 1 ? url.pathComponents[1] : nil {
|
||||||
|
openUrl("solian://posts/\(postId)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
case "search":
|
||||||
|
if let query = queryItems?.first(where: { $0.name == "query" })?.value {
|
||||||
|
let encodedQuery = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? query
|
||||||
|
openUrl("solian://search?q=\(encodedQuery)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
case "notifications":
|
||||||
|
openUrl("solian://notifications")
|
||||||
|
return true
|
||||||
|
|
||||||
|
case "compose":
|
||||||
|
openUrl("solian://compose")
|
||||||
|
return true
|
||||||
|
|
||||||
|
default:
|
||||||
|
if path.hasPrefix("/chat/") {
|
||||||
|
let channelId = path.replacingOccurrences(of: "/chat/", with: "")
|
||||||
|
openUrl("solian://chat/\(channelId)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if path.hasPrefix("/posts/") {
|
||||||
|
let postId = path.replacingOccurrences(of: "/posts/", with: "")
|
||||||
|
openUrl("solian://posts/\(postId)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if path.hasPrefix("/search") {
|
||||||
|
let query = queryItems?.first(where: { $0.name == "q" })?.value ?? ""
|
||||||
|
let encodedQuery = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? query
|
||||||
|
openUrl("solian://search?q=\(encodedQuery)")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if path == "/notifications" {
|
||||||
|
openUrl("solian://notifications")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if path.hasPrefix("/compose") || path == "/compose" {
|
||||||
|
openUrl("solian://compose")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if path.hasPrefix("/dashboard") {
|
||||||
|
openUrl("solian://dashboard")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private func openUrl(_ urlString: String) {
|
||||||
|
guard let url = URL(string: urlString) else {
|
||||||
|
print("[DeepLinkHandler] Invalid URL: \(urlString)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
UIApplication.shared.open(url) { success in
|
||||||
|
if success {
|
||||||
|
print("[DeepLinkHandler] Opened URL: \(urlString)")
|
||||||
|
} else {
|
||||||
|
print("[DeepLinkHandler] Failed to open URL: \(urlString)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
ios/Runner/Services/GroupDefaultSync.swift
Normal file
41
ios/Runner/Services/GroupDefaultSync.swift
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
//
|
||||||
|
// GroupDefaultSync.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/3.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
private let flutterKeyPrefix = "flutter."
|
||||||
|
|
||||||
|
private let flutterKeysToSync: [String] = [
|
||||||
|
"dyn_user_tk",
|
||||||
|
"app_server_url"
|
||||||
|
]
|
||||||
|
|
||||||
|
func syncDefaultsToGroup() {
|
||||||
|
print("[iOS] syncDefaultsToGroup() called")
|
||||||
|
|
||||||
|
let standard = UserDefaults.standard
|
||||||
|
let shared = UserDefaults(suiteName: "group.solsynth.solian")
|
||||||
|
|
||||||
|
guard let shared else {
|
||||||
|
print("[iOS] App Group UserDefaults not available")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for key in flutterKeysToSync {
|
||||||
|
let prefixedKey = key.starts(with: flutterKeyPrefix) ? key : flutterKeyPrefix + key
|
||||||
|
|
||||||
|
if let value = standard.object(forKey: prefixedKey) {
|
||||||
|
print("[iOS] Syncing key to App Group: \(prefixedKey)")
|
||||||
|
shared.set(value, forKey: prefixedKey)
|
||||||
|
} else {
|
||||||
|
print("[iOS] Key \(prefixedKey) was not found in the app data, skipping...")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared.synchronize()
|
||||||
|
print("[iOS] Sync completed")
|
||||||
|
}
|
||||||
177
ios/Runner/Services/NetworkService.swift
Normal file
177
ios/Runner/Services/NetworkService.swift
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
//
|
||||||
|
// NetworkService.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/16.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
final class NetworkService {
|
||||||
|
static let shared = NetworkService()
|
||||||
|
|
||||||
|
private let session: URLSession
|
||||||
|
private let decoder: JSONDecoder
|
||||||
|
|
||||||
|
private init() {
|
||||||
|
let config = URLSessionConfiguration.default
|
||||||
|
config.timeoutIntervalForRequest = 10
|
||||||
|
config.timeoutIntervalForResource = 30
|
||||||
|
self.session = URLSession(configuration: config)
|
||||||
|
|
||||||
|
self.decoder = JSONDecoder()
|
||||||
|
self.decoder.keyDecodingStrategy = .convertFromSnakeCase
|
||||||
|
}
|
||||||
|
|
||||||
|
private var baseUrl: String {
|
||||||
|
UserDefaults.shared.getServerUrl()
|
||||||
|
}
|
||||||
|
|
||||||
|
private var authHeaders: [String: String] {
|
||||||
|
var headers = [
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
]
|
||||||
|
if let token = UserDefaults.shared.getAuthToken() {
|
||||||
|
headers["Authorization"] = "AtField \(token)"
|
||||||
|
}
|
||||||
|
return headers
|
||||||
|
}
|
||||||
|
|
||||||
|
func getNotificationCount() async throws -> Int {
|
||||||
|
let url = try buildUrl(path: SharedConstants.API.notificationsCount)
|
||||||
|
let response: NotificationCountResponse = try await get(url: url)
|
||||||
|
return response.count
|
||||||
|
}
|
||||||
|
|
||||||
|
func markNotificationsRead() async throws {
|
||||||
|
let url = try buildUrl(path: SharedConstants.API.notificationsMarkRead)
|
||||||
|
let _: EmptyResponse = try await post(url: url)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getUnreadChatsCount() async throws -> Int {
|
||||||
|
let url = try buildUrl(path: SharedConstants.API.unreadChats)
|
||||||
|
let response: UnreadChatsResponse = try await get(url: url)
|
||||||
|
return response.unreadCount
|
||||||
|
}
|
||||||
|
|
||||||
|
func getMessages(channelId: String, offset: Int = 0, take: Int = 5) async throws -> [MessageResponse] {
|
||||||
|
let path = String(format: SharedConstants.API.messages, channelId)
|
||||||
|
let url = try buildUrl(path: path, queryItems: [
|
||||||
|
URLQueryItem(name: "offset", value: String(offset)),
|
||||||
|
URLQueryItem(name: "take", value: String(take))
|
||||||
|
])
|
||||||
|
let response: MessagesResponse = try await get(url: url)
|
||||||
|
return response.messages
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendMessage(channelId: String, content: String) async throws {
|
||||||
|
let path = String(format: SharedConstants.API.sendMessage, channelId)
|
||||||
|
let url = try buildUrl(path: path)
|
||||||
|
let body = SendMessageBody(content: content, nonce: generateNonce())
|
||||||
|
let _: EmptyResponse = try await post(url: url, body: body)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func buildUrl(path: String, queryItems: [URLQueryItem]? = nil) throws -> URL {
|
||||||
|
var components = URLComponents(string: baseUrl + path)
|
||||||
|
if let queryItems = queryItems, !queryItems.isEmpty {
|
||||||
|
components?.queryItems = queryItems
|
||||||
|
}
|
||||||
|
guard let url = components?.url else {
|
||||||
|
throw NetworkError.invalidUrl
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
private func get<T: Decodable>(url: URL) async throws -> T {
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
authHeaders.forEach { request.setValue($1, forHTTPHeaderField: $0) }
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
try validateResponse(response)
|
||||||
|
return try decoder.decode(T.self, from: data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func post<T: Decodable>(url: URL) async throws -> T {
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "POST"
|
||||||
|
authHeaders.forEach { request.setValue($1, forHTTPHeaderField: $0) }
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
try validateResponse(response)
|
||||||
|
|
||||||
|
if T.self == EmptyResponse.self {
|
||||||
|
return EmptyResponse() as! T
|
||||||
|
}
|
||||||
|
|
||||||
|
return try decoder.decode(T.self, from: data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func post<T: Decodable, B: Encodable>(url: URL, body: B) async throws -> T {
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "POST"
|
||||||
|
authHeaders.forEach { request.setValue($1, forHTTPHeaderField: $0) }
|
||||||
|
|
||||||
|
request.httpBody = try JSONEncoder().encode(body)
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
try validateResponse(response)
|
||||||
|
|
||||||
|
if T.self == EmptyResponse.self {
|
||||||
|
return EmptyResponse() as! T
|
||||||
|
}
|
||||||
|
|
||||||
|
return try decoder.decode(T.self, from: data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func validateResponse(_ response: URLResponse) throws {
|
||||||
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
|
throw NetworkError.invalidResponse
|
||||||
|
}
|
||||||
|
guard (200...299).contains(httpResponse.statusCode) else {
|
||||||
|
throw NetworkError.httpError(statusCode: httpResponse.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func generateNonce() -> String {
|
||||||
|
"\(Date().timeIntervalSince1970)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum NetworkError: Error {
|
||||||
|
case invalidUrl
|
||||||
|
case invalidResponse
|
||||||
|
case httpError(statusCode: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotificationCountResponse: Decodable {
|
||||||
|
let count: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UnreadChatsResponse: Decodable {
|
||||||
|
let unreadCount: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MessagesResponse: Decodable {
|
||||||
|
let messages: [MessageResponse]
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MessageResponse: Decodable {
|
||||||
|
let content: String?
|
||||||
|
let sender: SenderResponse?
|
||||||
|
|
||||||
|
struct SenderResponse: Decodable {
|
||||||
|
let account: AccountResponse?
|
||||||
|
|
||||||
|
struct AccountResponse: Decodable {
|
||||||
|
let name: String?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SendMessageBody: Encodable {
|
||||||
|
let content: String
|
||||||
|
let nonce: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct EmptyResponse: Decodable {}
|
||||||
45
ios/Runner/Services/SharedConstants.swift
Normal file
45
ios/Runner/Services/SharedConstants.swift
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
//
|
||||||
|
// SharedConstants.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/16.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum SharedConstants {
|
||||||
|
static let appGroupId = "group.solsynth.solian"
|
||||||
|
static let urlScheme = "solian"
|
||||||
|
static let serverUrlKey = "flutter.app_server_url"
|
||||||
|
static let tokenKey = "flutter.dyn_user_tk"
|
||||||
|
static let defaultServerUrl = "https://api.solian.app"
|
||||||
|
|
||||||
|
enum API {
|
||||||
|
static let notificationsCount = "/ring/notifications/count"
|
||||||
|
static let notificationsMarkRead = "/ring/notifications/all/read"
|
||||||
|
static let unreadChats = "/messager/chat/unread"
|
||||||
|
static let messages = "/messager/chat/%@/messages"
|
||||||
|
static let sendMessage = "/messager/chat/%@/messages"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UserDefaults {
|
||||||
|
static let shared: UserDefaults = {
|
||||||
|
UserDefaults(suiteName: SharedConstants.appGroupId) ?? UserDefaults.standard
|
||||||
|
}()
|
||||||
|
|
||||||
|
func getServerUrl() -> String {
|
||||||
|
string(forKey: SharedConstants.serverUrlKey) ?? SharedConstants.defaultServerUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAuthToken() -> String? {
|
||||||
|
guard let jsonString = string(forKey: SharedConstants.tokenKey),
|
||||||
|
let data = jsonString.data(using: .utf8),
|
||||||
|
let jsonObject = try? JSONSerialization.jsonObject(with: data),
|
||||||
|
let jsonDict = jsonObject as? [String: Any],
|
||||||
|
let token = jsonDict["token"] as? String else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return token
|
||||||
|
}
|
||||||
|
}
|
||||||
33
ios/Runner/en.lproj/Localizable.strings
Normal file
33
ios/Runner/en.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "Open Chat";
|
||||||
|
"intent_open_chat_desc" = "Open a specific chat room";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "Open Post";
|
||||||
|
"intent_open_post_desc" = "Open a specific post";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "Open Compose";
|
||||||
|
"intent_open_compose_desc" = "Open compose post screen";
|
||||||
|
"intent_compose_post_title" = "Compose Post";
|
||||||
|
"intent_compose_post_desc" = "Create a new post";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "Search Content";
|
||||||
|
"intent_search_desc" = "Search for content";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "View Notifications";
|
||||||
|
"intent_notifications_desc" = "View notifications";
|
||||||
|
"intent_check_notifications_title" = "Check Notifications";
|
||||||
|
"intent_check_notifications_desc" = "Check notification count";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "Send Message";
|
||||||
|
"intent_send_message_desc" = "Send a message to a chat channel";
|
||||||
|
"intent_read_messages_title" = "Read Messages";
|
||||||
|
"intent_read_messages_desc" = "Read recent messages from a chat channel";
|
||||||
|
"intent_unread_chats_title" = "Check Unread Chats";
|
||||||
|
"intent_unread_chats_desc" = "Check number of unread chat messages";
|
||||||
|
"intent_mark_read_title" = "Mark Notifications Read";
|
||||||
|
"intent_mark_read_desc" = "Mark all notifications as read";
|
||||||
33
ios/Runner/es.lproj/Localizable.strings
Normal file
33
ios/Runner/es.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "Abrir chat";
|
||||||
|
"intent_open_chat_desc" = "Abrir sala de chat específica";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "Abrir publicación";
|
||||||
|
"intent_open_post_desc" = "Abrir publicación específica";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "Abrir compose";
|
||||||
|
"intent_open_compose_desc" = "Abrir pantalla de publicación";
|
||||||
|
"intent_compose_post_title" = "Redactar publicación";
|
||||||
|
"intent_compose_post_desc" = "Crear nueva publicación";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "Buscar contenido";
|
||||||
|
"intent_search_desc" = "Buscar contenido";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "Ver notificaciones";
|
||||||
|
"intent_notifications_desc" = "Ver notificaciones";
|
||||||
|
"intent_check_notifications_title" = "Ver notificaciones";
|
||||||
|
"intent_check_notifications_desc" = "Ver número de notificaciones";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "Enviar mensaje";
|
||||||
|
"intent_send_message_desc" = "Enviar mensaje a canal de chat";
|
||||||
|
"intent_read_messages_title" = "Leer mensajes";
|
||||||
|
"intent_read_messages_desc" = "Leer mensajes recientes de un canal de chat";
|
||||||
|
"intent_unread_chats_title" = "Ver chats no leídos";
|
||||||
|
"intent_unread_chats_desc" = "Ver mensajes no leídos";
|
||||||
|
"intent_mark_read_title" = "Marcar notificaciones leídas";
|
||||||
|
"intent_mark_read_desc" = "Marcar todas como leídas";
|
||||||
33
ios/Runner/ja.lproj/Localizable.strings
Normal file
33
ios/Runner/ja.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "チャットを開く";
|
||||||
|
"intent_open_chat_desc" = "特定のチャットルームを開く";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "投稿を開く";
|
||||||
|
"intent_open_post_desc" = "特定の投稿を開く";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "作成を開く";
|
||||||
|
"intent_open_compose_desc" = "投稿作成画面を開く";
|
||||||
|
"intent_compose_post_title" = "投稿を作成する";
|
||||||
|
"intent_compose_post_desc" = "新規投稿を作成する";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "検索";
|
||||||
|
"intent_search_desc" = "コンテンツを検索";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "通知を見る";
|
||||||
|
"intent_notifications_desc" = "通知を見る";
|
||||||
|
"intent_check_notifications_title" = "通知を確認";
|
||||||
|
"intent_check_notifications_desc" = "通知数を確認";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "メッセージを送信";
|
||||||
|
"intent_send_message_desc" = "チャットチャンネルにメッセージを送信";
|
||||||
|
"intent_read_messages_title" = "メッセージを読む";
|
||||||
|
"intent_read_messages_desc" = "チャットチャンネルから最近のメッセージを読む";
|
||||||
|
"intent_unread_chats_title" = "未読チャットを確認";
|
||||||
|
"intent_unread_chats_desc" = "未読チャットメッセージ数を確認";
|
||||||
|
"intent_mark_read_title" = "通知を既読にする";
|
||||||
|
"intent_mark_read_desc" = "すべての通知を既読にする";
|
||||||
33
ios/Runner/ko.lproj/Localizable.strings
Normal file
33
ios/Runner/ko.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "채팅 열기";
|
||||||
|
"intent_open_chat_desc" = "특정 채팅방 열기";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "게시물 열기";
|
||||||
|
"intent_open_post_desc" = "특정 게시물 열기";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "글쓰기 열기";
|
||||||
|
"intent_open_compose_desc" = "글쓰기 화면 열기";
|
||||||
|
"intent_compose_post_title" = "게시물 작성";
|
||||||
|
"intent_compose_post_desc" = "새 게시물 작성";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "검색";
|
||||||
|
"intent_search_desc" = "콘텐츠 검색";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "알림 보기";
|
||||||
|
"intent_notifications_desc" = "알림 보기";
|
||||||
|
"intent_check_notifications_title" = "알림 확인";
|
||||||
|
"intent_check_notifications_desc" = "알림 수 확인";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "메시지 보내기";
|
||||||
|
"intent_send_message_desc" = "채팅 채널에 메시지 보내기";
|
||||||
|
"intent_read_messages_title" = "메시지 읽기";
|
||||||
|
"intent_read_messages_desc" = "채팅 채널에서 최근 메시지 읽기";
|
||||||
|
"intent_unread_chats_title" = "읽지 않은 채팅 확인";
|
||||||
|
"intent_unread_chats_desc" = "읽지 않은 채팅 메시지 수 확인";
|
||||||
|
"intent_mark_read_title" = "알림 읽음 처리";
|
||||||
|
"intent_mark_read_desc" = "모든 알림을 읽음으로 처리";
|
||||||
33
ios/Runner/zh-Hans.lproj/Localizable.strings
Normal file
33
ios/Runner/zh-Hans.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "打开聊天";
|
||||||
|
"intent_open_chat_desc" = "打开特定聊天室";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "打开帖子";
|
||||||
|
"intent_open_post_desc" = "打开特定帖子";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "打开撰写";
|
||||||
|
"intent_open_compose_desc" = "打开撰写帖子页面";
|
||||||
|
"intent_compose_post_title" = "撰写帖子";
|
||||||
|
"intent_compose_post_desc" = "创建新帖子";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "搜索内容";
|
||||||
|
"intent_search_desc" = "搜索内容";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "查看通知";
|
||||||
|
"intent_notifications_desc" = "查看通知";
|
||||||
|
"intent_check_notifications_title" = "检查通知";
|
||||||
|
"intent_check_notifications_desc" = "检查通知数量";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "发送消息";
|
||||||
|
"intent_send_message_desc" = "发送消息到聊天频道";
|
||||||
|
"intent_read_messages_title" = "读取消息";
|
||||||
|
"intent_read_messages_desc" = "从聊天频道读取最近消息";
|
||||||
|
"intent_unread_chats_title" = "检查未读聊天";
|
||||||
|
"intent_unread_chats_desc" = "检查未读聊天消息数量";
|
||||||
|
"intent_mark_read_title" = "标记通知已读";
|
||||||
|
"intent_mark_read_desc" = "将所有通知标记为已读";
|
||||||
33
ios/Runner/zh-Hant.lproj/Localizable.strings
Normal file
33
ios/Runner/zh-Hant.lproj/Localizable.strings
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* App Intents - Chat */
|
||||||
|
"intent_open_chat_title" = "開啟聊天";
|
||||||
|
"intent_open_chat_desc" = "開啟特定聊天室";
|
||||||
|
|
||||||
|
/* App Intents - Post */
|
||||||
|
"intent_open_post_title" = "開啟貼文";
|
||||||
|
"intent_open_post_desc" = "開啟特定貼文";
|
||||||
|
|
||||||
|
/* App Intents - Compose */
|
||||||
|
"intent_open_compose_title" = "開啟撰寫";
|
||||||
|
"intent_open_compose_desc" = "開啟撰寫貼文頁面";
|
||||||
|
"intent_compose_post_title" = "撰寫貼文";
|
||||||
|
"intent_compose_post_desc" = "建立新貼文";
|
||||||
|
|
||||||
|
/* App Intents - Search */
|
||||||
|
"intent_search_title" = "搜尋內容";
|
||||||
|
"intent_search_desc" = "搜尋內容";
|
||||||
|
|
||||||
|
/* App Intents - Notifications */
|
||||||
|
"intent_notifications_title" = "查看通知";
|
||||||
|
"intent_notifications_desc" = "查看通知";
|
||||||
|
"intent_check_notifications_title" = "檢查通知";
|
||||||
|
"intent_check_notifications_desc" = "檢查通知數量";
|
||||||
|
|
||||||
|
/* App Intents - Messages */
|
||||||
|
"intent_send_message_title" = "傳送訊息";
|
||||||
|
"intent_send_message_desc" = "傳送訊息到聊天頻道";
|
||||||
|
"intent_read_messages_title" = "讀取訊息";
|
||||||
|
"intent_read_messages_desc" = "從聊天頻道讀取最近訊息";
|
||||||
|
"intent_unread_chats_title" = "檢查未讀聊天";
|
||||||
|
"intent_unread_chats_desc" = "檢查未讀聊天訊息數量";
|
||||||
|
"intent_mark_read_title" = "標記通知已讀";
|
||||||
|
"intent_mark_read_desc" = "將所有通知標記為已讀";
|
||||||
BIN
ios/SfxMessage.caf
Normal file
BIN
ios/SfxMessage.caf
Normal file
Binary file not shown.
BIN
ios/SfxNotification.caf
Normal file
BIN
ios/SfxNotification.caf
Normal file
Binary file not shown.
@@ -5,7 +5,7 @@
|
|||||||
// Created by LittleSheep on 2025/5/31.
|
// Created by LittleSheep on 2025/5/31.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UserNotifications
|
@preconcurrency import UserNotifications
|
||||||
import Intents
|
import Intents
|
||||||
import Kingfisher
|
import Kingfisher
|
||||||
import UniformTypeIdentifiers
|
import UniformTypeIdentifiers
|
||||||
@@ -53,8 +53,10 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
private func processNotification(request: UNNotificationRequest, content: UNMutableNotificationContent) throws {
|
private func processNotification(request: UNNotificationRequest, content: UNMutableNotificationContent) throws {
|
||||||
switch content.userInfo["type"] as? String {
|
switch content.userInfo["type"] as? String {
|
||||||
case "messages.new":
|
case "messages.new":
|
||||||
|
content.sound = UNNotificationSound(named: UNNotificationSoundName("SfxMessage.caf"))
|
||||||
try handleMessagingNotification(request: request, content: content)
|
try handleMessagingNotification(request: request, content: content)
|
||||||
default:
|
default:
|
||||||
|
content.sound = UNNotificationSound(named: UNNotificationSoundName("SfxNotification.caf"))
|
||||||
try handleDefaultNotification(content: content)
|
try handleDefaultNotification(content: content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +151,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
|
|
||||||
let dispatchGroup = DispatchGroup()
|
let dispatchGroup = DispatchGroup()
|
||||||
var attachments: [UNNotificationAttachment] = []
|
var attachments: [UNNotificationAttachment] = []
|
||||||
let lock = NSLock() // To synchronize access to the attachments array
|
let queue = DispatchQueue(label: "dev.solsynth.solian.nse")
|
||||||
|
|
||||||
for attachmentUrl in attachmentUrls {
|
for attachmentUrl in attachmentUrls {
|
||||||
guard let remoteUrl = URL(string: attachmentUrl) else {
|
guard let remoteUrl = URL(string: attachmentUrl) else {
|
||||||
@@ -163,7 +165,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
.processor(scaleProcessor)
|
.processor(scaleProcessor)
|
||||||
] : nil) { [weak self] result in
|
] : nil) { [weak self] result in
|
||||||
defer { dispatchGroup.leave() }
|
defer { dispatchGroup.leave() }
|
||||||
guard let self = self else { return }
|
guard self != nil else { return }
|
||||||
|
|
||||||
switch result {
|
switch result {
|
||||||
case .success(let retrievalResult):
|
case .success(let retrievalResult):
|
||||||
@@ -176,12 +178,12 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
try retrievalResult.image.pngData()?.write(to: cachedFileUrl)
|
try retrievalResult.image.pngData()?.write(to: cachedFileUrl)
|
||||||
|
|
||||||
if let attachment = try? UNNotificationAttachment(identifier: attachmentUrl, url: cachedFileUrl, options: [
|
if let attachment = try? UNNotificationAttachment(identifier: attachmentUrl, url: cachedFileUrl, options: [
|
||||||
UNNotificationAttachmentOptionsTypeHintKey: type?.identifier as Any,
|
UNNotificationAttachmentOptionsTypeHintKey: UTType.png.identifier,
|
||||||
UNNotificationAttachmentOptionsThumbnailHiddenKey: 0,
|
UNNotificationAttachmentOptionsThumbnailHiddenKey: 0,
|
||||||
]) {
|
]) {
|
||||||
lock.lock()
|
queue.async {
|
||||||
attachments.append(attachment)
|
attachments.append(attachment)
|
||||||
lock.unlock()
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
print("Failed to write media to temporary file: \(error.localizedDescription)")
|
print("Failed to write media to temporary file: \(error.localizedDescription)")
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "icon-dark.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "tinted"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "icon 1.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
21
ios/SolianWidgetExtension/Assets.xcassets/CloudyLamb.imageset/Contents.json
vendored
Normal file
21
ios/SolianWidgetExtension/Assets.xcassets/CloudyLamb.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
ios/SolianWidgetExtension/Assets.xcassets/CloudyLamb.imageset/icon.png
vendored
Normal file
BIN
ios/SolianWidgetExtension/Assets.xcassets/CloudyLamb.imageset/icon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
21
ios/SolianWidgetExtension/Assets.xcassets/CloudyLambDark.imageset/Contents.json
vendored
Normal file
21
ios/SolianWidgetExtension/Assets.xcassets/CloudyLambDark.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon-dark.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
ios/SolianWidgetExtension/Assets.xcassets/CloudyLambDark.imageset/icon-dark.png
vendored
Normal file
BIN
ios/SolianWidgetExtension/Assets.xcassets/CloudyLambDark.imageset/icon-dark.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
6
ios/SolianWidgetExtension/Assets.xcassets/Contents.json
Normal file
6
ios/SolianWidgetExtension/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
11
ios/SolianWidgetExtension/Info.plist
Normal file
11
ios/SolianWidgetExtension/Info.plist
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?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>NSExtension</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExtensionPointIdentifier</key>
|
||||||
|
<string>com.apple.widgetkit-extension</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
720
ios/SolianWidgetExtension/SolianCheckInWidget.swift
Normal file
720
ios/SolianWidgetExtension/SolianCheckInWidget.swift
Normal file
@@ -0,0 +1,720 @@
|
|||||||
|
//
|
||||||
|
// SolianWidgetExtension.swift
|
||||||
|
// SolianWidgetExtension
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/3.
|
||||||
|
//
|
||||||
|
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct CheckInTip: Codable {
|
||||||
|
let isPositive: Bool
|
||||||
|
let title: String
|
||||||
|
let content: String
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case isPositive = "is_positive"
|
||||||
|
case title
|
||||||
|
case content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInAccount: Codable {
|
||||||
|
let id: String
|
||||||
|
let nick: String?
|
||||||
|
let profile: CheckInProfile?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInProfile: Codable {
|
||||||
|
let picture: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInResult: Codable {
|
||||||
|
let id: String
|
||||||
|
let level: Int
|
||||||
|
let rewardPoints: Int
|
||||||
|
let rewardExperience: Int
|
||||||
|
let tips: [CheckInTip]
|
||||||
|
let accountId: String
|
||||||
|
let account: CheckInAccount?
|
||||||
|
let createdAt: String
|
||||||
|
let updatedAt: String
|
||||||
|
let deletedAt: String?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case level
|
||||||
|
case rewardPoints = "reward_points"
|
||||||
|
case rewardExperience = "reward_experience"
|
||||||
|
case tips
|
||||||
|
case accountId = "account_id"
|
||||||
|
case account
|
||||||
|
case createdAt = "created_at"
|
||||||
|
case updatedAt = "updated_at"
|
||||||
|
case deletedAt = "deleted_at"
|
||||||
|
}
|
||||||
|
|
||||||
|
var createdDate: Date? {
|
||||||
|
let formatter = ISO8601DateFormatter()
|
||||||
|
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||||
|
|
||||||
|
if let date = formatter.date(from: createdAt) {
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for timestamps without fractional seconds
|
||||||
|
formatter.formatOptions = [.withInternetDateTime]
|
||||||
|
return formatter.date(from: createdAt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotableDay: Codable {
|
||||||
|
let date: String
|
||||||
|
let localName: String
|
||||||
|
let globalName: String
|
||||||
|
let countryCode: String?
|
||||||
|
let localizableKey: String?
|
||||||
|
let holidays: [Int]?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case date
|
||||||
|
case localName = "local_name"
|
||||||
|
case globalName = "global_name"
|
||||||
|
case countryCode = "country_code"
|
||||||
|
case localizableKey = "localizable_key"
|
||||||
|
case holidays
|
||||||
|
}
|
||||||
|
|
||||||
|
var notableDate: Date? {
|
||||||
|
ISO8601DateFormatter().date(from: date)
|
||||||
|
}
|
||||||
|
|
||||||
|
var isToday: Bool {
|
||||||
|
guard let notableDate = notableDate else { return false }
|
||||||
|
let calendar = Calendar.current
|
||||||
|
return calendar.isDateInToday(notableDate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CheckInService {
|
||||||
|
private let networkService = WidgetNetworkService()
|
||||||
|
|
||||||
|
func fetchCheckInResult() async throws -> CheckInResult? {
|
||||||
|
return try await networkService.makeRequest(path: "/pass/accounts/me/check-in")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NotableDayService {
|
||||||
|
private let networkService = WidgetNetworkService()
|
||||||
|
|
||||||
|
func fetchRecentNotableDay() async throws -> NotableDay? {
|
||||||
|
print("[WidgetKit] [NotableDayService] Fetching recent notable day...")
|
||||||
|
do {
|
||||||
|
let result: [NotableDay]? = try await networkService.makeRequest(path: "/pass/notable/me/recent")
|
||||||
|
print("[WidgetKit] [NotableDayService] Result: \(String(describing: result))")
|
||||||
|
|
||||||
|
guard let result = result else {
|
||||||
|
print("[WidgetKit] [NotableDayService] Result is nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
print("[WidgetKit] [NotableDayService] Result count: \(result.count)")
|
||||||
|
|
||||||
|
guard result.isEmpty == false else {
|
||||||
|
print("[WidgetKit] [NotableDayService] No notable days found")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
let firstDay = result.first!
|
||||||
|
print("[WidgetKit] [NotableDayService] First notable day: \(firstDay.localName), date: \(firstDay.date)")
|
||||||
|
|
||||||
|
return firstDay
|
||||||
|
} catch let decodingError as DecodingError {
|
||||||
|
print("[WidgetKit] [NotableDayService] Decoding error, trying as single object...")
|
||||||
|
print("[WidgetKit] [NotableDayService] Error: \(decodingError.localizedDescription)")
|
||||||
|
|
||||||
|
switch decodingError {
|
||||||
|
case .typeMismatch(let type, let context):
|
||||||
|
print("[WidgetKit] [NotableDayService] Type mismatch: expected \(type), context: \(context.debugDescription)")
|
||||||
|
case .valueNotFound(let type, let context):
|
||||||
|
print("[WidgetKit] [NotableDayService] Value not found: type \(type), context: \(context.debugDescription)")
|
||||||
|
case .keyNotFound(let key, let context):
|
||||||
|
print("[WidgetKit] [NotableDayService] Key not found: \(key), context: \(context.debugDescription)")
|
||||||
|
case .dataCorrupted(let context):
|
||||||
|
print("[WidgetKit] [NotableDayService] Data corrupted: \(context.debugDescription)")
|
||||||
|
@unknown default:
|
||||||
|
print("[WidgetKit] [NotableDayService] Unknown decoding error")
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
let singleResult: NotableDay? = try await networkService.makeRequest(path: "/pass/notable/me/recent")
|
||||||
|
print("[WidgetKit] [NotableDayService] Single object decode succeeded: \(singleResult?.localName ?? "nil")")
|
||||||
|
return singleResult
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [NotableDayService] Single object decode also failed: \(error.localizedDescription)")
|
||||||
|
throw decodingError
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [NotableDayService] Error fetching notable day: \(error.localizedDescription)")
|
||||||
|
print("[WidgetKit] [NotableDayService] Error type: \(type(of: error))")
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInEntry: TimelineEntry {
|
||||||
|
let date: Date
|
||||||
|
let result: CheckInResult?
|
||||||
|
let notableDay: NotableDay?
|
||||||
|
let error: String?
|
||||||
|
let isLoading: Bool
|
||||||
|
|
||||||
|
static func placeholder() -> CheckInEntry {
|
||||||
|
CheckInEntry(date: Date(), result: nil, notableDay: nil, error: nil, isLoading: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Provider: TimelineProvider {
|
||||||
|
private let apiService = CheckInService()
|
||||||
|
|
||||||
|
func placeholder(in context: Context) -> CheckInEntry {
|
||||||
|
CheckInEntry.placeholder()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSnapshot(in context: Context, completion: @escaping (CheckInEntry) -> ()) {
|
||||||
|
Task {
|
||||||
|
print("[WidgetKit] [Provider] Getting snapshot...")
|
||||||
|
async let checkInResult = try? await apiService.fetchCheckInResult()
|
||||||
|
async let notableDay = try? await NotableDayService().fetchRecentNotableDay()
|
||||||
|
|
||||||
|
let result = try? await checkInResult
|
||||||
|
let day = try? await notableDay
|
||||||
|
|
||||||
|
print("[WidgetKit] [Provider] Snapshot - CheckIn: \(result != nil ? "Found" : "Not found"), NotableDay: \(day != nil ? "Found" : "Not found")")
|
||||||
|
|
||||||
|
let entry = CheckInEntry(date: Date(), result: result, notableDay: day, error: nil, isLoading: false)
|
||||||
|
completion(entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
|
||||||
|
Task {
|
||||||
|
let currentDate = Date()
|
||||||
|
print("[WidgetKit] [Provider] Getting timeline at \(currentDate)...")
|
||||||
|
|
||||||
|
do {
|
||||||
|
async let checkInResult = try await apiService.fetchCheckInResult()
|
||||||
|
async let notableDay = try await NotableDayService().fetchRecentNotableDay()
|
||||||
|
|
||||||
|
let result = try await checkInResult
|
||||||
|
let day = try await notableDay
|
||||||
|
|
||||||
|
print("[WidgetKit] [Provider] Timeline - CheckIn: \(result != nil ? "Found" : "Not found"), NotableDay: \(day != nil ? "Found" : "Not found")")
|
||||||
|
|
||||||
|
let entry = CheckInEntry(date: currentDate, result: result, notableDay: day, error: nil, isLoading: false)
|
||||||
|
|
||||||
|
let nextUpdateDate: Date
|
||||||
|
if let result = result, let createdDate = result.createdDate {
|
||||||
|
let calendar = Calendar.current
|
||||||
|
if let tomorrow = calendar.date(byAdding: .day, value: 1, to: createdDate) {
|
||||||
|
nextUpdateDate = min(tomorrow, calendar.date(byAdding: .hour, value: 1, to: currentDate)!)
|
||||||
|
} else {
|
||||||
|
nextUpdateDate = calendar.date(byAdding: .hour, value: 1, to: currentDate)!
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nextUpdateDate = Calendar.current.date(byAdding: .minute, value: 30, to: currentDate)!
|
||||||
|
}
|
||||||
|
|
||||||
|
print("[WidgetKit] [Provider] Next update at: \(nextUpdateDate)")
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdateDate))
|
||||||
|
completion(timeline)
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [Provider] Error in getTimeline: \(error.localizedDescription)")
|
||||||
|
let entry = CheckInEntry(date: currentDate, result: nil, notableDay: nil, error: error.localizedDescription, isLoading: false)
|
||||||
|
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 10, to: currentDate)!
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
|
||||||
|
completion(timeline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInWidgetEntryView: View {
|
||||||
|
var entry: Provider.Entry
|
||||||
|
@Environment(\.widgetFamily) var family
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if let result = entry.result {
|
||||||
|
CheckedInView(result: result, notableDay: entry.notableDay)
|
||||||
|
} else if entry.isLoading {
|
||||||
|
LoadingView()
|
||||||
|
} else if let error = entry.error {
|
||||||
|
ErrorView(error: error)
|
||||||
|
} else {
|
||||||
|
NotCheckedInView(notableDay: entry.notableDay)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func getLevelName(for level: Int) -> String {
|
||||||
|
let key = "checkInResultT\(level)"
|
||||||
|
return NSLocalizedString(key, comment: "Check-in result level name")
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func NotableDayView(notableDay: NotableDay) -> some View {
|
||||||
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
if !notableDay.isToday {
|
||||||
|
Text(NSLocalizedString("notableDayUpcoming", comment: "Upcoming"))
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
HStack(spacing: isAccessory ? 8 : 6) {
|
||||||
|
Image(systemName: "sparkles")
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
.font(isAccessory ? .caption : .subheadline)
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
if notableDay.isToday {
|
||||||
|
Text(String(format: NSLocalizedString("notableDayToday", comment: "{name} is today!"), notableDay.localName))
|
||||||
|
.font(isAccessory ? .caption : .footnote)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(2)
|
||||||
|
} else {
|
||||||
|
if let notableDate = notableDay.notableDate {
|
||||||
|
let dateString = isCompact ? formatDateCompact(notableDate) : formatDateRegular(notableDate)
|
||||||
|
Text(String(format: NSLocalizedString("notableDayIs", comment: "{date} is {name}"), dateString, notableDay.localName))
|
||||||
|
.font(isAccessory ? .caption : .footnote)
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(2)
|
||||||
|
} else {
|
||||||
|
Text(notableDay.localName)
|
||||||
|
.font(isAccessory ? .caption : .footnote)
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if notableDay.isToday && !isAccessory {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "star.fill")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
Text(NSLocalizedString("today", comment: "Today"))
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isCompact: Bool {
|
||||||
|
family == .systemSmall || isAccessory
|
||||||
|
}
|
||||||
|
|
||||||
|
private func formatDateCompact(_ date: Date) -> String {
|
||||||
|
let formatter = DateFormatter()
|
||||||
|
formatter.dateFormat = "M/d"
|
||||||
|
return formatter.string(from: date)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func formatDateRegular(_ date: Date) -> String {
|
||||||
|
let formatter = DateFormatter()
|
||||||
|
formatter.dateFormat = "MMM d, yyyy"
|
||||||
|
return formatter.string(from: date)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func CheckedInView(result: CheckInResult, notableDay: NotableDay?) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://dashboard")!) {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 2 : 8) {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Image(systemName: "flame.fill")
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
.font(isAccessory ? .caption : .title3)
|
||||||
|
Text(getLevelName(for: result.level))
|
||||||
|
.font(isAccessory ? .caption2 : .headline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !result.tips.isEmpty {
|
||||||
|
if isAccessory {
|
||||||
|
let positiveTips = result.tips.filter { $0.isPositive }
|
||||||
|
let negativeTips = result.tips.filter { !$0.isPositive }
|
||||||
|
|
||||||
|
HStack(spacing: 2) {
|
||||||
|
if let positiveTip = positiveTips.first {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Image(systemName: "hand.thumbsup.fill")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Text(positiveTip.title)
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let negativeTip = negativeTips.first {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Image(systemName: "hand.thumbsdown.fill")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Text(negativeTip.title)
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
} else if family == .systemSmall {
|
||||||
|
let positiveTips = result.tips.filter { $0.isPositive }
|
||||||
|
let negativeTips = result.tips.filter { !$0.isPositive }
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
if let positiveTip = positiveTips.first {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "hand.thumbsup.fill")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.green.opacity(0.8))
|
||||||
|
Text(positiveTip.title)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let negativeTip = negativeTips.first {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "hand.thumbsdown.fill")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.red.opacity(0.8))
|
||||||
|
Text(negativeTip.title)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let positiveTips = result.tips.filter { $0.isPositive }
|
||||||
|
let negativeTips = result.tips.filter { !$0.isPositive }
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
if !positiveTips.isEmpty {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "hand.thumbsup.fill")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.green.opacity(0.8))
|
||||||
|
ForEach(Array(positiveTips.prefix(3)), id: \.title) { tip in
|
||||||
|
Text(tip.title)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
if tip.title != positiveTips.last?.title {
|
||||||
|
Text("•")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !negativeTips.isEmpty {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "hand.thumbsdown.fill")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.red.opacity(0.8))
|
||||||
|
ForEach(Array(negativeTips.prefix(3)), id: \.title) { tip in
|
||||||
|
Text(tip.title)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
if tip.title != negativeTips.last?.title {
|
||||||
|
Text("•")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if !isAccessory && family != .systemSmall {
|
||||||
|
Text("No fortune today")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let notableDay = notableDay {
|
||||||
|
NotableDayView(notableDay: notableDay)
|
||||||
|
}
|
||||||
|
|
||||||
|
if family == .systemLarge {
|
||||||
|
Spacer()
|
||||||
|
WidgetFooter()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 0 : (family == .systemSmall ? 6 : 12))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func WidgetFooter() -> some View {
|
||||||
|
HStack {
|
||||||
|
Text("Solian")
|
||||||
|
.font(.caption2)
|
||||||
|
.fontWeight(.medium)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isAccessory: Bool {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
if case .accessoryRectangular = family {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func NotCheckedInView(notableDay: NotableDay?) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://dashboard")!) {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 2 : 8) {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Image(systemName: "flame.fill")
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.font(isAccessory ? .caption : .title3)
|
||||||
|
Text(NSLocalizedString("checkIn", comment: "Check In"))
|
||||||
|
.font(isAccessory ? .caption2 : .headline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Text(NSLocalizedString("tapToCheckIn", comment: "Tap to check in today"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
if let notableDay = notableDay {
|
||||||
|
NotableDayView(notableDay: notableDay)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
WidgetFooter()
|
||||||
|
} else if let notableDay = notableDay {
|
||||||
|
NotableDayView(notableDay: notableDay)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 0 : (family == .systemSmall ? 6 : 12))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func LoadingView() -> some View {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 2 : 8) {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
ProgressView()
|
||||||
|
.scaleEffect(isAccessory ? 0.6 : 0.8)
|
||||||
|
Text(NSLocalizedString("loading", comment: "Loading..."))
|
||||||
|
.font(isAccessory ? .caption2 : .caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Spacer()
|
||||||
|
WidgetFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 0 : 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func ErrorView(error: String) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://dashboard")!) {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 2 : 8) {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "exclamationmark.triangle")
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.font(isAccessory ? .caption : .title3)
|
||||||
|
Text(NSLocalizedString("error", comment: "Error"))
|
||||||
|
.font(isAccessory ? .caption2 : .headline)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Text(NSLocalizedString("openAppToRefresh", comment: "Open app to refresh"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(error)
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.lineLimit(nil)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
WidgetFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 0 : (family == .systemSmall ? 6 : 12))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CheckInWidgetRootView: View {
|
||||||
|
var entry: Provider.Entry
|
||||||
|
@Environment(\.colorScheme) var colorScheme
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if #available(iOS 17.0, *) {
|
||||||
|
ZStack {
|
||||||
|
CheckInWidgetEntryView(entry: entry)
|
||||||
|
|
||||||
|
if entry.result != nil || entry.notableDay != nil {
|
||||||
|
GeometryReader { geometry in
|
||||||
|
Image(colorScheme == .dark ? "CloudyLambDark" : "CloudyLamb")
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(
|
||||||
|
width: geometry.size.width * 0.9,
|
||||||
|
height: geometry.size.width * 0.9
|
||||||
|
)
|
||||||
|
.opacity(0.18)
|
||||||
|
.mask(
|
||||||
|
LinearGradient(
|
||||||
|
gradient: Gradient(colors: [
|
||||||
|
Color.white,
|
||||||
|
Color.white,
|
||||||
|
Color.clear
|
||||||
|
]),
|
||||||
|
startPoint: .topLeading,
|
||||||
|
endPoint: .bottomTrailing
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.position(
|
||||||
|
x: geometry.size.width * 0.9,
|
||||||
|
y: 20
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.containerBackground(.fill.tertiary, for: .widget)
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
} else {
|
||||||
|
CheckInWidgetEntryView(entry: entry)
|
||||||
|
.padding()
|
||||||
|
.background()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SolianCheckInWidget: Widget {
|
||||||
|
let kind: String = "SolianCheckInWidget"
|
||||||
|
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
StaticConfiguration(kind: kind, provider: Provider()) { entry in
|
||||||
|
CheckInWidgetRootView(entry: entry)
|
||||||
|
}
|
||||||
|
.configurationDisplayName("Check In")
|
||||||
|
.description("View your daily check-in status")
|
||||||
|
.supportedFamilies(supportedFamilies)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var supportedFamilies: [WidgetFamily] {
|
||||||
|
#if os(iOS)
|
||||||
|
return [.systemSmall, .systemMedium, .systemLarge, .accessoryRectangular]
|
||||||
|
#else
|
||||||
|
return [.systemSmall, .systemMedium, .systemLarge]
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemSmall) {
|
||||||
|
SolianCheckInWidget()
|
||||||
|
} timeline: {
|
||||||
|
CheckInEntry(date: .now, result: nil, notableDay: nil, error: nil, isLoading: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemMedium) {
|
||||||
|
SolianCheckInWidget()
|
||||||
|
} timeline: {
|
||||||
|
CheckInEntry(
|
||||||
|
date: .now,
|
||||||
|
result: CheckInResult(
|
||||||
|
id: "test-id",
|
||||||
|
level: 2,
|
||||||
|
rewardPoints: 10,
|
||||||
|
rewardExperience: 100,
|
||||||
|
tips: [
|
||||||
|
CheckInTip(isPositive: true, title: "Good Luck", content: "Great day"),
|
||||||
|
CheckInTip(isPositive: true, title: "Creative", content: "Inspiration"),
|
||||||
|
CheckInTip(isPositive: false, title: "Shopping", content: "Expensive")
|
||||||
|
],
|
||||||
|
accountId: "account-id",
|
||||||
|
account: nil,
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
notableDay: NotableDay(
|
||||||
|
date: ISO8601DateFormatter().string(from: Calendar.current.date(byAdding: .day, value: 5, to: Date())!),
|
||||||
|
localName: "Christmas",
|
||||||
|
globalName: "Christmas",
|
||||||
|
countryCode: nil,
|
||||||
|
localizableKey: nil,
|
||||||
|
holidays: []
|
||||||
|
),
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
|
#Preview(as: .accessoryRectangular) {
|
||||||
|
SolianCheckInWidget()
|
||||||
|
} timeline: {
|
||||||
|
CheckInEntry(
|
||||||
|
date: .now,
|
||||||
|
result: CheckInResult(
|
||||||
|
id: "test-id",
|
||||||
|
level: 4,
|
||||||
|
rewardPoints: 50,
|
||||||
|
rewardExperience: 500,
|
||||||
|
tips: [
|
||||||
|
CheckInTip(isPositive: true, title: "Lucky", content: "Great fortune"),
|
||||||
|
CheckInTip(isPositive: true, title: "Success", content: "Opportunity")
|
||||||
|
],
|
||||||
|
accountId: "account-id",
|
||||||
|
account: nil,
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
notableDay: NotableDay(
|
||||||
|
date: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
localName: "New Year",
|
||||||
|
globalName: "New Year",
|
||||||
|
countryCode: nil,
|
||||||
|
localizableKey: nil,
|
||||||
|
holidays: []
|
||||||
|
),
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
937
ios/SolianWidgetExtension/SolianNotificationWidget.swift
Normal file
937
ios/SolianWidgetExtension/SolianNotificationWidget.swift
Normal file
@@ -0,0 +1,937 @@
|
|||||||
|
//
|
||||||
|
// SolianNotificationWidget.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/4.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
// MARK: - Notification Widget
|
||||||
|
|
||||||
|
struct NotificationMeta: Codable {
|
||||||
|
let pfp: String?
|
||||||
|
let images: [String]?
|
||||||
|
let actionUri: String?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case pfp
|
||||||
|
case images
|
||||||
|
case actionUri = "action_uri"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SnNotification: Codable, Identifiable {
|
||||||
|
let id: String
|
||||||
|
let topic: String
|
||||||
|
let title: String
|
||||||
|
let subtitle: String
|
||||||
|
let content: String
|
||||||
|
let meta: NotificationMeta?
|
||||||
|
let priority: Int
|
||||||
|
let viewedAt: String?
|
||||||
|
let accountId: String
|
||||||
|
let createdAt: String
|
||||||
|
let updatedAt: String
|
||||||
|
let deletedAt: String?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case topic
|
||||||
|
case title
|
||||||
|
case subtitle
|
||||||
|
case content
|
||||||
|
case meta
|
||||||
|
case priority
|
||||||
|
case viewedAt = "viewed_at"
|
||||||
|
case accountId = "account_id"
|
||||||
|
case createdAt = "created_at"
|
||||||
|
case updatedAt = "updated_at"
|
||||||
|
case deletedAt = "deleted_at"
|
||||||
|
}
|
||||||
|
|
||||||
|
var createdDate: Date? {
|
||||||
|
let formatter = ISO8601DateFormatter()
|
||||||
|
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||||
|
|
||||||
|
if let date = formatter.date(from: createdAt) {
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for timestamps without fractional seconds
|
||||||
|
formatter.formatOptions = [.withInternetDateTime]
|
||||||
|
return formatter.date(from: createdAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
var isUnread: Bool {
|
||||||
|
return viewedAt == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTopicIcon() -> String {
|
||||||
|
switch topic {
|
||||||
|
case "post.replies":
|
||||||
|
return "arrow.uturn.backward"
|
||||||
|
case "wallet.transactions":
|
||||||
|
return "wallet.pass"
|
||||||
|
case "relationships.friends.request":
|
||||||
|
return "person.badge.plus"
|
||||||
|
case "invites.chat":
|
||||||
|
return "message.badge"
|
||||||
|
case "invites.realm":
|
||||||
|
return "globe"
|
||||||
|
case "auth.login":
|
||||||
|
return "arrow.right.square"
|
||||||
|
case "posts.new":
|
||||||
|
return "doc.badge.plus"
|
||||||
|
case "wallet.orders.paid":
|
||||||
|
return "baggage"
|
||||||
|
case "posts.reactions.new":
|
||||||
|
return "face.smiling"
|
||||||
|
default:
|
||||||
|
return "bell"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotificationEntry: TimelineEntry {
|
||||||
|
let date: Date
|
||||||
|
let notifications: [SnNotification]?
|
||||||
|
let unreadCount: Int
|
||||||
|
let error: String?
|
||||||
|
let isLoading: Bool
|
||||||
|
|
||||||
|
static func placeholder() -> NotificationEntry {
|
||||||
|
NotificationEntry(date: Date(), notifications: nil, unreadCount: 0, error: nil, isLoading: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NotificationService {
|
||||||
|
private let networkService = WidgetNetworkService()
|
||||||
|
|
||||||
|
private lazy var session: URLSession = {
|
||||||
|
let configuration = URLSessionConfiguration.ephemeral
|
||||||
|
configuration.timeoutIntervalForRequest = 10.0
|
||||||
|
configuration.timeoutIntervalForResource = 10.0
|
||||||
|
configuration.waitsForConnectivity = false
|
||||||
|
return URLSession(configuration: configuration)
|
||||||
|
}()
|
||||||
|
|
||||||
|
func fetchRecentNotifications(take: Int = 5) async throws -> [SnNotification] {
|
||||||
|
if take == 0 {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let token = networkService.token else {
|
||||||
|
throw RemoteError.missingCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseURL = networkService.baseURL
|
||||||
|
guard let url = URL(string: "\(baseURL)/ring/notifications?unmark=true&take=\(take)") else {
|
||||||
|
throw RemoteError.invalidURL
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "GET"
|
||||||
|
request.setValue("AtField \(token)", forHTTPHeaderField: "Authorization")
|
||||||
|
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||||
|
request.timeoutInterval = 10.0
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
|
||||||
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
|
throw RemoteError.invalidResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
switch httpResponse.statusCode {
|
||||||
|
case 200...299:
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
let notifications = try decoder.decode([SnNotification].self, from: data)
|
||||||
|
return notifications
|
||||||
|
case 404:
|
||||||
|
return []
|
||||||
|
default:
|
||||||
|
throw RemoteError.httpError(httpResponse.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fetchUnreadCount() async throws -> Int {
|
||||||
|
guard let token = networkService.token else {
|
||||||
|
throw RemoteError.missingCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseURL = networkService.baseURL
|
||||||
|
guard let url = URL(string: "\(baseURL)/ring/notifications/count") else {
|
||||||
|
throw RemoteError.invalidURL
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "GET"
|
||||||
|
request.setValue("AtField \(token)", forHTTPHeaderField: "Authorization")
|
||||||
|
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||||
|
request.timeoutInterval = 10.0
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
|
||||||
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
|
throw RemoteError.invalidResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
switch httpResponse.statusCode {
|
||||||
|
case 200...299:
|
||||||
|
if let count = try? JSONSerialization.jsonObject(with: data) as? Int {
|
||||||
|
return count
|
||||||
|
} else if let count = try? JSONSerialization.jsonObject(with: data) as? Double {
|
||||||
|
return Int(count)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case 404:
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
throw RemoteError.httpError(httpResponse.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotificationProvider: TimelineProvider {
|
||||||
|
private let notificationService = NotificationService()
|
||||||
|
|
||||||
|
func placeholder(in context: Context) -> NotificationEntry {
|
||||||
|
NotificationEntry.placeholder()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSnapshot(in context: Context, completion: @escaping (NotificationEntry) -> ()) {
|
||||||
|
Task {
|
||||||
|
print("[WidgetKit] [NotificationProvider] Getting snapshot...")
|
||||||
|
async let notifications = try? await notificationService.fetchRecentNotifications(take: 5)
|
||||||
|
async let unreadCount = try? await notificationService.fetchUnreadCount()
|
||||||
|
|
||||||
|
let notifs = try? await notifications
|
||||||
|
let unread = (try? await unreadCount) ?? 0
|
||||||
|
|
||||||
|
print("[WidgetKit] [NotificationProvider] Snapshot - Notifications: \(notifs?.count ?? 0), Unread: \(unread)")
|
||||||
|
|
||||||
|
let entry = NotificationEntry(date: Date(), notifications: notifs, unreadCount: unread, error: nil, isLoading: false)
|
||||||
|
completion(entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
|
||||||
|
Task {
|
||||||
|
let currentDate = Date()
|
||||||
|
print("[WidgetKit] [NotificationProvider] Getting timeline at \(currentDate)...")
|
||||||
|
|
||||||
|
do {
|
||||||
|
let takeLimit: Int
|
||||||
|
switch context.family {
|
||||||
|
case .systemSmall:
|
||||||
|
takeLimit = 0
|
||||||
|
case .systemMedium:
|
||||||
|
takeLimit = 1
|
||||||
|
case .systemLarge:
|
||||||
|
takeLimit = 3
|
||||||
|
default:
|
||||||
|
takeLimit = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
async let notifications = try await notificationService.fetchRecentNotifications(take: takeLimit)
|
||||||
|
async let unreadCount = try await notificationService.fetchUnreadCount()
|
||||||
|
|
||||||
|
let notifs = try await notifications
|
||||||
|
let unread = try await unreadCount
|
||||||
|
|
||||||
|
print("[WidgetKit] [NotificationProvider] Timeline - Notifications: \(notifs.count), Unread: \(unread)")
|
||||||
|
|
||||||
|
let entry = NotificationEntry(date: currentDate, notifications: notifs, unreadCount: unread, error: nil, isLoading: false)
|
||||||
|
|
||||||
|
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 15, to: currentDate)!
|
||||||
|
print("[WidgetKit] [NotificationProvider] Next update at: \(nextUpdate)")
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
|
||||||
|
completion(timeline)
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [NotificationProvider] Error in getTimeline: \(error.localizedDescription)")
|
||||||
|
let entry = NotificationEntry(date: currentDate, notifications: nil, unreadCount: 0, error: error.localizedDescription, isLoading: false)
|
||||||
|
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 5, to: currentDate)!
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
|
||||||
|
completion(timeline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotificationWidgetEntryView: View {
|
||||||
|
var entry: NotificationProvider.Entry
|
||||||
|
@Environment(\.widgetFamily) var family
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if let notifications = entry.notifications, !notifications.isEmpty {
|
||||||
|
HasNotificationsView(notifications: notifications, unreadCount: entry.unreadCount)
|
||||||
|
} else if entry.isLoading {
|
||||||
|
LoadingView()
|
||||||
|
} else if let error = entry.error {
|
||||||
|
ErrorView(error: error)
|
||||||
|
} else {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isCompact: Bool {
|
||||||
|
family == .systemSmall || isAccessory
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isAccessory: Bool {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
if case .accessoryRectangular = family {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if case .accessoryCircular = family {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isCircular: Bool {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
if case .accessoryCircular = family {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func HasNotificationsView(notifications: [SnNotification], unreadCount: Int) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://notifications")!) {
|
||||||
|
if isCompact {
|
||||||
|
if isAccessory {
|
||||||
|
if isCircular {
|
||||||
|
ZStack {
|
||||||
|
Image(systemName: "bell.fill")
|
||||||
|
.font(.system(size: 20))
|
||||||
|
.foregroundColor(unreadCount > 0 ? .orange : .gray)
|
||||||
|
|
||||||
|
if unreadCount > 0 {
|
||||||
|
Text("\(min(unreadCount, 99))")
|
||||||
|
.font(.system(size: 10, weight: .bold))
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.padding(4)
|
||||||
|
.background(Circle().fill(Color.blue))
|
||||||
|
.offset(x: 12, y: -12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "bell.fill")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
.padding(.leading, 1.5)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("notifications", comment: "Notifications"))
|
||||||
|
.font(.caption2)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if unreadCount > 0 {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Text("\(unreadCount)")
|
||||||
|
.font(.caption2)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.padding(.horizontal, 6)
|
||||||
|
.background(
|
||||||
|
Capsule()
|
||||||
|
.fill(Color.blue.opacity(0.5))
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("unread", comment: "unread"))
|
||||||
|
.font(.caption2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text("on the Solar Network")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.padding(.horizontal, 1.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "bell.fill")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("notifications", comment: "Notifications"))
|
||||||
|
.font(.headline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}.padding(.bottom, 8)
|
||||||
|
|
||||||
|
Spacer(minLength: 2)
|
||||||
|
|
||||||
|
if unreadCount > 0 {
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
Text("\(unreadCount)")
|
||||||
|
.font(.system(.largeTitle, design: .rounded))
|
||||||
|
.fontWeight(.bold)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(minLength: 2)
|
||||||
|
|
||||||
|
if unreadCount > 0 {
|
||||||
|
Text(NSLocalizedString("unreadNotifications", comment: "unread notifications"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.lineLimit(2)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
} else {
|
||||||
|
Text(NSLocalizedString("noUnreadNotifications", comment: "no unread notifications"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "bell.fill")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("notifications", comment: "Notifications"))
|
||||||
|
.font(.headline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
if unreadCount > 0 {
|
||||||
|
Text("\(unreadCount)")
|
||||||
|
.font(.caption)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.padding(.horizontal, 6)
|
||||||
|
.padding(.vertical, 2)
|
||||||
|
.background(.blue)
|
||||||
|
.clipShape(Capsule())
|
||||||
|
}
|
||||||
|
}.padding(.bottom, 8)
|
||||||
|
|
||||||
|
let displayCount = family == .systemMedium ? 1 : 5
|
||||||
|
let displayNotifications = Array(notifications.prefix(displayCount))
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
|
ForEach(displayNotifications) { notification in
|
||||||
|
NotificationItemView(notification: notification, compact: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if family == .systemMedium {
|
||||||
|
Spacer()
|
||||||
|
} else {
|
||||||
|
Spacer()
|
||||||
|
Text(NSLocalizedString("tapToViewAll", comment: "Tap to view all notifications"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func NotificationItemView(notification: SnNotification, compact: Bool) -> some View {
|
||||||
|
HStack(alignment: .top, spacing: compact ? 6 : 12) {
|
||||||
|
if compact {
|
||||||
|
Image(systemName: notification.getTopicIcon())
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
} else {
|
||||||
|
ZStack {
|
||||||
|
Circle()
|
||||||
|
.fill(Color.gray.opacity(0.2))
|
||||||
|
.frame(width: 32, height: 32)
|
||||||
|
|
||||||
|
Image(systemName: notification.getTopicIcon())
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
Text(notification.title)
|
||||||
|
.font(compact ? .caption : .subheadline)
|
||||||
|
.fontWeight(notification.isUnread ? .semibold : .regular)
|
||||||
|
.lineLimit(1)
|
||||||
|
|
||||||
|
if !compact && !notification.subtitle.isEmpty {
|
||||||
|
Text(notification.subtitle)
|
||||||
|
.font(.caption)
|
||||||
|
.lineLimit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !compact && !notification.content.isEmpty {
|
||||||
|
Text(notification.content)
|
||||||
|
.font(.caption2)
|
||||||
|
.lineLimit(2)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let createdDate = notification.createdDate {
|
||||||
|
Text(formatRelativeTime(createdDate))
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.padding(.top, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
if notification.isUnread {
|
||||||
|
Circle()
|
||||||
|
.fill(Color.blue)
|
||||||
|
.frame(width: compact ? 6 : 8, height: compact ? 6 : 8)
|
||||||
|
.padding(.trailing, 6)
|
||||||
|
.padding(.top, 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.vertical, compact ? 2 : 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func NotificationCompactItem(notification: SnNotification) -> some View {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: notification.getTopicIcon())
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(notification.title)
|
||||||
|
.font(.caption2)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fontWeight(notification.isUnread ? .semibold : .regular)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func EmptyView() -> some View {
|
||||||
|
Link(destination: URL(string: "solian://notifications")!) {
|
||||||
|
if isCircular {
|
||||||
|
ZStack {
|
||||||
|
Image(systemName: "bell")
|
||||||
|
.font(.system(size: 20))
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 4 : 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "bell")
|
||||||
|
.font(isAccessory ? .caption : .title3)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("notifications", comment: "Notifications"))
|
||||||
|
.font(isAccessory ? .caption2 : .headline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Text(NSLocalizedString("noNotifications", comment: "No notifications yet"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 4 : 12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func LoadingView() -> some View {
|
||||||
|
if isCircular {
|
||||||
|
ProgressView()
|
||||||
|
.scaleEffect(0.8)
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 4 : 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
ProgressView()
|
||||||
|
.scaleEffect(isAccessory ? 0.6 : 0.8)
|
||||||
|
Text(NSLocalizedString("loading", comment: "Loading..."))
|
||||||
|
.font(isAccessory ? .caption2 : .caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 4 : 12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func ErrorView(error: String) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://notifications")!) {
|
||||||
|
if isCircular {
|
||||||
|
ZStack {
|
||||||
|
Image(systemName: "exclamationmark.triangle")
|
||||||
|
.font(.system(size: 20))
|
||||||
|
.foregroundColor(.red)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VStack(alignment: .leading, spacing: isAccessory ? 4 : 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "exclamationmark.triangle")
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.font(isAccessory ? .caption : .title3)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("error", comment: "Error"))
|
||||||
|
.font(isAccessory ? .caption2 : .headline)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAccessory {
|
||||||
|
Text(NSLocalizedString("openAppToRefresh", comment: "Open app to refresh"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(error)
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.lineLimit(nil)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(isAccessory ? 4 : 12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func formatRelativeTime(_ date: Date) -> String {
|
||||||
|
let now = Date()
|
||||||
|
let interval = now.timeIntervalSince(date)
|
||||||
|
|
||||||
|
if interval < 60 {
|
||||||
|
return NSLocalizedString("justNow", comment: "Just now")
|
||||||
|
} else if interval < 3600 {
|
||||||
|
let minutes = Int(interval / 60)
|
||||||
|
return String(format: NSLocalizedString("minutesAgo", comment: "%d min ago"), minutes)
|
||||||
|
} else if interval < 86400 {
|
||||||
|
let hours = Int(interval / 3600)
|
||||||
|
return String(format: NSLocalizedString("hoursAgo", comment: "%d hr ago"), hours)
|
||||||
|
} else {
|
||||||
|
let days = Int(interval / 86400)
|
||||||
|
return String(format: NSLocalizedString("daysAgo", comment: "%d d ago"), days)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NotificationWidgetRootView: View {
|
||||||
|
var entry: NotificationProvider.Entry
|
||||||
|
@Environment(\.colorScheme) var colorScheme
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if #available(iOS 17.0, *) {
|
||||||
|
ZStack {
|
||||||
|
NotificationWidgetEntryView(entry: entry)
|
||||||
|
|
||||||
|
if let notifications = entry.notifications, !notifications.isEmpty {
|
||||||
|
GeometryReader { geometry in
|
||||||
|
Image(colorScheme == .dark ? "CloudyLambDark" : "CloudyLamb")
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(
|
||||||
|
width: geometry.size.width * 0.9,
|
||||||
|
height: geometry.size.width * 0.9
|
||||||
|
)
|
||||||
|
.opacity(0.12)
|
||||||
|
.mask(
|
||||||
|
LinearGradient(
|
||||||
|
gradient: Gradient(colors: [
|
||||||
|
Color.white,
|
||||||
|
Color.white,
|
||||||
|
Color.clear
|
||||||
|
]),
|
||||||
|
startPoint: .topLeading,
|
||||||
|
endPoint: .bottomTrailing
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.position(
|
||||||
|
x: geometry.size.width * 0.85,
|
||||||
|
y: 20
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.containerBackground(.fill.tertiary, for: .widget)
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
} else {
|
||||||
|
NotificationWidgetEntryView(entry: entry)
|
||||||
|
.padding()
|
||||||
|
.background()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SolianNotificationWidget: Widget {
|
||||||
|
let kind: String = "SolianNotificationWidget"
|
||||||
|
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
StaticConfiguration(kind: kind, provider: NotificationProvider()) { entry in
|
||||||
|
NotificationWidgetRootView(entry: entry)
|
||||||
|
}
|
||||||
|
.configurationDisplayName("Notifications")
|
||||||
|
.description("View your recent notifications")
|
||||||
|
.supportedFamilies(supportedFamilies)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var supportedFamilies: [WidgetFamily] {
|
||||||
|
#if os(iOS)
|
||||||
|
return [.systemSmall, .systemMedium, .systemLarge, .accessoryRectangular, .accessoryCircular]
|
||||||
|
#else
|
||||||
|
return [.systemSmall, .systemMedium, .systemLarge]
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
|
#Preview(as: .accessoryRectangular) {
|
||||||
|
SolianNotificationWidget()
|
||||||
|
} timeline: {
|
||||||
|
NotificationEntry(
|
||||||
|
date: .now,
|
||||||
|
notifications: [
|
||||||
|
SnNotification(
|
||||||
|
id: "1",
|
||||||
|
topic: "post.replies",
|
||||||
|
title: "New reply to your post",
|
||||||
|
subtitle: "Someone replied to your message",
|
||||||
|
content: "This is notification content",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "2",
|
||||||
|
topic: "relationships.friends.request",
|
||||||
|
title: "New friend request",
|
||||||
|
subtitle: "You have a pending friend request",
|
||||||
|
content: "Someone wants to be your friend",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-3600)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
)
|
||||||
|
],
|
||||||
|
unreadCount: 1,
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#Preview(as: .systemSmall) {
|
||||||
|
SolianNotificationWidget()
|
||||||
|
} timeline: {
|
||||||
|
NotificationEntry(
|
||||||
|
date: .now,
|
||||||
|
notifications: [
|
||||||
|
SnNotification(
|
||||||
|
id: "1",
|
||||||
|
topic: "post.replies",
|
||||||
|
title: "New reply to your post",
|
||||||
|
subtitle: "Someone replied to your message",
|
||||||
|
content: "This is notification content",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "2",
|
||||||
|
topic: "relationships.friends.request",
|
||||||
|
title: "New friend request",
|
||||||
|
subtitle: "You have a pending friend request",
|
||||||
|
content: "Someone wants to be your friend",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-3600)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
)
|
||||||
|
],
|
||||||
|
unreadCount: 1,
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemMedium) {
|
||||||
|
SolianNotificationWidget()
|
||||||
|
} timeline: {
|
||||||
|
NotificationEntry(
|
||||||
|
date: .now,
|
||||||
|
notifications: [
|
||||||
|
SnNotification(
|
||||||
|
id: "1",
|
||||||
|
topic: "post.replies",
|
||||||
|
title: "New reply to your post",
|
||||||
|
subtitle: "Someone replied to your message",
|
||||||
|
content: "This is notification content",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "2",
|
||||||
|
topic: "relationships.friends.request",
|
||||||
|
title: "New friend request",
|
||||||
|
subtitle: "You have a pending friend request",
|
||||||
|
content: "Someone wants to be your friend",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-3600)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "3",
|
||||||
|
topic: "invites.chat",
|
||||||
|
title: "New chat invite",
|
||||||
|
subtitle: "You've been invited to a chat",
|
||||||
|
content: "Join the conversation",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-86400)),
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-86400)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
)
|
||||||
|
],
|
||||||
|
unreadCount: 2,
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
|
#Preview(as: .systemLarge) {
|
||||||
|
SolianNotificationWidget()
|
||||||
|
} timeline: {
|
||||||
|
NotificationEntry(
|
||||||
|
date: .now,
|
||||||
|
notifications: [
|
||||||
|
SnNotification(
|
||||||
|
id: "1",
|
||||||
|
topic: "post.replies",
|
||||||
|
title: "New reply",
|
||||||
|
subtitle: "Someone replied",
|
||||||
|
content: "Content",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "2",
|
||||||
|
topic: "relationships.friends.request",
|
||||||
|
title: "New friend request",
|
||||||
|
subtitle: "You have a pending friend request",
|
||||||
|
content: "Someone wants to be your friend",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-3600)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
),
|
||||||
|
SnNotification(
|
||||||
|
id: "3",
|
||||||
|
topic: "invites.chat",
|
||||||
|
title: "New chat invite",
|
||||||
|
subtitle: "You've been invited to a chat",
|
||||||
|
content: "Join the conversation",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-86400)),
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date().addingTimeInterval(-86400)),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
)
|
||||||
|
],
|
||||||
|
unreadCount: 3,
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .accessoryCircular) {
|
||||||
|
SolianNotificationWidget()
|
||||||
|
} timeline: {
|
||||||
|
NotificationEntry(
|
||||||
|
date: .now,
|
||||||
|
notifications: [
|
||||||
|
SnNotification(
|
||||||
|
id: "1",
|
||||||
|
topic: "post.replies",
|
||||||
|
title: "New reply",
|
||||||
|
subtitle: "Someone replied",
|
||||||
|
content: "Content",
|
||||||
|
meta: nil,
|
||||||
|
priority: 0,
|
||||||
|
viewedAt: nil,
|
||||||
|
accountId: "acc-1",
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
deletedAt: nil
|
||||||
|
)
|
||||||
|
],
|
||||||
|
unreadCount: 5,
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
549
ios/SolianWidgetExtension/SolianPostShuffleWidget.swift
Normal file
549
ios/SolianWidgetExtension/SolianPostShuffleWidget.swift
Normal file
@@ -0,0 +1,549 @@
|
|||||||
|
//
|
||||||
|
// SolianPostShuffleWidget.swift
|
||||||
|
// SolianWidgetExtension
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/4.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct SnPostPublisher: Codable {
|
||||||
|
let id: String
|
||||||
|
let name: String
|
||||||
|
let nick: String?
|
||||||
|
let description: String?
|
||||||
|
let picture: SnCloudFile?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case name
|
||||||
|
case nick
|
||||||
|
case description
|
||||||
|
case picture
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SnCloudFile: Codable {
|
||||||
|
let id: String
|
||||||
|
let url: String?
|
||||||
|
let thumbnail: String?
|
||||||
|
let mimeType: String?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case url
|
||||||
|
case thumbnail
|
||||||
|
case mimeType = "mimetype"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SnPost: Codable, Identifiable {
|
||||||
|
let id: String
|
||||||
|
let title: String?
|
||||||
|
let description: String?
|
||||||
|
let content: String?
|
||||||
|
let publisher: SnPostPublisher
|
||||||
|
let tags: [SnPostTag]?
|
||||||
|
let createdAt: String?
|
||||||
|
let updatedAt: String?
|
||||||
|
let attachments: [SnCloudFile]?
|
||||||
|
|
||||||
|
var createdDate: Date? {
|
||||||
|
guard let createdAt = createdAt else { return nil }
|
||||||
|
|
||||||
|
let formatter = ISO8601DateFormatter()
|
||||||
|
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||||
|
|
||||||
|
if let date = formatter.date(from: createdAt) {
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for timestamps without fractional seconds
|
||||||
|
formatter.formatOptions = [.withInternetDateTime]
|
||||||
|
return formatter.date(from: createdAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasTitle: Bool {
|
||||||
|
guard let title = title else { return false }
|
||||||
|
return !title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasDescription: Bool {
|
||||||
|
guard let description = description else { return false }
|
||||||
|
return !description.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasContent: Bool {
|
||||||
|
guard let content = content else { return false }
|
||||||
|
return !content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
var attachmentCount: Int {
|
||||||
|
attachments?.count ?? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case title
|
||||||
|
case description
|
||||||
|
case content
|
||||||
|
case publisher
|
||||||
|
case tags
|
||||||
|
case createdAt = "created_at"
|
||||||
|
case updatedAt = "updated_at"
|
||||||
|
case attachments
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SnPostTag: Codable {
|
||||||
|
let id: String
|
||||||
|
let slug: String
|
||||||
|
let name: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
class PostShuffleService {
|
||||||
|
private let networkService = WidgetNetworkService()
|
||||||
|
|
||||||
|
private lazy var session: URLSession = {
|
||||||
|
let configuration = URLSessionConfiguration.ephemeral
|
||||||
|
configuration.timeoutIntervalForRequest = 10.0
|
||||||
|
configuration.timeoutIntervalForResource = 10.0
|
||||||
|
configuration.waitsForConnectivity = false
|
||||||
|
return URLSession(configuration: configuration)
|
||||||
|
}()
|
||||||
|
|
||||||
|
func fetchRandomPost() async throws -> SnPost? {
|
||||||
|
guard let token = networkService.token else {
|
||||||
|
throw RemoteError.missingCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseURL = networkService.baseURL
|
||||||
|
guard let url = URL(string: "\(baseURL)/sphere/posts?shuffle=true&take=1") else {
|
||||||
|
throw RemoteError.invalidURL
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "GET"
|
||||||
|
request.setValue("AtField \(token)", forHTTPHeaderField: "Authorization")
|
||||||
|
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||||
|
request.timeoutInterval = 10.0
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
|
||||||
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
|
throw RemoteError.invalidResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
switch httpResponse.statusCode {
|
||||||
|
case 200...299:
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
let posts = try decoder.decode([SnPost].self, from: data)
|
||||||
|
return posts.first
|
||||||
|
case 404:
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
throw RemoteError.httpError(httpResponse.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PostShuffleEntry: TimelineEntry {
|
||||||
|
let date: Date
|
||||||
|
let post: SnPost?
|
||||||
|
let error: String?
|
||||||
|
let isLoading: Bool
|
||||||
|
|
||||||
|
static func placeholder() -> PostShuffleEntry {
|
||||||
|
PostShuffleEntry(date: Date(), post: nil, error: nil, isLoading: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PostShuffleProvider: TimelineProvider {
|
||||||
|
private let postShuffleService = PostShuffleService()
|
||||||
|
|
||||||
|
func placeholder(in context: Context) -> PostShuffleEntry {
|
||||||
|
PostShuffleEntry.placeholder()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSnapshot(in context: Context, completion: @escaping (PostShuffleEntry) -> ()) {
|
||||||
|
Task {
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Getting snapshot...")
|
||||||
|
let post = try? await postShuffleService.fetchRandomPost()
|
||||||
|
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Snapshot - Post: \(post != nil ? "Found" : "Not found")")
|
||||||
|
|
||||||
|
let entry = PostShuffleEntry(date: Date(), post: post, error: nil, isLoading: false)
|
||||||
|
completion(entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
|
||||||
|
Task {
|
||||||
|
let currentDate = Date()
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Getting timeline at \(currentDate)...")
|
||||||
|
|
||||||
|
do {
|
||||||
|
let post = try await postShuffleService.fetchRandomPost()
|
||||||
|
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Timeline - Post: \(post != nil ? "Found" : "Not found")")
|
||||||
|
|
||||||
|
let entry = PostShuffleEntry(date: currentDate, post: post, error: nil, isLoading: false)
|
||||||
|
|
||||||
|
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 10, to: currentDate)!
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Next update at: \(nextUpdate)")
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
|
||||||
|
completion(timeline)
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [PostShuffleProvider] Error in getTimeline: \(error.localizedDescription)")
|
||||||
|
let entry = PostShuffleEntry(date: currentDate, post: nil, error: error.localizedDescription, isLoading: false)
|
||||||
|
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 5, to: currentDate)!
|
||||||
|
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
|
||||||
|
completion(timeline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PostShuffleWidgetEntryView: View {
|
||||||
|
var entry: PostShuffleProvider.Entry
|
||||||
|
@Environment(\.widgetFamily) var family
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if let post = entry.post {
|
||||||
|
PostContentView(post: post)
|
||||||
|
} else if entry.isLoading {
|
||||||
|
LoadingView()
|
||||||
|
} else if let error = entry.error {
|
||||||
|
ErrorView(error: error)
|
||||||
|
} else {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func PostContentView(post: SnPost) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://posts/\(post.id)")!) {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(alignment: .top, spacing: 8) {
|
||||||
|
if let avatarUrl = post.publisher.picture?.url ?? post.publisher.picture?.thumbnail {
|
||||||
|
AsyncImage(url: URL(string: avatarUrl)) { phase in
|
||||||
|
switch phase {
|
||||||
|
case .success(let image):
|
||||||
|
image
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fill)
|
||||||
|
case .failure(_):
|
||||||
|
Circle()
|
||||||
|
.fill(Color.gray.opacity(0.3))
|
||||||
|
default:
|
||||||
|
Circle()
|
||||||
|
.fill(Color.gray.opacity(0.3))
|
||||||
|
.overlay(
|
||||||
|
ProgressView()
|
||||||
|
.scaleEffect(0.5)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(width: 40, height: 40)
|
||||||
|
.clipShape(Circle())
|
||||||
|
} else {
|
||||||
|
Circle()
|
||||||
|
.fill(Color.gray.opacity(0.3))
|
||||||
|
.frame(width: 40, height: 40)
|
||||||
|
}
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
Text(post.publisher.nick ?? post.publisher.name)
|
||||||
|
.font(.headline)
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.lineLimit(1)
|
||||||
|
|
||||||
|
if let createdDate = post.createdDate {
|
||||||
|
Text(formatRelativeTime(createdDate))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
if post.attachmentCount > 0 {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Image(systemName: "paperclip")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Text("\(post.attachmentCount)")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if post.hasTitle {
|
||||||
|
Text(post.title!)
|
||||||
|
.font(family == .systemMedium ? .subheadline : .body)
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.lineLimit(family == .systemMedium ? 2 : 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
if post.hasDescription {
|
||||||
|
Text(post.description!)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.lineLimit(family == .systemMedium ? 2 : 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
if post.hasContent {
|
||||||
|
Text(post.content!)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(family == .systemMedium ? 3 : 8)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let tags = post.tags, !tags.isEmpty {
|
||||||
|
let displayTags = Array(tags.prefix(family == .systemMedium ? 2 : 4))
|
||||||
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
ForEach(displayTags, id: \.id) { tag in
|
||||||
|
Text("#\(tag.name ?? tag.slug)")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
.padding(.horizontal, 6)
|
||||||
|
.padding(.vertical, 2)
|
||||||
|
.background(Color.blue.opacity(0.1))
|
||||||
|
.clipShape(Capsule())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func EmptyView() -> some View {
|
||||||
|
Link(destination: URL(string: "solian://posts/shuffle")!) {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "text.alignleft")
|
||||||
|
.font(.title3)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(NSLocalizedString("noPostsAvailable", comment: "No posts available"))
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Text(NSLocalizedString("tapToRefresh", comment: "Tap to refresh"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func LoadingView() -> some View {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
ProgressView()
|
||||||
|
.scaleEffect(0.8)
|
||||||
|
Text(NSLocalizedString("loadingPost", comment: "Loading post..."))
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func ErrorView(error: String) -> some View {
|
||||||
|
Link(destination: URL(string: "solian://posts/shuffle")!) {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "exclamationmark.triangle")
|
||||||
|
.font(.title3)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(NSLocalizedString("error", comment: "Error"))
|
||||||
|
.font(.headline)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(NSLocalizedString("openAppToRefresh", comment: "Open app to refresh"))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(error)
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.lineLimit(5)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func formatRelativeTime(_ date: Date) -> String {
|
||||||
|
let now = Date()
|
||||||
|
let interval = now.timeIntervalSince(date)
|
||||||
|
|
||||||
|
if interval < 60 {
|
||||||
|
return NSLocalizedString("justNow", comment: "Just now")
|
||||||
|
} else if interval < 3600 {
|
||||||
|
let minutes = Int(interval / 60)
|
||||||
|
return String(format: NSLocalizedString("minutesAgo", comment: "%d min ago"), minutes)
|
||||||
|
} else if interval < 86400 {
|
||||||
|
let hours = Int(interval / 3600)
|
||||||
|
return String(format: NSLocalizedString("hoursAgo", comment: "%d hr ago"), hours)
|
||||||
|
} else {
|
||||||
|
let days = Int(interval / 86400)
|
||||||
|
return String(format: NSLocalizedString("daysAgo", comment: "%d d ago"), days)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PostShuffleWidgetRootView: View {
|
||||||
|
var entry: PostShuffleProvider.Entry
|
||||||
|
@Environment(\.colorScheme) var colorScheme
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if #available(iOS 17.0, *) {
|
||||||
|
ZStack {
|
||||||
|
PostShuffleWidgetEntryView(entry: entry)
|
||||||
|
|
||||||
|
if entry.post != nil {
|
||||||
|
GeometryReader { geometry in
|
||||||
|
Image(colorScheme == .dark ? "CloudyLambDark" : "CloudyLamb")
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.frame(
|
||||||
|
width: geometry.size.width * 0.9,
|
||||||
|
height: geometry.size.width * 0.9
|
||||||
|
)
|
||||||
|
.opacity(0.12)
|
||||||
|
.mask(
|
||||||
|
LinearGradient(
|
||||||
|
gradient: Gradient(colors: [
|
||||||
|
Color.white,
|
||||||
|
Color.white,
|
||||||
|
Color.clear
|
||||||
|
]),
|
||||||
|
startPoint: .topLeading,
|
||||||
|
endPoint: .bottomTrailing
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.position(
|
||||||
|
x: geometry.size.width * 0.9,
|
||||||
|
y: 20
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.containerBackground(.fill.tertiary, for: .widget)
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
} else {
|
||||||
|
PostShuffleWidgetEntryView(entry: entry)
|
||||||
|
.padding()
|
||||||
|
.background()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SolianPostShuffleWidget: Widget {
|
||||||
|
let kind: String = "SolianPostShuffleWidget"
|
||||||
|
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
StaticConfiguration(kind: kind, provider: PostShuffleProvider()) { entry in
|
||||||
|
PostShuffleWidgetRootView(entry: entry)
|
||||||
|
}
|
||||||
|
.configurationDisplayName("Random Post")
|
||||||
|
.description("Discover a random post from the network")
|
||||||
|
.supportedFamilies(supportedFamilies)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var supportedFamilies: [WidgetFamily] {
|
||||||
|
return [.systemMedium, .systemLarge]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemMedium) {
|
||||||
|
SolianPostShuffleWidget()
|
||||||
|
} timeline: {
|
||||||
|
PostShuffleEntry(
|
||||||
|
date: .now,
|
||||||
|
post: SnPost(
|
||||||
|
id: "test-post-id",
|
||||||
|
title: "Hello World!",
|
||||||
|
description: "This is a test post description",
|
||||||
|
content: "This is a content of a test post. It can be longer and show more text in the widget.",
|
||||||
|
publisher: SnPostPublisher(
|
||||||
|
id: "publisher-1",
|
||||||
|
name: "Test Publisher",
|
||||||
|
nick: "Testy",
|
||||||
|
description: "A test publisher",
|
||||||
|
picture: nil
|
||||||
|
),
|
||||||
|
tags: [
|
||||||
|
SnPostTag(id: "tag-1", slug: "test", name: "Test"),
|
||||||
|
SnPostTag(id: "tag-2", slug: "example", name: "Example")
|
||||||
|
],
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
attachments: []
|
||||||
|
),
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemLarge) {
|
||||||
|
SolianPostShuffleWidget()
|
||||||
|
} timeline: {
|
||||||
|
PostShuffleEntry(
|
||||||
|
date: .now,
|
||||||
|
post: SnPost(
|
||||||
|
id: "test-post-id",
|
||||||
|
title: "Welcome to the Solar Network!",
|
||||||
|
description: "This is a test post description that is a bit longer to demonstrate the widget layout with various content types",
|
||||||
|
content: "This is content of a test post. It can be longer and show more text in the widget. The large widget should display more content and allow for better reading experience. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||||
|
publisher: SnPostPublisher(
|
||||||
|
id: "publisher-1",
|
||||||
|
name: "Test Publisher",
|
||||||
|
nick: "Testy McTestface",
|
||||||
|
description: "A test publisher",
|
||||||
|
picture: nil
|
||||||
|
),
|
||||||
|
tags: [
|
||||||
|
SnPostTag(id: "tag-1", slug: "test", name: "Test"),
|
||||||
|
SnPostTag(id: "tag-2", slug: "example", name: "Example"),
|
||||||
|
SnPostTag(id: "tag-3", slug: "widget", name: "Widget"),
|
||||||
|
SnPostTag(id: "tag-4", slug: "ios", name: "iOS")
|
||||||
|
],
|
||||||
|
createdAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
updatedAt: ISO8601DateFormatter().string(from: Date()),
|
||||||
|
attachments: [
|
||||||
|
SnCloudFile(id: "file-1", url: nil, thumbnail: nil, mimeType: "image/jpeg"),
|
||||||
|
SnCloudFile(id: "file-2", url: nil, thumbnail: nil, mimeType: "image/png")
|
||||||
|
]
|
||||||
|
),
|
||||||
|
error: nil,
|
||||||
|
isLoading: false
|
||||||
|
)
|
||||||
|
}
|
||||||
18
ios/SolianWidgetExtension/SolianWidgetExtensionBundle.swift
Normal file
18
ios/SolianWidgetExtension/SolianWidgetExtensionBundle.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// SolianWidgetExtensionBundle.swift
|
||||||
|
// SolianWidgetExtension
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/3.
|
||||||
|
//
|
||||||
|
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@main
|
||||||
|
struct SolianWidgetExtensionBundle: WidgetBundle {
|
||||||
|
var body: some Widget {
|
||||||
|
SolianCheckInWidget()
|
||||||
|
SolianNotificationWidget()
|
||||||
|
SolianPostShuffleWidget()
|
||||||
|
}
|
||||||
|
}
|
||||||
136
ios/SolianWidgetExtension/WidgetNetworking.swift
Normal file
136
ios/SolianWidgetExtension/WidgetNetworking.swift
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
//
|
||||||
|
// Networking.swift
|
||||||
|
// SolianWidgetExtensionExtension
|
||||||
|
//
|
||||||
|
// Created by LittleSheep on 2026/1/4.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum RemoteError: Error {
|
||||||
|
case missingCredentials
|
||||||
|
case invalidURL
|
||||||
|
case invalidResponse
|
||||||
|
case httpError(Int)
|
||||||
|
case decodingError
|
||||||
|
}
|
||||||
|
|
||||||
|
extension RemoteError: LocalizedError {
|
||||||
|
var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .missingCredentials:
|
||||||
|
return "Please open the app to sign in."
|
||||||
|
case .invalidURL:
|
||||||
|
return "Invalid server configuration."
|
||||||
|
case .invalidResponse:
|
||||||
|
return "Server returned an invalid response."
|
||||||
|
case .httpError(let code):
|
||||||
|
return "Server error (\(code))."
|
||||||
|
case .decodingError:
|
||||||
|
return "Failed to read server data."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TokenData: Codable {
|
||||||
|
let token: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class WidgetNetworkService {
|
||||||
|
private let appGroup = "group.solsynth.solian"
|
||||||
|
private let tokenKey = "flutter.dyn_user_tk"
|
||||||
|
private let urlKey = "flutter.app_server_url"
|
||||||
|
|
||||||
|
private lazy var session: URLSession = {
|
||||||
|
let configuration = URLSessionConfiguration.ephemeral
|
||||||
|
configuration.timeoutIntervalForRequest = 10.0
|
||||||
|
configuration.timeoutIntervalForResource = 10.0
|
||||||
|
configuration.waitsForConnectivity = false
|
||||||
|
return URLSession(configuration: configuration)
|
||||||
|
}()
|
||||||
|
|
||||||
|
private var userDefaults: UserDefaults? {
|
||||||
|
UserDefaults(suiteName: appGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
var token: String? {
|
||||||
|
guard let tokenString = userDefaults?.string(forKey: tokenKey) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let data = tokenString.data(using: .utf8) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
let tokenData = try JSONDecoder().decode(TokenData.self, from: data)
|
||||||
|
return tokenData.token
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] Failed to decode token: \(error)")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var baseURL: String {
|
||||||
|
return userDefaults?.string(forKey: urlKey) ?? "https://api.solian.app"
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeRequest<T: Codable>(
|
||||||
|
path: String,
|
||||||
|
method: String = "GET",
|
||||||
|
headers: [String: String] = [:]
|
||||||
|
) async throws -> T? {
|
||||||
|
guard let token = token else {
|
||||||
|
throw RemoteError.missingCredentials
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let url = URL(string: "\(baseURL)\(path)") else {
|
||||||
|
throw RemoteError.invalidURL
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = method
|
||||||
|
request.setValue("AtField \(token)", forHTTPHeaderField: "Authorization")
|
||||||
|
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||||
|
|
||||||
|
for (key, value) in headers {
|
||||||
|
request.setValue(value, forHTTPHeaderField: key)
|
||||||
|
}
|
||||||
|
|
||||||
|
request.timeoutInterval = 10.0
|
||||||
|
|
||||||
|
print("[WidgetKit] [Network] Requesting: \(baseURL)\(path)")
|
||||||
|
|
||||||
|
let (data, response) = try await session.data(for: request)
|
||||||
|
|
||||||
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
|
throw RemoteError.invalidResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
print("[WidgetKit] [Network] Status: \(httpResponse.statusCode), Data length: \(data.count)")
|
||||||
|
|
||||||
|
if let jsonString = String(data: data, encoding: .utf8) {
|
||||||
|
print("[WidgetKit] [Network] Response: \(jsonString.prefix(500))")
|
||||||
|
}
|
||||||
|
|
||||||
|
switch httpResponse.statusCode {
|
||||||
|
case 200...299:
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
do {
|
||||||
|
let result = try decoder.decode(T.self, from: data)
|
||||||
|
print("[WidgetKit] [Network] Successfully decoded response")
|
||||||
|
return result
|
||||||
|
} catch {
|
||||||
|
print("[WidgetKit] [Network] Decoding error: \(error.localizedDescription)")
|
||||||
|
print("[WidgetKit] [Network] Expected type: \(String(describing: T.self))")
|
||||||
|
throw RemoteError.decodingError
|
||||||
|
}
|
||||||
|
case 404:
|
||||||
|
print("[WidgetKit] [Network] Resource not found (404)")
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
print("[WidgetKit] [Network] HTTP Error: \(httpResponse.statusCode)")
|
||||||
|
throw RemoteError.httpError(httpResponse.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
ios/SolianWidgetExtension/en.lproj/Localizable.strings
Normal file
46
ios/SolianWidgetExtension/en.lproj/Localizable.strings
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "Great Misfortune";
|
||||||
|
"checkInResultT1" = "Misfortune";
|
||||||
|
"checkInResultT2" = "Moderate";
|
||||||
|
"checkInResultT3" = "Fortune";
|
||||||
|
"checkInResultT4" = "Great Fortune";
|
||||||
|
"checkInResultT5" = "Special";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "Check In";
|
||||||
|
"tapToCheckIn" = "Tap to check in today";
|
||||||
|
"error" = "Error";
|
||||||
|
"openAppToRefresh" = "Open app to refresh";
|
||||||
|
"loading" = "Loading...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d EXP";
|
||||||
|
"footer" = "Solian Check In";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@ is today!";
|
||||||
|
"notableDayIs" = "%@ is %@";
|
||||||
|
"notableDayUpcoming" = "Upcoming";
|
||||||
|
"today" = "Today";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "Notifications";
|
||||||
|
"noNotifications" = "No notifications yet";
|
||||||
|
"tapToViewAll" = "Tap to view all notifications";
|
||||||
|
"justNow" = "Just now";
|
||||||
|
"minutesAgo" = "%d min ago";
|
||||||
|
"hoursAgo" = "%d hr ago";
|
||||||
|
"daysAgo" = "%d d ago";
|
||||||
|
"pleaseSignIn" = "Please open the app to sign in.";
|
||||||
|
"invalidServerConfig" = "Invalid server configuration.";
|
||||||
|
"invalidResponse" = "Server returned an invalid response.";
|
||||||
|
"httpError" = "Server error (%d).";
|
||||||
|
"decodingError" = "Failed to read server data.";
|
||||||
|
"unreadNotifications" = "Notification(s) unread";
|
||||||
|
"noNotifications" = "No notifications";
|
||||||
|
"noUnreadNotifications" = "All notifications are read";
|
||||||
|
"unread" = "unread";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "No posts available";
|
||||||
|
"tapToRefresh" = "Tap to refresh";
|
||||||
|
"loadingPost" = "Loading post...";
|
||||||
41
ios/SolianWidgetExtension/es.lproj/Localizable.strings
Normal file
41
ios/SolianWidgetExtension/es.lproj/Localizable.strings
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "Gran Desventura";
|
||||||
|
"checkInResultT1" = "Desventura";
|
||||||
|
"checkInResultT2" = "Moderado";
|
||||||
|
"checkInResultT3" = "Buena Fortuna";
|
||||||
|
"checkInResultT4" = "Gran Fortuna";
|
||||||
|
"checkInResultT5" = "Especial";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "Registrar";
|
||||||
|
"tapToCheckIn" = "Toca para registrar hoy";
|
||||||
|
"error" = "Error";
|
||||||
|
"openAppToRefresh" = "Abre la aplicación para actualizar";
|
||||||
|
"loading" = "Cargando...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d EXP";
|
||||||
|
"footer" = "Registro Solian";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@ es hoy!";
|
||||||
|
"notableDayIs" = "%@ es %@";
|
||||||
|
"today" = "Hoy";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "Notificaciones";
|
||||||
|
"noNotifications" = "Aún no hay notificaciones";
|
||||||
|
"tapToViewAll" = "Toca para ver todas las notificaciones";
|
||||||
|
"justNow" = "Ahora mismo";
|
||||||
|
"minutesAgo" = "hace %d min";
|
||||||
|
"hoursAgo" = "hace %d hr";
|
||||||
|
"daysAgo" = "hace %d días";
|
||||||
|
"pleaseSignIn" = "Por favor, abre la aplicación para iniciar sesión.";
|
||||||
|
"invalidServerConfig" = "Configuración del servidor no válida.";
|
||||||
|
"invalidResponse" = "El servidor devolvió una respuesta no válida.";
|
||||||
|
"httpError" = "Error del servidor (%d).";
|
||||||
|
"decodingError" = "Error al leer los datos del servidor.";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "No hay publicaciones disponibles";
|
||||||
|
"tapToRefresh" = "Toca para actualizar";
|
||||||
|
"loadingPost" = "Cargando publicación...";
|
||||||
41
ios/SolianWidgetExtension/ja.lproj/Localizable.strings
Normal file
41
ios/SolianWidgetExtension/ja.lproj/Localizable.strings
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "大凶";
|
||||||
|
"checkInResultT1" = "凶";
|
||||||
|
"checkInResultT2" = "中平";
|
||||||
|
"checkInResultT3" = "吉";
|
||||||
|
"checkInResultT4" = "大吉";
|
||||||
|
"checkInResultT5" = "特殊";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "チェックイン";
|
||||||
|
"tapToCheckIn" = "タップして今日チェックイン";
|
||||||
|
"error" = "エラー";
|
||||||
|
"openAppToRefresh" = "アプリを開いて更新";
|
||||||
|
"loading" = "読み込み中...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d 経験値";
|
||||||
|
"footer" = "Solian チェックイン";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@は今日です!";
|
||||||
|
"notableDayIs" = "%@は%@です";
|
||||||
|
"today" = "今日";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "通知";
|
||||||
|
"noNotifications" = "まだ通知はありません";
|
||||||
|
"tapToViewAll" = "タップしてすべての通知を表示";
|
||||||
|
"justNow" = "たった今";
|
||||||
|
"minutesAgo" = "%d分前";
|
||||||
|
"hoursAgo" = "%d時間前";
|
||||||
|
"daysAgo" = "%d日前";
|
||||||
|
"pleaseSignIn" = "アプリを開いてサインインしてください。";
|
||||||
|
"invalidServerConfig" = "サーバー設定が無効です。";
|
||||||
|
"invalidResponse" = "サーバーから無効な応答が返されました。";
|
||||||
|
"httpError" = "サーバーエラー (%d)。";
|
||||||
|
"decodingError" = "サーバーデータの読み込みに失敗しました。";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "利用可能な投稿がありません";
|
||||||
|
"tapToRefresh" = "タップして更新";
|
||||||
|
"loadingPost" = "投稿を読み込み中...";
|
||||||
41
ios/SolianWidgetExtension/ko.lproj/Localizable.strings
Normal file
41
ios/SolianWidgetExtension/ko.lproj/Localizable.strings
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "대흉";
|
||||||
|
"checkInResultT1" = "흉";
|
||||||
|
"checkInResultT2" = "중평";
|
||||||
|
"checkInResultT3" = "길";
|
||||||
|
"checkInResultT4" = "대길";
|
||||||
|
"checkInResultT5" = "특수";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "체크인";
|
||||||
|
"tapToCheckIn" = "탭하여 오늘 체크인";
|
||||||
|
"error" = "오류";
|
||||||
|
"openAppToRefresh" = "앱을 열어 새로고침";
|
||||||
|
"loading" = "로딩 중...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d 경험치";
|
||||||
|
"footer" = "Solian 체크인";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@ 오늘입니다!";
|
||||||
|
"notableDayIs" = "%@ 은/는 %@";
|
||||||
|
"today" = "오늘";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "알림";
|
||||||
|
"noNotifications" = "아직 알림이 없습니다";
|
||||||
|
"tapToViewAll" = "탭하여 모든 알림 보기";
|
||||||
|
"justNow" = "방금";
|
||||||
|
"minutesAgo" = "%d분 전";
|
||||||
|
"hoursAgo" = "%d시간 전";
|
||||||
|
"daysAgo" = "%d일 전";
|
||||||
|
"pleaseSignIn" = "앱을 열어 로그인하세요.";
|
||||||
|
"invalidServerConfig" = "서버 구성이 올바르지 않습니다.";
|
||||||
|
"invalidResponse" = "서버에서 잘못된 응답을 받았습니다.";
|
||||||
|
"httpError" = "서버 오류 (%d).";
|
||||||
|
"decodingError" = "서버 데이터 읽기에 실패했습니다.";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "사용 가능한 게시물이 없습니다";
|
||||||
|
"tapToRefresh" = "탭하여 새로고침";
|
||||||
|
"loadingPost" = "게시물 로딩 중...";
|
||||||
46
ios/SolianWidgetExtension/zh-Hans.lproj/Localizable.strings
Normal file
46
ios/SolianWidgetExtension/zh-Hans.lproj/Localizable.strings
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "大凶";
|
||||||
|
"checkInResultT1" = "凶";
|
||||||
|
"checkInResultT2" = "中平";
|
||||||
|
"checkInResultT3" = "吉";
|
||||||
|
"checkInResultT4" = "大吉";
|
||||||
|
"checkInResultT5" = "特殊";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "打卡";
|
||||||
|
"tapToCheckIn" = "点击今日打卡";
|
||||||
|
"error" = "错误";
|
||||||
|
"openAppToRefresh" = "打开应用以刷新";
|
||||||
|
"loading" = "加载中...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d 经验值";
|
||||||
|
"footer" = "Solian 签到";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@是今天!";
|
||||||
|
"notableDayIs" = "%@ 是 %@";
|
||||||
|
"notableDayUpcoming" = "接下来";
|
||||||
|
"today" = "今天";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "通知";
|
||||||
|
"noNotifications" = "还没有通知";
|
||||||
|
"tapToViewAll" = "点击查看所有通知";
|
||||||
|
"justNow" = "刚刚";
|
||||||
|
"minutesAgo" = "%d分钟前";
|
||||||
|
"hoursAgo" = "%d小时前";
|
||||||
|
"daysAgo" = "%d天前";
|
||||||
|
"pleaseSignIn" = "请打开应用登录。";
|
||||||
|
"invalidServerConfig" = "服务器配置无效。";
|
||||||
|
"invalidResponse" = "服务器返回了无效响应。";
|
||||||
|
"httpError" = "服务器错误 (%d)。";
|
||||||
|
"decodingError" = "读取服务器数据失败。";
|
||||||
|
"unreadNotifications" = "条通知未读";
|
||||||
|
"noNotifications" = "没有通知";
|
||||||
|
"noUnreadNotifications" = "没有未读通知";
|
||||||
|
"unread" = "未读";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "没有可用的帖子";
|
||||||
|
"tapToRefresh" = "点击刷新";
|
||||||
|
"loadingPost" = "加载帖子中...";
|
||||||
41
ios/SolianWidgetExtension/zh-Hant.lproj/Localizable.strings
Normal file
41
ios/SolianWidgetExtension/zh-Hant.lproj/Localizable.strings
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* Check In Level Names */
|
||||||
|
"checkInResultT0" = "大凶";
|
||||||
|
"checkInResultT1" = "凶";
|
||||||
|
"checkInResultT2" = "中平";
|
||||||
|
"checkInResultT3" = "吉";
|
||||||
|
"checkInResultT4" = "大吉";
|
||||||
|
"checkInResultT5" = "特殊";
|
||||||
|
|
||||||
|
/* Widget UI Strings */
|
||||||
|
"checkIn" = "打卡";
|
||||||
|
"tapToCheckIn" = "點擊今日打卡";
|
||||||
|
"error" = "錯誤";
|
||||||
|
"openAppToRefresh" = "打開應用以刷新";
|
||||||
|
"loading" = "載入中...";
|
||||||
|
"rewardPoints" = "%d";
|
||||||
|
"rewardExperience" = "%d 經驗值";
|
||||||
|
"footer" = "Solian 簽到";
|
||||||
|
|
||||||
|
/* Notable Day Strings */
|
||||||
|
"notableDayToday" = "%@是今天!";
|
||||||
|
"notableDayIs" = "%@ 是 %@";
|
||||||
|
"today" = "今天";
|
||||||
|
|
||||||
|
/* Notification Widget Strings */
|
||||||
|
"notifications" = "通知";
|
||||||
|
"noNotifications" = "還沒有通知";
|
||||||
|
"tapToViewAll" = "點擊查看所有通知";
|
||||||
|
"justNow" = "剛剛";
|
||||||
|
"minutesAgo" = "%d分鐘前";
|
||||||
|
"hoursAgo" = "%d小時前";
|
||||||
|
"daysAgo" = "%d天前";
|
||||||
|
"pleaseSignIn" = "請打開應用登錄。";
|
||||||
|
"invalidServerConfig" = "伺服器配置無效。";
|
||||||
|
"invalidResponse" = "伺服器返回了無效響應。";
|
||||||
|
"httpError" = "伺服器錯誤 (%d)。";
|
||||||
|
"decodingError" = "讀取伺服器數據失敗。";
|
||||||
|
|
||||||
|
/* Post Shuffle Widget Strings */
|
||||||
|
"noPostsAvailable" = "沒有可用的帖子";
|
||||||
|
"tapToRefresh" = "點擊刷新";
|
||||||
|
"loadingPost" = "載入帖子中...";
|
||||||
12
ios/SolianWidgetExtensionExtension.entitlements
Normal file
12
ios/SolianWidgetExtensionExtension.entitlements
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?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>com.apple.security.application-groups</key>
|
||||||
|
<array>
|
||||||
|
<string>group.solsynth.solian</string>
|
||||||
|
</array>
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
135
lib/hooks/use_room_file_picker.dart
Normal file
135
lib/hooks/use_room_file_picker.dart
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:island/models/file.dart';
|
||||||
|
import 'package:island/widgets/chat/chat_link_attachments.dart';
|
||||||
|
|
||||||
|
class RoomFilePicker {
|
||||||
|
final List<UniversalFile> attachments;
|
||||||
|
final void Function(List<UniversalFile>) updateAttachments;
|
||||||
|
final Future<void> Function() pickPhotos;
|
||||||
|
final Future<void> Function() pickVideos;
|
||||||
|
final Future<void> Function() pickAudio;
|
||||||
|
final Future<void> Function() pickFiles;
|
||||||
|
final Future<void> Function() linkAttachment;
|
||||||
|
|
||||||
|
RoomFilePicker({
|
||||||
|
required this.attachments,
|
||||||
|
required this.updateAttachments,
|
||||||
|
required this.pickPhotos,
|
||||||
|
required this.pickVideos,
|
||||||
|
required this.pickAudio,
|
||||||
|
required this.pickFiles,
|
||||||
|
required this.linkAttachment,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomFilePicker useRoomFilePicker(
|
||||||
|
BuildContext context,
|
||||||
|
List<UniversalFile> currentAttachments,
|
||||||
|
Function(List<UniversalFile>) onAttachmentsChanged,
|
||||||
|
) {
|
||||||
|
final attachments = useState<List<UniversalFile>>(currentAttachments);
|
||||||
|
|
||||||
|
Future<void> pickPhotos() async {
|
||||||
|
final picker = ImagePicker();
|
||||||
|
final results = await picker.pickMultiImage();
|
||||||
|
if (results.isEmpty) return;
|
||||||
|
attachments.value = [
|
||||||
|
...attachments.value,
|
||||||
|
...results.map(
|
||||||
|
(xfile) => UniversalFile(data: xfile, type: UniversalFileType.image),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickVideos() async {
|
||||||
|
final result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.video,
|
||||||
|
allowMultiple: true,
|
||||||
|
allowCompression: false,
|
||||||
|
);
|
||||||
|
if (result == null || result.count == 0) return;
|
||||||
|
attachments.value = [
|
||||||
|
...attachments.value,
|
||||||
|
...result.files.map(
|
||||||
|
(e) => UniversalFile(data: e.xFile, type: UniversalFileType.video),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickAudio() async {
|
||||||
|
final result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.audio,
|
||||||
|
allowMultiple: true,
|
||||||
|
allowCompression: false,
|
||||||
|
);
|
||||||
|
if (result == null || result.count == 0) return;
|
||||||
|
attachments.value = [
|
||||||
|
...attachments.value,
|
||||||
|
...result.files.map(
|
||||||
|
(e) => UniversalFile(data: e.xFile, type: UniversalFileType.audio),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickFiles() async {
|
||||||
|
final result = await FilePicker.platform.pickFiles(
|
||||||
|
allowMultiple: true,
|
||||||
|
allowCompression: false,
|
||||||
|
);
|
||||||
|
if (result == null || result.count == 0) return;
|
||||||
|
attachments.value = [
|
||||||
|
...attachments.value,
|
||||||
|
...result.files.map(
|
||||||
|
(e) => UniversalFile(data: e.xFile, type: UniversalFileType.file),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> linkAttachment() async {
|
||||||
|
final cloudFile = await showModalBottomSheet<SnCloudFile?>(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) => const ChatLinkAttachment(),
|
||||||
|
);
|
||||||
|
if (cloudFile == null) return;
|
||||||
|
|
||||||
|
attachments.value = [
|
||||||
|
...attachments.value,
|
||||||
|
UniversalFile(
|
||||||
|
data: cloudFile,
|
||||||
|
type: switch (cloudFile.mimeType?.split('/').firstOrNull) {
|
||||||
|
'image' => UniversalFileType.image,
|
||||||
|
'video' => UniversalFileType.video,
|
||||||
|
'audio' => UniversalFileType.audio,
|
||||||
|
_ => UniversalFileType.file,
|
||||||
|
},
|
||||||
|
isLink: true,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateAttachments(List<UniversalFile> newAttachments) {
|
||||||
|
attachments.value = newAttachments;
|
||||||
|
onAttachmentsChanged(attachments.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RoomFilePicker(
|
||||||
|
attachments: attachments.value,
|
||||||
|
updateAttachments: updateAttachments,
|
||||||
|
pickPhotos: pickPhotos,
|
||||||
|
pickVideos: pickVideos,
|
||||||
|
pickAudio: pickAudio,
|
||||||
|
pickFiles: pickFiles,
|
||||||
|
linkAttachment: linkAttachment,
|
||||||
|
);
|
||||||
|
}
|
||||||
236
lib/hooks/use_room_input.dart
Normal file
236
lib/hooks/use_room_input.dart
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:island/models/file.dart';
|
||||||
|
import 'package:island/models/chat.dart';
|
||||||
|
import 'package:island/models/poll.dart';
|
||||||
|
import 'package:island/models/wallet.dart';
|
||||||
|
import 'package:island/pods/chat/chat_subscribe.dart';
|
||||||
|
import 'package:island/database/message.dart';
|
||||||
|
import 'package:island/pods/chat/messages_notifier.dart';
|
||||||
|
import 'package:island/widgets/chat/message_item.dart';
|
||||||
|
import 'package:pasteboard/pasteboard.dart';
|
||||||
|
|
||||||
|
class RoomInputManager {
|
||||||
|
final TextEditingController messageController;
|
||||||
|
final List<UniversalFile> attachments;
|
||||||
|
final Map<String, Map<int, double?>> attachmentProgress;
|
||||||
|
final SnChatMessage? messageEditingTo;
|
||||||
|
final SnChatMessage? messageReplyingTo;
|
||||||
|
final SnChatMessage? messageForwardingTo;
|
||||||
|
final SnPoll? selectedPoll;
|
||||||
|
final SnWalletFund? selectedFund;
|
||||||
|
final void Function(List<UniversalFile>) updateAttachments;
|
||||||
|
final void Function(String, double?) updateAttachmentProgress;
|
||||||
|
final void Function(SnChatMessage?) setEditingTo;
|
||||||
|
final void Function(SnChatMessage?) setReplyingTo;
|
||||||
|
final void Function(SnChatMessage?) setForwardingTo;
|
||||||
|
final void Function(SnPoll?) setPoll;
|
||||||
|
final void Function(SnWalletFund?) setFund;
|
||||||
|
final void Function() clear;
|
||||||
|
final void Function() clearAttachmentsOnly;
|
||||||
|
final Future<void> Function() handlePaste;
|
||||||
|
final void Function(WidgetRef ref) sendMessage;
|
||||||
|
final void Function(String action, LocalChatMessage message) onMessageAction;
|
||||||
|
|
||||||
|
RoomInputManager({
|
||||||
|
required this.messageController,
|
||||||
|
required this.attachments,
|
||||||
|
required this.attachmentProgress,
|
||||||
|
this.messageEditingTo,
|
||||||
|
this.messageReplyingTo,
|
||||||
|
this.messageForwardingTo,
|
||||||
|
this.selectedPoll,
|
||||||
|
this.selectedFund,
|
||||||
|
required this.updateAttachments,
|
||||||
|
required this.updateAttachmentProgress,
|
||||||
|
required this.setEditingTo,
|
||||||
|
required this.setReplyingTo,
|
||||||
|
required this.setForwardingTo,
|
||||||
|
required this.setPoll,
|
||||||
|
required this.setFund,
|
||||||
|
required this.clear,
|
||||||
|
required this.clearAttachmentsOnly,
|
||||||
|
required this.handlePaste,
|
||||||
|
required this.sendMessage,
|
||||||
|
required this.onMessageAction,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomInputManager useRoomInputManager(WidgetRef ref, String roomId) {
|
||||||
|
final messageController = useTextEditingController();
|
||||||
|
final attachments = useState<List<UniversalFile>>([]);
|
||||||
|
final attachmentProgress = useState<Map<String, Map<int, double?>>>({});
|
||||||
|
final messageEditingTo = useState<SnChatMessage?>(null);
|
||||||
|
final messageReplyingTo = useState<SnChatMessage?>(null);
|
||||||
|
final messageForwardingTo = useState<SnChatMessage?>(null);
|
||||||
|
final selectedPoll = useState<SnPoll?>(null);
|
||||||
|
final selectedFund = useState<SnWalletFund?>(null);
|
||||||
|
|
||||||
|
final chatSubscribeNotifier = ref.read(
|
||||||
|
chatSubscribeProvider(roomId).notifier,
|
||||||
|
);
|
||||||
|
final messagesNotifier = ref.read(messagesProvider(roomId).notifier);
|
||||||
|
|
||||||
|
void updateAttachments(List<UniversalFile> newAttachments) {
|
||||||
|
attachments.value = newAttachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateAttachmentProgress(String messageId, double? progress) {
|
||||||
|
attachmentProgress.value = {
|
||||||
|
...attachmentProgress.value,
|
||||||
|
messageId: {0: progress},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void setEditingTo(SnChatMessage? message) {
|
||||||
|
messageEditingTo.value = message;
|
||||||
|
if (message != null) {
|
||||||
|
messageController.text = message.content ?? '';
|
||||||
|
attachments.value = message.attachments
|
||||||
|
.map((e) => UniversalFile.fromAttachment(e))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReplyingTo(SnChatMessage? message) {
|
||||||
|
messageReplyingTo.value = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setForwardingTo(SnChatMessage? message) {
|
||||||
|
messageForwardingTo.value = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPoll(SnPoll? poll) {
|
||||||
|
selectedPoll.value = poll;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFund(SnWalletFund? fund) {
|
||||||
|
selectedFund.value = fund;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
messageController.clear();
|
||||||
|
messageEditingTo.value = null;
|
||||||
|
messageReplyingTo.value = null;
|
||||||
|
messageForwardingTo.value = null;
|
||||||
|
selectedPoll.value = null;
|
||||||
|
selectedFund.value = null;
|
||||||
|
attachments.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearAttachmentsOnly() {
|
||||||
|
messageController.clear();
|
||||||
|
attachments.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
void onTextChange() {
|
||||||
|
if (messageController.text.isNotEmpty) {
|
||||||
|
chatSubscribeNotifier.sendTypingStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
messageController.addListener(onTextChange);
|
||||||
|
return () => messageController.removeListener(onTextChange);
|
||||||
|
}, [messageController]);
|
||||||
|
|
||||||
|
Future<void> handlePaste() async {
|
||||||
|
final image = await Pasteboard.image;
|
||||||
|
if (image != null) {
|
||||||
|
final newAttachments = [
|
||||||
|
...attachments.value,
|
||||||
|
UniversalFile(
|
||||||
|
displayName: 'image.jpeg',
|
||||||
|
data: XFile.fromData(
|
||||||
|
image,
|
||||||
|
mimeType: "image/jpeg",
|
||||||
|
name: 'image.jpeg',
|
||||||
|
),
|
||||||
|
type: UniversalFileType.image,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
attachments.value = newAttachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
final textData = await Clipboard.getData(Clipboard.kTextPlain);
|
||||||
|
if (textData != null && textData.text != null) {
|
||||||
|
final text = messageController.text;
|
||||||
|
final selection = messageController.selection;
|
||||||
|
final start = selection.start >= 0 ? selection.start : text.length;
|
||||||
|
final end = selection.end >= 0 ? selection.end : text.length;
|
||||||
|
final newText = text.replaceRange(start, end, textData.text!);
|
||||||
|
messageController.value = TextEditingValue(
|
||||||
|
text: newText,
|
||||||
|
selection: TextSelection.collapsed(
|
||||||
|
offset: start + textData.text!.length,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onMessageAction(String action, LocalChatMessage message) {
|
||||||
|
switch (action) {
|
||||||
|
case MessageItemAction.delete:
|
||||||
|
messagesNotifier.deleteMessage(message.id);
|
||||||
|
case MessageItemAction.edit:
|
||||||
|
setEditingTo(message.toRemoteMessage());
|
||||||
|
case MessageItemAction.forward:
|
||||||
|
setForwardingTo(message.toRemoteMessage());
|
||||||
|
case MessageItemAction.reply:
|
||||||
|
setReplyingTo(message.toRemoteMessage());
|
||||||
|
case MessageItemAction.resend:
|
||||||
|
messagesNotifier.retryMessage(message.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendMessage(WidgetRef ref) {
|
||||||
|
if (messageController.text.trim().isNotEmpty ||
|
||||||
|
attachments.value.isNotEmpty ||
|
||||||
|
selectedPoll.value != null ||
|
||||||
|
selectedFund.value != null) {
|
||||||
|
messagesNotifier.sendMessage(
|
||||||
|
ref,
|
||||||
|
messageController.text.trim(),
|
||||||
|
attachments.value,
|
||||||
|
poll: selectedPoll.value,
|
||||||
|
fund: selectedFund.value,
|
||||||
|
editingTo: messageEditingTo.value,
|
||||||
|
forwardingTo: messageForwardingTo.value,
|
||||||
|
replyingTo: messageReplyingTo.value,
|
||||||
|
onProgress: (messageId, progress) {
|
||||||
|
attachmentProgress.value = {
|
||||||
|
...attachmentProgress.value,
|
||||||
|
messageId: progress,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RoomInputManager(
|
||||||
|
messageController: messageController,
|
||||||
|
attachments: attachments.value,
|
||||||
|
attachmentProgress: attachmentProgress.value,
|
||||||
|
messageEditingTo: messageEditingTo.value,
|
||||||
|
messageReplyingTo: messageReplyingTo.value,
|
||||||
|
messageForwardingTo: messageForwardingTo.value,
|
||||||
|
selectedPoll: selectedPoll.value,
|
||||||
|
selectedFund: selectedFund.value,
|
||||||
|
updateAttachments: updateAttachments,
|
||||||
|
updateAttachmentProgress: updateAttachmentProgress,
|
||||||
|
setEditingTo: setEditingTo,
|
||||||
|
setReplyingTo: setReplyingTo,
|
||||||
|
setForwardingTo: setForwardingTo,
|
||||||
|
setPoll: setPoll,
|
||||||
|
setFund: setFund,
|
||||||
|
clear: clear,
|
||||||
|
clearAttachmentsOnly: clearAttachmentsOnly,
|
||||||
|
handlePaste: handlePaste,
|
||||||
|
sendMessage: sendMessage,
|
||||||
|
onMessageAction: onMessageAction,
|
||||||
|
);
|
||||||
|
}
|
||||||
127
lib/hooks/use_room_scroll.dart
Normal file
127
lib/hooks/use_room_scroll.dart
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
|
import 'package:island/database/message.dart';
|
||||||
|
import 'package:island/pods/chat/messages_notifier.dart';
|
||||||
|
import 'package:super_sliver_list/super_sliver_list.dart';
|
||||||
|
|
||||||
|
class RoomScrollManager {
|
||||||
|
final ScrollController scrollController;
|
||||||
|
final ListController listController;
|
||||||
|
final ValueNotifier<double> bottomGradientOpacity;
|
||||||
|
bool isScrollingToMessage;
|
||||||
|
final void Function({
|
||||||
|
required String messageId,
|
||||||
|
required List<LocalChatMessage> messageList,
|
||||||
|
})
|
||||||
|
scrollToMessage;
|
||||||
|
|
||||||
|
RoomScrollManager({
|
||||||
|
required this.scrollController,
|
||||||
|
required this.listController,
|
||||||
|
required this.bottomGradientOpacity,
|
||||||
|
required this.scrollToMessage,
|
||||||
|
this.isScrollingToMessage = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomScrollManager useRoomScrollManager(
|
||||||
|
WidgetRef ref,
|
||||||
|
String roomId,
|
||||||
|
Future<int> Function(String) jumpToMessage,
|
||||||
|
AsyncValue<List<LocalChatMessage>> messagesAsync,
|
||||||
|
) {
|
||||||
|
final scrollController = useScrollController();
|
||||||
|
final listController = useMemoized(() => ListController(), []);
|
||||||
|
final bottomGradientOpacity = useState(ValueNotifier<double>(0.0));
|
||||||
|
|
||||||
|
var isLoading = false;
|
||||||
|
var isScrollingToMessage = false;
|
||||||
|
final messagesNotifier = ref.read(messagesProvider(roomId).notifier);
|
||||||
|
final flashingMessagesNotifier = ref.read(flashingMessagesProvider.notifier);
|
||||||
|
|
||||||
|
void performScrollAnimation({required int index, required String messageId}) {
|
||||||
|
flashingMessagesNotifier.update((set) => set.union({messageId}));
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
try {
|
||||||
|
listController.animateToItem(
|
||||||
|
index: index,
|
||||||
|
scrollController: scrollController,
|
||||||
|
alignment: 0.5,
|
||||||
|
duration: (estimatedDistance) => Duration(
|
||||||
|
milliseconds: (estimatedDistance * 0.5).clamp(200, 800).toInt(),
|
||||||
|
),
|
||||||
|
curve: (estimatedDistance) => Curves.easeOutCubic,
|
||||||
|
);
|
||||||
|
|
||||||
|
Future.delayed(const Duration(milliseconds: 800), () {
|
||||||
|
isScrollingToMessage = false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
isScrollingToMessage = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void scrollToMessageWrapper({
|
||||||
|
required String messageId,
|
||||||
|
required List<LocalChatMessage> messageList,
|
||||||
|
}) {
|
||||||
|
if (isScrollingToMessage) return;
|
||||||
|
isScrollingToMessage = true;
|
||||||
|
|
||||||
|
final messageIndex = messageList.indexWhere((m) => m.id == messageId);
|
||||||
|
|
||||||
|
if (messageIndex == -1) {
|
||||||
|
jumpToMessage(messageId).then((index) {
|
||||||
|
if (index != -1) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
performScrollAnimation(index: index, messageId: messageId);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
isScrollingToMessage = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
performScrollAnimation(index: messageIndex, messageId: messageId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
void onScroll() {
|
||||||
|
messagesAsync.when(
|
||||||
|
data: (messageList) {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
|
if (!isLoading) {
|
||||||
|
isLoading = true;
|
||||||
|
messagesNotifier.loadMore().then((_) => isLoading = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final pixels = scrollController.position.pixels;
|
||||||
|
bottomGradientOpacity.value.value = (pixels / 500.0).clamp(0.0, 1.0);
|
||||||
|
},
|
||||||
|
loading: () {},
|
||||||
|
error: (_, _) {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollController.addListener(onScroll);
|
||||||
|
return () => scrollController.removeListener(onScroll);
|
||||||
|
}, [scrollController, messagesAsync]);
|
||||||
|
|
||||||
|
return RoomScrollManager(
|
||||||
|
scrollController: scrollController,
|
||||||
|
listController: listController,
|
||||||
|
bottomGradientOpacity: bottomGradientOpacity.value,
|
||||||
|
scrollToMessage: scrollToMessageWrapper,
|
||||||
|
isScrollingToMessage: isScrollingToMessage,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:croppy/croppy.dart';
|
import 'package:croppy/croppy.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
@@ -11,16 +12,20 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:hotkey_manager/hotkey_manager.dart';
|
import 'package:hotkey_manager/hotkey_manager.dart';
|
||||||
import 'package:image_picker_android/image_picker_android.dart';
|
import 'package:image_picker_android/image_picker_android.dart';
|
||||||
|
import 'package:island/services/analytics_service.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
import 'package:island/firebase_options.dart';
|
import 'package:island/firebase_options.dart';
|
||||||
import 'package:island/pods/config.dart';
|
import 'package:island/pods/config.dart';
|
||||||
|
import 'package:island/pods/audio.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/pods/theme.dart';
|
import 'package:island/pods/theme.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/pods/websocket.dart';
|
import 'package:island/pods/websocket.dart';
|
||||||
import 'package:island/route.dart';
|
import 'package:island/route.dart';
|
||||||
import 'package:island/services/notify.dart';
|
import 'package:island/services/notify.dart';
|
||||||
|
import 'package:island/services/widget_sync_service.dart';
|
||||||
import 'package:island/services/timezone.dart';
|
import 'package:island/services/timezone.dart';
|
||||||
|
import 'package:island/services/quick_actions.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:relative_time/relative_time.dart';
|
import 'package:relative_time/relative_time.dart';
|
||||||
@@ -97,6 +102,25 @@ void main() async {
|
|||||||
talker.error("[SplashScreen] Failed to load timezone database... $err");
|
talker.error("[SplashScreen] Failed to load timezone database... $err");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
talker.info("[QuickActions] Initializing Quick Actions service...");
|
||||||
|
final quickActionsService = QuickActionsService();
|
||||||
|
await quickActionsService.initialize();
|
||||||
|
talker.info("[QuickActions] Quick Actions service is ready!");
|
||||||
|
} catch (err) {
|
||||||
|
talker.error(
|
||||||
|
"[QuickActions] Failed to initialize Quick Actions service... $err",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
talker.info("[Analytics] Initializing Analytics service...");
|
||||||
|
final analyticsService = AnalyticsService();
|
||||||
|
analyticsService.initialize();
|
||||||
|
} catch (err) {
|
||||||
|
talker.error("[Analytics] Failed to initialize Analytics service... $err");
|
||||||
|
}
|
||||||
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
if (!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows)) {
|
if (!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows)) {
|
||||||
@@ -169,6 +193,16 @@ void main() async {
|
|||||||
|
|
||||||
runApp(
|
runApp(
|
||||||
ProviderScope(
|
ProviderScope(
|
||||||
|
retry: (retryCount, error) {
|
||||||
|
if (retryCount > 3) return null;
|
||||||
|
if (error is DioException) {
|
||||||
|
if (error.response?.statusCode == 401) return null;
|
||||||
|
if (error.response?.statusCode == 403) return null;
|
||||||
|
if (error.response?.statusCode == 404) return null;
|
||||||
|
if (error.response?.statusCode == 500) return null;
|
||||||
|
}
|
||||||
|
return const Duration(milliseconds: 300);
|
||||||
|
},
|
||||||
observers: [
|
observers: [
|
||||||
TalkerRiverpodObserver(
|
TalkerRiverpodObserver(
|
||||||
talker: talker,
|
talker: talker,
|
||||||
@@ -282,6 +316,11 @@ class IslandApp extends HookConsumerWidget {
|
|||||||
ref.listen(websocketStateProvider, (_, state) {
|
ref.listen(websocketStateProvider, (_, state) {
|
||||||
talker.info('[WebSocket] $state');
|
talker.info('[WebSocket] $state');
|
||||||
});
|
});
|
||||||
|
ref.listen(userInfoProvider, (_, user) {
|
||||||
|
if (user.value != null) {
|
||||||
|
WidgetSyncService().syncToWidget();
|
||||||
|
}
|
||||||
|
});
|
||||||
Future(() {
|
Future(() {
|
||||||
userNotifier.fetchUser().then((_) {
|
userNotifier.fetchUser().then((_) {
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
@@ -289,6 +328,9 @@ class IslandApp extends HookConsumerWidget {
|
|||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
subscribePushNotification(apiClient);
|
subscribePushNotification(apiClient);
|
||||||
initializeLocalNotifications();
|
initializeLocalNotifications();
|
||||||
|
ref.read(audioSessionProvider);
|
||||||
|
ref.read(notificationSfxProvider);
|
||||||
|
ref.read(messageSfxProvider);
|
||||||
final wsNotifier = ref.read(websocketStateProvider.notifier);
|
final wsNotifier = ref.read(websocketStateProvider.notifier);
|
||||||
wsNotifier.connect();
|
wsNotifier.connect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ sealed class SnScrappedLink with _$SnScrappedLink {
|
|||||||
const factory SnScrappedLink({
|
const factory SnScrappedLink({
|
||||||
required String type,
|
required String type,
|
||||||
required String url,
|
required String url,
|
||||||
required String title,
|
required String? title,
|
||||||
required String? description,
|
required String? description,
|
||||||
required String? imageUrl,
|
required String? imageUrl,
|
||||||
required String? faviconUrl,
|
required String? faviconUrl,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnScrappedLink {
|
mixin _$SnScrappedLink {
|
||||||
|
|
||||||
String get type; String get url; String get title; String? get description; String? get imageUrl; String? get faviconUrl; String? get siteName; String? get contentType; String? get author; DateTime? get publishedDate;
|
String get type; String get url; String? get title; String? get description; String? get imageUrl; String? get faviconUrl; String? get siteName; String? get contentType; String? get author; DateTime? get publishedDate;
|
||||||
/// Create a copy of SnScrappedLink
|
/// Create a copy of SnScrappedLink
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -48,7 +48,7 @@ abstract mixin class $SnScrappedLinkCopyWith<$Res> {
|
|||||||
factory $SnScrappedLinkCopyWith(SnScrappedLink value, $Res Function(SnScrappedLink) _then) = _$SnScrappedLinkCopyWithImpl;
|
factory $SnScrappedLinkCopyWith(SnScrappedLink value, $Res Function(SnScrappedLink) _then) = _$SnScrappedLinkCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate
|
String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@ class _$SnScrappedLinkCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnScrappedLink
|
/// Create a copy of SnScrappedLink
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? url = null,Object? title = null,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? url = null,Object? title = freezed,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
|
as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable
|
as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable
|
as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -159,7 +159,7 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnScrappedLink() when $default != null:
|
case _SnScrappedLink() when $default != null:
|
||||||
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _:
|
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _:
|
||||||
@@ -180,7 +180,7 @@ return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUr
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnScrappedLink():
|
case _SnScrappedLink():
|
||||||
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);}
|
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);}
|
||||||
@@ -197,7 +197,7 @@ return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUr
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnScrappedLink() when $default != null:
|
case _SnScrappedLink() when $default != null:
|
||||||
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _:
|
return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _:
|
||||||
@@ -217,7 +217,7 @@ class _SnScrappedLink implements SnScrappedLink {
|
|||||||
|
|
||||||
@override final String type;
|
@override final String type;
|
||||||
@override final String url;
|
@override final String url;
|
||||||
@override final String title;
|
@override final String? title;
|
||||||
@override final String? description;
|
@override final String? description;
|
||||||
@override final String? imageUrl;
|
@override final String? imageUrl;
|
||||||
@override final String? faviconUrl;
|
@override final String? faviconUrl;
|
||||||
@@ -259,7 +259,7 @@ abstract mixin class _$SnScrappedLinkCopyWith<$Res> implements $SnScrappedLinkCo
|
|||||||
factory _$SnScrappedLinkCopyWith(_SnScrappedLink value, $Res Function(_SnScrappedLink) _then) = __$SnScrappedLinkCopyWithImpl;
|
factory _$SnScrappedLinkCopyWith(_SnScrappedLink value, $Res Function(_SnScrappedLink) _then) = __$SnScrappedLinkCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate
|
String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -276,12 +276,12 @@ class __$SnScrappedLinkCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnScrappedLink
|
/// Create a copy of SnScrappedLink
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? url = null,Object? title = null,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? url = null,Object? title = freezed,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) {
|
||||||
return _then(_SnScrappedLink(
|
return _then(_SnScrappedLink(
|
||||||
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
|
as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable
|
as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable
|
as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _SnScrappedLink _$SnScrappedLinkFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnScrappedLink(
|
_SnScrappedLink(
|
||||||
type: json['type'] as String,
|
type: json['type'] as String,
|
||||||
url: json['url'] as String,
|
url: json['url'] as String,
|
||||||
title: json['title'] as String,
|
title: json['title'] as String?,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
imageUrl: json['image_url'] as String?,
|
imageUrl: json['image_url'] as String?,
|
||||||
faviconUrl: json['favicon_url'] as String?,
|
faviconUrl: json['favicon_url'] as String?,
|
||||||
|
|||||||
@@ -37,6 +37,45 @@ sealed class UniversalFile with _$UniversalFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnFileReplica with _$SnFileReplica {
|
||||||
|
const factory SnFileReplica({
|
||||||
|
required String id,
|
||||||
|
required String objectId,
|
||||||
|
required String poolId,
|
||||||
|
required SnFilePool? pool,
|
||||||
|
required String storageId,
|
||||||
|
required int status,
|
||||||
|
required bool isPrimary,
|
||||||
|
required DateTime createdAt,
|
||||||
|
required DateTime updatedAt,
|
||||||
|
required DateTime? deletedAt,
|
||||||
|
}) = _SnFileReplica;
|
||||||
|
|
||||||
|
factory SnFileReplica.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnFileReplicaFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnCloudFileObject with _$SnCloudFileObject {
|
||||||
|
const factory SnCloudFileObject({
|
||||||
|
required String id,
|
||||||
|
required int size,
|
||||||
|
required Map<String, dynamic>? meta,
|
||||||
|
required String? mimeType,
|
||||||
|
required String? hash,
|
||||||
|
required bool hasCompression,
|
||||||
|
required bool hasThumbnail,
|
||||||
|
required List<SnFileReplica> fileReplicas,
|
||||||
|
required DateTime createdAt,
|
||||||
|
required DateTime updatedAt,
|
||||||
|
required DateTime? deletedAt,
|
||||||
|
}) = _SnCloudFileObject;
|
||||||
|
|
||||||
|
factory SnCloudFileObject.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnCloudFileObjectFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class SnCloudFile with _$SnCloudFile {
|
sealed class SnCloudFile with _$SnCloudFile {
|
||||||
const factory SnCloudFile({
|
const factory SnCloudFile({
|
||||||
@@ -45,13 +84,11 @@ sealed class SnCloudFile with _$SnCloudFile {
|
|||||||
required String? description,
|
required String? description,
|
||||||
required Map<String, dynamic>? fileMeta,
|
required Map<String, dynamic>? fileMeta,
|
||||||
required Map<String, dynamic>? userMeta,
|
required Map<String, dynamic>? userMeta,
|
||||||
required SnFilePool? pool,
|
|
||||||
@Default([]) List<int> sensitiveMarks,
|
@Default([]) List<int> sensitiveMarks,
|
||||||
required String? mimeType,
|
required String? mimeType,
|
||||||
required String? hash,
|
required String? hash,
|
||||||
required int size,
|
required int size,
|
||||||
required DateTime? uploadedAt,
|
required DateTime? uploadedAt,
|
||||||
required String? uploadedTo,
|
|
||||||
required DateTime createdAt,
|
required DateTime createdAt,
|
||||||
required DateTime updatedAt,
|
required DateTime updatedAt,
|
||||||
required DateTime? deletedAt,
|
required DateTime? deletedAt,
|
||||||
|
|||||||
@@ -279,42 +279,42 @@ as String?,
|
|||||||
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnCloudFile {
|
mixin _$SnFileReplica {
|
||||||
|
|
||||||
String get id; String get name; String? get description; Map<String, dynamic>? get fileMeta; Map<String, dynamic>? get userMeta; SnFilePool? get pool; List<int> get sensitiveMarks; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; String? get uploadedTo; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get url;
|
String get id; String get objectId; String get poolId; SnFilePool? get pool; String get storageId; int get status; bool get isPrimary; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
|
||||||
/// Create a copy of SnCloudFile
|
/// Create a copy of SnFileReplica
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnCloudFileCopyWith<SnCloudFile> get copyWith => _$SnCloudFileCopyWithImpl<SnCloudFile>(this as SnCloudFile, _$identity);
|
$SnFileReplicaCopyWith<SnFileReplica> get copyWith => _$SnFileReplicaCopyWithImpl<SnFileReplica>(this as SnFileReplica, _$identity);
|
||||||
|
|
||||||
/// Serializes this SnCloudFile to a JSON map.
|
/// Serializes this SnFileReplica to a JSON map.
|
||||||
Map<String, dynamic> toJson();
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.fileMeta, fileMeta)&&const DeepCollectionEquality().equals(other.userMeta, userMeta)&&(identical(other.pool, pool) || other.pool == pool)&&const DeepCollectionEquality().equals(other.sensitiveMarks, sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnFileReplica&&(identical(other.id, id) || other.id == id)&&(identical(other.objectId, objectId) || other.objectId == objectId)&&(identical(other.poolId, poolId) || other.poolId == poolId)&&(identical(other.pool, pool) || other.pool == pool)&&(identical(other.storageId, storageId) || other.storageId == storageId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),pool,const DeepCollectionEquality().hash(sensitiveMarks),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt,url);
|
int get hashCode => Object.hash(runtimeType,id,objectId,poolId,pool,storageId,status,isPrimary,createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, pool: $pool, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)';
|
return 'SnFileReplica(id: $id, objectId: $objectId, poolId: $poolId, pool: $pool, storageId: $storageId, status: $status, isPrimary: $isPrimary, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract mixin class $SnCloudFileCopyWith<$Res> {
|
abstract mixin class $SnFileReplicaCopyWith<$Res> {
|
||||||
factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl;
|
factory $SnFileReplicaCopyWith(SnFileReplica value, $Res Function(SnFileReplica) _then) = _$SnFileReplicaCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, SnFilePool? pool, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url
|
String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -322,37 +322,31 @@ $SnFilePoolCopyWith<$Res>? get pool;
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class _$SnCloudFileCopyWithImpl<$Res>
|
class _$SnFileReplicaCopyWithImpl<$Res>
|
||||||
implements $SnCloudFileCopyWith<$Res> {
|
implements $SnFileReplicaCopyWith<$Res> {
|
||||||
_$SnCloudFileCopyWithImpl(this._self, this._then);
|
_$SnFileReplicaCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
final SnCloudFile _self;
|
final SnFileReplica _self;
|
||||||
final $Res Function(SnCloudFile) _then;
|
final $Res Function(SnFileReplica) _then;
|
||||||
|
|
||||||
/// Create a copy of SnCloudFile
|
/// Create a copy of SnFileReplica
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? pool = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? objectId = null,Object? poolId = null,Object? pool = freezed,Object? storageId = null,Object? status = null,Object? isPrimary = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
as String,objectId: null == objectId ? _self.objectId : objectId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String,poolId: null == poolId ? _self.poolId : poolId // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,fileMeta: freezed == fileMeta ? _self.fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable
|
as String,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, dynamic>?,userMeta: freezed == userMeta ? _self.userMeta : userMeta // ignore: cast_nullable_to_non_nullable
|
as SnFilePool?,storageId: null == storageId ? _self.storageId : storageId // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, dynamic>?,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable
|
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
as SnFilePool?,sensitiveMarks: null == sensitiveMarks ? _self.sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable
|
as int,isPrimary: null == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
|
||||||
as List<int>,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
as bool,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
as DateTime?,
|
||||||
as String?,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/// Create a copy of SnCloudFile
|
/// Create a copy of SnFileReplica
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -368,6 +362,607 @@ $SnFilePoolCopyWith<$Res>? get pool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [SnFileReplica].
|
||||||
|
extension SnFileReplicaPatterns on SnFileReplica {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SnFileReplica value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SnFileReplica value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SnFileReplica value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica() when $default != null:
|
||||||
|
return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica():
|
||||||
|
return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnFileReplica() when $default != null:
|
||||||
|
return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _SnFileReplica implements SnFileReplica {
|
||||||
|
const _SnFileReplica({required this.id, required this.objectId, required this.poolId, required this.pool, required this.storageId, required this.status, required this.isPrimary, required this.createdAt, required this.updatedAt, required this.deletedAt});
|
||||||
|
factory _SnFileReplica.fromJson(Map<String, dynamic> json) => _$SnFileReplicaFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String objectId;
|
||||||
|
@override final String poolId;
|
||||||
|
@override final SnFilePool? pool;
|
||||||
|
@override final String storageId;
|
||||||
|
@override final int status;
|
||||||
|
@override final bool isPrimary;
|
||||||
|
@override final DateTime createdAt;
|
||||||
|
@override final DateTime updatedAt;
|
||||||
|
@override final DateTime? deletedAt;
|
||||||
|
|
||||||
|
/// Create a copy of SnFileReplica
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$SnFileReplicaCopyWith<_SnFileReplica> get copyWith => __$SnFileReplicaCopyWithImpl<_SnFileReplica>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$SnFileReplicaToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnFileReplica&&(identical(other.id, id) || other.id == id)&&(identical(other.objectId, objectId) || other.objectId == objectId)&&(identical(other.poolId, poolId) || other.poolId == poolId)&&(identical(other.pool, pool) || other.pool == pool)&&(identical(other.storageId, storageId) || other.storageId == storageId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,objectId,poolId,pool,storageId,status,isPrimary,createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SnFileReplica(id: $id, objectId: $objectId, poolId: $poolId, pool: $pool, storageId: $storageId, status: $status, isPrimary: $isPrimary, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$SnFileReplicaCopyWith<$Res> implements $SnFileReplicaCopyWith<$Res> {
|
||||||
|
factory _$SnFileReplicaCopyWith(_SnFileReplica value, $Res Function(_SnFileReplica) _then) = __$SnFileReplicaCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $SnFilePoolCopyWith<$Res>? get pool;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$SnFileReplicaCopyWithImpl<$Res>
|
||||||
|
implements _$SnFileReplicaCopyWith<$Res> {
|
||||||
|
__$SnFileReplicaCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _SnFileReplica _self;
|
||||||
|
final $Res Function(_SnFileReplica) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SnFileReplica
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? objectId = null,Object? poolId = null,Object? pool = freezed,Object? storageId = null,Object? status = null,Object? isPrimary = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
|
return _then(_SnFileReplica(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,objectId: null == objectId ? _self.objectId : objectId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,poolId: null == poolId ? _self.poolId : poolId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnFilePool?,storageId: null == storageId ? _self.storageId : storageId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,isPrimary: null == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of SnFileReplica
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnFilePoolCopyWith<$Res>? get pool {
|
||||||
|
if (_self.pool == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnFilePoolCopyWith<$Res>(_self.pool!, (value) {
|
||||||
|
return _then(_self.copyWith(pool: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SnCloudFileObject {
|
||||||
|
|
||||||
|
String get id; int get size; Map<String, dynamic>? get meta; String? get mimeType; String? get hash; bool get hasCompression; bool get hasThumbnail; List<SnFileReplica> get fileReplicas; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
|
||||||
|
/// Create a copy of SnCloudFileObject
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnCloudFileObjectCopyWith<SnCloudFileObject> get copyWith => _$SnCloudFileObjectCopyWithImpl<SnCloudFileObject>(this as SnCloudFileObject, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this SnCloudFileObject to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFileObject&&(identical(other.id, id) || other.id == id)&&(identical(other.size, size) || other.size == size)&&const DeepCollectionEquality().equals(other.meta, meta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.hasCompression, hasCompression) || other.hasCompression == hasCompression)&&(identical(other.hasThumbnail, hasThumbnail) || other.hasThumbnail == hasThumbnail)&&const DeepCollectionEquality().equals(other.fileReplicas, fileReplicas)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,size,const DeepCollectionEquality().hash(meta),mimeType,hash,hasCompression,hasThumbnail,const DeepCollectionEquality().hash(fileReplicas),createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SnCloudFileObject(id: $id, size: $size, meta: $meta, mimeType: $mimeType, hash: $hash, hasCompression: $hasCompression, hasThumbnail: $hasThumbnail, fileReplicas: $fileReplicas, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $SnCloudFileObjectCopyWith<$Res> {
|
||||||
|
factory $SnCloudFileObjectCopyWith(SnCloudFileObject value, $Res Function(SnCloudFileObject) _then) = _$SnCloudFileObjectCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, int size, Map<String, dynamic>? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List<SnFileReplica> fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$SnCloudFileObjectCopyWithImpl<$Res>
|
||||||
|
implements $SnCloudFileObjectCopyWith<$Res> {
|
||||||
|
_$SnCloudFileObjectCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final SnCloudFileObject _self;
|
||||||
|
final $Res Function(SnCloudFileObject) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SnCloudFileObject
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? size = null,Object? meta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? hasCompression = null,Object? hasThumbnail = null,Object? fileReplicas = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,meta: freezed == meta ? _self.meta : meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,hasCompression: null == hasCompression ? _self.hasCompression : hasCompression // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,hasThumbnail: null == hasThumbnail ? _self.hasThumbnail : hasThumbnail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,fileReplicas: null == fileReplicas ? _self.fileReplicas : fileReplicas // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SnFileReplica>,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [SnCloudFileObject].
|
||||||
|
extension SnCloudFileObjectPatterns on SnCloudFileObject {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SnCloudFileObject value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SnCloudFileObject value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SnCloudFileObject value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, int size, Map<String, dynamic>? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List<SnFileReplica> fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject() when $default != null:
|
||||||
|
return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, int size, Map<String, dynamic>? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List<SnFileReplica> fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject():
|
||||||
|
return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, int size, Map<String, dynamic>? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List<SnFileReplica> fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _SnCloudFileObject() when $default != null:
|
||||||
|
return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _SnCloudFileObject implements SnCloudFileObject {
|
||||||
|
const _SnCloudFileObject({required this.id, required this.size, required final Map<String, dynamic>? meta, required this.mimeType, required this.hash, required this.hasCompression, required this.hasThumbnail, required final List<SnFileReplica> fileReplicas, required this.createdAt, required this.updatedAt, required this.deletedAt}): _meta = meta,_fileReplicas = fileReplicas;
|
||||||
|
factory _SnCloudFileObject.fromJson(Map<String, dynamic> json) => _$SnCloudFileObjectFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final int size;
|
||||||
|
final Map<String, dynamic>? _meta;
|
||||||
|
@override Map<String, dynamic>? get meta {
|
||||||
|
final value = _meta;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_meta is EqualUnmodifiableMapView) return _meta;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableMapView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final String? mimeType;
|
||||||
|
@override final String? hash;
|
||||||
|
@override final bool hasCompression;
|
||||||
|
@override final bool hasThumbnail;
|
||||||
|
final List<SnFileReplica> _fileReplicas;
|
||||||
|
@override List<SnFileReplica> get fileReplicas {
|
||||||
|
if (_fileReplicas is EqualUnmodifiableListView) return _fileReplicas;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_fileReplicas);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final DateTime createdAt;
|
||||||
|
@override final DateTime updatedAt;
|
||||||
|
@override final DateTime? deletedAt;
|
||||||
|
|
||||||
|
/// Create a copy of SnCloudFileObject
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$SnCloudFileObjectCopyWith<_SnCloudFileObject> get copyWith => __$SnCloudFileObjectCopyWithImpl<_SnCloudFileObject>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$SnCloudFileObjectToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFileObject&&(identical(other.id, id) || other.id == id)&&(identical(other.size, size) || other.size == size)&&const DeepCollectionEquality().equals(other._meta, _meta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.hasCompression, hasCompression) || other.hasCompression == hasCompression)&&(identical(other.hasThumbnail, hasThumbnail) || other.hasThumbnail == hasThumbnail)&&const DeepCollectionEquality().equals(other._fileReplicas, _fileReplicas)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,size,const DeepCollectionEquality().hash(_meta),mimeType,hash,hasCompression,hasThumbnail,const DeepCollectionEquality().hash(_fileReplicas),createdAt,updatedAt,deletedAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SnCloudFileObject(id: $id, size: $size, meta: $meta, mimeType: $mimeType, hash: $hash, hasCompression: $hasCompression, hasThumbnail: $hasThumbnail, fileReplicas: $fileReplicas, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$SnCloudFileObjectCopyWith<$Res> implements $SnCloudFileObjectCopyWith<$Res> {
|
||||||
|
factory _$SnCloudFileObjectCopyWith(_SnCloudFileObject value, $Res Function(_SnCloudFileObject) _then) = __$SnCloudFileObjectCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, int size, Map<String, dynamic>? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List<SnFileReplica> fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$SnCloudFileObjectCopyWithImpl<$Res>
|
||||||
|
implements _$SnCloudFileObjectCopyWith<$Res> {
|
||||||
|
__$SnCloudFileObjectCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _SnCloudFileObject _self;
|
||||||
|
final $Res Function(_SnCloudFileObject) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SnCloudFileObject
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? size = null,Object? meta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? hasCompression = null,Object? hasThumbnail = null,Object? fileReplicas = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
||||||
|
return _then(_SnCloudFileObject(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,meta: freezed == meta ? _self._meta : meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,hasCompression: null == hasCompression ? _self.hasCompression : hasCompression // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,hasThumbnail: null == hasThumbnail ? _self.hasThumbnail : hasThumbnail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,fileReplicas: null == fileReplicas ? _self._fileReplicas : fileReplicas // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SnFileReplica>,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SnCloudFile {
|
||||||
|
|
||||||
|
String get id; String get name; String? get description; Map<String, dynamic>? get fileMeta; Map<String, dynamic>? get userMeta; List<int> get sensitiveMarks; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get url;
|
||||||
|
/// Create a copy of SnCloudFile
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnCloudFileCopyWith<SnCloudFile> get copyWith => _$SnCloudFileCopyWithImpl<SnCloudFile>(this as SnCloudFile, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this SnCloudFile to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.fileMeta, fileMeta)&&const DeepCollectionEquality().equals(other.userMeta, userMeta)&&const DeepCollectionEquality().equals(other.sensitiveMarks, sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),const DeepCollectionEquality().hash(sensitiveMarks),mimeType,hash,size,uploadedAt,createdAt,updatedAt,deletedAt,url);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $SnCloudFileCopyWith<$Res> {
|
||||||
|
factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$SnCloudFileCopyWithImpl<$Res>
|
||||||
|
implements $SnCloudFileCopyWith<$Res> {
|
||||||
|
_$SnCloudFileCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final SnCloudFile _self;
|
||||||
|
final $Res Function(SnCloudFile) _then;
|
||||||
|
|
||||||
|
/// Create a copy of SnCloudFile
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,fileMeta: freezed == fileMeta ? _self.fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,userMeta: freezed == userMeta ? _self.userMeta : userMeta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,sensitiveMarks: null == sensitiveMarks ? _self.sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<int>,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Adds pattern-matching-related methods to [SnCloudFile].
|
/// Adds pattern-matching-related methods to [SnCloudFile].
|
||||||
extension SnCloudFilePatterns on SnCloudFile {
|
extension SnCloudFilePatterns on SnCloudFile {
|
||||||
/// A variant of `map` that fallback to returning `orElse`.
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
@@ -443,10 +1038,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, SnFilePool? pool, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnCloudFile() when $default != null:
|
case _SnCloudFile() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _:
|
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -464,10 +1059,10 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, SnFilePool? pool, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnCloudFile():
|
case _SnCloudFile():
|
||||||
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);}
|
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -481,10 +1076,10 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, SnFilePool? pool, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnCloudFile() when $default != null:
|
case _SnCloudFile() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _:
|
return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -496,7 +1091,7 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnCloudFile implements SnCloudFile {
|
class _SnCloudFile implements SnCloudFile {
|
||||||
const _SnCloudFile({required this.id, required this.name, required this.description, required final Map<String, dynamic>? fileMeta, required final Map<String, dynamic>? userMeta, required this.pool, final List<int> sensitiveMarks = const [], required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.uploadedTo, required this.createdAt, required this.updatedAt, required this.deletedAt, this.url}): _fileMeta = fileMeta,_userMeta = userMeta,_sensitiveMarks = sensitiveMarks;
|
const _SnCloudFile({required this.id, required this.name, required this.description, required final Map<String, dynamic>? fileMeta, required final Map<String, dynamic>? userMeta, final List<int> sensitiveMarks = const [], required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.createdAt, required this.updatedAt, required this.deletedAt, this.url}): _fileMeta = fileMeta,_userMeta = userMeta,_sensitiveMarks = sensitiveMarks;
|
||||||
factory _SnCloudFile.fromJson(Map<String, dynamic> json) => _$SnCloudFileFromJson(json);
|
factory _SnCloudFile.fromJson(Map<String, dynamic> json) => _$SnCloudFileFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@@ -520,7 +1115,6 @@ class _SnCloudFile implements SnCloudFile {
|
|||||||
return EqualUnmodifiableMapView(value);
|
return EqualUnmodifiableMapView(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override final SnFilePool? pool;
|
|
||||||
final List<int> _sensitiveMarks;
|
final List<int> _sensitiveMarks;
|
||||||
@override@JsonKey() List<int> get sensitiveMarks {
|
@override@JsonKey() List<int> get sensitiveMarks {
|
||||||
if (_sensitiveMarks is EqualUnmodifiableListView) return _sensitiveMarks;
|
if (_sensitiveMarks is EqualUnmodifiableListView) return _sensitiveMarks;
|
||||||
@@ -532,7 +1126,6 @@ class _SnCloudFile implements SnCloudFile {
|
|||||||
@override final String? hash;
|
@override final String? hash;
|
||||||
@override final int size;
|
@override final int size;
|
||||||
@override final DateTime? uploadedAt;
|
@override final DateTime? uploadedAt;
|
||||||
@override final String? uploadedTo;
|
|
||||||
@override final DateTime createdAt;
|
@override final DateTime createdAt;
|
||||||
@override final DateTime updatedAt;
|
@override final DateTime updatedAt;
|
||||||
@override final DateTime? deletedAt;
|
@override final DateTime? deletedAt;
|
||||||
@@ -551,16 +1144,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&(identical(other.pool, pool) || other.pool == pool)&&const DeepCollectionEquality().equals(other._sensitiveMarks, _sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&const DeepCollectionEquality().equals(other._sensitiveMarks, _sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),pool,const DeepCollectionEquality().hash(_sensitiveMarks),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt,url);
|
int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),const DeepCollectionEquality().hash(_sensitiveMarks),mimeType,hash,size,uploadedAt,createdAt,updatedAt,deletedAt,url);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, pool: $pool, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)';
|
return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -571,11 +1164,11 @@ abstract mixin class _$SnCloudFileCopyWith<$Res> implements $SnCloudFileCopyWith
|
|||||||
factory _$SnCloudFileCopyWith(_SnCloudFile value, $Res Function(_SnCloudFile) _then) = __$SnCloudFileCopyWithImpl;
|
factory _$SnCloudFileCopyWith(_SnCloudFile value, $Res Function(_SnCloudFile) _then) = __$SnCloudFileCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, SnFilePool? pool, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url
|
String id, String name, String? description, Map<String, dynamic>? fileMeta, Map<String, dynamic>? userMeta, List<int> sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $SnFilePoolCopyWith<$Res>? get pool;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -588,21 +1181,19 @@ class __$SnCloudFileCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnCloudFile
|
/// Create a copy of SnCloudFile
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? pool = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) {
|
||||||
return _then(_SnCloudFile(
|
return _then(_SnCloudFile(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,fileMeta: freezed == fileMeta ? _self._fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable
|
as String?,fileMeta: freezed == fileMeta ? _self._fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, dynamic>?,userMeta: freezed == userMeta ? _self._userMeta : userMeta // ignore: cast_nullable_to_non_nullable
|
as Map<String, dynamic>?,userMeta: freezed == userMeta ? _self._userMeta : userMeta // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, dynamic>?,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable
|
as Map<String, dynamic>?,sensitiveMarks: null == sensitiveMarks ? _self._sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable
|
||||||
as SnFilePool?,sensitiveMarks: null == sensitiveMarks ? _self._sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<int>,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
as List<int>,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||||
as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable
|
as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable
|
as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -610,19 +1201,7 @@ as String?,
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of SnCloudFile
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$SnFilePoolCopyWith<$Res>? get pool {
|
|
||||||
if (_self.pool == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $SnFilePoolCopyWith<$Res>(_self.pool!, (value) {
|
|
||||||
return _then(_self.copyWith(pool: value));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,78 @@ const _$UniversalFileTypeEnumMap = {
|
|||||||
UniversalFileType.file: 'file',
|
UniversalFileType.file: 'file',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_SnFileReplica _$SnFileReplicaFromJson(Map<String, dynamic> json) =>
|
||||||
|
_SnFileReplica(
|
||||||
|
id: json['id'] as String,
|
||||||
|
objectId: json['object_id'] as String,
|
||||||
|
poolId: json['pool_id'] as String,
|
||||||
|
pool: json['pool'] == null
|
||||||
|
? null
|
||||||
|
: SnFilePool.fromJson(json['pool'] as Map<String, dynamic>),
|
||||||
|
storageId: json['storage_id'] as String,
|
||||||
|
status: (json['status'] as num).toInt(),
|
||||||
|
isPrimary: json['is_primary'] as bool,
|
||||||
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
|
deletedAt: json['deleted_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnFileReplicaToJson(_SnFileReplica instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'object_id': instance.objectId,
|
||||||
|
'pool_id': instance.poolId,
|
||||||
|
'pool': instance.pool?.toJson(),
|
||||||
|
'storage_id': instance.storageId,
|
||||||
|
'status': instance.status,
|
||||||
|
'is_primary': instance.isPrimary,
|
||||||
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
|
};
|
||||||
|
|
||||||
|
_SnCloudFileObject _$SnCloudFileObjectFromJson(Map<String, dynamic> json) =>
|
||||||
|
_SnCloudFileObject(
|
||||||
|
id: json['id'] as String,
|
||||||
|
size: (json['size'] as num).toInt(),
|
||||||
|
meta: json['meta'] as Map<String, dynamic>?,
|
||||||
|
mimeType: json['mime_type'] as String?,
|
||||||
|
hash: json['hash'] as String?,
|
||||||
|
hasCompression: json['has_compression'] as bool,
|
||||||
|
hasThumbnail: json['has_thumbnail'] as bool,
|
||||||
|
fileReplicas: (json['file_replicas'] as List<dynamic>)
|
||||||
|
.map((e) => SnFileReplica.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
|
deletedAt: json['deleted_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnCloudFileObjectToJson(_SnCloudFileObject instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'size': instance.size,
|
||||||
|
'meta': instance.meta,
|
||||||
|
'mime_type': instance.mimeType,
|
||||||
|
'hash': instance.hash,
|
||||||
|
'has_compression': instance.hasCompression,
|
||||||
|
'has_thumbnail': instance.hasThumbnail,
|
||||||
|
'file_replicas': instance.fileReplicas.map((e) => e.toJson()).toList(),
|
||||||
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
|
};
|
||||||
|
|
||||||
_SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
_SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
fileMeta: json['file_meta'] as Map<String, dynamic>?,
|
fileMeta: json['file_meta'] as Map<String, dynamic>?,
|
||||||
userMeta: json['user_meta'] as Map<String, dynamic>?,
|
userMeta: json['user_meta'] as Map<String, dynamic>?,
|
||||||
pool: json['pool'] == null
|
|
||||||
? null
|
|
||||||
: SnFilePool.fromJson(json['pool'] as Map<String, dynamic>),
|
|
||||||
sensitiveMarks:
|
sensitiveMarks:
|
||||||
(json['sensitive_marks'] as List<dynamic>?)
|
(json['sensitive_marks'] as List<dynamic>?)
|
||||||
?.map((e) => (e as num).toInt())
|
?.map((e) => (e as num).toInt())
|
||||||
@@ -49,7 +112,6 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
|||||||
uploadedAt: json['uploaded_at'] == null
|
uploadedAt: json['uploaded_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['uploaded_at'] as String),
|
: DateTime.parse(json['uploaded_at'] as String),
|
||||||
uploadedTo: json['uploaded_to'] as String?,
|
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt: json['deleted_at'] == null
|
deletedAt: json['deleted_at'] == null
|
||||||
@@ -65,13 +127,11 @@ Map<String, dynamic> _$SnCloudFileToJson(_SnCloudFile instance) =>
|
|||||||
'description': instance.description,
|
'description': instance.description,
|
||||||
'file_meta': instance.fileMeta,
|
'file_meta': instance.fileMeta,
|
||||||
'user_meta': instance.userMeta,
|
'user_meta': instance.userMeta,
|
||||||
'pool': instance.pool?.toJson(),
|
|
||||||
'sensitive_marks': instance.sensitiveMarks,
|
'sensitive_marks': instance.sensitiveMarks,
|
||||||
'mime_type': instance.mimeType,
|
'mime_type': instance.mimeType,
|
||||||
'hash': instance.hash,
|
'hash': instance.hash,
|
||||||
'size': instance.size,
|
'size': instance.size,
|
||||||
'uploaded_at': instance.uploadedAt?.toIso8601String(),
|
'uploaded_at': instance.uploadedAt?.toIso8601String(),
|
||||||
'uploaded_to': instance.uploadedTo,
|
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
'updated_at': instance.updatedAt.toIso8601String(),
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
||||||
import 'package:island/models/file.dart';
|
|
||||||
|
|
||||||
part 'reference.freezed.dart';
|
|
||||||
part 'reference.g.dart';
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
sealed class Reference with _$Reference {
|
|
||||||
const factory Reference({
|
|
||||||
required String id,
|
|
||||||
@JsonKey(name: 'file_id') required String fileId,
|
|
||||||
SnCloudFile? file,
|
|
||||||
required String usage,
|
|
||||||
@JsonKey(name: 'resource_id') required String resourceId,
|
|
||||||
@JsonKey(name: 'expired_at') DateTime? expiredAt,
|
|
||||||
@JsonKey(name: 'created_at') required DateTime createdAt,
|
|
||||||
@JsonKey(name: 'updated_at') required DateTime updatedAt,
|
|
||||||
@JsonKey(name: 'deleted_at') DateTime? deletedAt,
|
|
||||||
}) = _Reference;
|
|
||||||
|
|
||||||
factory Reference.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$ReferenceFromJson(json);
|
|
||||||
}
|
|
||||||
@@ -1,319 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
// coverage:ignore-file
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
|
||||||
|
|
||||||
part of 'reference.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// FreezedGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
// dart format off
|
|
||||||
T _$identity<T>(T value) => value;
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$Reference {
|
|
||||||
|
|
||||||
String get id;@JsonKey(name: 'file_id') String get fileId; SnCloudFile? get file; String get usage;@JsonKey(name: 'resource_id') String get resourceId;@JsonKey(name: 'expired_at') DateTime? get expiredAt;@JsonKey(name: 'created_at') DateTime get createdAt;@JsonKey(name: 'updated_at') DateTime get updatedAt;@JsonKey(name: 'deleted_at') DateTime? get deletedAt;
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$ReferenceCopyWith<Reference> get copyWith => _$ReferenceCopyWithImpl<Reference>(this as Reference, _$identity);
|
|
||||||
|
|
||||||
/// Serializes this Reference to a JSON map.
|
|
||||||
Map<String, dynamic> toJson();
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Reference&&(identical(other.id, id) || other.id == id)&&(identical(other.fileId, fileId) || other.fileId == fileId)&&(identical(other.file, file) || other.file == file)&&(identical(other.usage, usage) || other.usage == usage)&&(identical(other.resourceId, resourceId) || other.resourceId == resourceId)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType,id,fileId,file,usage,resourceId,expiredAt,createdAt,updatedAt,deletedAt);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Reference(id: $id, fileId: $fileId, file: $file, usage: $usage, resourceId: $resourceId, expiredAt: $expiredAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract mixin class $ReferenceCopyWith<$Res> {
|
|
||||||
factory $ReferenceCopyWith(Reference value, $Res Function(Reference) _then) = _$ReferenceCopyWithImpl;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
String id,@JsonKey(name: 'file_id') String fileId, SnCloudFile? file, String usage,@JsonKey(name: 'resource_id') String resourceId,@JsonKey(name: 'expired_at') DateTime? expiredAt,@JsonKey(name: 'created_at') DateTime createdAt,@JsonKey(name: 'updated_at') DateTime updatedAt,@JsonKey(name: 'deleted_at') DateTime? deletedAt
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$SnCloudFileCopyWith<$Res>? get file;
|
|
||||||
|
|
||||||
}
|
|
||||||
/// @nodoc
|
|
||||||
class _$ReferenceCopyWithImpl<$Res>
|
|
||||||
implements $ReferenceCopyWith<$Res> {
|
|
||||||
_$ReferenceCopyWithImpl(this._self, this._then);
|
|
||||||
|
|
||||||
final Reference _self;
|
|
||||||
final $Res Function(Reference) _then;
|
|
||||||
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? fileId = null,Object? file = freezed,Object? usage = null,Object? resourceId = null,Object? expiredAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
|
||||||
return _then(_self.copyWith(
|
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,fileId: null == fileId ? _self.fileId : fileId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,file: freezed == file ? _self.file : file // ignore: cast_nullable_to_non_nullable
|
|
||||||
as SnCloudFile?,usage: null == usage ? _self.usage : usage // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,resourceId: null == resourceId ? _self.resourceId : resourceId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$SnCloudFileCopyWith<$Res>? get file {
|
|
||||||
if (_self.file == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $SnCloudFileCopyWith<$Res>(_self.file!, (value) {
|
|
||||||
return _then(_self.copyWith(file: value));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Adds pattern-matching-related methods to [Reference].
|
|
||||||
extension ReferencePatterns on Reference {
|
|
||||||
/// A variant of `map` that fallback to returning `orElse`.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return orElse();
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Reference value)? $default,{required TResult orElse(),}){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference() when $default != null:
|
|
||||||
return $default(_that);case _:
|
|
||||||
return orElse();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A `switch`-like method, using callbacks.
|
|
||||||
///
|
|
||||||
/// Callbacks receives the raw object, upcasted.
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case final Subclass2 value:
|
|
||||||
/// return ...;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Reference value) $default,){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference():
|
|
||||||
return $default(_that);}
|
|
||||||
}
|
|
||||||
/// A variant of `map` that fallback to returning `null`.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return null;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Reference value)? $default,){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference() when $default != null:
|
|
||||||
return $default(_that);case _:
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A variant of `when` that fallback to an `orElse` callback.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return orElse();
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @JsonKey(name: 'file_id') String fileId, SnCloudFile? file, String usage, @JsonKey(name: 'resource_id') String resourceId, @JsonKey(name: 'expired_at') DateTime? expiredAt, @JsonKey(name: 'created_at') DateTime createdAt, @JsonKey(name: 'updated_at') DateTime updatedAt, @JsonKey(name: 'deleted_at') DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference() when $default != null:
|
|
||||||
return $default(_that.id,_that.fileId,_that.file,_that.usage,_that.resourceId,_that.expiredAt,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
|
||||||
return orElse();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A `switch`-like method, using callbacks.
|
|
||||||
///
|
|
||||||
/// As opposed to `map`, this offers destructuring.
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case Subclass2(:final field2):
|
|
||||||
/// return ...;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @JsonKey(name: 'file_id') String fileId, SnCloudFile? file, String usage, @JsonKey(name: 'resource_id') String resourceId, @JsonKey(name: 'expired_at') DateTime? expiredAt, @JsonKey(name: 'created_at') DateTime createdAt, @JsonKey(name: 'updated_at') DateTime updatedAt, @JsonKey(name: 'deleted_at') DateTime? deletedAt) $default,) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference():
|
|
||||||
return $default(_that.id,_that.fileId,_that.file,_that.usage,_that.resourceId,_that.expiredAt,_that.createdAt,_that.updatedAt,_that.deletedAt);}
|
|
||||||
}
|
|
||||||
/// A variant of `when` that fallback to returning `null`
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return null;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @JsonKey(name: 'file_id') String fileId, SnCloudFile? file, String usage, @JsonKey(name: 'resource_id') String resourceId, @JsonKey(name: 'expired_at') DateTime? expiredAt, @JsonKey(name: 'created_at') DateTime createdAt, @JsonKey(name: 'updated_at') DateTime updatedAt, @JsonKey(name: 'deleted_at') DateTime? deletedAt)? $default,) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _Reference() when $default != null:
|
|
||||||
return $default(_that.id,_that.fileId,_that.file,_that.usage,_that.resourceId,_that.expiredAt,_that.createdAt,_that.updatedAt,_that.deletedAt);case _:
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
|
|
||||||
class _Reference implements Reference {
|
|
||||||
const _Reference({required this.id, @JsonKey(name: 'file_id') required this.fileId, this.file, required this.usage, @JsonKey(name: 'resource_id') required this.resourceId, @JsonKey(name: 'expired_at') this.expiredAt, @JsonKey(name: 'created_at') required this.createdAt, @JsonKey(name: 'updated_at') required this.updatedAt, @JsonKey(name: 'deleted_at') this.deletedAt});
|
|
||||||
factory _Reference.fromJson(Map<String, dynamic> json) => _$ReferenceFromJson(json);
|
|
||||||
|
|
||||||
@override final String id;
|
|
||||||
@override@JsonKey(name: 'file_id') final String fileId;
|
|
||||||
@override final SnCloudFile? file;
|
|
||||||
@override final String usage;
|
|
||||||
@override@JsonKey(name: 'resource_id') final String resourceId;
|
|
||||||
@override@JsonKey(name: 'expired_at') final DateTime? expiredAt;
|
|
||||||
@override@JsonKey(name: 'created_at') final DateTime createdAt;
|
|
||||||
@override@JsonKey(name: 'updated_at') final DateTime updatedAt;
|
|
||||||
@override@JsonKey(name: 'deleted_at') final DateTime? deletedAt;
|
|
||||||
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$ReferenceCopyWith<_Reference> get copyWith => __$ReferenceCopyWithImpl<_Reference>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$ReferenceToJson(this, );
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Reference&&(identical(other.id, id) || other.id == id)&&(identical(other.fileId, fileId) || other.fileId == fileId)&&(identical(other.file, file) || other.file == file)&&(identical(other.usage, usage) || other.usage == usage)&&(identical(other.resourceId, resourceId) || other.resourceId == resourceId)&&(identical(other.expiredAt, expiredAt) || other.expiredAt == expiredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType,id,fileId,file,usage,resourceId,expiredAt,createdAt,updatedAt,deletedAt);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Reference(id: $id, fileId: $fileId, file: $file, usage: $usage, resourceId: $resourceId, expiredAt: $expiredAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract mixin class _$ReferenceCopyWith<$Res> implements $ReferenceCopyWith<$Res> {
|
|
||||||
factory _$ReferenceCopyWith(_Reference value, $Res Function(_Reference) _then) = __$ReferenceCopyWithImpl;
|
|
||||||
@override @useResult
|
|
||||||
$Res call({
|
|
||||||
String id,@JsonKey(name: 'file_id') String fileId, SnCloudFile? file, String usage,@JsonKey(name: 'resource_id') String resourceId,@JsonKey(name: 'expired_at') DateTime? expiredAt,@JsonKey(name: 'created_at') DateTime createdAt,@JsonKey(name: 'updated_at') DateTime updatedAt,@JsonKey(name: 'deleted_at') DateTime? deletedAt
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
@override $SnCloudFileCopyWith<$Res>? get file;
|
|
||||||
|
|
||||||
}
|
|
||||||
/// @nodoc
|
|
||||||
class __$ReferenceCopyWithImpl<$Res>
|
|
||||||
implements _$ReferenceCopyWith<$Res> {
|
|
||||||
__$ReferenceCopyWithImpl(this._self, this._then);
|
|
||||||
|
|
||||||
final _Reference _self;
|
|
||||||
final $Res Function(_Reference) _then;
|
|
||||||
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? fileId = null,Object? file = freezed,Object? usage = null,Object? resourceId = null,Object? expiredAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
|
|
||||||
return _then(_Reference(
|
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,fileId: null == fileId ? _self.fileId : fileId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,file: freezed == file ? _self.file : file // ignore: cast_nullable_to_non_nullable
|
|
||||||
as SnCloudFile?,usage: null == usage ? _self.usage : usage // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,resourceId: null == resourceId ? _self.resourceId : resourceId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a copy of Reference
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$SnCloudFileCopyWith<$Res>? get file {
|
|
||||||
if (_self.file == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $SnCloudFileCopyWith<$Res>(_self.file!, (value) {
|
|
||||||
return _then(_self.copyWith(file: value));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// dart format on
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'reference.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
_Reference _$ReferenceFromJson(Map<String, dynamic> json) => _Reference(
|
|
||||||
id: json['id'] as String,
|
|
||||||
fileId: json['file_id'] as String,
|
|
||||||
file: json['file'] == null
|
|
||||||
? null
|
|
||||||
: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
|
||||||
usage: json['usage'] as String,
|
|
||||||
resourceId: json['resource_id'] as String,
|
|
||||||
expiredAt: json['expired_at'] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
|
||||||
deletedAt: json['deleted_at'] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$ReferenceToJson(_Reference instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'file_id': instance.fileId,
|
|
||||||
'file': instance.file?.toJson(),
|
|
||||||
'usage': instance.usage,
|
|
||||||
'resource_id': instance.resourceId,
|
|
||||||
'expired_at': instance.expiredAt?.toIso8601String(),
|
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
|
||||||
'updated_at': instance.updatedAt.toIso8601String(),
|
|
||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
|
||||||
};
|
|
||||||
@@ -12,9 +12,10 @@ sealed class SnRelationship with _$SnRelationship {
|
|||||||
required DateTime? updatedAt,
|
required DateTime? updatedAt,
|
||||||
required DateTime? deletedAt,
|
required DateTime? deletedAt,
|
||||||
required String accountId,
|
required String accountId,
|
||||||
required SnAccount account,
|
// Usually the account was not included in the response
|
||||||
|
required SnAccount? account,
|
||||||
required String relatedId,
|
required String relatedId,
|
||||||
required SnAccount related,
|
required SnAccount? related,
|
||||||
required DateTime? expiredAt,
|
required DateTime? expiredAt,
|
||||||
required int status,
|
required int status,
|
||||||
}) = _SnRelationship;
|
}) = _SnRelationship;
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnRelationship {
|
mixin _$SnRelationship {
|
||||||
|
|
||||||
DateTime? get createdAt; DateTime? get updatedAt; DateTime? get deletedAt; String get accountId; SnAccount get account; String get relatedId; SnAccount get related; DateTime? get expiredAt; int get status;
|
DateTime? get createdAt; DateTime? get updatedAt; DateTime? get deletedAt; String get accountId;// Usually the account was not included in the response
|
||||||
|
SnAccount? get account; String get relatedId; SnAccount? get related; DateTime? get expiredAt; int get status;
|
||||||
/// Create a copy of SnRelationship
|
/// Create a copy of SnRelationship
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -48,11 +49,11 @@ abstract mixin class $SnRelationshipCopyWith<$Res> {
|
|||||||
factory $SnRelationshipCopyWith(SnRelationship value, $Res Function(SnRelationship) _then) = _$SnRelationshipCopyWithImpl;
|
factory $SnRelationshipCopyWith(SnRelationship value, $Res Function(SnRelationship) _then) = _$SnRelationshipCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount account, String relatedId, SnAccount related, DateTime? expiredAt, int status
|
DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount? account, String relatedId, SnAccount? related, DateTime? expiredAt, int status
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$SnAccountCopyWith<$Res> get account;$SnAccountCopyWith<$Res> get related;
|
$SnAccountCopyWith<$Res>? get account;$SnAccountCopyWith<$Res>? get related;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -65,16 +66,16 @@ class _$SnRelationshipCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnRelationship
|
/// Create a copy of SnRelationship
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? accountId = null,Object? account = null,Object? relatedId = null,Object? related = null,Object? expiredAt = freezed,Object? status = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? accountId = null,Object? account = freezed,Object? relatedId = null,Object? related = freezed,Object? expiredAt = freezed,Object? status = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as DateTime?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,account: null == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
as String,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount,relatedId: null == relatedId ? _self.relatedId : relatedId // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,relatedId: null == relatedId ? _self.relatedId : relatedId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,related: null == related ? _self.related : related // ignore: cast_nullable_to_non_nullable
|
as String,related: freezed == related ? _self.related : related // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
as DateTime?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int,
|
||||||
));
|
));
|
||||||
@@ -83,18 +84,24 @@ as int,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res> get account {
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
|
if (_self.account == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $SnAccountCopyWith<$Res>(_self.account, (value) {
|
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
|
||||||
return _then(_self.copyWith(account: value));
|
return _then(_self.copyWith(account: value));
|
||||||
});
|
});
|
||||||
}/// Create a copy of SnRelationship
|
}/// Create a copy of SnRelationship
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res> get related {
|
$SnAccountCopyWith<$Res>? get related {
|
||||||
|
if (_self.related == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $SnAccountCopyWith<$Res>(_self.related, (value) {
|
return $SnAccountCopyWith<$Res>(_self.related!, (value) {
|
||||||
return _then(_self.copyWith(related: value));
|
return _then(_self.copyWith(related: value));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -176,7 +183,7 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount account, String relatedId, SnAccount related, DateTime? expiredAt, int status)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount? account, String relatedId, SnAccount? related, DateTime? expiredAt, int status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnRelationship() when $default != null:
|
case _SnRelationship() when $default != null:
|
||||||
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);case _:
|
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);case _:
|
||||||
@@ -197,7 +204,7 @@ return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount account, String relatedId, SnAccount related, DateTime? expiredAt, int status) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount? account, String relatedId, SnAccount? related, DateTime? expiredAt, int status) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnRelationship():
|
case _SnRelationship():
|
||||||
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);}
|
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);}
|
||||||
@@ -214,7 +221,7 @@ return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount account, String relatedId, SnAccount related, DateTime? expiredAt, int status)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount? account, String relatedId, SnAccount? related, DateTime? expiredAt, int status)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnRelationship() when $default != null:
|
case _SnRelationship() when $default != null:
|
||||||
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);case _:
|
return $default(_that.createdAt,_that.updatedAt,_that.deletedAt,_that.accountId,_that.account,_that.relatedId,_that.related,_that.expiredAt,_that.status);case _:
|
||||||
@@ -236,9 +243,10 @@ class _SnRelationship implements SnRelationship {
|
|||||||
@override final DateTime? updatedAt;
|
@override final DateTime? updatedAt;
|
||||||
@override final DateTime? deletedAt;
|
@override final DateTime? deletedAt;
|
||||||
@override final String accountId;
|
@override final String accountId;
|
||||||
@override final SnAccount account;
|
// Usually the account was not included in the response
|
||||||
|
@override final SnAccount? account;
|
||||||
@override final String relatedId;
|
@override final String relatedId;
|
||||||
@override final SnAccount related;
|
@override final SnAccount? related;
|
||||||
@override final DateTime? expiredAt;
|
@override final DateTime? expiredAt;
|
||||||
@override final int status;
|
@override final int status;
|
||||||
|
|
||||||
@@ -275,11 +283,11 @@ abstract mixin class _$SnRelationshipCopyWith<$Res> implements $SnRelationshipCo
|
|||||||
factory _$SnRelationshipCopyWith(_SnRelationship value, $Res Function(_SnRelationship) _then) = __$SnRelationshipCopyWithImpl;
|
factory _$SnRelationshipCopyWith(_SnRelationship value, $Res Function(_SnRelationship) _then) = __$SnRelationshipCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount account, String relatedId, SnAccount related, DateTime? expiredAt, int status
|
DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, String accountId, SnAccount? account, String relatedId, SnAccount? related, DateTime? expiredAt, int status
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $SnAccountCopyWith<$Res> get account;@override $SnAccountCopyWith<$Res> get related;
|
@override $SnAccountCopyWith<$Res>? get account;@override $SnAccountCopyWith<$Res>? get related;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -292,16 +300,16 @@ class __$SnRelationshipCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnRelationship
|
/// Create a copy of SnRelationship
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? accountId = null,Object? account = null,Object? relatedId = null,Object? related = null,Object? expiredAt = freezed,Object? status = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? accountId = null,Object? account = freezed,Object? relatedId = null,Object? related = freezed,Object? expiredAt = freezed,Object? status = null,}) {
|
||||||
return _then(_SnRelationship(
|
return _then(_SnRelationship(
|
||||||
createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as DateTime?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
as DateTime?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,account: null == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
as String,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount,relatedId: null == relatedId ? _self.relatedId : relatedId // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,relatedId: null == relatedId ? _self.relatedId : relatedId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,related: null == related ? _self.related : related // ignore: cast_nullable_to_non_nullable
|
as String,related: freezed == related ? _self.related : related // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,expiredAt: freezed == expiredAt ? _self.expiredAt : expiredAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
as DateTime?,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int,
|
||||||
));
|
));
|
||||||
@@ -311,18 +319,24 @@ as int,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res> get account {
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
|
if (_self.account == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $SnAccountCopyWith<$Res>(_self.account, (value) {
|
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
|
||||||
return _then(_self.copyWith(account: value));
|
return _then(_self.copyWith(account: value));
|
||||||
});
|
});
|
||||||
}/// Create a copy of SnRelationship
|
}/// Create a copy of SnRelationship
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res> get related {
|
$SnAccountCopyWith<$Res>? get related {
|
||||||
|
if (_self.related == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $SnAccountCopyWith<$Res>(_self.related, (value) {
|
return $SnAccountCopyWith<$Res>(_self.related!, (value) {
|
||||||
return _then(_self.copyWith(related: value));
|
return _then(_self.copyWith(related: value));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,13 @@ _SnRelationship _$SnRelationshipFromJson(Map<String, dynamic> json) =>
|
|||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
account: json['account'] == null
|
||||||
|
? null
|
||||||
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
relatedId: json['related_id'] as String,
|
relatedId: json['related_id'] as String,
|
||||||
related: SnAccount.fromJson(json['related'] as Map<String, dynamic>),
|
related: json['related'] == null
|
||||||
|
? null
|
||||||
|
: SnAccount.fromJson(json['related'] as Map<String, dynamic>),
|
||||||
expiredAt: json['expired_at'] == null
|
expiredAt: json['expired_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
@@ -33,9 +37,9 @@ Map<String, dynamic> _$SnRelationshipToJson(_SnRelationship instance) =>
|
|||||||
'updated_at': instance.updatedAt?.toIso8601String(),
|
'updated_at': instance.updatedAt?.toIso8601String(),
|
||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
'account_id': instance.accountId,
|
'account_id': instance.accountId,
|
||||||
'account': instance.account.toJson(),
|
'account': instance.account?.toJson(),
|
||||||
'related_id': instance.relatedId,
|
'related_id': instance.relatedId,
|
||||||
'related': instance.related.toJson(),
|
'related': instance.related?.toJson(),
|
||||||
'expired_at': instance.expiredAt?.toIso8601String(),
|
'expired_at': instance.expiredAt?.toIso8601String(),
|
||||||
'status': instance.status,
|
'status': instance.status,
|
||||||
};
|
};
|
||||||
|
|||||||
176
lib/pods/audio.dart
Normal file
176
lib/pods/audio.dart
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
import 'package:island/pods/config.dart';
|
||||||
|
import 'package:audio_session/audio_session.dart';
|
||||||
|
import 'package:dart_midi_pro/dart_midi_pro.dart';
|
||||||
|
|
||||||
|
final sfxPlayerProvider = Provider<AudioPlayer>((ref) {
|
||||||
|
final player = AudioPlayer();
|
||||||
|
ref.onDispose(() {
|
||||||
|
player.dispose();
|
||||||
|
});
|
||||||
|
return player;
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> _configureAudioSession() async {
|
||||||
|
final session = await AudioSession.instance;
|
||||||
|
await session.configure(
|
||||||
|
const AudioSessionConfiguration(
|
||||||
|
avAudioSessionCategory: AVAudioSessionCategory.playback,
|
||||||
|
avAudioSessionCategoryOptions:
|
||||||
|
AVAudioSessionCategoryOptions.mixWithOthers,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await session.setActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
final audioSessionProvider = FutureProvider<void>((ref) async {
|
||||||
|
await _configureAudioSession();
|
||||||
|
});
|
||||||
|
|
||||||
|
final notificationSfxProvider = FutureProvider<void>((ref) async {
|
||||||
|
final player = ref.watch(sfxPlayerProvider);
|
||||||
|
await player.setVolume(0.75);
|
||||||
|
await player.setAudioSource(
|
||||||
|
AudioSource.asset('assets/audio/notification.mp3'),
|
||||||
|
preload: true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
final messageSfxProvider = FutureProvider<void>((ref) async {
|
||||||
|
final player = ref.watch(sfxPlayerProvider);
|
||||||
|
await player.setAudioSource(
|
||||||
|
AudioSource.asset('assets/audio/messages.mp3'),
|
||||||
|
preload: true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> _playSfx(String assetPath, double volume) async {
|
||||||
|
final player = AudioPlayer();
|
||||||
|
await player.setVolume(volume);
|
||||||
|
await player.setAudioSource(AudioSource.asset(assetPath));
|
||||||
|
await player.play();
|
||||||
|
await player.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void playNotificationSfx(WidgetRef ref) {
|
||||||
|
final settings = ref.read(appSettingsProvider);
|
||||||
|
if (!settings.soundEffects) return;
|
||||||
|
_playSfx('assets/audio/notification.mp3', 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
void playMessageSfx(WidgetRef ref) {
|
||||||
|
final settings = ref.read(appSettingsProvider);
|
||||||
|
if (!settings.soundEffects) return;
|
||||||
|
_playSfx('assets/audio/messages.mp3', 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
class MiniSampleSynth {
|
||||||
|
final String sampleAsset;
|
||||||
|
final int baseNote; // MIDI note of the sample (usually 72 = C5 for lower pitch playback)
|
||||||
|
|
||||||
|
AudioPlayer? currentPlayer;
|
||||||
|
|
||||||
|
MiniSampleSynth({required this.sampleAsset, this.baseNote = 72});
|
||||||
|
|
||||||
|
Future<void> playMidiAsset(String midiAsset) async {
|
||||||
|
final data = await rootBundle.load(midiAsset);
|
||||||
|
final midi = MidiParser().parseMidiFromBuffer(data.buffer.asUint8List());
|
||||||
|
|
||||||
|
for (final track in midi.tracks) {
|
||||||
|
int currentTick = 0;
|
||||||
|
|
||||||
|
for (final event in track) {
|
||||||
|
currentTick += event.deltaTime;
|
||||||
|
|
||||||
|
if (event is NoteOnEvent && event.velocity > 0) {
|
||||||
|
final note = event.noteNumber;
|
||||||
|
final durationTicks = _estimateDuration(track, event);
|
||||||
|
final durationMs = _ticksToMs(durationTicks, midi);
|
||||||
|
|
||||||
|
_scheduleNote(
|
||||||
|
note: note,
|
||||||
|
startMs: _ticksToMs(currentTick, midi),
|
||||||
|
durationMs: durationMs,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _scheduleNote({
|
||||||
|
required int note,
|
||||||
|
required int startMs,
|
||||||
|
required int durationMs,
|
||||||
|
}) {
|
||||||
|
Future.delayed(Duration(milliseconds: startMs), () async {
|
||||||
|
// Stop any currently playing note
|
||||||
|
if (currentPlayer != null) {
|
||||||
|
await currentPlayer!.stop();
|
||||||
|
await currentPlayer!.dispose();
|
||||||
|
currentPlayer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final player = AudioPlayer();
|
||||||
|
currentPlayer = player;
|
||||||
|
|
||||||
|
await player.setAudioSource(AudioSource.asset(sampleAsset));
|
||||||
|
final speed = _noteToSpeed(note);
|
||||||
|
await player.setSpeed(speed);
|
||||||
|
await player.play();
|
||||||
|
|
||||||
|
Future.delayed(Duration(milliseconds: durationMs), () async {
|
||||||
|
if (currentPlayer == player) {
|
||||||
|
await player.stop();
|
||||||
|
await player.dispose();
|
||||||
|
currentPlayer = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
double _noteToSpeed(int note) {
|
||||||
|
return math.pow(2, (note - baseNote) / 12).toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
int _getTempo(MidiFile midi) {
|
||||||
|
for (var track in midi.tracks) {
|
||||||
|
for (var event in track) {
|
||||||
|
if (event is SetTempoEvent) {
|
||||||
|
return event.microsecondsPerBeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 500000; // default 120 BPM
|
||||||
|
}
|
||||||
|
|
||||||
|
int _ticksToMs(int ticks, MidiFile midi) {
|
||||||
|
final tempo = _getTempo(midi);
|
||||||
|
final ticksPerBeat = midi.header.ticksPerBeat ?? 480;
|
||||||
|
|
||||||
|
return ((ticks * tempo) / ticksPerBeat / 1000).round();
|
||||||
|
}
|
||||||
|
|
||||||
|
int _estimateDuration(List<MidiEvent> track, NoteOnEvent on) {
|
||||||
|
int ticks = 0;
|
||||||
|
bool started = false;
|
||||||
|
|
||||||
|
for (final e in track) {
|
||||||
|
if (e == on) {
|
||||||
|
started = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!started) continue;
|
||||||
|
|
||||||
|
ticks += e.deltaTime;
|
||||||
|
|
||||||
|
if (e is NoteOffEvent && e.noteNumber == on.noteNumber) {
|
||||||
|
return ticks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 200; // fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ import "dart:async";
|
|||||||
import "dart:convert";
|
import "dart:convert";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
|
import "package:just_audio/just_audio.dart";
|
||||||
|
import "package:island/pods/config.dart";
|
||||||
import "package:island/models/chat.dart";
|
import "package:island/models/chat.dart";
|
||||||
import "package:island/pods/chat/chat_room.dart";
|
import "package:island/pods/chat/chat_room.dart";
|
||||||
import "package:island/pods/lifecycle.dart";
|
import "package:island/pods/lifecycle.dart";
|
||||||
@@ -198,7 +200,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
return _typingStatuses;
|
return _typingStatuses;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMessage(WebSocketPacket pkt) {
|
Future<void> onMessage(WebSocketPacket pkt) async {
|
||||||
if (!pkt.type.startsWith('messages')) return;
|
if (!pkt.type.startsWith('messages')) return;
|
||||||
if (['messages.read'].contains(pkt.type)) return;
|
if (['messages.read'].contains(pkt.type)) return;
|
||||||
|
|
||||||
@@ -221,7 +223,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
// Add new typing status
|
// Add new typing status
|
||||||
_typingStatuses.add(sender);
|
_typingStatuses.add(sender);
|
||||||
}
|
}
|
||||||
state = List.of(_typingStatuses);
|
if (ref.mounted) state = List.of(_typingStatuses);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +240,20 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
_messagesNotifier.receiveMessage(message);
|
_messagesNotifier.receiveMessage(message);
|
||||||
// Send read receipt for new message
|
// Send read receipt for new message
|
||||||
sendReadReceipt();
|
sendReadReceipt();
|
||||||
|
// Play sound for new messages when app is unfocused
|
||||||
|
if (pkt.type == 'messages.new' &&
|
||||||
|
message.senderId != _chatIdentity.id &&
|
||||||
|
ref.read(appLifecycleStateProvider).value !=
|
||||||
|
AppLifecycleState.resumed &&
|
||||||
|
ref.read(appSettingsProvider).soundEffects) {
|
||||||
|
final player = AudioPlayer();
|
||||||
|
await player.setVolume(0.75);
|
||||||
|
await player.setAudioSource(
|
||||||
|
AudioSource.asset('assets/audio/messages.mp3'),
|
||||||
|
);
|
||||||
|
await player.play();
|
||||||
|
player.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class ChatSubscribeNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatSubscribeNotifierHash() =>
|
String _$chatSubscribeNotifierHash() =>
|
||||||
r'b7624ae45ace2944a88f8b4d14ddce556c236371';
|
r'f2f5059a975fc44a41850459d6b7d041ff9d41cb';
|
||||||
|
|
||||||
final class ChatSubscribeNotifierFamily extends $Family
|
final class ChatSubscribeNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
late Future<SnAccount?> Function(String) _fetchAccount;
|
late Future<SnAccount?> Function(String) _fetchAccount;
|
||||||
|
|
||||||
// Disposal handling
|
|
||||||
bool _disposed = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
||||||
_apiClient = ref.watch(apiClientProvider);
|
_apiClient = ref.watch(apiClientProvider);
|
||||||
@@ -81,17 +78,11 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
talker.log('MessagesNotifier built for room $roomId');
|
talker.log('MessagesNotifier built for room $roomId');
|
||||||
|
|
||||||
// Set up disposal handling
|
|
||||||
ref.onDispose(() {
|
|
||||||
_disposed = true;
|
|
||||||
talker.log('MessagesNotifier disposed for room $roomId');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Only setup sync and lifecycle listeners if user is a member
|
// Only setup sync and lifecycle listeners if user is a member
|
||||||
if (identity != null) {
|
if (identity != null) {
|
||||||
ref.listen(appLifecycleStateProvider, (_, next) {
|
ref.listen(appLifecycleStateProvider, (_, next) {
|
||||||
next.whenData((state) {
|
next.whenData((state) {
|
||||||
if (_disposed) return; // Check disposal before accessing ref
|
if (!ref.mounted) return; // Check disposal before accessing ref
|
||||||
if (state == AppLifecycleState.paused) {
|
if (state == AppLifecycleState.paused) {
|
||||||
_lastPauseTime = DateTime.now();
|
_lastPauseTime = DateTime.now();
|
||||||
talker.log('App paused, recording time');
|
talker.log('App paused, recording time');
|
||||||
@@ -100,7 +91,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
final diff = DateTime.now().difference(_lastPauseTime!);
|
final diff = DateTime.now().difference(_lastPauseTime!);
|
||||||
if (diff > const Duration(minutes: 1)) {
|
if (diff > const Duration(minutes: 1)) {
|
||||||
talker.log('App resumed after >1 min, syncing messages');
|
talker.log('App resumed after >1 min, syncing messages');
|
||||||
if (!_disposed) {
|
if (!!ref.mounted) {
|
||||||
syncMessages(); // Check disposal before calling syncMessages
|
syncMessages(); // Check disposal before calling syncMessages
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -137,7 +128,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
uniqueMessages.add(message);
|
uniqueMessages.add(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state = AsyncValue.data(uniqueMessages);
|
if (ref.mounted) state = AsyncValue.data(uniqueMessages);
|
||||||
} finally {
|
} finally {
|
||||||
_isUpdatingState = false;
|
_isUpdatingState = false;
|
||||||
}
|
}
|
||||||
@@ -336,7 +327,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
talker.log('Starting message sync');
|
talker.log('Starting message sync');
|
||||||
// Use Future.microtask to set syncing state, but check disposal to avoid errors
|
// Use Future.microtask to set syncing state, but check disposal to avoid errors
|
||||||
Future.microtask(() {
|
Future.microtask(() {
|
||||||
if (!_disposed) {
|
if (!!ref.mounted) {
|
||||||
ref.read(chatSyncingProvider.notifier).set(true);
|
ref.read(chatSyncingProvider.notifier).set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -359,7 +350,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
take: _pageSize,
|
take: _pageSize,
|
||||||
);
|
);
|
||||||
state = AsyncValue.data(newMessages);
|
if (ref.mounted) state = AsyncValue.data(newMessages);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +408,9 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
} finally {
|
} finally {
|
||||||
talker.log('Finished message sync');
|
talker.log('Finished message sync');
|
||||||
// Always reset global syncing state, regardless of disposal
|
// Always reset global syncing state, regardless of disposal
|
||||||
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
Future.microtask(() {
|
||||||
|
if (ref.mounted) ref.read(chatSyncingProvider.notifier).set(false);
|
||||||
|
});
|
||||||
_isSyncing = false;
|
_isSyncing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,18 +500,18 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
_hasMore = messages.length == _pageSize;
|
_hasMore = messages.length == _pageSize;
|
||||||
|
|
||||||
state = AsyncValue.data(messages);
|
if (ref.mounted) state = AsyncValue.data(messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadMore() async {
|
Future<void> loadMore() async {
|
||||||
if (!_hasMore || state is AsyncLoading) return;
|
if (!_hasMore || state is AsyncLoading) return;
|
||||||
talker.log('Loading more messages');
|
talker.log('Loading more messages');
|
||||||
|
|
||||||
if (!_disposed) {
|
if (!!ref.mounted) {
|
||||||
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final offset = currentMessages.length;
|
final offset = currentMessages.length;
|
||||||
|
|
||||||
final newMessages = await listMessages(offset: offset, take: _pageSize);
|
final newMessages = await listMessages(offset: offset, take: _pageSize);
|
||||||
@@ -527,9 +520,11 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_hasMore = false;
|
_hasMore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
state = AsyncValue.data(
|
state = AsyncValue.data(
|
||||||
_sortMessages([...currentMessages, ...newMessages]),
|
_sortMessages([...currentMessages, ...newMessages]),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} catch (err, stackTrace) {
|
} catch (err, stackTrace) {
|
||||||
talker.log(
|
talker.log(
|
||||||
'Error loading more messages',
|
'Error loading more messages',
|
||||||
@@ -540,12 +535,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
// Always reset global syncing state, regardless of disposal
|
// Always reset global syncing state, regardless of disposal
|
||||||
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
Future.microtask(() {
|
||||||
|
if (ref.mounted) ref.read(chatSyncingProvider.notifier).set(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sendMessage(
|
Future<void> sendMessage(
|
||||||
WidgetRef ref,
|
WidgetRef outerRef,
|
||||||
String content,
|
String content,
|
||||||
List<UniversalFile> attachments, {
|
List<UniversalFile> attachments, {
|
||||||
SnPoll? poll,
|
SnPoll? poll,
|
||||||
@@ -578,14 +575,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_fileUploadProgress[localMessage.id] = {};
|
_fileUploadProgress[localMessage.id] = {};
|
||||||
await _database.saveMessageWithSender(localMessage);
|
await _database.saveMessageWithSender(localMessage);
|
||||||
|
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
state = AsyncValue.data([localMessage, ...currentMessages]);
|
state = AsyncValue.data([localMessage, ...currentMessages]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var cloudAttachments = List.empty(growable: true);
|
var cloudAttachments = List.empty(growable: true);
|
||||||
for (var idx = 0; idx < attachments.length; idx++) {
|
for (var idx = 0; idx < attachments.length; idx++) {
|
||||||
final cloudFile = await FileUploader.createCloudFile(
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
ref: ref,
|
ref: outerRef,
|
||||||
fileData: attachments[idx],
|
fileData: attachments[idx],
|
||||||
onProgress: (progress, _) {
|
onProgress: (progress, _) {
|
||||||
_fileUploadProgress[localMessage.id]?[idx] = progress ?? 0.0;
|
_fileUploadProgress[localMessage.id]?[idx] = progress ?? 0.0;
|
||||||
@@ -628,6 +625,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
await _database.deleteMessage(localMessage.id);
|
await _database.deleteMessage(localMessage.id);
|
||||||
await _database.saveMessageWithSender(updatedMessage);
|
await _database.saveMessageWithSender(updatedMessage);
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = state.value ?? [];
|
||||||
if (editingTo != null) {
|
if (editingTo != null) {
|
||||||
final newMessages = currentMessages
|
final newMessages = currentMessages
|
||||||
@@ -646,6 +644,8 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}).toList();
|
}).toList();
|
||||||
state = AsyncValue.data(newMessages);
|
state = AsyncValue.data(newMessages);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
talker.log('Message with nonce $nonce sent successfully');
|
talker.log('Message with nonce $nonce sent successfully');
|
||||||
} catch (e, stackTrace) {
|
} catch (e, stackTrace) {
|
||||||
talker.log(
|
talker.log(
|
||||||
@@ -660,6 +660,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
localMessage.id,
|
localMessage.id,
|
||||||
MessageStatus.failed,
|
MessageStatus.failed,
|
||||||
);
|
);
|
||||||
|
if (ref.mounted) {
|
||||||
final newMessages = (state.value ?? []).map((m) {
|
final newMessages = (state.value ?? []).map((m) {
|
||||||
if (m.id == localMessage.id) {
|
if (m.id == localMessage.id) {
|
||||||
return m..status = MessageStatus.failed;
|
return m..status = MessageStatus.failed;
|
||||||
@@ -667,6 +668,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
return m;
|
return m;
|
||||||
}).toList();
|
}).toList();
|
||||||
state = AsyncValue.data(newMessages);
|
state = AsyncValue.data(newMessages);
|
||||||
|
}
|
||||||
showErrorAlert(e);
|
showErrorAlert(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,6 +709,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
await _database.deleteMessage(pendingMessageId);
|
await _database.deleteMessage(pendingMessageId);
|
||||||
await _database.saveMessageWithSender(updatedMessage);
|
await _database.saveMessageWithSender(updatedMessage);
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
final newMessages = (state.value ?? []).map((m) {
|
final newMessages = (state.value ?? []).map((m) {
|
||||||
if (m.id == pendingMessageId) {
|
if (m.id == pendingMessageId) {
|
||||||
return updatedMessage;
|
return updatedMessage;
|
||||||
@@ -714,6 +717,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
return m;
|
return m;
|
||||||
}).toList();
|
}).toList();
|
||||||
state = AsyncValue.data(newMessages);
|
state = AsyncValue.data(newMessages);
|
||||||
|
}
|
||||||
} catch (e, stackTrace) {
|
} catch (e, stackTrace) {
|
||||||
talker.log(
|
talker.log(
|
||||||
'Failed to retry message $pendingMessageId',
|
'Failed to retry message $pendingMessageId',
|
||||||
@@ -727,6 +731,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
pendingMessageId,
|
pendingMessageId,
|
||||||
MessageStatus.failed,
|
MessageStatus.failed,
|
||||||
);
|
);
|
||||||
|
if (ref.mounted) {
|
||||||
final newMessages = (state.value ?? []).map((m) {
|
final newMessages = (state.value ?? []).map((m) {
|
||||||
if (m.id == pendingMessageId) {
|
if (m.id == pendingMessageId) {
|
||||||
return m..status = MessageStatus.failed;
|
return m..status = MessageStatus.failed;
|
||||||
@@ -734,6 +739,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
return m;
|
return m;
|
||||||
}).toList();
|
}).toList();
|
||||||
state = AsyncValue.data(_sortMessages(newMessages));
|
state = AsyncValue.data(_sortMessages(newMessages));
|
||||||
|
}
|
||||||
showErrorAlert(e);
|
showErrorAlert(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -765,13 +771,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
if (!isSilentMessage) {
|
if (!isSilentMessage) {
|
||||||
await _database.saveMessageWithSender(localMessage);
|
await _database.saveMessageWithSender(localMessage);
|
||||||
|
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final existingIndex = currentMessages.indexWhere(
|
final existingIndex = currentMessages.indexWhere(
|
||||||
(m) =>
|
(m) =>
|
||||||
m.id == localMessage.id ||
|
m.id == localMessage.id ||
|
||||||
(localMessage.nonce != null && m.nonce == localMessage.nonce),
|
(localMessage.nonce != null && m.nonce == localMessage.nonce),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
if (existingIndex >= 0) {
|
if (existingIndex >= 0) {
|
||||||
final newList = [...currentMessages];
|
final newList = [...currentMessages];
|
||||||
newList[existingIndex] = localMessage;
|
newList[existingIndex] = localMessage;
|
||||||
@@ -782,6 +789,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (remoteMessage.type) {
|
switch (remoteMessage.type) {
|
||||||
case "messages.delete":
|
case "messages.delete":
|
||||||
@@ -846,15 +854,17 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
await _database.updateMessage(_database.messageToCompanion(updatedMessage));
|
await _database.updateMessage(_database.messageToCompanion(updatedMessage));
|
||||||
|
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final index = currentMessages.indexWhere((m) => m.id == updatedMessage.id);
|
final index = currentMessages.indexWhere((m) => m.id == updatedMessage.id);
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
final newList = [...currentMessages];
|
final newList = [...currentMessages];
|
||||||
newList[index] = updatedMessage;
|
newList[index] = updatedMessage;
|
||||||
state = AsyncValue.data(_sortMessages(newList));
|
state = AsyncValue.data(_sortMessages(newList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> receiveMessageDeletion(String messageId) async {
|
Future<void> receiveMessageDeletion(String messageId) async {
|
||||||
// Block message deletions during jumps to prevent list resets
|
// Block message deletions during jumps to prevent list resets
|
||||||
@@ -866,7 +876,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
talker.log('Received message deletion $messageId');
|
talker.log('Received message deletion $messageId');
|
||||||
_pendingMessages.remove(messageId);
|
_pendingMessages.remove(messageId);
|
||||||
|
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final messageIndex = currentMessages.indexWhere((m) => m.id == messageId);
|
final messageIndex = currentMessages.indexWhere((m) => m.id == messageId);
|
||||||
|
|
||||||
LocalChatMessage? messageToUpdate;
|
LocalChatMessage? messageToUpdate;
|
||||||
@@ -892,12 +902,14 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
await _database.saveMessageWithSender(deletedMessage);
|
await _database.saveMessageWithSender(deletedMessage);
|
||||||
|
|
||||||
|
if (ref.mounted) {
|
||||||
if (messageIndex != -1) {
|
if (messageIndex != -1) {
|
||||||
final newList = [...currentMessages];
|
final newList = [...currentMessages];
|
||||||
newList[messageIndex] = deletedMessage;
|
newList[messageIndex] = deletedMessage;
|
||||||
state = AsyncValue.data(newList);
|
state = AsyncValue.data(newList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> deleteMessage(String messageId) async {
|
Future<void> deleteMessage(String messageId) async {
|
||||||
talker.log('Deleting message $messageId');
|
talker.log('Deleting message $messageId');
|
||||||
@@ -916,7 +928,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_pendingMessages.remove(messageId);
|
_pendingMessages.remove(messageId);
|
||||||
await _database.deleteMessage(messageId);
|
await _database.deleteMessage(messageId);
|
||||||
|
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final newMessages = currentMessages
|
final newMessages = currentMessages
|
||||||
.where((m) => m.id != messageId)
|
.where((m) => m.id != messageId)
|
||||||
.toList();
|
.toList();
|
||||||
@@ -1058,7 +1070,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_isJumping = true;
|
_isJumping = true;
|
||||||
|
|
||||||
// Clear flashing messages when starting a new jump
|
// Clear flashing messages when starting a new jump
|
||||||
if (!_disposed) {
|
if (!!ref.mounted) {
|
||||||
ref.read(flashingMessagesProvider.notifier).state = {};
|
ref.read(flashingMessagesProvider.notifier).state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1072,7 +1084,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if message is already in current state to avoid duplicate loading
|
// Check if message is already in current state to avoid duplicate loading
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = (ref.mounted ? state.value : null) ?? [];
|
||||||
final existingIndex = currentMessages.indexWhere(
|
final existingIndex = currentMessages.indexWhere(
|
||||||
(m) => m.id == messageId,
|
(m) => m.id == messageId,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ final class MessagesNotifierProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$messagesNotifierHash() => r'a721a4b92b48ee7c2289cdcd7130bbf1ca9dcb40';
|
String _$messagesNotifierHash() => r'622fed0908eb04381a971e36540c516743246dff';
|
||||||
|
|
||||||
final class MessagesNotifierFamily extends $Family
|
final class MessagesNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:island/services/analytics_service.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
@@ -41,6 +42,7 @@ const kAppAskedReview = 'app_asked_review';
|
|||||||
const kAppDashSearchEngine = 'app_dash_search_engine';
|
const kAppDashSearchEngine = 'app_dash_search_engine';
|
||||||
const kAppDefaultScreen = 'app_default_screen';
|
const kAppDefaultScreen = 'app_default_screen';
|
||||||
const kAppShowFediverseContent = 'app_show_fediverse_content';
|
const kAppShowFediverseContent = 'app_show_fediverse_content';
|
||||||
|
const kAppDashboardConfig = 'app_dashboard_config';
|
||||||
|
|
||||||
// Will be overrided by the ProviderScope
|
// Will be overrided by the ProviderScope
|
||||||
final sharedPreferencesProvider = Provider<SharedPreferences>((ref) {
|
final sharedPreferencesProvider = Provider<SharedPreferences>((ref) {
|
||||||
@@ -67,6 +69,19 @@ sealed class ThemeColors with _$ThemeColors {
|
|||||||
_$ThemeColorsFromJson(json);
|
_$ThemeColorsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class DashboardConfig with _$DashboardConfig {
|
||||||
|
factory DashboardConfig({
|
||||||
|
required List<String> verticalLayouts,
|
||||||
|
required List<String> horizontalLayouts,
|
||||||
|
required bool showSearchBar,
|
||||||
|
required bool showClockAndCountdown,
|
||||||
|
}) = _DashboardConfig;
|
||||||
|
|
||||||
|
factory DashboardConfig.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$DashboardConfigFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class AppSettings with _$AppSettings {
|
sealed class AppSettings with _$AppSettings {
|
||||||
const factory AppSettings({
|
const factory AppSettings({
|
||||||
@@ -93,6 +108,7 @@ sealed class AppSettings with _$AppSettings {
|
|||||||
required String? dashSearchEngine,
|
required String? dashSearchEngine,
|
||||||
required String? defaultScreen,
|
required String? defaultScreen,
|
||||||
required bool showFediverseContent,
|
required bool showFediverseContent,
|
||||||
|
required DashboardConfig? dashboardConfig,
|
||||||
}) = _AppSettings;
|
}) = _AppSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +141,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
dashSearchEngine: prefs.getString(kAppDashSearchEngine),
|
dashSearchEngine: prefs.getString(kAppDashSearchEngine),
|
||||||
defaultScreen: prefs.getString(kAppDefaultScreen),
|
defaultScreen: prefs.getString(kAppDefaultScreen),
|
||||||
showFediverseContent: prefs.getBool(kAppShowFediverseContent) ?? true,
|
showFediverseContent: prefs.getBool(kAppShowFediverseContent) ?? true,
|
||||||
|
dashboardConfig: _getDashboardConfigFromPrefs(prefs),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +174,18 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DashboardConfig? _getDashboardConfigFromPrefs(SharedPreferences prefs) {
|
||||||
|
final jsonString = prefs.getString(kAppDashboardConfig);
|
||||||
|
if (jsonString == null) return null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final json = jsonDecode(jsonString);
|
||||||
|
return DashboardConfig.fromJson(json);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setDefaultPoolId(String? value) {
|
void setDefaultPoolId(String? value) {
|
||||||
final prefs = ref.read(sharedPreferencesProvider);
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@@ -256,8 +285,11 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
|
|
||||||
void setThemeMode(String value) {
|
void setThemeMode(String value) {
|
||||||
final prefs = ref.read(sharedPreferencesProvider);
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
|
final oldValue = state.themeMode;
|
||||||
prefs.setString(kAppThemeMode, value);
|
prefs.setString(kAppThemeMode, value);
|
||||||
state = state.copyWith(themeMode: value);
|
state = state.copyWith(themeMode: value);
|
||||||
|
|
||||||
|
AnalyticsService().logThemeChanged(oldValue ?? 'system', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAppTransparentBackground(double value) {
|
void setAppTransparentBackground(double value) {
|
||||||
@@ -320,6 +352,23 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
prefs.setBool(kAppShowFediverseContent, value);
|
prefs.setBool(kAppShowFediverseContent, value);
|
||||||
state = state.copyWith(showFediverseContent: value);
|
state = state.copyWith(showFediverseContent: value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDashboardConfig(DashboardConfig? value) {
|
||||||
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
|
if (value != null) {
|
||||||
|
final json = jsonEncode(value.toJson());
|
||||||
|
prefs.setString(kAppDashboardConfig, json);
|
||||||
|
} else {
|
||||||
|
prefs.remove(kAppDashboardConfig);
|
||||||
|
}
|
||||||
|
state = state.copyWith(dashboardConfig: value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetDashboardConfig() {
|
||||||
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
|
prefs.remove(kAppDashboardConfig);
|
||||||
|
state = state.copyWith(dashboardConfig: null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final updateInfoProvider =
|
final updateInfoProvider =
|
||||||
|
|||||||
@@ -281,6 +281,284 @@ as int?,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$DashboardConfig {
|
||||||
|
|
||||||
|
List<String> get verticalLayouts; List<String> get horizontalLayouts; bool get showSearchBar; bool get showClockAndCountdown;
|
||||||
|
/// Create a copy of DashboardConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$DashboardConfigCopyWith<DashboardConfig> get copyWith => _$DashboardConfigCopyWithImpl<DashboardConfig>(this as DashboardConfig, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this DashboardConfig to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is DashboardConfig&&const DeepCollectionEquality().equals(other.verticalLayouts, verticalLayouts)&&const DeepCollectionEquality().equals(other.horizontalLayouts, horizontalLayouts)&&(identical(other.showSearchBar, showSearchBar) || other.showSearchBar == showSearchBar)&&(identical(other.showClockAndCountdown, showClockAndCountdown) || other.showClockAndCountdown == showClockAndCountdown));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(verticalLayouts),const DeepCollectionEquality().hash(horizontalLayouts),showSearchBar,showClockAndCountdown);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'DashboardConfig(verticalLayouts: $verticalLayouts, horizontalLayouts: $horizontalLayouts, showSearchBar: $showSearchBar, showClockAndCountdown: $showClockAndCountdown)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $DashboardConfigCopyWith<$Res> {
|
||||||
|
factory $DashboardConfigCopyWith(DashboardConfig value, $Res Function(DashboardConfig) _then) = _$DashboardConfigCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
List<String> verticalLayouts, List<String> horizontalLayouts, bool showSearchBar, bool showClockAndCountdown
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$DashboardConfigCopyWithImpl<$Res>
|
||||||
|
implements $DashboardConfigCopyWith<$Res> {
|
||||||
|
_$DashboardConfigCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final DashboardConfig _self;
|
||||||
|
final $Res Function(DashboardConfig) _then;
|
||||||
|
|
||||||
|
/// Create a copy of DashboardConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? verticalLayouts = null,Object? horizontalLayouts = null,Object? showSearchBar = null,Object? showClockAndCountdown = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
verticalLayouts: null == verticalLayouts ? _self.verticalLayouts : verticalLayouts // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,horizontalLayouts: null == horizontalLayouts ? _self.horizontalLayouts : horizontalLayouts // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,showSearchBar: null == showSearchBar ? _self.showSearchBar : showSearchBar // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,showClockAndCountdown: null == showClockAndCountdown ? _self.showClockAndCountdown : showClockAndCountdown // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [DashboardConfig].
|
||||||
|
extension DashboardConfigPatterns on DashboardConfig {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _DashboardConfig value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _DashboardConfig value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _DashboardConfig value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<String> verticalLayouts, List<String> horizontalLayouts, bool showSearchBar, bool showClockAndCountdown)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig() when $default != null:
|
||||||
|
return $default(_that.verticalLayouts,_that.horizontalLayouts,_that.showSearchBar,_that.showClockAndCountdown);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<String> verticalLayouts, List<String> horizontalLayouts, bool showSearchBar, bool showClockAndCountdown) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig():
|
||||||
|
return $default(_that.verticalLayouts,_that.horizontalLayouts,_that.showSearchBar,_that.showClockAndCountdown);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<String> verticalLayouts, List<String> horizontalLayouts, bool showSearchBar, bool showClockAndCountdown)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _DashboardConfig() when $default != null:
|
||||||
|
return $default(_that.verticalLayouts,_that.horizontalLayouts,_that.showSearchBar,_that.showClockAndCountdown);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _DashboardConfig implements DashboardConfig {
|
||||||
|
_DashboardConfig({required final List<String> verticalLayouts, required final List<String> horizontalLayouts, required this.showSearchBar, required this.showClockAndCountdown}): _verticalLayouts = verticalLayouts,_horizontalLayouts = horizontalLayouts;
|
||||||
|
factory _DashboardConfig.fromJson(Map<String, dynamic> json) => _$DashboardConfigFromJson(json);
|
||||||
|
|
||||||
|
final List<String> _verticalLayouts;
|
||||||
|
@override List<String> get verticalLayouts {
|
||||||
|
if (_verticalLayouts is EqualUnmodifiableListView) return _verticalLayouts;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_verticalLayouts);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String> _horizontalLayouts;
|
||||||
|
@override List<String> get horizontalLayouts {
|
||||||
|
if (_horizontalLayouts is EqualUnmodifiableListView) return _horizontalLayouts;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_horizontalLayouts);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final bool showSearchBar;
|
||||||
|
@override final bool showClockAndCountdown;
|
||||||
|
|
||||||
|
/// Create a copy of DashboardConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$DashboardConfigCopyWith<_DashboardConfig> get copyWith => __$DashboardConfigCopyWithImpl<_DashboardConfig>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$DashboardConfigToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _DashboardConfig&&const DeepCollectionEquality().equals(other._verticalLayouts, _verticalLayouts)&&const DeepCollectionEquality().equals(other._horizontalLayouts, _horizontalLayouts)&&(identical(other.showSearchBar, showSearchBar) || other.showSearchBar == showSearchBar)&&(identical(other.showClockAndCountdown, showClockAndCountdown) || other.showClockAndCountdown == showClockAndCountdown));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_verticalLayouts),const DeepCollectionEquality().hash(_horizontalLayouts),showSearchBar,showClockAndCountdown);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'DashboardConfig(verticalLayouts: $verticalLayouts, horizontalLayouts: $horizontalLayouts, showSearchBar: $showSearchBar, showClockAndCountdown: $showClockAndCountdown)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$DashboardConfigCopyWith<$Res> implements $DashboardConfigCopyWith<$Res> {
|
||||||
|
factory _$DashboardConfigCopyWith(_DashboardConfig value, $Res Function(_DashboardConfig) _then) = __$DashboardConfigCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
List<String> verticalLayouts, List<String> horizontalLayouts, bool showSearchBar, bool showClockAndCountdown
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$DashboardConfigCopyWithImpl<$Res>
|
||||||
|
implements _$DashboardConfigCopyWith<$Res> {
|
||||||
|
__$DashboardConfigCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _DashboardConfig _self;
|
||||||
|
final $Res Function(_DashboardConfig) _then;
|
||||||
|
|
||||||
|
/// Create a copy of DashboardConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? verticalLayouts = null,Object? horizontalLayouts = null,Object? showSearchBar = null,Object? showClockAndCountdown = null,}) {
|
||||||
|
return _then(_DashboardConfig(
|
||||||
|
verticalLayouts: null == verticalLayouts ? _self._verticalLayouts : verticalLayouts // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,horizontalLayouts: null == horizontalLayouts ? _self._horizontalLayouts : horizontalLayouts // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,showSearchBar: null == showSearchBar ? _self.showSearchBar : showSearchBar // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,showClockAndCountdown: null == showClockAndCountdown ? _self.showClockAndCountdown : showClockAndCountdown // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -290,7 +568,7 @@ mixin _$AppSettings {
|
|||||||
ThemeColors? get customColors; Size? get windowSize;// The window size for desktop platforms
|
ThemeColors? get customColors; Size? get windowSize;// The window size for desktop platforms
|
||||||
double get windowOpacity;// The window opacity for desktop platforms
|
double get windowOpacity;// The window opacity for desktop platforms
|
||||||
double get cardTransparency;// The card background opacity
|
double get cardTransparency;// The card background opacity
|
||||||
String? get defaultPoolId; String get messageDisplayStyle; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen; bool get showFediverseContent;
|
String? get defaultPoolId; String get messageDisplayStyle; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen; bool get showFediverseContent; DashboardConfig? get dashboardConfig;
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -301,16 +579,16 @@ $AppSettingsCopyWith<AppSettings> get copyWith => _$AppSettingsCopyWithImpl<AppS
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent)&&(identical(other.dashboardConfig, dashboardConfig) || other.dashboardConfig == dashboardConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent]);
|
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent,dashboardConfig]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent)';
|
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent, dashboardConfig: $dashboardConfig)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -321,11 +599,11 @@ abstract mixin class $AppSettingsCopyWith<$Res> {
|
|||||||
factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl;
|
factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent
|
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent, DashboardConfig? dashboardConfig
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$ThemeColorsCopyWith<$Res>? get customColors;
|
$ThemeColorsCopyWith<$Res>? get customColors;$DashboardConfigCopyWith<$Res>? get dashboardConfig;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -338,7 +616,7 @@ class _$AppSettingsCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,Object? dashboardConfig = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -363,7 +641,8 @@ as String?,askedReview: null == askedReview ? _self.askedReview : askedReview //
|
|||||||
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,dashboardConfig: freezed == dashboardConfig ? _self.dashboardConfig : dashboardConfig // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DashboardConfig?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
@@ -378,6 +657,18 @@ $ThemeColorsCopyWith<$Res>? get customColors {
|
|||||||
return $ThemeColorsCopyWith<$Res>(_self.customColors!, (value) {
|
return $ThemeColorsCopyWith<$Res>(_self.customColors!, (value) {
|
||||||
return _then(_self.copyWith(customColors: value));
|
return _then(_self.copyWith(customColors: value));
|
||||||
});
|
});
|
||||||
|
}/// Create a copy of AppSettings
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$DashboardConfigCopyWith<$Res>? get dashboardConfig {
|
||||||
|
if (_self.dashboardConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $DashboardConfigCopyWith<$Res>(_self.dashboardConfig!, (value) {
|
||||||
|
return _then(_self.copyWith(dashboardConfig: value));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,10 +748,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent, DashboardConfig? dashboardConfig)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings() when $default != null:
|
case _AppSettings() when $default != null:
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);case _:
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent,_that.dashboardConfig);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -478,10 +769,10 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent, DashboardConfig? dashboardConfig) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings():
|
case _AppSettings():
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);}
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent,_that.dashboardConfig);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -495,10 +786,10 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent, DashboardConfig? dashboardConfig)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings() when $default != null:
|
case _AppSettings() when $default != null:
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);case _:
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent,_that.dashboardConfig);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -510,7 +801,7 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
|
|
||||||
|
|
||||||
class _AppSettings implements AppSettings {
|
class _AppSettings implements AppSettings {
|
||||||
const _AppSettings({required this.dataSavingMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen, required this.showFediverseContent});
|
const _AppSettings({required this.dataSavingMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen, required this.showFediverseContent, required this.dashboardConfig});
|
||||||
|
|
||||||
|
|
||||||
@override final bool dataSavingMode;
|
@override final bool dataSavingMode;
|
||||||
@@ -540,6 +831,7 @@ class _AppSettings implements AppSettings {
|
|||||||
@override final String? dashSearchEngine;
|
@override final String? dashSearchEngine;
|
||||||
@override final String? defaultScreen;
|
@override final String? defaultScreen;
|
||||||
@override final bool showFediverseContent;
|
@override final bool showFediverseContent;
|
||||||
|
@override final DashboardConfig? dashboardConfig;
|
||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -551,16 +843,16 @@ _$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent)&&(identical(other.dashboardConfig, dashboardConfig) || other.dashboardConfig == dashboardConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent]);
|
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent,dashboardConfig]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent)';
|
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent, dashboardConfig: $dashboardConfig)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -571,11 +863,11 @@ abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith
|
|||||||
factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl;
|
factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent
|
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent, DashboardConfig? dashboardConfig
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $ThemeColorsCopyWith<$Res>? get customColors;
|
@override $ThemeColorsCopyWith<$Res>? get customColors;@override $DashboardConfigCopyWith<$Res>? get dashboardConfig;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -588,7 +880,7 @@ class __$AppSettingsCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,Object? dashboardConfig = freezed,}) {
|
||||||
return _then(_AppSettings(
|
return _then(_AppSettings(
|
||||||
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -613,7 +905,8 @@ as String?,askedReview: null == askedReview ? _self.askedReview : askedReview //
|
|||||||
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,dashboardConfig: freezed == dashboardConfig ? _self.dashboardConfig : dashboardConfig // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DashboardConfig?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,6 +922,18 @@ $ThemeColorsCopyWith<$Res>? get customColors {
|
|||||||
return $ThemeColorsCopyWith<$Res>(_self.customColors!, (value) {
|
return $ThemeColorsCopyWith<$Res>(_self.customColors!, (value) {
|
||||||
return _then(_self.copyWith(customColors: value));
|
return _then(_self.copyWith(customColors: value));
|
||||||
});
|
});
|
||||||
|
}/// Create a copy of AppSettings
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$DashboardConfigCopyWith<$Res>? get dashboardConfig {
|
||||||
|
if (_self.dashboardConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $DashboardConfigCopyWith<$Res>(_self.dashboardConfig!, (value) {
|
||||||
|
return _then(_self.copyWith(dashboardConfig: value));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,26 @@ Map<String, dynamic> _$ThemeColorsToJson(_ThemeColors instance) =>
|
|||||||
'error': instance.error,
|
'error': instance.error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_DashboardConfig _$DashboardConfigFromJson(Map<String, dynamic> json) =>
|
||||||
|
_DashboardConfig(
|
||||||
|
verticalLayouts: (json['vertical_layouts'] as List<dynamic>)
|
||||||
|
.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
|
horizontalLayouts: (json['horizontal_layouts'] as List<dynamic>)
|
||||||
|
.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
|
showSearchBar: json['show_search_bar'] as bool,
|
||||||
|
showClockAndCountdown: json['show_clock_and_countdown'] as bool,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$DashboardConfigToJson(_DashboardConfig instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'vertical_layouts': instance.verticalLayouts,
|
||||||
|
'horizontal_layouts': instance.horizontalLayouts,
|
||||||
|
'show_search_bar': instance.showSearchBar,
|
||||||
|
'show_clock_and_countdown': instance.showClockAndCountdown,
|
||||||
|
};
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
@@ -65,7 +85,7 @@ final class AppSettingsNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$appSettingsNotifierHash() =>
|
String _$appSettingsNotifierHash() =>
|
||||||
r'2437c621dcb1625a120ed1f21ab5c29906ba98be';
|
r'0a7f75bd95850b0c564b29c57912ec8fcac53f09';
|
||||||
|
|
||||||
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
||||||
AppSettings build();
|
AppSettings build();
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
||||||
import 'package:island/models/reference.dart';
|
|
||||||
import 'package:island/pods/network.dart';
|
|
||||||
|
|
||||||
part 'file_references.g.dart';
|
|
||||||
|
|
||||||
@riverpod
|
|
||||||
Future<List<Reference>> fileReferences(Ref ref, String fileId) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
|
||||||
final response = await client.get('/drive/files/$fileId/references');
|
|
||||||
final list = response.data as List<dynamic>;
|
|
||||||
return list
|
|
||||||
.map((json) => Reference.fromJson(json as Map<String, dynamic>))
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'file_references.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
// ignore_for_file: type=lint, type=warning
|
|
||||||
|
|
||||||
@ProviderFor(fileReferences)
|
|
||||||
final fileReferencesProvider = FileReferencesFamily._();
|
|
||||||
|
|
||||||
final class FileReferencesProvider
|
|
||||||
extends
|
|
||||||
$FunctionalProvider<
|
|
||||||
AsyncValue<List<Reference>>,
|
|
||||||
List<Reference>,
|
|
||||||
FutureOr<List<Reference>>
|
|
||||||
>
|
|
||||||
with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
|
|
||||||
FileReferencesProvider._({
|
|
||||||
required FileReferencesFamily super.from,
|
|
||||||
required String super.argument,
|
|
||||||
}) : super(
|
|
||||||
retry: null,
|
|
||||||
name: r'fileReferencesProvider',
|
|
||||||
isAutoDispose: true,
|
|
||||||
dependencies: null,
|
|
||||||
$allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String debugGetCreateSourceHash() => _$fileReferencesHash();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return r'fileReferencesProvider'
|
|
||||||
''
|
|
||||||
'($argument)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@$internal
|
|
||||||
@override
|
|
||||||
$FutureProviderElement<List<Reference>> $createElement(
|
|
||||||
$ProviderPointer pointer,
|
|
||||||
) => $FutureProviderElement(pointer);
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<List<Reference>> create(Ref ref) {
|
|
||||||
final argument = this.argument as String;
|
|
||||||
return fileReferences(ref, argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is FileReferencesProvider && other.argument == argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return argument.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
|
||||||
|
|
||||||
final class FileReferencesFamily extends $Family
|
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
|
|
||||||
FileReferencesFamily._()
|
|
||||||
: super(
|
|
||||||
retry: null,
|
|
||||||
name: r'fileReferencesProvider',
|
|
||||||
dependencies: null,
|
|
||||||
$allTransitiveDependencies: null,
|
|
||||||
isAutoDispose: true,
|
|
||||||
);
|
|
||||||
|
|
||||||
FileReferencesProvider call(String fileId) =>
|
|
||||||
FileReferencesProvider._(argument: fileId, from: this);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => r'fileReferencesProvider';
|
|
||||||
}
|
|
||||||
@@ -29,30 +29,59 @@ class UploadTasksNotifier extends Notifier<List<DriveTask>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _handleWebSocketPacket(dynamic packet) {
|
void _handleWebSocketPacket(dynamic packet) {
|
||||||
if (packet.type.startsWith('task.')) {
|
if (packet.type.startsWith('task.') || packet.type == 'upload.completed') {
|
||||||
final data = packet.data;
|
final data = packet.data;
|
||||||
if (data == null) return;
|
if (data == null && packet.type != 'upload.completed') return;
|
||||||
|
|
||||||
// Debug logging
|
// Debug logging
|
||||||
talker.info(
|
talker.info(
|
||||||
'[UploadTasks] Received WebSocket packet: ${packet.type}, data: $data',
|
'[UploadTasks] Received WebSocket packet: ${packet.type}, data: $data',
|
||||||
);
|
);
|
||||||
|
|
||||||
final taskId = data['task_id'] as String?;
|
final taskId = data != null ? (data['task_id'] as String?) : null;
|
||||||
if (taskId == null) return;
|
if (taskId == null && packet.type != 'upload.completed') return;
|
||||||
|
|
||||||
switch (packet.type) {
|
switch (packet.type) {
|
||||||
case 'task.created':
|
case 'task.created':
|
||||||
_handleTaskCreated(taskId, data);
|
_handleTaskCreated(taskId!, data);
|
||||||
break;
|
break;
|
||||||
case 'task.progress':
|
case 'task.progress':
|
||||||
_handleProgressUpdate(taskId, data);
|
_handleProgressUpdate(taskId!, data);
|
||||||
break;
|
break;
|
||||||
case 'task.completed':
|
case 'task.completed':
|
||||||
_handleUploadCompleted(taskId, data);
|
_handleUploadCompleted(taskId!, data);
|
||||||
|
break;
|
||||||
|
case 'upload.completed':
|
||||||
|
// For upload.completed, we need to find the taskId differently
|
||||||
|
// Since data is null, we can't get task_id from data
|
||||||
|
// We'll need to mark all in-progress uploads as completed
|
||||||
|
// For now, assume we need to handle it per task, but since no task_id,
|
||||||
|
// perhaps it's a broadcast or we need to modify the logic
|
||||||
|
// Actually, looking at the logs, upload.completed has data: null, but maybe in real scenario it has task_id?
|
||||||
|
// For now, let's assume it needs task_id, and modify accordingly
|
||||||
|
// But since the original code expects data, perhaps the server sends data with task_id
|
||||||
|
// Wait, in the logs: "upload.completed null" - the null is data, but perhaps in code it's null
|
||||||
|
// To be safe, let's modify to handle upload.completed even with null data, but we need task_id
|
||||||
|
// Perhaps search for in-progress tasks and complete them
|
||||||
|
// But that's risky. Let's see the log again: the previous task.progress had task_id: YvvfVbaWSxj5vUnFnzJDu
|
||||||
|
// So probably upload.completed should have the same task_id
|
||||||
|
// Perhaps the server sends it with data containing task_id
|
||||||
|
// The log says "upload.completed null" meaning data is null
|
||||||
|
// But maybe it's a logging issue. To fix, let's assume data has task_id for upload.completed
|
||||||
|
// If not, we can modify _handleUploadCompleted to accept null data and find the task
|
||||||
|
if (data != null && data['task_id'] != null) {
|
||||||
|
_handleUploadCompleted(data['task_id'], data);
|
||||||
|
} else {
|
||||||
|
// If no data, perhaps complete the most recent in-progress task
|
||||||
|
final inProgressTasks = state.where((task) => task.status == DriveTaskStatus.inProgress).toList();
|
||||||
|
if (inProgressTasks.isNotEmpty) {
|
||||||
|
final task = inProgressTasks.last; // Assume the last one
|
||||||
|
_handleUploadCompleted(task.taskId, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'task.failed':
|
case 'task.failed':
|
||||||
_handleUploadFailed(taskId, data);
|
_handleUploadFailed(taskId!, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,6 +285,21 @@ class UploadTasksNotifier extends Notifier<List<DriveTask>> {
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateUploadProgress(String taskId, int uploadedBytes, int uploadedChunks) {
|
||||||
|
state =
|
||||||
|
state.map((task) {
|
||||||
|
if (task.taskId == taskId) {
|
||||||
|
return task.copyWith(
|
||||||
|
uploadedBytes: uploadedBytes,
|
||||||
|
uploadedChunks: uploadedChunks,
|
||||||
|
status: DriveTaskStatus.inProgress,
|
||||||
|
updatedAt: DateTime.now(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return task;
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
void updateDownloadProgress(
|
void updateDownloadProgress(
|
||||||
String taskId,
|
String taskId,
|
||||||
int downloadedBytes,
|
int downloadedBytes,
|
||||||
@@ -470,6 +514,7 @@ class EnhancedFileUploader extends FileUploader {
|
|||||||
|
|
||||||
// Step 2: Upload chunks
|
// Step 2: Upload chunks
|
||||||
int bytesUploaded = 0;
|
int bytesUploaded = 0;
|
||||||
|
int chunksUploaded = 0;
|
||||||
if (fileData is XFile) {
|
if (fileData is XFile) {
|
||||||
// Use stream for XFile
|
// Use stream for XFile
|
||||||
final subscription = fileData.openRead().listen(null);
|
final subscription = fileData.openRead().listen(null);
|
||||||
@@ -494,6 +539,11 @@ class EnhancedFileUploader extends FileUploader {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
bytesUploaded += chunkData.length;
|
bytesUploaded += chunkData.length;
|
||||||
|
chunksUploaded += 1;
|
||||||
|
// Update upload progress in UI
|
||||||
|
ref
|
||||||
|
.read(uploadTasksProvider.notifier)
|
||||||
|
.updateUploadProgress(taskId, bytesUploaded, chunksUploaded);
|
||||||
}
|
}
|
||||||
subscription.cancel();
|
subscription.cancel();
|
||||||
} else if (fileData is Uint8List) {
|
} else if (fileData is Uint8List) {
|
||||||
@@ -521,6 +571,11 @@ class EnhancedFileUploader extends FileUploader {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
bytesUploaded += chunks[i].length;
|
bytesUploaded += chunks[i].length;
|
||||||
|
chunksUploaded += 1;
|
||||||
|
// Update upload progress in UI
|
||||||
|
ref
|
||||||
|
.read(uploadTasksProvider.notifier)
|
||||||
|
.updateUploadProgress(taskId, bytesUploaded, chunksUploaded);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw ArgumentError('Invalid fileData type');
|
throw ArgumentError('Invalid fileData type');
|
||||||
|
|||||||
99
lib/pods/notification.dart
Normal file
99
lib/pods/notification.dart
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:island/models/account.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
|
part 'notification.g.dart';
|
||||||
|
|
||||||
|
const kNotificationBaseDuration = Duration(seconds: 5);
|
||||||
|
const kNotificationStackedDuration = Duration(seconds: 1);
|
||||||
|
|
||||||
|
class NotificationItem {
|
||||||
|
final String id;
|
||||||
|
final SnNotification notification;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final int index;
|
||||||
|
final Duration duration;
|
||||||
|
final bool dismissed;
|
||||||
|
|
||||||
|
NotificationItem({
|
||||||
|
String? id,
|
||||||
|
required this.notification,
|
||||||
|
DateTime? createdAt,
|
||||||
|
required this.index,
|
||||||
|
Duration? duration,
|
||||||
|
this.dismissed = false,
|
||||||
|
}) : id = id ?? const Uuid().v4(),
|
||||||
|
createdAt = createdAt ?? DateTime.now(),
|
||||||
|
duration =
|
||||||
|
duration ?? kNotificationBaseDuration + Duration(seconds: index);
|
||||||
|
|
||||||
|
NotificationItem copyWith({
|
||||||
|
String? id,
|
||||||
|
SnNotification? notification,
|
||||||
|
DateTime? createdAt,
|
||||||
|
int? index,
|
||||||
|
Duration? duration,
|
||||||
|
bool? dismissed,
|
||||||
|
}) {
|
||||||
|
return NotificationItem(
|
||||||
|
id: id ?? this.id,
|
||||||
|
notification: notification ?? this.notification,
|
||||||
|
createdAt: createdAt ?? this.createdAt,
|
||||||
|
index: index ?? this.index,
|
||||||
|
duration: duration ?? this.duration,
|
||||||
|
dismissed: dismissed ?? this.dismissed,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other is NotificationItem && other.id == id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => id.hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class NotificationState extends _$NotificationState {
|
||||||
|
final Map<String, Timer> _timers = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<NotificationItem> build() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(SnNotification notification, {Duration? duration}) {
|
||||||
|
final newItem = NotificationItem(
|
||||||
|
notification: notification,
|
||||||
|
index: state.length,
|
||||||
|
duration: duration,
|
||||||
|
);
|
||||||
|
state = [...state, newItem];
|
||||||
|
_timers[newItem.id] = Timer(newItem.duration, () => dismiss(newItem.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
void dismiss(String id) {
|
||||||
|
_timers[id]?.cancel();
|
||||||
|
_timers.remove(id);
|
||||||
|
final index = state.indexWhere((item) => item.id == id);
|
||||||
|
if (index != -1) {
|
||||||
|
state = List.from(state)..[index] = state[index].copyWith(dismissed: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove(String id) {
|
||||||
|
state = state.where((item) => item.id != id).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
for (final timer in _timers.values) {
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
_timers.clear();
|
||||||
|
state = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
63
lib/pods/notification.g.dart
Normal file
63
lib/pods/notification.g.dart
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'notification.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(NotificationState)
|
||||||
|
final notificationStateProvider = NotificationStateProvider._();
|
||||||
|
|
||||||
|
final class NotificationStateProvider
|
||||||
|
extends $NotifierProvider<NotificationState, List<NotificationItem>> {
|
||||||
|
NotificationStateProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'notificationStateProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$notificationStateHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
NotificationState create() => NotificationState();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(List<NotificationItem> value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<List<NotificationItem>>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$notificationStateHash() => r'4597cfc7c75dd0fd05dab65f78265a3ae10d23e7';
|
||||||
|
|
||||||
|
abstract class _$NotificationState extends $Notifier<List<NotificationItem>> {
|
||||||
|
List<NotificationItem> build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final ref =
|
||||||
|
this.ref as $Ref<List<NotificationItem>, List<NotificationItem>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<List<NotificationItem>, List<NotificationItem>>,
|
||||||
|
List<NotificationItem>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleCreate(ref, build);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,11 +58,18 @@ class ActivityListNotifier
|
|||||||
// Find the latest createdAt timestamp from all items for cursor-based pagination
|
// Find the latest createdAt timestamp from all items for cursor-based pagination
|
||||||
// This ensures we get items created before this timestamp, regardless of sort order
|
// This ensures we get items created before this timestamp, regardless of sort order
|
||||||
if (items.isNotEmpty) {
|
if (items.isNotEmpty) {
|
||||||
final latestCreatedAt = items
|
final newestCreatedAt = items
|
||||||
.where((e) => e.type.startsWith('posts.'))
|
.where((e) => e.type.startsWith('posts.'))
|
||||||
.map((e) => e.createdAt)
|
.map((e) => e.createdAt)
|
||||||
.reduce((a, b) => a.isBefore(b) ? a : b);
|
.reduce((a, b) => a.isBefore(b) ? a : b);
|
||||||
cursor = latestCreatedAt.toUtc().toIso8601String();
|
if (cursor != null) {
|
||||||
|
final prevCursor = DateTime.tryParse(cursor!);
|
||||||
|
if (prevCursor != null && prevCursor.isAfter(newestCreatedAt)) {
|
||||||
|
cursor = newestCreatedAt.toUtc().toIso8601String();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cursor = newestCreatedAt.toUtc().toIso8601String();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io' show Platform;
|
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
@@ -13,6 +9,7 @@ import 'package:island/models/account.dart';
|
|||||||
import 'package:island/pods/config.dart';
|
import 'package:island/pods/config.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
|
import 'package:island/services/analytics_service.dart';
|
||||||
|
|
||||||
class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
||||||
@override
|
@override
|
||||||
@@ -31,9 +28,7 @@ class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
|||||||
final response = await client.get('/pass/accounts/me');
|
final response = await client.get('/pass/accounts/me');
|
||||||
final user = SnAccount.fromJson(response.data);
|
final user = SnAccount.fromJson(response.data);
|
||||||
|
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
AnalyticsService().setUserId(user.id);
|
||||||
FirebaseAnalytics.instance.setUserId(id: user.id);
|
|
||||||
}
|
|
||||||
return user;
|
return user;
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
if (error is DioException) {
|
if (error is DioException) {
|
||||||
@@ -91,9 +86,8 @@ class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
|||||||
final prefs = ref.read(sharedPreferencesProvider);
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
await prefs.remove(kTokenPairStoreKey);
|
await prefs.remove(kTokenPairStoreKey);
|
||||||
ref.invalidate(tokenProvider);
|
ref.invalidate(tokenProvider);
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
AnalyticsService().setUserId(null);
|
||||||
FirebaseAnalytics.instance.setUserId(id: null);
|
AnalyticsService().logLogout();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
|||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/publishers/${arg.pubName}/feeds/${arg.feedId}',
|
'/insight/publishers/${arg.pubName}/feeds/${arg.feedId}',
|
||||||
);
|
);
|
||||||
return SnWebFeed.fromJson(response.data);
|
return SnWebFeed.fromJson(response.data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -47,7 +47,7 @@ class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
|||||||
state = const AsyncValue.loading();
|
state = const AsyncValue.loading();
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final url = '/sphere/publishers/${feed.publisherId}/feeds';
|
final url = '/insight/publishers/${feed.publisherId}/feeds';
|
||||||
|
|
||||||
final response = feed.id.isEmpty
|
final response = feed.id.isEmpty
|
||||||
? await client.post(url, data: feed.toJson())
|
? await client.post(url, data: feed.toJson())
|
||||||
@@ -67,7 +67,7 @@ class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
|||||||
state = const AsyncValue.loading();
|
state = const AsyncValue.loading();
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.delete('/sphere/publishers/${arg.pubName}/feeds/$feedId');
|
await client.delete('/insight/publishers/${arg.pubName}/feeds/$feedId');
|
||||||
state = AsyncValue.data(
|
state = AsyncValue.data(
|
||||||
SnWebFeed(
|
SnWebFeed(
|
||||||
id: '',
|
id: '',
|
||||||
@@ -93,7 +93,7 @@ class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
|||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post(
|
await client.post(
|
||||||
'/sphere/publishers/${arg.pubName}/feeds/$feedId/scrap',
|
'/insight/publishers/${arg.pubName}/feeds/$feedId/scrap',
|
||||||
options: Options(
|
options: Options(
|
||||||
sendTimeout: const Duration(seconds: 60),
|
sendTimeout: const Duration(seconds: 60),
|
||||||
receiveTimeout: const Duration(seconds: 180),
|
receiveTimeout: const Duration(seconds: 180),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/pods/paging.dart';
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
@@ -22,7 +23,7 @@ import 'package:island/pods/network.dart';
|
|||||||
part 'relationship.g.dart';
|
part 'relationship.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
Future<List<SnRelationship>> friendRequest(Ref ref) async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final resp = await client.get('/pass/relationships/requests');
|
final resp = await client.get('/pass/relationships/requests');
|
||||||
return resp.data
|
return resp.data
|
||||||
@@ -31,11 +32,9 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final relationshipListNotifierProvider =
|
final relationshipListNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
AsyncNotifierProvider.autoDispose<
|
RelationshipListNotifier.new,
|
||||||
RelationshipListNotifier,
|
);
|
||||||
PaginationState<SnRelationship>
|
|
||||||
>(RelationshipListNotifier.new);
|
|
||||||
|
|
||||||
class RelationshipListNotifier
|
class RelationshipListNotifier
|
||||||
extends AsyncNotifier<PaginationState<SnRelationship>>
|
extends AsyncNotifier<PaginationState<SnRelationship>>
|
||||||
@@ -84,6 +83,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
final String? currentUserId;
|
final String? currentUserId;
|
||||||
final bool showRelatedAccount;
|
final bool showRelatedAccount;
|
||||||
final Function(SnRelationship, int)? onUpdateStatus;
|
final Function(SnRelationship, int)? onUpdateStatus;
|
||||||
|
final Function(SnRelationship)? onDelete;
|
||||||
|
|
||||||
const RelationshipListTile({
|
const RelationshipListTile({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -96,18 +96,19 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
required this.currentUserId,
|
required this.currentUserId,
|
||||||
this.showRelatedAccount = false,
|
this.showRelatedAccount = false,
|
||||||
this.onUpdateStatus,
|
this.onUpdateStatus,
|
||||||
|
this.onDelete,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final account = showRelatedAccount
|
final account = showRelatedAccount
|
||||||
? relationship.related
|
? relationship.related!
|
||||||
: relationship.account;
|
: relationship.account!;
|
||||||
final isPending =
|
final isPending =
|
||||||
relationship.status == 0 && relationship.relatedId == currentUserId;
|
relationship.status == 0 && relationship.relatedId == currentUserId;
|
||||||
final isWaiting =
|
final isWaiting =
|
||||||
relationship.status == 0 && relationship.accountId == currentUserId;
|
relationship.status == 0 && relationship.accountId == currentUserId;
|
||||||
final isEstablished = relationship.status == 1 || relationship.status == 2;
|
final isEstablished = relationship.status != 0;
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: const EdgeInsets.only(left: 16, right: 12),
|
contentPadding: const EdgeInsets.only(left: 16, right: 12),
|
||||||
@@ -185,21 +186,36 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
if (relationship.status >= 100) // If friend
|
if (relationship.status >= 100) // If friend
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(Symbols.block),
|
|
||||||
title: Text('blockUser').tr(),
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
),
|
|
||||||
onTap: () => onUpdateStatus?.call(relationship, -100),
|
onTap: () => onUpdateStatus?.call(relationship, -100),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.block),
|
||||||
|
const Gap(12),
|
||||||
|
Text('blockUser').tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else if (relationship.status <= -100) // If blocked
|
else if (relationship.status <= -100) // If blocked
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(Symbols.person_add),
|
|
||||||
title: Text('unblockUser').tr(),
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
),
|
|
||||||
onTap: () => onUpdateStatus?.call(relationship, 100),
|
onTap: () => onUpdateStatus?.call(relationship, 100),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.person_add),
|
||||||
|
const Gap(12),
|
||||||
|
Text('unblockUser').tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (onDelete != null)
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () => onDelete?.call(relationship),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.delete),
|
||||||
|
const Gap(12),
|
||||||
|
Text('forgotRelationship').tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -230,40 +246,11 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post('/pass/relationships/${result.id}/friends');
|
await client.post('/pass/relationships/${result.id}/friends');
|
||||||
ref.invalidate(sentFriendRequestProvider);
|
ref.invalidate(friendRequestProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
final submitting = useState(false);
|
final submitting = useState(false);
|
||||||
|
|
||||||
Future<void> handleFriendRequest(
|
|
||||||
SnRelationship relationship,
|
|
||||||
bool isAccept,
|
|
||||||
) async {
|
|
||||||
try {
|
|
||||||
submitting.value = true;
|
|
||||||
final client = ref.read(apiClientProvider);
|
|
||||||
await client.post(
|
|
||||||
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
|
||||||
);
|
|
||||||
relationshipNotifier.refresh();
|
|
||||||
if (!context.mounted) return;
|
|
||||||
if (isAccept) {
|
|
||||||
showSnackBar(
|
|
||||||
'friendRequestAccepted'.tr(args: ['@${relationship.account.name}']),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
showSnackBar(
|
|
||||||
'friendRequestDeclined'.tr(args: ['@${relationship.account.name}']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
HapticFeedback.lightImpact();
|
|
||||||
} catch (err) {
|
|
||||||
showErrorAlert(err);
|
|
||||||
} finally {
|
|
||||||
submitting.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updateRelationship(
|
Future<void> updateRelationship(
|
||||||
SnRelationship relationship,
|
SnRelationship relationship,
|
||||||
int newStatus,
|
int newStatus,
|
||||||
@@ -276,8 +263,32 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
relationshipNotifier.refresh();
|
relationshipNotifier.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteRelationship(SnRelationship relationship) async {
|
||||||
|
final confirmed = await showConfirmAlert(
|
||||||
|
'forgotRelationshipConfirm'.tr(
|
||||||
|
args: ['@${relationship.related!.name}'],
|
||||||
|
),
|
||||||
|
'forgotRelationship'.tr(),
|
||||||
|
isDanger: true,
|
||||||
|
);
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showLoadingModal(context);
|
||||||
|
try {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
await client.delete('/pass/relationships/${relationship.relatedId}');
|
||||||
|
relationshipNotifier.refresh();
|
||||||
|
showSnackBar('relationshipDeleted'.tr());
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
} finally {
|
||||||
|
if (context.mounted) hideLoadingModal(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
final requests = ref.watch(sentFriendRequestProvider);
|
final requests = ref.watch(friendRequestProvider);
|
||||||
|
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBar: AppBar(title: Text('relationships').tr()),
|
appBar: AppBar(title: Text('relationships').tr()),
|
||||||
@@ -293,9 +304,9 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
if (requests.hasValue && requests.value!.isNotEmpty)
|
if (requests.hasValue && requests.value!.isNotEmpty)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Symbols.send),
|
leading: const Icon(Symbols.send),
|
||||||
title: Text('friendSentRequest').tr(),
|
title: Text('friendRequests').tr(),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'friendSentRequestHint'.plural(requests.value!.length),
|
'friendRequestsHint'.plural(requests.value!.length),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -316,11 +327,10 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
return RelationshipListTile(
|
return RelationshipListTile(
|
||||||
relationship: relationship,
|
relationship: relationship,
|
||||||
submitting: submitting.value,
|
submitting: submitting.value,
|
||||||
onAccept: () => handleFriendRequest(relationship, true),
|
|
||||||
onDecline: () => handleFriendRequest(relationship, false),
|
|
||||||
currentUserId: user.value?.id,
|
currentUserId: user.value?.id,
|
||||||
showRelatedAccount: false,
|
showRelatedAccount: true,
|
||||||
onUpdateStatus: updateRelationship,
|
onUpdateStatus: updateRelationship,
|
||||||
|
onDelete: deleteRelationship,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -336,19 +346,54 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final requests = ref.watch(sentFriendRequestProvider);
|
final requests = ref.watch(friendRequestProvider);
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
|
|
||||||
Future<void> cancelRequest(SnRelationship request) async {
|
Future<void> cancelRequest(SnRelationship request) async {
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.delete('/pass/relationships/${request.relatedId}/friends');
|
await client.delete('/pass/relationships/${request.relatedId}/friends');
|
||||||
ref.invalidate(sentFriendRequestProvider);
|
ref.invalidate(friendRequestProvider);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final submitting = useState(false);
|
||||||
|
|
||||||
|
Future<void> handleFriendRequest(
|
||||||
|
SnRelationship relationship,
|
||||||
|
bool isAccept,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
submitting.value = true;
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
await client.post(
|
||||||
|
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
||||||
|
);
|
||||||
|
ref.invalidate(friendRequestProvider);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
if (isAccept) {
|
||||||
|
showSnackBar(
|
||||||
|
'friendRequestAccepted'.tr(
|
||||||
|
args: ['@${relationship.account!.name}'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
showSnackBar(
|
||||||
|
'friendRequestDeclined'.tr(
|
||||||
|
args: ['@${relationship.account!.name}'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
HapticFeedback.lightImpact();
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
} finally {
|
||||||
|
submitting.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: MediaQuery.of(context).size.height * 0.8,
|
maxHeight: MediaQuery.of(context).size.height * 0.8,
|
||||||
@@ -366,7 +411,7 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'friendSentRequest'.tr(),
|
'friendRequests'.tr(),
|
||||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
letterSpacing: -0.5,
|
letterSpacing: -0.5,
|
||||||
@@ -377,7 +422,7 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
icon: const Icon(Symbols.refresh),
|
icon: const Icon(Symbols.refresh),
|
||||||
style: IconButton.styleFrom(minimumSize: const Size(36, 36)),
|
style: IconButton.styleFrom(minimumSize: const Size(36, 36)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
ref.invalidate(sentFriendRequestProvider);
|
ref.invalidate(friendRequestProvider);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -394,7 +439,7 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
data: (items) => items.isEmpty
|
data: (items) => items.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'friendSentRequestEmpty'.tr(),
|
'friendRequestsEmpty'.tr(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -406,6 +451,8 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
return RelationshipListTile(
|
return RelationshipListTile(
|
||||||
relationship: request,
|
relationship: request,
|
||||||
onCancel: () => cancelRequest(request),
|
onCancel: () => cancelRequest(request),
|
||||||
|
onAccept: () => handleFriendRequest(request, true),
|
||||||
|
onDecline: () => handleFriendRequest(request, false),
|
||||||
currentUserId: user.value?.id,
|
currentUserId: user.value?.id,
|
||||||
showRelatedAccount: true,
|
showRelatedAccount: true,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ part of 'relationship.dart';
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(sentFriendRequest)
|
@ProviderFor(friendRequest)
|
||||||
final sentFriendRequestProvider = SentFriendRequestProvider._();
|
final friendRequestProvider = FriendRequestProvider._();
|
||||||
|
|
||||||
final class SentFriendRequestProvider
|
final class FriendRequestProvider
|
||||||
extends
|
extends
|
||||||
$FunctionalProvider<
|
$FunctionalProvider<
|
||||||
AsyncValue<List<SnRelationship>>,
|
AsyncValue<List<SnRelationship>>,
|
||||||
@@ -22,19 +22,19 @@ final class SentFriendRequestProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnRelationship>>,
|
$FutureModifier<List<SnRelationship>>,
|
||||||
$FutureProvider<List<SnRelationship>> {
|
$FutureProvider<List<SnRelationship>> {
|
||||||
SentFriendRequestProvider._()
|
FriendRequestProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'sentFriendRequestProvider',
|
name: r'friendRequestProvider',
|
||||||
isAutoDispose: true,
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
$allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String debugGetCreateSourceHash() => _$sentFriendRequestHash();
|
String debugGetCreateSourceHash() => _$friendRequestHash();
|
||||||
|
|
||||||
@$internal
|
@$internal
|
||||||
@override
|
@override
|
||||||
@@ -44,8 +44,8 @@ final class SentFriendRequestProvider
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<SnRelationship>> create(Ref ref) {
|
FutureOr<List<SnRelationship>> create(Ref ref) {
|
||||||
return sentFriendRequest(ref);
|
return friendRequest(ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';
|
String _$friendRequestHash() => r'b066553f9bd0505a7a272cf10cb3ca312152acd6';
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
import 'package:island/database/message.dart';
|
import 'package:island/database/message.dart';
|
||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/widgets/chat/message_item.dart';
|
import 'package:island/widgets/chat/message_item.dart';
|
||||||
|
|
||||||
// Provider to track animated messages to prevent replay
|
// Provider to track animated messages to prevent replay
|
||||||
final animatedMessagesProvider =
|
final animatedMessagesProvider = NotifierProvider.autoDispose(
|
||||||
NotifierProvider<AnimatedMessagesNotifier, Set<String>>(
|
|
||||||
AnimatedMessagesNotifier.new,
|
AnimatedMessagesNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ class AnimatedMessagesNotifier extends Notifier<Set<String>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MessageItemWrapper extends ConsumerWidget {
|
class MessageItemWrapper extends HookConsumerWidget {
|
||||||
final LocalChatMessage message;
|
final LocalChatMessage message;
|
||||||
final int index;
|
final int index;
|
||||||
final bool isLastInGroup;
|
final bool isLastInGroup;
|
||||||
@@ -54,51 +54,6 @@ class MessageItemWrapper extends ConsumerWidget {
|
|||||||
required this.roomOpenTime,
|
required this.roomOpenTime,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
// Animation logic
|
|
||||||
final animatedMessages = ref.watch(animatedMessagesProvider);
|
|
||||||
final isNewMessage = message.createdAt.isAfter(roomOpenTime);
|
|
||||||
final hasAnimated = animatedMessages.contains(message.id);
|
|
||||||
|
|
||||||
// Only animate if:
|
|
||||||
// 1. Animation is enabled
|
|
||||||
// 2. Message is new (created after room open)
|
|
||||||
// 3. Has not animated yet
|
|
||||||
final shouldAnimate = !disableAnimation && isNewMessage && !hasAnimated;
|
|
||||||
|
|
||||||
final child = chatIdentity.when(
|
|
||||||
skipError: true,
|
|
||||||
data: (identity) => _buildContent(context, identity),
|
|
||||||
loading: () => _buildLoading(),
|
|
||||||
error: (_, _) => const SizedBox.shrink(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!shouldAnimate) {
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TweenAnimationBuilder<double>(
|
|
||||||
key: ValueKey('anim-${message.id}'), // Ensure unique key for animation
|
|
||||||
tween: Tween<double>(begin: 0.0, end: 1.0),
|
|
||||||
duration: Duration(milliseconds: 400 + (index % 5) * 50),
|
|
||||||
curve: Curves.easeOutCubic,
|
|
||||||
builder: (context, value, child) {
|
|
||||||
return Transform.translate(
|
|
||||||
offset: Offset(0, 20 * (1 - value)),
|
|
||||||
child: Opacity(opacity: value, child: child),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onEnd: () {
|
|
||||||
// Mark as animated
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
ref.read(animatedMessagesProvider.notifier).addMessage(message.id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildContent(BuildContext context, SnChatMember? identity) {
|
Widget _buildContent(BuildContext context, SnChatMember? identity) {
|
||||||
final isSelected = selectedMessages.contains(message.id);
|
final isSelected = selectedMessages.contains(message.id);
|
||||||
final isCurrentUser = identity?.id == message.senderId;
|
final isCurrentUser = identity?.id == message.senderId;
|
||||||
@@ -116,11 +71,8 @@ class MessageItemWrapper extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color:
|
color: isSelected
|
||||||
isSelected
|
? Theme.of(context).colorScheme.primaryContainer.withOpacity(0.3)
|
||||||
? Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.primaryContainer.withOpacity(0.3)
|
|
||||||
: null,
|
: null,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -130,8 +82,7 @@ class MessageItemWrapper extends ConsumerWidget {
|
|||||||
key: ValueKey('item-${message.id}'),
|
key: ValueKey('item-${message.id}'),
|
||||||
message: message,
|
message: message,
|
||||||
isCurrentUser: isCurrentUser,
|
isCurrentUser: isCurrentUser,
|
||||||
onAction:
|
onAction: isSelectionMode
|
||||||
isSelectionMode
|
|
||||||
? null
|
? null
|
||||||
: (action) => onMessageAction(action, message),
|
: (action) => onMessageAction(action, message),
|
||||||
onJump: onJump,
|
onJump: onJump,
|
||||||
@@ -178,4 +129,88 @@ class MessageItemWrapper extends ConsumerWidget {
|
|||||||
onJump: (_) {},
|
onJump: (_) {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
// Animation logic
|
||||||
|
final animatedMessages = ref.watch(animatedMessagesProvider);
|
||||||
|
final isNewMessage = message.createdAt.isAfter(roomOpenTime);
|
||||||
|
final hasAnimated = animatedMessages.contains(message.id);
|
||||||
|
|
||||||
|
// Only animate if:
|
||||||
|
// 1. Animation is enabled
|
||||||
|
// 2. Message is new (created after room open)
|
||||||
|
// 3. Has not animated yet
|
||||||
|
final shouldAnimate = !disableAnimation && isNewMessage && !hasAnimated;
|
||||||
|
|
||||||
|
final child = chatIdentity.when(
|
||||||
|
skipError: true,
|
||||||
|
data: (identity) => _buildContent(context, identity),
|
||||||
|
loading: () => _buildLoading(),
|
||||||
|
error: (_, _) => const SizedBox.shrink(),
|
||||||
|
);
|
||||||
|
|
||||||
|
final controller = useAnimationController(
|
||||||
|
duration: Duration(milliseconds: 400 + (index % 5) * 50),
|
||||||
|
);
|
||||||
|
|
||||||
|
final hasStarted = useState(false);
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
if (shouldAnimate && !hasStarted.value) {
|
||||||
|
hasStarted.value = true;
|
||||||
|
controller.forward().then((_) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
ref.read(animatedMessagesProvider.notifier).addMessage(message.id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, [shouldAnimate]);
|
||||||
|
|
||||||
|
if (!shouldAnimate) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
final curvedAnimation = useMemoized(
|
||||||
|
() => CurvedAnimation(parent: controller, curve: Curves.easeOutQuart),
|
||||||
|
[controller],
|
||||||
|
);
|
||||||
|
|
||||||
|
final sizeAnimation = useMemoized(
|
||||||
|
() => Tween<double>(begin: 0.0, end: 1.0).animate(curvedAnimation),
|
||||||
|
[curvedAnimation],
|
||||||
|
);
|
||||||
|
|
||||||
|
final slideAnimation = useMemoized(
|
||||||
|
() => Tween<Offset>(
|
||||||
|
begin: const Offset(0, 0.12),
|
||||||
|
end: Offset.zero,
|
||||||
|
).animate(curvedAnimation),
|
||||||
|
[curvedAnimation],
|
||||||
|
);
|
||||||
|
|
||||||
|
final fadeAnimation = useMemoized(
|
||||||
|
() => Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||||
|
CurvedAnimation(
|
||||||
|
parent: controller,
|
||||||
|
curve: const Interval(0.1, 1.0, curve: Curves.easeOut),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[controller],
|
||||||
|
);
|
||||||
|
|
||||||
|
return AnimatedBuilder(
|
||||||
|
animation: controller,
|
||||||
|
builder: (context, child) => FadeTransition(
|
||||||
|
opacity: fadeAnimation,
|
||||||
|
child: SizeTransition(
|
||||||
|
axis: Axis.vertical,
|
||||||
|
sizeFactor: sizeAnimation,
|
||||||
|
child: SlideTransition(position: slideAnimation, child: child),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,11 +105,9 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
|
|
||||||
return feedAsync.when(
|
return feedAsync.when(
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error:
|
error: (error, _) => ResponseErrorWidget(
|
||||||
(error, _) => ResponseErrorWidget(
|
|
||||||
error: error,
|
error: error,
|
||||||
onRetry:
|
onRetry: () => ref.invalidate(
|
||||||
() => ref.invalidate(
|
|
||||||
webFeedNotifierProvider((pubName: pubName, feedId: feedId)),
|
webFeedNotifierProvider((pubName: pubName, feedId: feedId)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -140,7 +138,7 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
showErrorAlert(e);
|
showErrorAlert(e);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
if (context.mounted) isLoading.value = false;
|
||||||
}
|
}
|
||||||
}, [pubName, feedId, ref, context, isLoading]);
|
}, [pubName, feedId, ref, context, isLoading]);
|
||||||
|
|
||||||
@@ -160,8 +158,8 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
@@ -184,8 +182,8 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
@@ -197,8 +195,8 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
@@ -256,7 +254,12 @@ class WebfeedForm extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
).padding(horizontal: 20, vertical: 12);
|
).padding(horizontal: 20, vertical: 12);
|
||||||
|
|
||||||
return Column(children: [Expanded(child: formWidget), buttonsRow]);
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(child: formWidget),
|
||||||
|
buttonsRow,
|
||||||
|
],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
|
import 'package:desktop_drop/desktop_drop.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
@@ -26,9 +27,13 @@ import 'package:island/models/activity.dart';
|
|||||||
import 'package:island/screens/notification.dart';
|
import 'package:island/screens/notification.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
import 'package:slide_countdown/slide_countdown.dart';
|
import 'package:slide_countdown/slide_countdown.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:island/widgets/share/share_sheet.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
import 'package:island/screens/dashboard/dash_customize.dart';
|
||||||
|
import 'package:island/pods/config.dart';
|
||||||
|
|
||||||
class DashboardScreen extends HookConsumerWidget {
|
class DashboardScreen extends HookConsumerWidget {
|
||||||
const DashboardScreen({super.key});
|
const DashboardScreen({super.key});
|
||||||
|
|
||||||
@@ -41,6 +46,111 @@ class DashboardScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper functions for dynamic dashboard rendering
|
||||||
|
class DashboardRenderer {
|
||||||
|
// Map individual card IDs to widgets
|
||||||
|
static Widget buildCard(String cardId, WidgetRef ref) {
|
||||||
|
switch (cardId) {
|
||||||
|
case 'checkIn':
|
||||||
|
return CheckInWidget(margin: EdgeInsets.zero);
|
||||||
|
case 'fortuneGraph':
|
||||||
|
return Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: FortuneGraphWidget(
|
||||||
|
events: ref.watch(
|
||||||
|
eventCalendarProvider(
|
||||||
|
EventCalendarQuery(
|
||||||
|
uname: 'me',
|
||||||
|
year: DateTime.now().year,
|
||||||
|
month: DateTime.now().month,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 'fortuneCard':
|
||||||
|
return FortuneCard(unlimited: true);
|
||||||
|
case 'postFeatured':
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 400),
|
||||||
|
child: PostFeaturedList(),
|
||||||
|
);
|
||||||
|
case 'friendsOverview':
|
||||||
|
return FriendsOverviewWidget();
|
||||||
|
case 'notifications':
|
||||||
|
return NotificationsCard();
|
||||||
|
case 'chatList':
|
||||||
|
return ChatListCard();
|
||||||
|
default:
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map column group IDs to column widgets
|
||||||
|
static Widget buildColumn(String columnId, WidgetRef ref) {
|
||||||
|
switch (columnId) {
|
||||||
|
case 'activityColumn':
|
||||||
|
return SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: Column(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
CheckInWidget(margin: EdgeInsets.zero),
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: FortuneGraphWidget(
|
||||||
|
events: ref.watch(
|
||||||
|
eventCalendarProvider(
|
||||||
|
EventCalendarQuery(
|
||||||
|
uname: 'me',
|
||||||
|
year: DateTime.now().year,
|
||||||
|
month: DateTime.now().month,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(child: FortuneCard()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 'postsColumn':
|
||||||
|
return SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return PostFeaturedList(
|
||||||
|
collapsable: false,
|
||||||
|
maxHeight: constraints.maxHeight,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 'socialColumn':
|
||||||
|
return SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: Column(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
FriendsOverviewWidget(),
|
||||||
|
Expanded(child: NotificationsCard()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 'chatsColumn':
|
||||||
|
return SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: Column(
|
||||||
|
spacing: 16,
|
||||||
|
children: [Expanded(child: ChatListCard())],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DashboardGrid extends HookConsumerWidget {
|
class DashboardGrid extends HookConsumerWidget {
|
||||||
const DashboardGrid({super.key});
|
const DashboardGrid({super.key});
|
||||||
|
|
||||||
@@ -50,8 +160,27 @@ class DashboardGrid extends HookConsumerWidget {
|
|||||||
final devicePadding = MediaQuery.paddingOf(context);
|
final devicePadding = MediaQuery.paddingOf(context);
|
||||||
|
|
||||||
final userInfo = ref.watch(userInfoProvider);
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
final appSettings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
return Container(
|
final dragging = useState(false);
|
||||||
|
|
||||||
|
return DropTarget(
|
||||||
|
onDragDone: (detail) {
|
||||||
|
dragging.value = false;
|
||||||
|
if (detail.files.isNotEmpty) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
useRootNavigator: true,
|
||||||
|
builder: (context) => ShareSheet.files(files: detail.files),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDragEntered: (_) => dragging.value = true,
|
||||||
|
onDragExited: (_) => dragging.value = false,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: isWide
|
maxHeight: isWide
|
||||||
? math.min(640, MediaQuery.sizeOf(context).height * 0.65)
|
? math.min(640, MediaQuery.sizeOf(context).height * 0.65)
|
||||||
@@ -64,15 +193,20 @@ class DashboardGrid extends HookConsumerWidget {
|
|||||||
spacing: 16,
|
spacing: 16,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
// Clock card spans full width
|
// Clock card spans full width (only if enabled in settings)
|
||||||
if (isWide)
|
if (isWide &&
|
||||||
|
(appSettings.dashboardConfig?.showClockAndCountdown ??
|
||||||
|
true))
|
||||||
ClockCard().padding(horizontal: 24)
|
ClockCard().padding(horizontal: 24)
|
||||||
else
|
else if (!isWide)
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
|
if (appSettings.dashboardConfig?.showClockAndCountdown ??
|
||||||
|
true)
|
||||||
Expanded(child: ClockCard(compact: true)),
|
Expanded(child: ClockCard(compact: true)),
|
||||||
|
if (appSettings.dashboardConfig?.showSearchBar ?? true)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
eventBus.fire(CommandPaletteTriggerEvent());
|
eventBus.fire(CommandPaletteTriggerEvent());
|
||||||
@@ -82,14 +216,17 @@ class DashboardGrid extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
).padding(horizontal: 24),
|
).padding(horizontal: 24),
|
||||||
// Row with two cards side by side
|
// Row with two cards side by side (only if enabled in settings)
|
||||||
if (isWide)
|
if (isWide &&
|
||||||
|
(appSettings.dashboardConfig?.showSearchBar ?? true))
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: isWide ? 24 : 16),
|
padding: EdgeInsets.symmetric(horizontal: isWide ? 24 : 16),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
hintText: 'searchAnything'.tr(),
|
hintText: 'searchAnything'.tr(),
|
||||||
constraints: const BoxConstraints(minHeight: 56),
|
constraints: const BoxConstraints(minHeight: 56),
|
||||||
leading: const Icon(Symbols.search).padding(horizontal: 24),
|
leading: const Icon(
|
||||||
|
Symbols.search,
|
||||||
|
).padding(horizontal: 24),
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
eventBus.fire(CommandPaletteTriggerEvent());
|
eventBus.fire(CommandPaletteTriggerEvent());
|
||||||
@@ -124,6 +261,74 @@ class DashboardGrid extends HookConsumerWidget {
|
|||||||
).padding(horizontal: isWide ? 24 : 16),
|
).padding(horizontal: isWide ? 24 : 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
// Customize button
|
||||||
|
Positioned(
|
||||||
|
bottom: isWide ? 16 : 16 + devicePadding.bottom,
|
||||||
|
right: 16,
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
useRootNavigator: true,
|
||||||
|
builder: (context) => const DashboardCustomizationSheet(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Symbols.tune,
|
||||||
|
size: 16,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
'customize',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
).tr(),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (dragging.value)
|
||||||
|
Positioned.fill(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.primaryContainer.withOpacity(0.9),
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Symbols.upload_file,
|
||||||
|
size: 64,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
const Gap(16),
|
||||||
|
Text(
|
||||||
|
'dropToShare'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.headlineMedium
|
||||||
|
?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,56 +339,30 @@ class _DashboardGridWide extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final userInfo = ref.watch(userInfoProvider);
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
final appSettings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
return Row(
|
final List<Widget> children = [];
|
||||||
spacing: 16,
|
|
||||||
children: [
|
// Always include account unactivated card if user is not activated
|
||||||
if (userInfo.value != null && userInfo.value?.activatedAt == null)
|
if (userInfo.value != null && userInfo.value?.activatedAt == null) {
|
||||||
SizedBox(width: 400, child: AccountUnactivatedCard()),
|
children.add(SizedBox(width: 400, child: AccountUnactivatedCard()));
|
||||||
SizedBox(
|
}
|
||||||
width: 400,
|
|
||||||
child: Column(
|
// Add configured columns in the specified order
|
||||||
spacing: 16,
|
final horizontalLayouts =
|
||||||
children: [
|
appSettings.dashboardConfig?.horizontalLayouts ??
|
||||||
CheckInWidget(margin: EdgeInsets.zero),
|
['activityColumn', 'postsColumn', 'socialColumn', 'chatsColumn'];
|
||||||
Card(
|
|
||||||
margin: EdgeInsets.zero,
|
for (final columnId in horizontalLayouts) {
|
||||||
child: FortuneGraphWidget(
|
children.add(DashboardRenderer.buildColumn(columnId, ref));
|
||||||
events: ref.watch(
|
}
|
||||||
eventCalendarProvider(
|
|
||||||
EventCalendarQuery(
|
// If no children, add a SizedBox.expand to maintain width
|
||||||
uname: 'me',
|
if (children.isEmpty) {
|
||||||
year: DateTime.now().year,
|
children.add(SizedBox(width: MediaQuery.sizeOf(context).width));
|
||||||
month: DateTime.now().month,
|
}
|
||||||
),
|
|
||||||
),
|
return Row(spacing: 16, children: children);
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(child: FortuneCard()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 400, child: PostFeaturedList(collapsable: false)),
|
|
||||||
SizedBox(
|
|
||||||
width: 400,
|
|
||||||
child: Column(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
FriendsOverviewWidget(),
|
|
||||||
Expanded(child: NotificationsCard()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 400,
|
|
||||||
child: Column(
|
|
||||||
spacing: 16,
|
|
||||||
children: [Expanded(child: ChatListCard())],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,37 +372,33 @@ class _DashboardGridNarrow extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final userInfo = ref.watch(userInfoProvider);
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
|
final appSettings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
return Column(
|
final List<Widget> children = [];
|
||||||
spacing: 16,
|
|
||||||
children: [
|
// Always include account unactivated card if user is not activated
|
||||||
if (userInfo.value != null && userInfo.value?.activatedAt == null)
|
if (userInfo.value != null && userInfo.value?.activatedAt == null) {
|
||||||
AccountUnactivatedCard(),
|
children.add(AccountUnactivatedCard());
|
||||||
CheckInWidget(margin: EdgeInsets.zero),
|
}
|
||||||
FortuneCard(),
|
|
||||||
ConstrainedBox(
|
// Add configured cards in the specified order
|
||||||
constraints: const BoxConstraints(maxHeight: 400),
|
final verticalLayouts =
|
||||||
child: PostFeaturedList(),
|
appSettings.dashboardConfig?.verticalLayouts ??
|
||||||
),
|
[
|
||||||
FriendsOverviewWidget(),
|
'checkIn',
|
||||||
NotificationsCard(),
|
'fortuneCard',
|
||||||
ChatListCard(),
|
'postFeatured',
|
||||||
Card(
|
'friendsOverview',
|
||||||
margin: EdgeInsets.zero,
|
'notifications',
|
||||||
child: FortuneGraphWidget(
|
'chatList',
|
||||||
events: ref.watch(
|
'fortuneGraph',
|
||||||
eventCalendarProvider(
|
];
|
||||||
EventCalendarQuery(
|
|
||||||
uname: 'me',
|
for (final cardId in verticalLayouts) {
|
||||||
year: DateTime.now().year,
|
children.add(DashboardRenderer.buildCard(cardId, ref));
|
||||||
month: DateTime.now().month,
|
}
|
||||||
),
|
|
||||||
),
|
return Column(spacing: 16, children: children);
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +479,9 @@ class ClockCard extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Row(
|
||||||
spacing: 5,
|
spacing: 5,
|
||||||
children: [
|
children: [
|
||||||
notableDay.when(
|
notableDay.when(
|
||||||
@@ -318,6 +495,7 @@ class ClockCard extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -528,13 +706,14 @@ class ChatListCard extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FortuneCard extends HookConsumerWidget {
|
class FortuneCard extends HookConsumerWidget {
|
||||||
const FortuneCard({super.key});
|
final bool unlimited;
|
||||||
|
const FortuneCard({super.key, this.unlimited = false});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final fortuneAsync = ref.watch(randomFortuneSayingProvider);
|
final fortuneAsync = ref.watch(randomFortuneSayingProvider);
|
||||||
|
|
||||||
return Card(
|
final child = Card(
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
@@ -550,16 +729,19 @@ class FortuneCard extends HookConsumerWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
fortune.content,
|
fortune.content,
|
||||||
maxLines: 2,
|
maxLines: unlimited ? null : 2,
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text('—— ${fortune.source}').bold(),
|
Text('—— ${fortune.source}').bold(),
|
||||||
],
|
],
|
||||||
).padding(horizontal: 16);
|
).padding(horizontal: 16, vertical: unlimited ? 12 : 0);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
).height(48);
|
);
|
||||||
|
|
||||||
|
if (unlimited) return child;
|
||||||
|
return child.height(48);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,6 +764,7 @@ class _UnauthorizedCard extends HookConsumerWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
|
const SizedBox(width: double.infinity),
|
||||||
Icon(
|
Icon(
|
||||||
Symbols.dashboard_rounded,
|
Symbols.dashboard_rounded,
|
||||||
size: 64,
|
size: 64,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user