Compare commits
127 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
|
|||
|
188b6821a2
|
|||
|
0ebbe0bd5a
|
|||
|
46a826ff86
|
|||
|
1d99ac6441
|
|||
|
e2efdc4064
|
|||
|
cba1a3884b
|
|||
|
7147ce1efa
|
|||
|
78c1a284a5
|
|||
|
f1f5113b01
|
|||
|
a44552f105
|
|||
|
8c1ad94555
|
|||
|
84f5677260
|
|||
|
aa1ffdbf10
|
|||
|
c24d13461b
|
|||
|
3b60fcb87c
|
|||
|
3605b997b1
|
|||
|
800815c721
|
|||
|
3b13a63e7b
|
|||
|
81d69ce10f
|
@@ -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",
|
||||||
@@ -358,7 +361,7 @@
|
|||||||
"accountSettingsHelp": "Account Settings Help",
|
"accountSettingsHelp": "Account Settings Help",
|
||||||
"accountSettingsHelpContent": "This page allows you to manage your account security, privacy, and other settings. If you need assistance, please contact support.",
|
"accountSettingsHelpContent": "This page allows you to manage your account security, privacy, and other settings. If you need assistance, please contact support.",
|
||||||
"unauthorized": "Unauthorized",
|
"unauthorized": "Unauthorized",
|
||||||
"unauthorizedHint": "You're not signed in or session expired, please sign in again.",
|
"unauthorizedHint": "You're not signed in or session expired, please sign in and try again.",
|
||||||
"publisherBelongsTo": "Belongs to {}",
|
"publisherBelongsTo": "Belongs to {}",
|
||||||
"postContent": "Content",
|
"postContent": "Content",
|
||||||
"postSettings": "Settings",
|
"postSettings": "Settings",
|
||||||
@@ -924,6 +927,7 @@
|
|||||||
"fileHash": "File Hash",
|
"fileHash": "File Hash",
|
||||||
"exifData": "EXIF Data",
|
"exifData": "EXIF Data",
|
||||||
"postShuffle": "Shuffle Posts",
|
"postShuffle": "Shuffle Posts",
|
||||||
|
"swipeToExplore": "Swipe to explore",
|
||||||
"leveling": "Leveling",
|
"leveling": "Leveling",
|
||||||
"levelingHistory": "Leveling History",
|
"levelingHistory": "Leveling History",
|
||||||
"stellarProgram": "Stellar Program",
|
"stellarProgram": "Stellar Program",
|
||||||
@@ -1356,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?",
|
||||||
@@ -1581,5 +1611,46 @@
|
|||||||
"followingEmptyHint": "Start by searching for users or explore other instances",
|
"followingEmptyHint": "Start by searching for users or explore other instances",
|
||||||
"fediversePost": "Fediverse Post",
|
"fediversePost": "Fediverse Post",
|
||||||
"fediversePostDescribe": "Post from the Fediverse Network",
|
"fediversePostDescribe": "Post from the Fediverse Network",
|
||||||
"settingsShowFediverseContent": "Show Fediverse Content"
|
"settingsShowFediverseContent": "Show Fediverse Content",
|
||||||
|
"universalSearch": "Universal Search",
|
||||||
|
"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,287 +0,0 @@
|
|||||||
# ActivityPub Implementation for Solar Network
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
This document outlines the initial implementation of ActivityPub federation for the Solar Network (DysonNetwork), following the plan outlined in `ACTIVITYPUB_PLAN.md`.
|
|
||||||
|
|
||||||
## What Has Been Created
|
|
||||||
|
|
||||||
### 1. Database Models (DysonNetwork.Shared/Models)
|
|
||||||
|
|
||||||
All ActivityPub-related models are shared across projects and located in `DysonNetwork.Shared/Models/`:
|
|
||||||
|
|
||||||
#### FediverseInstance.cs
|
|
||||||
- Tracks ActivityPub instances (servers) in the fediverse
|
|
||||||
- Stores instance metadata, blocking status, and activity tracking
|
|
||||||
- Links to actors and content from that instance
|
|
||||||
|
|
||||||
#### FediverseActor.cs
|
|
||||||
- Represents remote actors (users/accounts) from other instances
|
|
||||||
- Stores actor information including keys, inbox/outbox URLs
|
|
||||||
- Links to instance and manages relationships
|
|
||||||
- Tracks whether the actor is a bot, locked, or discoverable
|
|
||||||
|
|
||||||
#### FediverseContent.cs
|
|
||||||
- Stores content (posts, notes, etc.) received from the fediverse
|
|
||||||
- Supports multiple content types (Note, Article, Image, Video, etc.)
|
|
||||||
- Includes attachments, mentions, tags, and emojis
|
|
||||||
- Links to local posts for unified display
|
|
||||||
|
|
||||||
#### FediverseActivity.cs
|
|
||||||
- Tracks ActivityPub activities (Create, Follow, Like, Announce, etc.)
|
|
||||||
- Stores raw activity data and processing status
|
|
||||||
- Links to actors, content, and local entities
|
|
||||||
- Supports both incoming and outgoing activities
|
|
||||||
|
|
||||||
#### FediverseRelationship.cs
|
|
||||||
- Manages follow relationships between local and remote actors
|
|
||||||
- Tracks relationship state (Pending, Accepted, Rejected)
|
|
||||||
- Supports muting and blocking
|
|
||||||
- Links to local accounts/publishers
|
|
||||||
|
|
||||||
#### FediverseReaction.cs
|
|
||||||
- Stores reactions (likes, emoji) from both local and remote actors
|
|
||||||
- Links to content and actor
|
|
||||||
- Supports federation of reactions
|
|
||||||
|
|
||||||
### 2. Database Migration
|
|
||||||
|
|
||||||
**File**: `DysonNetwork.Sphere/Migrations/20251228120000_AddActivityPubModels.cs`
|
|
||||||
|
|
||||||
This migration creates the following tables:
|
|
||||||
- `fediverse_instances` - Instance tracking
|
|
||||||
- `fediverse_actors` - Remote actor profiles
|
|
||||||
- `fediverse_contents` - Federated content storage
|
|
||||||
- `fediverse_activities` - Activity tracking and processing
|
|
||||||
- `fediverse_relationships` - Follow relationships
|
|
||||||
- `fediverse_reactions` - Reactions from fediverse
|
|
||||||
|
|
||||||
### 3. API Controllers (DysonNetwork.Sphere/ActivityPub)
|
|
||||||
|
|
||||||
#### WebFingerController.cs
|
|
||||||
- **Endpoint**: `GET /.well-known/webfinger?resource=acct:<username>@<domain>`
|
|
||||||
- **Purpose**: Allows other instances to discover actors via WebFinger protocol
|
|
||||||
- **Response**: Returns actor's inbox/outbox URLs and profile page links
|
|
||||||
- Maps local Publishers to ActivityPub actors
|
|
||||||
|
|
||||||
#### ActivityPubController.cs
|
|
||||||
Provides three main endpoints:
|
|
||||||
|
|
||||||
1. **GET /activitypub/actors/{username}**
|
|
||||||
- Returns ActivityPub actor profile in JSON-LD format
|
|
||||||
- Includes actor's keys, inbox, outbox, followers, and following URLs
|
|
||||||
- Maps SnPublisher to ActivityPub Person type
|
|
||||||
|
|
||||||
2. **GET /activitypub/actors/{username}/outbox**
|
|
||||||
- Returns actor's outbox collection
|
|
||||||
- Lists public posts as ActivityPub activities
|
|
||||||
- Supports pagination
|
|
||||||
|
|
||||||
3. **POST /activitypub/actors/{username}/inbox**
|
|
||||||
- Receives incoming ActivityPub activities
|
|
||||||
- Supports Create, Follow, Like, Announce activities
|
|
||||||
- Placeholder for activity processing logic
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
|
|
||||||
```
|
|
||||||
Remote Instance Solar Network (Sphere)
|
|
||||||
│ │
|
|
||||||
│ ───WebFinger─────> │
|
|
||||||
│ │
|
|
||||||
│ <───Actor JSON──── │
|
|
||||||
│ │
|
|
||||||
│ ───Activity─────> │ → Inbox Processing
|
|
||||||
│ │
|
|
||||||
│ <───Activity────── │ ← Outbox Distribution
|
|
||||||
```
|
|
||||||
|
|
||||||
### Model Relationships
|
|
||||||
|
|
||||||
- `SnFediverseInstance` has many `SnFediverseActor`
|
|
||||||
- `SnFediverseInstance` has many `SnFediverseContent`
|
|
||||||
- `SnFediverseActor` has many `SnFediverseContent`
|
|
||||||
- `SnFediverseActor` has many `SnFediverseActivity`
|
|
||||||
- `SnFediverseActor` has many `SnFediverseRelationship` (as follower and following)
|
|
||||||
- `SnFediverseContent` has many `SnFediverseActivity`
|
|
||||||
- `SnFediverseContent` has many `SnFediverseReaction`
|
|
||||||
- `SnFediverseContent` optionally links to `SnPost` (local copy)
|
|
||||||
|
|
||||||
### Local to Fediverse Mapping
|
|
||||||
|
|
||||||
| Solar Network Model | ActivityPub Type |
|
|
||||||
|-------------------|-----------------|
|
|
||||||
| SnPublisher | Person (Actor) |
|
|
||||||
| SnPost | Note / Article |
|
|
||||||
| SnPostReaction | Like / EmojiReact |
|
|
||||||
| Follow | Follow Activity |
|
|
||||||
| SnPublisherSubscription | Follow Relationship |
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
### Stage 1: Core Infrastructure ✅ (COMPLETED)
|
|
||||||
- ✅ Create database models for ActivityPub entities
|
|
||||||
- ✅ Create database migration
|
|
||||||
- ✅ Implement basic WebFinger endpoint
|
|
||||||
- ✅ Implement basic Actor endpoint
|
|
||||||
- ✅ Implement Inbox/Outbox endpoints
|
|
||||||
|
|
||||||
### Stage 2: Activity Processing ✅ (COMPLETED)
|
|
||||||
- ✅ Implement HTTP Signature verification (ActivityPubSignatureService)
|
|
||||||
- ✅ Process incoming activities:
|
|
||||||
- Follow/Accept/Reject
|
|
||||||
- Create (incoming posts)
|
|
||||||
- Like/Announce
|
|
||||||
- Delete/Update
|
|
||||||
- Undo
|
|
||||||
- ✅ Generate outgoing activities (ActivityPubDeliveryService)
|
|
||||||
- ✅ Queue and retry failed deliveries (basic implementation)
|
|
||||||
|
|
||||||
### Stage 3: Key Management ✅ (COMPLETED)
|
|
||||||
- ✅ Generate RSA key pairs for each Publisher (ActivityPubKeyService)
|
|
||||||
- ✅ Store public/private keys in Publisher.Meta
|
|
||||||
- ✅ Sign outgoing HTTP requests
|
|
||||||
- ✅ Verify incoming HTTP signatures
|
|
||||||
|
|
||||||
### Stage 4: Content Federation (IN PROGRESS)
|
|
||||||
- ✅ Convert between SnPost and ActivityPub Note/Article (basic mapping)
|
|
||||||
- ✅ Handle content attachments and media
|
|
||||||
- ✅ Support content warnings and sensitive content
|
|
||||||
- ✅ Handle replies, boosts, and mentions
|
|
||||||
- ⏳ Add local post reference for federated content
|
|
||||||
- ⏳ Handle media attachments in federated content
|
|
||||||
|
|
||||||
### Stage 5: Relationship Management ✅ (COMPLETED)
|
|
||||||
- ✅ Handle follow/unfollow logic
|
|
||||||
- ✅ Update followers/following collections
|
|
||||||
- ✅ Block/mute functionality (data model ready)
|
|
||||||
- ✅ Relationship state machine (Pending, Accepted, Rejected)
|
|
||||||
|
|
||||||
### Stage 6: Testing & Interop (NEXT)
|
|
||||||
- ⏳ Test with Mastodon instances
|
|
||||||
- ⏳ Test with Pleroma/Akkoma instances
|
|
||||||
- ⏳ Test with Lemmy instances
|
|
||||||
- ⏳ Verify WebFinger and actor discovery
|
|
||||||
- ⏳ Test activity delivery and processing
|
|
||||||
|
|
||||||
## Implementation Details
|
|
||||||
|
|
||||||
### Core Services
|
|
||||||
|
|
||||||
#### 1. ActivityPubKeyService
|
|
||||||
- Generates RSA 2048-bit key pairs for ActivityPub
|
|
||||||
- Signs data with private key
|
|
||||||
- Verifies signatures with public key
|
|
||||||
- Key stored in `SnPublisher.Meta["private_key"]` and `["public_key"]`
|
|
||||||
|
|
||||||
#### 2. ActivityPubSignatureService
|
|
||||||
- Verifies incoming HTTP Signature headers
|
|
||||||
- Signs outgoing HTTP requests
|
|
||||||
- Manages key retrieval and storage
|
|
||||||
- Builds signing strings according to ActivityPub spec
|
|
||||||
|
|
||||||
#### 3. ActivityPubActivityProcessor
|
|
||||||
- Processes all incoming activity types
|
|
||||||
- Follow: Creates relationship, sends Accept
|
|
||||||
- Accept: Updates relationship to accepted state
|
|
||||||
- Reject: Updates relationship to rejected state
|
|
||||||
- Create: Stores federated content
|
|
||||||
- Like: Records like reaction
|
|
||||||
- Announce: Increments boost count
|
|
||||||
- Undo: Reverts previous actions
|
|
||||||
- Delete: Soft-deletes federated content
|
|
||||||
- Update: Marks content as edited
|
|
||||||
|
|
||||||
#### 4. ActivityPubDeliveryService
|
|
||||||
- Sends Follow activities to remote instances
|
|
||||||
- Sends Accept activities in response to follows
|
|
||||||
- Sends Create activities (posts) to followers
|
|
||||||
- Sends Like activities to remote instances
|
|
||||||
- Sends Undo activities
|
|
||||||
- Fetches remote actor profiles on-demand
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
|
|
||||||
#### Incoming Activity Flow
|
|
||||||
```
|
|
||||||
Remote Server → HTTP Signature Verification → Activity Type → Specific Handler
|
|
||||||
↓
|
|
||||||
Database Update & Response
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Outgoing Activity Flow
|
|
||||||
```
|
|
||||||
Local Action → Create Activity → Sign with Key → Send to Followers' Inboxes
|
|
||||||
↓
|
|
||||||
Track Status & Retry
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Add to `appsettings.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ActivityPub": {
|
|
||||||
"Domain": "your-domain.com",
|
|
||||||
"EnableFederation": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Database Migration
|
|
||||||
|
|
||||||
To apply the migration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet ef database update
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
### WebFinger
|
|
||||||
```bash
|
|
||||||
curl "https://your-domain.com/.well-known/webfinger?resource=acct:username@your-domain.com"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Actor Profile
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" https://your-domain.com/activitypub/actors/username
|
|
||||||
```
|
|
||||||
|
|
||||||
### Outbox
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" https://your-domain.com/activitypub/actors/username/outbox
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- All models follow the existing Solar Network patterns (ModelBase, NodaTime, JSON columns)
|
|
||||||
- Controllers use standard ASP.NET Core patterns with dependency injection
|
|
||||||
- Database uses PostgreSQL with JSONB for flexible metadata storage
|
|
||||||
- Migration follows existing naming conventions
|
|
||||||
- Soft delete is enabled on all models
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
- [ActivityPub W3C Recommendation](https://www.w3.org/TR/activitypub/)
|
|
||||||
- [ActivityStreams 2.0](https://www.w3.org/TR/activitystreams-core/)
|
|
||||||
- [WebFinger RFC 7033](https://tools.ietf.org/html/rfc7033)
|
|
||||||
- [Mastodon Federation Documentation](https://docs.joinmastodon.org/spec/activitypub/)
|
|
||||||
|
|
||||||
## TODOs
|
|
||||||
|
|
||||||
- [ ] Implement HTTP Signature verification middleware
|
|
||||||
- [ ] Create activity processor service
|
|
||||||
- [ ] Implement activity queue and retry logic
|
|
||||||
- [ ] Add key generation for Publishers
|
|
||||||
- [ ] Implement content conversion between formats
|
|
||||||
- [ ] Add inbox background worker
|
|
||||||
- [ ] Add outbox delivery worker
|
|
||||||
- [ ] Implement relationship management logic
|
|
||||||
- [ ] Add moderation tools for federated content
|
|
||||||
- [ ] Add federation metrics and monitoring
|
|
||||||
- [ ] Write comprehensive tests
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
🛠️ ActivityPub 接入 Solar Network 的分步清单
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🧱 1. 准备 & 设计阶段
|
|
||||||
|
|
||||||
1.1 理解 ActivityPub 的核心概念
|
|
||||||
• Actor / Object / Activity / Collection
|
|
||||||
• Outbox / Inbox / Followers 列表
|
|
||||||
ActivityPub 是使用 JSON-LD + ActivityStreams 2.0 来描述社交行为的规范。 
|
|
||||||
|
|
||||||
1.2 映射你现有的 Solar Domain 结构
|
|
||||||
|
|
||||||
把你现在 Solar Network 的用户、帖子、关注、点赞等:
|
|
||||||
• 映射为 ActivityPub 的 Actor / Note / Follow / Like 等
|
|
||||||
• 明确本地模型与 ActivityStreams 对应关系
|
|
||||||
|
|
||||||
比如:
|
|
||||||
• Solar User → ActivityPub Actor
|
|
||||||
• Post → ActivityPub Note/Object
|
|
||||||
• Like → ActivityPub Like Activity
|
|
||||||
这一步是关键的领域建模设计。
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🚪 2. Actor 发现与必要入口
|
|
||||||
|
|
||||||
2.1 实现 WebFinger
|
|
||||||
|
|
||||||
为每个用户提供 WebFinger endpoint:
|
|
||||||
|
|
||||||
GET /.well-known/webfinger?resource=acct:<username>@<domain>
|
|
||||||
|
|
||||||
用来让远端服务器查出 actor 细节(包括 inbox/outbox URL)。
|
|
||||||
|
|
||||||
2.2 Actor 资源 URL
|
|
||||||
|
|
||||||
确保每个用户有一个全局可访问的 URL,例如:
|
|
||||||
|
|
||||||
https://solar.io/users/alice
|
|
||||||
|
|
||||||
并在其 JSON-LD 中包含:
|
|
||||||
• inbox
|
|
||||||
• outbox
|
|
||||||
• followers
|
|
||||||
• following
|
|
||||||
这些是 ActivityPub 基础通信的入口。 
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
📮 3. 核心协议实现
|
|
||||||
|
|
||||||
3.1 Inbox / Outbox 接口
|
|
||||||
|
|
||||||
Inbox(接收来自其他实例的 Activity)
|
|
||||||
Outbox(本地用户发布 Activity 的出口)
|
|
||||||
|
|
||||||
Outbox 需要:
|
|
||||||
• 生成 activity JSON(Create、Follow、Like 等)
|
|
||||||
• 存储至本地数据库
|
|
||||||
• 推送到各 follower 的 Inbox
|
|
||||||
|
|
||||||
Inbox 需要:
|
|
||||||
• 接收并 parse Activity
|
|
||||||
• 验证签名
|
|
||||||
• 处理活动(如接受 Follow,记录远程 Post 等)
|
|
||||||
|
|
||||||
注意:
|
|
||||||
• 请求需要验证 HTTP Signatures(远端服务器签名)。 
|
|
||||||
• 必须满足 ActivityPub 规范对字段的要求。
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🔐 4. 安全与签名
|
|
||||||
|
|
||||||
4.1 Actor Keys
|
|
||||||
|
|
||||||
每个 Actor 对应一对 RSA / Ed25519 密钥:
|
|
||||||
• 私钥用于签名发送到其它服务器的请求
|
|
||||||
• 公钥发布在 Actor JSON 中供对方验证
|
|
||||||
|
|
||||||
远端服务器发送到你的 Inbox 时,需要:
|
|
||||||
• 使用对方的公钥验证签名
|
|
||||||
|
|
||||||
HTTP Signatures 是服务器间通信安全的一部分,防止伪造请求。 
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🌐 5. 实现联邦逻辑
|
|
||||||
|
|
||||||
5.1 关注逻辑
|
|
||||||
|
|
||||||
处理:
|
|
||||||
• Follow Activity
|
|
||||||
• Accept / Reject Activity
|
|
||||||
• 更新本地 followers / following 数据
|
|
||||||
|
|
||||||
实现流程参考:1. 本地用户发起 Follow 2. 推送 Follow 到远端 Inbox 3. 等待远端发送 Accept 或 Reject
|
|
||||||
|
|
||||||
5.2 推送 content(联邦同步)
|
|
||||||
|
|
||||||
当本地用户发布内容时:
|
|
||||||
• 从 Outbox 取出 Create Activity
|
|
||||||
• 发送到所有远端 followers 的 Inbox
|
|
||||||
注意:你可以缓存远端 followers 数据表来减少重复请求。
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
📡 6. 消息处理与存储
|
|
||||||
|
|
||||||
6.1 本地对象缓存
|
|
||||||
|
|
||||||
对于接收到的远端内容(Post / Note / Like 等):
|
|
||||||
• 需要保存到 Solar 的数据库
|
|
||||||
• 供 UI / API 生成用户时间线
|
|
||||||
这使得 Solar 能把远端联邦内容与本地内容统一展示。
|
|
||||||
|
|
||||||
6.2 处理 Collections
|
|
||||||
|
|
||||||
ActivityPub 定义了 Collection 类型用于:
|
|
||||||
• followers 列表
|
|
||||||
• liked 列表
|
|
||||||
• outbox、inbox
|
|
||||||
|
|
||||||
你需要实现这些集合的获取与分页逻辑。
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🔁 7. 与现有 Solar Network API 协调
|
|
||||||
|
|
||||||
你可能已经有本地的帖子、用户 API。那么:
|
|
||||||
• 把这套 API 与 ActivityPub 同步层绑定
|
|
||||||
• 决定哪些内容对外发布
|
|
||||||
• 决定哪些 Activity 类型需要响应
|
|
||||||
|
|
||||||
比如:
|
|
||||||
|
|
||||||
Solar Post Create -> 生成 ActivityPub Create Note -> 发往联邦
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
📦 8. 测试与兼容性
|
|
||||||
|
|
||||||
8.1 与现存联邦测试
|
|
||||||
|
|
||||||
用已存在的 ActivityPub 实例测试兼容性:
|
|
||||||
• Mastodon
|
|
||||||
• Pleroma
|
|
||||||
• Lemmy 等
|
|
||||||
|
|
||||||
检查:
|
|
||||||
• 对方是否能关注 Solar 用户
|
|
||||||
• Solar 是否能接收远端内容
|
|
||||||
|
|
||||||
ActivityPub 规范(W3C Recommendation)有详细规范流包括:
|
|
||||||
• Server to Server API
|
|
||||||
你最重要的目标是与现存实例互操作。 
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🧪 9. UX & 监控支持
|
|
||||||
|
|
||||||
9.1 用户显示远端内容
|
|
||||||
|
|
||||||
从 Inbox 收到内容后:
|
|
||||||
• 如何展示在 Solar UI
|
|
||||||
• 链接远端用户的展示名 / 头像
|
|
||||||
|
|
||||||
9.2 监控 & 审计
|
|
||||||
• 失败的推送
|
|
||||||
• 无法验证签名的请求
|
|
||||||
• 阻止 spam / 恶意 Activity
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
🏁 10. 逐步推进
|
|
||||||
|
|
||||||
建议按阶段 rollout:
|
|
||||||
|
|
||||||
阶段 目标
|
|
||||||
Stage 1 实现 Actor / WebFinger / Outbox / Inbox 基本框架
|
|
||||||
Stage 2 支持 Follow / Accept / Reject Activity
|
|
||||||
Stage 3 支持 Create / Like / Announce
|
|
||||||
Stage 4 与远端实例互联测试
|
|
||||||
Stage 5 UI & Feed 统一显示本地 + 联邦内容
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
📌 小结
|
|
||||||
|
|
||||||
核心步骤总结:1. 映射 Solar Network 数据模型到 ActivityPub 2. 实现 WebFinger + Actor JSON-LD 3. 实现 Inbox 和 Outbox endpoints 4. 管理 Actor Keys 与 HTTP Signatures 5. 处理关注/发帖/点赞等 Activity 6. 推送到远端 / 接收远端同步 7. 将远端内容存入 Solar 并展示 8. 测试与现有 Fediverse 实例互通
|
|
||||||
|
|
||||||
这套步骤覆盖了 ActivityPub 协议必须实现的点和实际联邦要处理的逻辑。 
|
|
||||||
|
|
||||||
⸻
|
|
||||||
|
|
||||||
如果你想,我可以进一步展开 Solar Network 对应的具体 API 设计模板(包括 Inbox / Outbox 的 REST 定义与 JSON 输出示例),甚至帮你写 可运行的 Go / .NET 样例代码。你希望从哪一部分开始深入?
|
|
||||||
@@ -1,273 +0,0 @@
|
|||||||
# ActivityPub Implementation Summary
|
|
||||||
|
|
||||||
## What Has Been Implemented
|
|
||||||
|
|
||||||
### 1. Database Models ✅
|
|
||||||
All models located in `DysonNetwork.Shared/Models/`:
|
|
||||||
|
|
||||||
| Model | Purpose | Key Features |
|
|
||||||
|--------|---------|--------------|
|
|
||||||
| `SnFediverseInstance` | Track fediverse servers | Domain blocking, metadata, activity tracking |
|
|
||||||
| `SnFediverseActor` | Remote user profiles | Keys, inbox/outbox URLs, relationships |
|
|
||||||
| `SnFediverseContent` | Federated posts/notes | Multiple content types, attachments, mentions, tags |
|
|
||||||
| `SnFediverseActivity` | Activity tracking | All activity types, processing status, raw data |
|
|
||||||
| `SnFediverseRelationship` | Follow relationships | State machine, muting/blocking |
|
|
||||||
| `SnFediverseReaction` | Federated reactions | Likes, emoji reactions |
|
|
||||||
|
|
||||||
### 2. Database Migrations ✅
|
|
||||||
- `20251228120000_AddActivityPubModels.cs` - Core ActivityPub tables
|
|
||||||
- `20251228130000_AddPublisherMetaForActivityPubKeys.cs` - Publisher metadata for keys
|
|
||||||
|
|
||||||
### 3. Core Services ✅
|
|
||||||
|
|
||||||
#### ActivityPubKeyService
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/ActivityPubKeyService.cs`
|
|
||||||
- **Responsibilities**:
|
|
||||||
- Generate RSA 2048-bit key pairs
|
|
||||||
- Sign data with private key
|
|
||||||
- Verify signatures with public key
|
|
||||||
- **Key Storage**: Keys stored in `SnPublisher.Meta`
|
|
||||||
|
|
||||||
#### ActivityPubSignatureService
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/ActivityPubSignatureService.cs`
|
|
||||||
- **Responsibilities**:
|
|
||||||
- Verify incoming HTTP Signature headers
|
|
||||||
- Sign outgoing HTTP requests
|
|
||||||
- Build signing strings per ActivityPub spec
|
|
||||||
- Manage key retrieval for actors
|
|
||||||
- **Signature Algorithm**: RSA-SHA256
|
|
||||||
|
|
||||||
#### ActivityPubActivityProcessor
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/ActivityPubActivityProcessor.cs`
|
|
||||||
- **Supported Activities**:
|
|
||||||
- ✅ Follow - Creates relationship, sends Accept
|
|
||||||
- ✅ Accept - Updates relationship to accepted
|
|
||||||
- ✅ Reject - Updates relationship to rejected
|
|
||||||
- ✅ Create - Stores federated content
|
|
||||||
- ✅ Like - Records like reaction
|
|
||||||
- ✅ Announce - Increments boost count
|
|
||||||
- ✅ Undo - Reverts previous actions
|
|
||||||
- ✅ Delete - Soft-deletes federated content
|
|
||||||
- ✅ Update - Marks content as edited
|
|
||||||
|
|
||||||
#### ActivityPubDeliveryService
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs`
|
|
||||||
- **Outgoing Activities**:
|
|
||||||
- ✅ Follow - Send to remote actors
|
|
||||||
- ✅ Accept - Respond to follow requests
|
|
||||||
- ✅ Create - Send new posts to followers
|
|
||||||
- ✅ Like - Send to remote instances
|
|
||||||
- ✅ Undo - Undo previous actions
|
|
||||||
- **Features**:
|
|
||||||
- HTTP signature signing
|
|
||||||
- Remote actor fetching
|
|
||||||
- Follower discovery
|
|
||||||
|
|
||||||
### 4. API Controllers ✅
|
|
||||||
|
|
||||||
#### WebFingerController
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/WebFingerController.cs`
|
|
||||||
- **Endpoints**:
|
|
||||||
- `GET /.well-known/webfinger?resource=acct:<username>@<domain>`
|
|
||||||
- **Purpose**: Allow remote instances to discover local actors
|
|
||||||
|
|
||||||
#### ActivityPubController
|
|
||||||
- **Location**: `DysonNetwork.Sphere/ActivityPub/ActivityPubController.cs`
|
|
||||||
- **Endpoints**:
|
|
||||||
- `GET /activitypub/actors/{username}` - Actor profile in JSON-LD
|
|
||||||
- `GET /activitypub/actors/{username}/outbox` - Public posts
|
|
||||||
- `POST /activitypub/actors/{username}/inbox` - Receive activities
|
|
||||||
- **Features**:
|
|
||||||
- Public key in actor profile
|
|
||||||
- ActivityPub JSON-LD responses
|
|
||||||
- HTTP signature verification on inbox
|
|
||||||
- Activity processing pipeline
|
|
||||||
|
|
||||||
### 5. Model Updates ✅
|
|
||||||
- Added `Meta` field to `SnPublisher` for storing ActivityPub keys
|
|
||||||
- All models follow existing Solar Network patterns
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
### Incoming Activity Flow
|
|
||||||
```
|
|
||||||
1. Remote server sends POST to /inbox
|
|
||||||
2. HTTP Signature is verified
|
|
||||||
3. Activity type is identified
|
|
||||||
4. Specific handler processes activity:
|
|
||||||
- Follow: Create relationship, send Accept
|
|
||||||
- Create: Store content
|
|
||||||
- Like: Record reaction
|
|
||||||
- etc.
|
|
||||||
5. Database is updated
|
|
||||||
6. Response sent
|
|
||||||
```
|
|
||||||
|
|
||||||
### Outgoing Activity Flow
|
|
||||||
```
|
|
||||||
1. Local action occurs (post, like, follow)
|
|
||||||
2. Activity is created in ActivityPub format
|
|
||||||
3. Remote followers are discovered
|
|
||||||
4. HTTP request is signed with publisher's private key
|
|
||||||
5. Activity sent to each follower's inbox
|
|
||||||
6. Status logged
|
|
||||||
```
|
|
||||||
|
|
||||||
### Key Management
|
|
||||||
```
|
|
||||||
1. Publisher creates post/follows
|
|
||||||
2. Check if keys exist in Publisher.Meta
|
|
||||||
3. If not, generate RSA 2048-bit key pair
|
|
||||||
4. Store keys in Publisher.Meta
|
|
||||||
5. Use keys for signing
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Add to `appsettings.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ActivityPub": {
|
|
||||||
"Domain": "your-domain.com",
|
|
||||||
"EnableFederation": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## API Endpoints
|
|
||||||
|
|
||||||
### WebFinger
|
|
||||||
```bash
|
|
||||||
GET /.well-known/webfinger?resource=acct:username@domain.com
|
|
||||||
Accept: application/jrd+json
|
|
||||||
```
|
|
||||||
|
|
||||||
### Actor Profile
|
|
||||||
```bash
|
|
||||||
GET /activitypub/actors/username
|
|
||||||
Accept: application/activity+json
|
|
||||||
```
|
|
||||||
|
|
||||||
### Outbox
|
|
||||||
```bash
|
|
||||||
GET /activitypub/actors/username/outbox
|
|
||||||
Accept: application/activity+json
|
|
||||||
```
|
|
||||||
|
|
||||||
### Inbox
|
|
||||||
```bash
|
|
||||||
POST /activitypub/actors/username/inbox
|
|
||||||
Content-Type: application/activity+json
|
|
||||||
Signature: keyId="...",algorithm="...",headers="...",signature="..."
|
|
||||||
```
|
|
||||||
|
|
||||||
## Database Schema
|
|
||||||
|
|
||||||
### Fediverse Tables
|
|
||||||
- `fediverse_instances` - Server metadata and blocking
|
|
||||||
- `fediverse_actors` - Remote actor profiles
|
|
||||||
- `fediverse_contents` - Federated posts/notes
|
|
||||||
- `fediverse_activities` - Activity tracking
|
|
||||||
- `fediverse_relationships` - Follow relationships
|
|
||||||
- `fediverse_reactions` - Federated reactions
|
|
||||||
|
|
||||||
### Publisher Enhancement
|
|
||||||
- Added `publishers.meta` JSONB column for key storage
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
### Immediate (Ready for Testing)
|
|
||||||
- Apply database migrations
|
|
||||||
- Test WebFinger with a Mastodon instance
|
|
||||||
- Test follow/unfollow with another instance
|
|
||||||
- Test receiving posts from federated timeline
|
|
||||||
|
|
||||||
### Short Term
|
|
||||||
- Add HTTP Signature verification middleware
|
|
||||||
- Implement activity queue with retry logic
|
|
||||||
- Add background worker for processing queued activities
|
|
||||||
- Add metrics and monitoring
|
|
||||||
- Implement local content display in timelines
|
|
||||||
|
|
||||||
### Long Term
|
|
||||||
- Add Media support for federated content
|
|
||||||
- Implement content filtering
|
|
||||||
- Add moderation tools for federated content
|
|
||||||
- Support more activity types
|
|
||||||
- Implement instance block list management
|
|
||||||
|
|
||||||
## Compatibility
|
|
||||||
|
|
||||||
The implementation follows:
|
|
||||||
- ✅ [ActivityPub W3C Recommendation](https://www.w3.org/TR/activitypub/)
|
|
||||||
- ✅ [ActivityStreams 2.0](https://www.w3.org/TR/activitystreams-core/)
|
|
||||||
- ✅ [WebFinger RFC 7033](https://tools.ietf.org/html/rfc7033)
|
|
||||||
- ✅ [HTTP Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures)
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
### Local Testing
|
|
||||||
```bash
|
|
||||||
# 1. Apply migrations
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet ef database update
|
|
||||||
|
|
||||||
# 2. Test WebFinger
|
|
||||||
curl "http://localhost:5000/.well-known/webfinger?resource=acct:username@localhost"
|
|
||||||
|
|
||||||
# 3. Test Actor
|
|
||||||
curl -H "Accept: application/activity+json" http://localhost:5000/activitypub/actors/username
|
|
||||||
```
|
|
||||||
|
|
||||||
### Federation Testing
|
|
||||||
1. Set up a Mastodon instance (or use a public one)
|
|
||||||
2. Follow a Mastodon user from Solar Network
|
|
||||||
3. Create a post on Solar Network
|
|
||||||
4. Verify it appears on Mastodon timeline
|
|
||||||
|
|
||||||
## Architecture Decisions
|
|
||||||
|
|
||||||
1. **Key Storage**: Using `SnPublisher.Meta` JSONB field for flexibility
|
|
||||||
2. **Content Storage**: Federated content stored separately from local posts
|
|
||||||
3. **Relationship State**: Implemented with explicit states (Pending, Accepted, Rejected)
|
|
||||||
4. **Signature Algorithm**: RSA-SHA256 for compatibility
|
|
||||||
5. **Activity Processing**: Synchronous for now, can be made async with queue
|
|
||||||
6. **Content Types**: Support for Note, Article initially (can expand)
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- All ActivityPub communication uses HTTP Signatures
|
|
||||||
- Private keys never leave the server
|
|
||||||
- Public keys are published in actor profiles
|
|
||||||
- Soft delete is enabled on all federated models
|
|
||||||
- Failed activity deliveries are logged but not retried (future enhancement)
|
|
||||||
- Content is federated only when visibility is Public
|
|
||||||
|
|
||||||
## Files Created/Modified
|
|
||||||
|
|
||||||
### New Files
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseInstance.cs`
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseActor.cs`
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseContent.cs`
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseActivity.cs`
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseRelationship.cs`
|
|
||||||
- `DysonNetwork.Shared/Models/FediverseReaction.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/WebFingerController.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/ActivityPubController.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/ActivityPubKeyService.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/ActivityPubSignatureService.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/ActivityPubActivityProcessor.cs`
|
|
||||||
- `DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs`
|
|
||||||
- `DysonNetwork.Sphere/Migrations/20251228120000_AddActivityPubModels.cs`
|
|
||||||
- `DysonNetwork.Sphere/Migrations/20251228130000_AddPublisherMetaForActivityPubKeys.cs`
|
|
||||||
|
|
||||||
### Modified Files
|
|
||||||
- `DysonNetwork.Shared/Models/Publisher.cs` - Added Meta field
|
|
||||||
- `DysonNetwork.Sphere/AppDatabase.cs` - Added DbSets for ActivityPub
|
|
||||||
- `DysonNetwork.Sphere/Startup/ServiceCollectionExtensions.cs` - Registered ActivityPub services
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
- [ActivityPub Implementation Guide](./ACTIVITYPUB_IMPLEMENTATION.md)
|
|
||||||
- [ActivityPub Plan](./ACTIVITYPUB_PLAN.md)
|
|
||||||
- [Solar Network Architecture](./README.md)
|
|
||||||
@@ -1,820 +0,0 @@
|
|||||||
# ActivityPub Testing Guide for Solar Network
|
|
||||||
|
|
||||||
This guide will help you test the ActivityPub implementation in Solar Network, starting with a self-hosted instance and then moving to a real instance.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- ✅ Solar Network codebase with ActivityPub implementation
|
|
||||||
- ✅ Docker installed (for running Mastodon/Fediverse instances)
|
|
||||||
- ✅ PostgreSQL database running
|
|
||||||
- ✅ `.NET 10` SDK
|
|
||||||
|
|
||||||
## Part 1: Set Up a Self-Hosted Test Instance
|
|
||||||
|
|
||||||
### Option A: Using Mastodon (Recommended for Compatibility)
|
|
||||||
|
|
||||||
#### 1. Create a Docker Compose File
|
|
||||||
|
|
||||||
Create `docker-compose.mastodon-test.yml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
restart: always
|
|
||||||
image: postgres:14-alpine
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: mastodon
|
|
||||||
POSTGRES_PASSWORD: mastodon_password
|
|
||||||
POSTGRES_DB: mastodon
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "pg_isready", "-U", "mastodon"]
|
|
||||||
interval: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
redis:
|
|
||||||
restart: always
|
|
||||||
image: redis:7-alpine
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
|
||||||
interval: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
es:
|
|
||||||
restart: always
|
|
||||||
image: docker.elastic.co/elasticsearch:8.10.2
|
|
||||||
environment:
|
|
||||||
- "discovery.type=single-node"
|
|
||||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
|
||||||
- "xpack.security.enabled=false"
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "curl -silent http://localhost:9200/_cluster/health || exit 1"]
|
|
||||||
interval: 10s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
web:
|
|
||||||
restart: always
|
|
||||||
image: tootsuite/mastodon:latest
|
|
||||||
env_file: .env.mastodon
|
|
||||||
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
|
||||||
ports:
|
|
||||||
- "3001:3000"
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
- redis
|
|
||||||
- es
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
volumes:
|
|
||||||
- ./mastodon-data/public:/mastodon/public/system
|
|
||||||
|
|
||||||
streaming:
|
|
||||||
restart: always
|
|
||||||
image: tootsuite/mastodon:latest
|
|
||||||
env_file: .env.mastodon
|
|
||||||
command: node ./streaming
|
|
||||||
ports:
|
|
||||||
- "4000:4000"
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
- redis
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
|
|
||||||
sidekiq:
|
|
||||||
restart: always
|
|
||||||
image: tootsuite/mastodon:latest
|
|
||||||
env_file: .env.mastodon
|
|
||||||
command: bundle exec sidekiq
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
- redis
|
|
||||||
networks:
|
|
||||||
- mastodon_network
|
|
||||||
|
|
||||||
networks:
|
|
||||||
mastodon_network:
|
|
||||||
driver: bridge
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Create Environment File
|
|
||||||
|
|
||||||
Create `.env.mastodon`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Federation
|
|
||||||
LOCAL_DOMAIN=mastodon.local
|
|
||||||
LOCAL_HTTPS=false
|
|
||||||
|
|
||||||
# Database
|
|
||||||
DB_HOST=db
|
|
||||||
DB_PORT=5432
|
|
||||||
DB_USER=mastodon
|
|
||||||
DB_NAME=mastodon
|
|
||||||
DB_PASS=mastodon_password
|
|
||||||
|
|
||||||
# Redis
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
# Elasticsearch
|
|
||||||
ES_ENABLED=true
|
|
||||||
ES_HOST=es
|
|
||||||
ES_PORT=9200
|
|
||||||
|
|
||||||
# Secrets (generate these!)
|
|
||||||
SECRET_KEY_BASE=change_me_to_a_random_string_at_least_32_chars
|
|
||||||
OTP_SECRET=change_me_to_another_random_string
|
|
||||||
|
|
||||||
# Defaults
|
|
||||||
SINGLE_USER_MODE=false
|
|
||||||
DEFAULT_LOCALE=en
|
|
||||||
```
|
|
||||||
|
|
||||||
**Generate secrets:**
|
|
||||||
```bash
|
|
||||||
# Run these to generate random secrets
|
|
||||||
openssl rand -base64 32
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. Start Mastodon
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml up -d
|
|
||||||
|
|
||||||
# Check logs
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml logs -f web
|
|
||||||
```
|
|
||||||
|
|
||||||
Wait for the web service to be healthy (may take 2-5 minutes).
|
|
||||||
|
|
||||||
#### 4. Create a Mastodon Account
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run this command to create an admin account
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml exec web \
|
|
||||||
bin/tootctl accounts create \
|
|
||||||
testuser \
|
|
||||||
testuser@mastodon.local \
|
|
||||||
--email=test@example.com \
|
|
||||||
--confirmed \
|
|
||||||
--role=admin \
|
|
||||||
--approve
|
|
||||||
```
|
|
||||||
|
|
||||||
Set password: `TestPassword123!`
|
|
||||||
|
|
||||||
#### 5. Update Your /etc/hosts
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/hosts
|
|
||||||
```
|
|
||||||
|
|
||||||
Add:
|
|
||||||
```
|
|
||||||
127.0.0.1 mastodon.local
|
|
||||||
127.0.0.1 solar.local
|
|
||||||
```
|
|
||||||
|
|
||||||
### Option B: Using GoToSocial (Lightweight Alternative)
|
|
||||||
|
|
||||||
Create `docker-compose.gotosocial.yml`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
gotosocial:
|
|
||||||
image: superseriousbusiness/gotosocial:latest
|
|
||||||
environment:
|
|
||||||
- GTS_HOST=gotosocial.local
|
|
||||||
- GTS_ACCOUNT_DOMAIN=gotosocial.local
|
|
||||||
- GTS_PROTOCOL=http
|
|
||||||
- GTS_DB_TYPE=sqlite
|
|
||||||
- GTS_DB_ADDRESS=/gotosocial/data/sqlite.db
|
|
||||||
- GTS_STORAGE_LOCAL_BASE_PATH=/gotosocial/data/storage
|
|
||||||
ports:
|
|
||||||
- "3002:8080"
|
|
||||||
volumes:
|
|
||||||
- ./gotosocial-data:/gotosocial/data
|
|
||||||
|
|
||||||
networks:
|
|
||||||
default:
|
|
||||||
```
|
|
||||||
|
|
||||||
Start it:
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.gotosocial.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
Create account:
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.gotosocial.yml exec gotosocial \
|
|
||||||
/gotosocial/gotosocial admin account create \
|
|
||||||
--username testuser \
|
|
||||||
--email test@example.com \
|
|
||||||
--password TestPassword123!
|
|
||||||
```
|
|
||||||
|
|
||||||
## Part 2: Configure Solar Network for Federation
|
|
||||||
|
|
||||||
### 1. Update appsettings.json
|
|
||||||
|
|
||||||
Edit `DysonNetwork.Sphere/appsettings.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ActivityPub": {
|
|
||||||
"Domain": "solar.local",
|
|
||||||
"EnableFederation": true
|
|
||||||
},
|
|
||||||
"Kestrel": {
|
|
||||||
"Endpoints": {
|
|
||||||
"Http": {
|
|
||||||
"Url": "http://solar.local:5000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Update /etc/hosts
|
|
||||||
|
|
||||||
Add both instances:
|
|
||||||
```
|
|
||||||
127.0.0.1 mastodon.local
|
|
||||||
127.0.0.1 solar.local
|
|
||||||
127.0.0.1 gotosocial.local
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Apply Database Migrations
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet ef database update
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Start Solar Network
|
|
||||||
|
|
||||||
```bash
|
|
||||||
dotnet run --project DysonNetwork.Sphere
|
|
||||||
```
|
|
||||||
|
|
||||||
Solar Network should now be running on `http://solar.local:5000`
|
|
||||||
|
|
||||||
## Part 3: Create Test Users
|
|
||||||
|
|
||||||
### In Solar Network
|
|
||||||
|
|
||||||
1. Open http://solar.local:5000 (or your web interface)
|
|
||||||
2. Create a new account/publisher named `solaruser`
|
|
||||||
3. Note down the publisher ID for later
|
|
||||||
|
|
||||||
**Or via API** (if you have an existing account):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# First, create a publisher in Solar Network
|
|
||||||
curl -X POST http://solar.local:5000/api/publishers \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{
|
|
||||||
"name": "solaruser",
|
|
||||||
"nick": "Solar User",
|
|
||||||
"bio": "Testing ActivityPub federation!",
|
|
||||||
"type": 0
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### In Mastodon
|
|
||||||
|
|
||||||
Open http://mastodon.local:3001 and log in with:
|
|
||||||
- Username: `testuser`
|
|
||||||
- Password: `TestPassword123!`
|
|
||||||
|
|
||||||
## Part 4: Test Federation Scenarios
|
|
||||||
|
|
||||||
### Test 1: WebFinger Discovery
|
|
||||||
|
|
||||||
**Goal**: Verify Solar Network is discoverable
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Query Solar Network's WebFinger endpoint
|
|
||||||
curl -v "http://solar.local:5000/.well-known/webfinger?resource=acct:solaruser@solar.local"
|
|
||||||
|
|
||||||
# Expected response (200 OK):
|
|
||||||
{
|
|
||||||
"subject": "acct:solaruser@solar.local",
|
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"rel": "self",
|
|
||||||
"type": "application/activity+json",
|
|
||||||
"href": "https://solar.local:5000/activitypub/actors/solaruser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rel": "http://webfinger.net/rel/profile-page",
|
|
||||||
"type": "text/html",
|
|
||||||
"href": "https://solar.local:5000/users/solaruser"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test 2: Fetch Actor Profile
|
|
||||||
|
|
||||||
**Goal**: Get ActivityPub actor JSON
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Fetch Solar Network actor from Mastodon
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser
|
|
||||||
|
|
||||||
# Expected response includes:
|
|
||||||
{
|
|
||||||
"@context": ["https://www.w3.org/ns/activitystreams"],
|
|
||||||
"id": "https://solar.local:5000/activitypub/actors/solaruser",
|
|
||||||
"type": "Person",
|
|
||||||
"preferredUsername": "solaruser",
|
|
||||||
"inbox": "https://solar.local:5000/activitypub/actors/solaruser/inbox",
|
|
||||||
"outbox": "https://solar.local:5000/activitypub/actors/solaruser/outbox",
|
|
||||||
"followers": "https://solar.local:5000/activitypub/actors/solaruser/followers",
|
|
||||||
"publicKey": {
|
|
||||||
"id": "https://solar.local:5000/activitypub/actors/solaruser#main-key",
|
|
||||||
"owner": "https://solar.local:5000/activitypub/actors/solaruser",
|
|
||||||
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\n..."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test 3: Follow from Mastodon to Solar Network
|
|
||||||
|
|
||||||
**Goal**: Mastodon user follows Solar Network user
|
|
||||||
|
|
||||||
1. **In Mastodon**:
|
|
||||||
- Go to http://mastodon.local:3001
|
|
||||||
- In search bar, type: `@solaruser@solar.local`
|
|
||||||
- Click the follow button
|
|
||||||
|
|
||||||
2. **Verify in Solar Network**:
|
|
||||||
```bash
|
|
||||||
# Check database for relationship
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_relationships WHERE is_local_actor = true;"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check Solar Network logs**:
|
|
||||||
Should see:
|
|
||||||
```
|
|
||||||
Processing activity type: Follow from actor: ...
|
|
||||||
Processed follow from ... to ...
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Verify Mastodon receives Accept**:
|
|
||||||
- Check Mastodon logs for Accept activity
|
|
||||||
- Verify follow appears as accepted in Mastodon
|
|
||||||
|
|
||||||
### Test 4: Follow from Solar Network to Mastodon
|
|
||||||
|
|
||||||
**Goal**: Solar Network user follows Mastodon user
|
|
||||||
|
|
||||||
You'll need to call the ActivityPub delivery service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Via API (you'll need to implement this endpoint):
|
|
||||||
curl -X POST http://solar.local:5000/api/activitypub/follow \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{
|
|
||||||
"targetActorUri": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Or test directly with curl** (simulating a Follow activity):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create a Follow activity
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/solaruser/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "http://mastodon.local:3001/test-follow-activity",
|
|
||||||
"type": "Follow",
|
|
||||||
"actor": "http://mastodon.local:3001/users/testuser",
|
|
||||||
"object": "https://solar.local:5000/activitypub/actors/solaruser"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test 5: Create a Post in Solar Network
|
|
||||||
|
|
||||||
**Goal**: Post federates to Mastodon
|
|
||||||
|
|
||||||
1. **Create a post via Solar Network API**:
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/api/posts \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{
|
|
||||||
"content": "Hello fediverse! Testing ActivityPub from Solar Network! 🚀",
|
|
||||||
"visibility": 0,
|
|
||||||
"publisherId": "PUBLISHER_ID"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Wait a few seconds**
|
|
||||||
|
|
||||||
3. **Check in Mastodon**:
|
|
||||||
- Go to http://mastodon.local:3001
|
|
||||||
- The post should appear in the federated timeline
|
|
||||||
- It should show `@solaruser@solar.local` as the author
|
|
||||||
|
|
||||||
4. **Verify Solar Network logs**:
|
|
||||||
```
|
|
||||||
Successfully sent activity to http://mastodon.local:3001/inbox
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test 6: Like from Mastodon
|
|
||||||
|
|
||||||
**Goal**: Mastodon user likes a Solar Network post
|
|
||||||
|
|
||||||
1. **In Mastodon**:
|
|
||||||
- Find the Solar Network post
|
|
||||||
- Click the favorite/like button
|
|
||||||
|
|
||||||
2. **Verify in Solar Network**:
|
|
||||||
```bash
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_reactions;"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check Solar Network logs**:
|
|
||||||
```
|
|
||||||
Processing activity type: Like from actor: ...
|
|
||||||
Processed like from ...
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test 7: Reply from Mastodon
|
|
||||||
|
|
||||||
**Goal**: Reply federates to Solar Network
|
|
||||||
|
|
||||||
1. **In Mastodon**:
|
|
||||||
- Reply to the Solar Network post
|
|
||||||
- Write: "@solaruser Nice to meet you!"
|
|
||||||
|
|
||||||
2. **Verify in Solar Network**:
|
|
||||||
```bash
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_contents WHERE in_reply_to IS NOT NULL;"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Part 5: Debugging and Troubleshooting
|
|
||||||
|
|
||||||
### Enable Detailed Logging
|
|
||||||
|
|
||||||
Edit `appsettings.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Debug",
|
|
||||||
"DysonNetwork.Sphere.ActivityPub": "Trace"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Database State
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check actors
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT uri, username, display_name FROM fediverse_actors;"
|
|
||||||
|
|
||||||
# Check contents
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT uri, type, content FROM fediverse_contents;"
|
|
||||||
|
|
||||||
# Check relationships
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_relationships;"
|
|
||||||
|
|
||||||
# Check activities
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT type, status, error_message FROM fediverse_activities;"
|
|
||||||
|
|
||||||
# Check failed activities
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_activities WHERE status = 3;" # 3 = Failed
|
|
||||||
```
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### Issue: "Failed to verify signature"
|
|
||||||
|
|
||||||
**Cause**: HTTP Signature verification failed
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Check the signature header format
|
|
||||||
2. Verify public key matches actor's keyId
|
|
||||||
3. Ensure Date header is within 5 minutes
|
|
||||||
4. Check host header matches request URL
|
|
||||||
|
|
||||||
#### Issue: "Target actor or inbox not found"
|
|
||||||
|
|
||||||
**Cause**: Remote actor not fetched yet
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Manually fetch the actor first
|
|
||||||
2. Check actor URL is correct
|
|
||||||
3. Verify remote instance is accessible
|
|
||||||
|
|
||||||
#### Issue: "Content already exists"
|
|
||||||
|
|
||||||
**Cause**: Duplicate activity received
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. This is normal - deduplication is working
|
|
||||||
2. Check if content appears correctly
|
|
||||||
|
|
||||||
#### Issue: CORS errors when testing from browser
|
|
||||||
|
|
||||||
**Cause**: Browser blocking cross-origin requests
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Use curl for API testing
|
|
||||||
2. Or disable CORS in development
|
|
||||||
3. Test directly from Mastodon interface
|
|
||||||
|
|
||||||
### View HTTP Signatures
|
|
||||||
|
|
||||||
For debugging, you can inspect the signature:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# From Mastodon to Solar Network
|
|
||||||
curl -v -X POST http://solar.local:5000/activitypub/actors/solaruser/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{"type":"Follow",...}'
|
|
||||||
```
|
|
||||||
|
|
||||||
Look for the `Signature` header in the output.
|
|
||||||
|
|
||||||
### Test HTTP Signature Verification Manually
|
|
||||||
|
|
||||||
Create a test script `test-signature.js`:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const crypto = require('crypto');
|
|
||||||
|
|
||||||
// Test signature verification
|
|
||||||
const publicKey = `-----BEGIN PUBLIC KEY-----
|
|
||||||
...
|
|
||||||
-----END PUBLIC KEY-----`;
|
|
||||||
|
|
||||||
const signingString = `(request-target): post /activitypub/actors/solaruser/inbox
|
|
||||||
host: solar.local:5000
|
|
||||||
date: ${new Date().toUTCString()}
|
|
||||||
content-length: ...`;
|
|
||||||
|
|
||||||
const signature = '...';
|
|
||||||
|
|
||||||
const verify = crypto.createVerify('SHA256');
|
|
||||||
verify.update(signingString);
|
|
||||||
const isValid = verify.verify(publicKey, signature, 'base64');
|
|
||||||
|
|
||||||
console.log('Signature valid:', isValid);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Part 6: Test with a Real Instance
|
|
||||||
|
|
||||||
### Preparing for Public Federation
|
|
||||||
|
|
||||||
1. **Get a real domain** (e.g., via ngrok or a VPS)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Using ngrok for testing
|
|
||||||
ngrok http 5000
|
|
||||||
|
|
||||||
# This gives you: https://random-id.ngrok-free.app
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Update Solar Network config**:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"ActivityPub": {
|
|
||||||
"Domain": "your-domain.com",
|
|
||||||
"EnableFederation": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Update DNS** (if using real domain):
|
|
||||||
- Add A record pointing to your server
|
|
||||||
- Configure HTTPS (required for production federation)
|
|
||||||
|
|
||||||
4. **Test WebFinger with your domain**:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl "https://your-domain.com/.well-known/webfinger?resource=acct:username@your-domain.com"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test with Mastodon.social
|
|
||||||
|
|
||||||
1. **Create a Mastodon.social account**
|
|
||||||
- Go to https://mastodon.social
|
|
||||||
- Sign up for a test account
|
|
||||||
|
|
||||||
2. **Search for your Solar Network user**:
|
|
||||||
- In Mastodon.social search: `@username@your-domain.com`
|
|
||||||
- Click follow
|
|
||||||
|
|
||||||
3. **Create a post in Solar Network**
|
|
||||||
- Should appear in Mastodon.social
|
|
||||||
|
|
||||||
4. **Reply from Mastodon.social**
|
|
||||||
- Should appear in Solar Network
|
|
||||||
|
|
||||||
### Test with Other Instances
|
|
||||||
|
|
||||||
- **Pleroma**: Similar to Mastodon, good for testing
|
|
||||||
- **Lemmy**: For testing community features (later)
|
|
||||||
- **Pixelfed**: For testing media posts
|
|
||||||
- **PeerTube**: For testing video content (later)
|
|
||||||
|
|
||||||
## Part 7: Verification Checklist
|
|
||||||
|
|
||||||
### Self-Hosted Instance Tests
|
|
||||||
|
|
||||||
- [ ] WebFinger returns correct actor links
|
|
||||||
- [ ] Actor profile has all required fields
|
|
||||||
- [ ] Follow from Mastodon to Solar Network works
|
|
||||||
- [ ] Follow from Solar Network to Mastodon works
|
|
||||||
- [ ] Accept activity sent back to Mastodon
|
|
||||||
- [ ] Posts from Solar Network appear in Mastodon timeline
|
|
||||||
- [ ] Posts from Mastodon appear in Solar Network database
|
|
||||||
- [ ] Likes from Mastodon appear in Solar Network
|
|
||||||
- [ ] Replies from Mastodon appear in Solar Network
|
|
||||||
- [ ] Keys are properly generated and stored
|
|
||||||
- [ ] HTTP signatures are correctly verified
|
|
||||||
- [ ] Outbox returns public posts
|
|
||||||
|
|
||||||
### Real Instance Tests
|
|
||||||
|
|
||||||
- [ ] Domain is publicly accessible
|
|
||||||
- [ ] HTTPS is working (or HTTP for local testing)
|
|
||||||
- [ ] WebFinger works with your domain
|
|
||||||
- [ ] Actor is discoverable from other instances
|
|
||||||
- [ ] Posts federate to public instances
|
|
||||||
- [ ] Users can follow across instances
|
|
||||||
- [ ] Timelines show federated content
|
|
||||||
|
|
||||||
## Part 8: Monitoring During Tests
|
|
||||||
|
|
||||||
### Check Solar Network Logs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Follow logs in real-time
|
|
||||||
dotnet run --project DysonNetwork.Sphere | grep -i activitypub
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Mastodon Logs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml logs -f web | grep -i federation
|
|
||||||
```
|
|
||||||
|
|
||||||
### Monitor Database Activity
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Watch activity table
|
|
||||||
watch -n 2 'psql -d dyson_network -c "SELECT type, status, created_at FROM fediverse_activities ORDER BY created_at DESC LIMIT 10;"'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Network Traffic
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Monitor HTTP requests
|
|
||||||
tcpdump -i lo port 5000 or port 3001 -A
|
|
||||||
```
|
|
||||||
|
|
||||||
## Part 9: Advanced Testing
|
|
||||||
|
|
||||||
### Test HTTP Signature Fallbacks
|
|
||||||
|
|
||||||
Test with various signature headers:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# With Date header
|
|
||||||
curl -H "Date: $(date -u +%a,\ %d\ %b\ %Y\ %T\ GMT)" ...
|
|
||||||
|
|
||||||
# With Digest header
|
|
||||||
curl -H "Digest: SHA-256=$(echo -n '{}' | openssl dgst -sha256 -binary | base64)" ...
|
|
||||||
|
|
||||||
# Multiple signed headers
|
|
||||||
curl -H "Signature: keyId=\"...\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest\",signature=\"...\"" ...
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Rate Limiting
|
|
||||||
|
|
||||||
Send multiple requests quickly:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for i in {1..10}; do
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/solaruser/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{"type":"Create",...}'
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Large Posts
|
|
||||||
|
|
||||||
Send post with attachments:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/api/posts \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"content": "A post with an image",
|
|
||||||
"attachments": [{"id": "file-id"}],
|
|
||||||
"visibility": 0
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Part 10: Cleanup
|
|
||||||
|
|
||||||
### Stop Test Instances
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Stop Mastodon
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml down
|
|
||||||
|
|
||||||
# Stop GoToSocial
|
|
||||||
docker-compose -f docker-compose.gotosocial.yml down
|
|
||||||
|
|
||||||
# Remove data volumes
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml down -v
|
|
||||||
```
|
|
||||||
|
|
||||||
### Reset Solar Network Database
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Warning: This deletes all data!
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet ef database drop
|
|
||||||
dotnet ef database update
|
|
||||||
```
|
|
||||||
|
|
||||||
### Remove /etc/hosts Entries
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/hosts
|
|
||||||
|
|
||||||
# Remove these lines:
|
|
||||||
# 127.0.0.1 mastodon.local
|
|
||||||
# 127.0.0.1 solar.local
|
|
||||||
# 127.0.0.1 gotosocial.local
|
|
||||||
```
|
|
||||||
|
|
||||||
## Next Steps After Testing
|
|
||||||
|
|
||||||
1. **Fix any issues found during testing**
|
|
||||||
2. **Add retry logic for failed deliveries**
|
|
||||||
3. **Implement activity queue for async processing**
|
|
||||||
4. **Add monitoring and metrics**
|
|
||||||
5. **Test with more instances (Pleroma, Pixelfed, etc.)**
|
|
||||||
6. **Add support for more activity types**
|
|
||||||
7. **Improve error handling and logging**
|
|
||||||
8. **Add admin interface for managing federation**
|
|
||||||
|
|
||||||
## Useful Tools
|
|
||||||
|
|
||||||
### ActivityPub Testing Tools
|
|
||||||
- [ActivityPub Playground](https://swicth.github.io/activity-pub-playground/)
|
|
||||||
- [FediTest](https://feditest.com/)
|
|
||||||
- [FediVerse.net](https://fedi.net/)
|
|
||||||
|
|
||||||
### HTTP Testing
|
|
||||||
- [curl](https://curl.se/)
|
|
||||||
- [httpie](https://httpie.io/)
|
|
||||||
- [Postman](https://www.postman.com/)
|
|
||||||
|
|
||||||
### JSON Inspection
|
|
||||||
- [jq](https://stedolan.github.io/jq/)
|
|
||||||
- [jsonpath.com](https://jsonpath.com/)
|
|
||||||
|
|
||||||
### Network Debugging
|
|
||||||
- [Wireshark](https://www.wireshark.org/)
|
|
||||||
- [tcpdump](https://www.tcpdump.org/)
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
- [ActivityPub W3C Spec](https://www.w3.org/TR/activitypub/)
|
|
||||||
- [HTTP Signatures Draft](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures)
|
|
||||||
- [WebFinger RFC 7033](https://tools.ietf.org/html/rfc7033)
|
|
||||||
- [Mastodon Federation Documentation](https://docs.joinmastodon.org/admin/federation/)
|
|
||||||
@@ -1,506 +0,0 @@
|
|||||||
# ActivityPub Testing Helper API
|
|
||||||
|
|
||||||
This document describes helper endpoints for testing ActivityPub federation.
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
These endpoints allow you to manually trigger ActivityPub activities for testing purposes without implementing the full UI federation integration yet.
|
|
||||||
|
|
||||||
## Helper Endpoints
|
|
||||||
|
|
||||||
### 1. Send Follow Activity
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/test/follow`
|
|
||||||
|
|
||||||
**Description**: Sends a Follow activity to a remote actor
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"targetActorUri": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"activityId": "http://solar.local:5000/activitypub/activities/...",
|
|
||||||
"targetActor": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Send Like Activity
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/test/like`
|
|
||||||
|
|
||||||
**Description**: Sends a Like activity for a post (can be local or remote)
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"postId": "POST_ID",
|
|
||||||
"targetActorUri": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"activityId": "http://solar.local:5000/activitypub/activities/..."
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Send Announce (Boost) Activity
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/test/announce`
|
|
||||||
|
|
||||||
**Description**: Boosts a post to followers
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"postId": "POST_ID"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Send Undo Activity
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/test/undo`
|
|
||||||
|
|
||||||
**Description**: Undoes a previous activity
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"activityType": "Like", // or "Follow", "Announce"
|
|
||||||
"objectUri": "http://solar.local:5000/activitypub/objects/POST_ID"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Get Federation Status
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/test/status`
|
|
||||||
|
|
||||||
**Description**: Returns current federation statistics
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"actors": {
|
|
||||||
"total": 5,
|
|
||||||
"local": 1,
|
|
||||||
"remote": 4
|
|
||||||
},
|
|
||||||
"contents": {
|
|
||||||
"total": 25,
|
|
||||||
"byType": {
|
|
||||||
"Note": 20,
|
|
||||||
"Article": 5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relationships": {
|
|
||||||
"total": 8,
|
|
||||||
"accepted": 6,
|
|
||||||
"pending": 1,
|
|
||||||
"rejected": 1
|
|
||||||
},
|
|
||||||
"activities": {
|
|
||||||
"total": 45,
|
|
||||||
"byStatus": {
|
|
||||||
"Completed": 40,
|
|
||||||
"Pending": 3,
|
|
||||||
"Failed": 2
|
|
||||||
},
|
|
||||||
"byType": {
|
|
||||||
"Create": 20,
|
|
||||||
"Follow": 8,
|
|
||||||
"Accept": 6,
|
|
||||||
"Like": 5,
|
|
||||||
"Announce": 3,
|
|
||||||
"Undo": 2,
|
|
||||||
"Delete": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6. Get Recent Activities
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/test/activities`
|
|
||||||
|
|
||||||
**Query Parameters**:
|
|
||||||
- `limit`: Number of activities to return (default: 20)
|
|
||||||
- `type`: Filter by activity type (optional)
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"activities": [
|
|
||||||
{
|
|
||||||
"id": "ACTIVITY_ID",
|
|
||||||
"type": "Follow",
|
|
||||||
"status": "Completed",
|
|
||||||
"actorUri": "http://mastodon.local:3001/users/testuser",
|
|
||||||
"objectUri": "http://solar.local:5000/activitypub/actors/solaruser",
|
|
||||||
"createdAt": "2024-01-15T10:30:00Z",
|
|
||||||
"errorMessage": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 7. Get Actor Keys
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/test/actors/{username}/keys`
|
|
||||||
|
|
||||||
**Description**: Returns the public/private key pair for a publisher
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"username": "solaruser",
|
|
||||||
"hasKeys": true,
|
|
||||||
"actorUri": "http://solar.local:5000/activitypub/actors/solaruser",
|
|
||||||
"publicKeyId": "http://solar.local:5000/activitypub/actors/solaruser#main-key",
|
|
||||||
"publicKey": "-----BEGIN PUBLIC KEY-----\n...",
|
|
||||||
"privateKeyStored": true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 8. Test HTTP Signature
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/test/sign`
|
|
||||||
|
|
||||||
**Description**: Test if a signature string is valid for a given public key
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"publicKey": "-----BEGIN PUBLIC KEY-----\n...",
|
|
||||||
"signingString": "(request-target): post /inbox\nhost: example.com\ndate: ...",
|
|
||||||
"signature": "..."
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"valid": true,
|
|
||||||
"message": "Signature is valid"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Controller Implementation
|
|
||||||
|
|
||||||
Create `DysonNetwork.Sphere/ActivityPub/ActivityPubTestController.cs`:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace DysonNetwork.Sphere.ActivityPub;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
[Route("api/activitypub/test")]
|
|
||||||
[Authorize] // Require auth for testing
|
|
||||||
public class ActivityPubTestController(
|
|
||||||
AppDatabase db,
|
|
||||||
ActivityPubDeliveryService deliveryService,
|
|
||||||
ActivityPubKeyService keyService,
|
|
||||||
ActivityPubSignatureService signatureService,
|
|
||||||
IConfiguration configuration,
|
|
||||||
ILogger<ActivityPubTestController> logger
|
|
||||||
) : ControllerBase
|
|
||||||
{
|
|
||||||
[HttpPost("follow")]
|
|
||||||
public async Task<ActionResult> TestFollow([FromBody] TestFollowRequest request)
|
|
||||||
{
|
|
||||||
var currentUser = GetCurrentUser();
|
|
||||||
var publisher = await GetPublisherForUser(currentUser.Id);
|
|
||||||
|
|
||||||
if (publisher == null)
|
|
||||||
return BadRequest("Publisher not found");
|
|
||||||
|
|
||||||
var success = await deliveryService.SendFollowActivityAsync(
|
|
||||||
publisher.Id,
|
|
||||||
request.TargetActorUri
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(new
|
|
||||||
{
|
|
||||||
success,
|
|
||||||
targetActorUri = request.TargetActorUri,
|
|
||||||
publisherId = publisher.Id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("like")]
|
|
||||||
public async Task<ActionResult> TestLike([FromBody] TestLikeRequest request)
|
|
||||||
{
|
|
||||||
var currentUser = GetCurrentUser();
|
|
||||||
var publisher = await GetPublisherForUser(currentUser.Id);
|
|
||||||
|
|
||||||
var success = await deliveryService.SendLikeActivityAsync(
|
|
||||||
request.PostId,
|
|
||||||
currentUser.Id,
|
|
||||||
request.TargetActorUri
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(new { success, postId = request.PostId });
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("announce")]
|
|
||||||
public async Task<ActionResult> TestAnnounce([FromBody] TestAnnounceRequest request)
|
|
||||||
{
|
|
||||||
var post = await db.Posts.FindAsync(request.PostId);
|
|
||||||
if (post == null)
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
var success = await deliveryService.SendCreateActivityAsync(post);
|
|
||||||
|
|
||||||
return Ok(new { success, postId = request.PostId });
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("undo")]
|
|
||||||
public async Task<ActionResult> TestUndo([FromBody] TestUndoRequest request)
|
|
||||||
{
|
|
||||||
var currentUser = GetCurrentUser();
|
|
||||||
var publisher = await GetPublisherForUser(currentUser.Id);
|
|
||||||
|
|
||||||
if (publisher == null)
|
|
||||||
return BadRequest("Publisher not found");
|
|
||||||
|
|
||||||
var success = await deliveryService.SendUndoActivityAsync(
|
|
||||||
request.ActivityType,
|
|
||||||
request.ObjectUri,
|
|
||||||
publisher.Id
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(new { success, activityType = request.ActivityType });
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("status")]
|
|
||||||
public async Task<ActionResult> GetStatus()
|
|
||||||
{
|
|
||||||
var totalActors = await db.FediverseActors.CountAsync();
|
|
||||||
var localActors = await db.FediverseActors
|
|
||||||
.CountAsync(a => a.Uri.Contains("solar.local"));
|
|
||||||
|
|
||||||
var totalContents = await db.FediverseContents.CountAsync();
|
|
||||||
|
|
||||||
var relationships = await db.FediverseRelationships
|
|
||||||
.GroupBy(r => r.State)
|
|
||||||
.Select(g => new { State = g.Key, Count = g.Count() })
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var activitiesByStatus = await db.FediverseActivities
|
|
||||||
.GroupBy(a => a.Status)
|
|
||||||
.Select(g => new { Status = g.Key, Count = g.Count() })
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var activitiesByType = await db.FediverseActivities
|
|
||||||
.GroupBy(a => a.Type)
|
|
||||||
.Select(g => new { Type = g.Key, Count = g.Count() })
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return Ok(new
|
|
||||||
{
|
|
||||||
actors = new
|
|
||||||
{
|
|
||||||
total = totalActors,
|
|
||||||
local = localActors,
|
|
||||||
remote = totalActors - localActors
|
|
||||||
},
|
|
||||||
contents = new
|
|
||||||
{
|
|
||||||
total = totalContents
|
|
||||||
},
|
|
||||||
relationships = relationships.ToDictionary(r => r.State.ToString(), r => r.Count),
|
|
||||||
activities = new
|
|
||||||
{
|
|
||||||
byStatus = activitiesByStatus.ToDictionary(a => a.Status.ToString(), a => a.Count),
|
|
||||||
byType = activitiesByType.ToDictionary(a => a.Type.ToString(), a => a.Count)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("activities")]
|
|
||||||
public async Task<ActionResult> GetActivities([FromQuery] int limit = 20, [FromQuery] string? type = null)
|
|
||||||
{
|
|
||||||
var query = db.FediverseActivities
|
|
||||||
.OrderByDescending(a => a.CreatedAt);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(type))
|
|
||||||
{
|
|
||||||
query = query.Where(a => a.Type.ToString() == type);
|
|
||||||
}
|
|
||||||
|
|
||||||
var activities = await query
|
|
||||||
.Take(limit)
|
|
||||||
.Select(a => new
|
|
||||||
{
|
|
||||||
a.Id,
|
|
||||||
a.Type,
|
|
||||||
a.Status,
|
|
||||||
ActorUri = a.Actor.Uri,
|
|
||||||
ObjectUri = a.ObjectUri,
|
|
||||||
a.CreatedAt,
|
|
||||||
a.ErrorMessage
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return Ok(new { activities });
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("actors/{username}/keys")]
|
|
||||||
public async Task<ActionResult> GetActorKeys(string username)
|
|
||||||
{
|
|
||||||
var publisher = await db.Publishers
|
|
||||||
.FirstOrDefaultAsync(p => p.Name == username);
|
|
||||||
|
|
||||||
if (publisher == null)
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
var actorUrl = $"http://solar.local:5000/activitypub/actors/{username}";
|
|
||||||
|
|
||||||
var (privateKey, publicKey) = keyService.GenerateKeyPair();
|
|
||||||
|
|
||||||
return Ok(new
|
|
||||||
{
|
|
||||||
username,
|
|
||||||
hasKeys = publisher.Meta != null,
|
|
||||||
actorUri,
|
|
||||||
publicKeyId = $"{actorUrl}#main-key",
|
|
||||||
publicKey = publicKey,
|
|
||||||
privateKeyStored = publisher.Meta != null
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("sign")]
|
|
||||||
public ActionResult TestSignature([FromBody] TestSignatureRequest request)
|
|
||||||
{
|
|
||||||
var isValid = keyService.Verify(
|
|
||||||
request.PublicKey,
|
|
||||||
request.SigningString,
|
|
||||||
request.Signature
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(new
|
|
||||||
{
|
|
||||||
valid = isValid,
|
|
||||||
message = isValid ? "Signature is valid" : "Signature is invalid"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<SnPublisher?> GetPublisherForUser(Guid accountId)
|
|
||||||
{
|
|
||||||
return await db.Publishers
|
|
||||||
.Include(p => p.Members)
|
|
||||||
.Where(p => p.Members.Any(m => m.AccountId == accountId))
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Guid GetCurrentUser()
|
|
||||||
{
|
|
||||||
// Implement based on your auth system
|
|
||||||
return Guid.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TestFollowRequest
|
|
||||||
{
|
|
||||||
public string TargetActorUri { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TestLikeRequest
|
|
||||||
{
|
|
||||||
public Guid PostId { get; set; }
|
|
||||||
public string TargetActorUri { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TestAnnounceRequest
|
|
||||||
{
|
|
||||||
public Guid PostId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TestUndoRequest
|
|
||||||
{
|
|
||||||
public string ActivityType { get; set; } = string.Empty;
|
|
||||||
public string ObjectUri { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TestSignatureRequest
|
|
||||||
{
|
|
||||||
public string PublicKey { get; set; } = string.Empty;
|
|
||||||
public string SigningString { get; set; } = string.Empty;
|
|
||||||
public string Signature { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing with Helper Endpoints
|
|
||||||
|
|
||||||
### 1. Test Follow
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/api/activitypub/test/follow \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{
|
|
||||||
"targetActorUri": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Test Like
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/api/activitypub/test/like \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{
|
|
||||||
"postId": "YOUR_POST_ID",
|
|
||||||
"targetActorUri": "http://mastodon.local:5000/activitypub/actors/mastodonuser"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Check Status
|
|
||||||
```bash
|
|
||||||
curl http://solar.local:5000/api/activitypub/test/status \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Get Recent Activities
|
|
||||||
```bash
|
|
||||||
curl "http://solar.local:5000/api/activitypub/test/activities?limit=10" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Integration with Main Flow
|
|
||||||
|
|
||||||
These helper endpoints can be used to:
|
|
||||||
|
|
||||||
1. **Quickly test federation** without full UI integration
|
|
||||||
2. **Debug specific activity types** in isolation
|
|
||||||
3. **Verify HTTP signatures** are correct
|
|
||||||
4. **Test error handling** for various scenarios
|
|
||||||
5. **Monitor federation status** during development
|
|
||||||
|
|
||||||
## Security Notes
|
|
||||||
|
|
||||||
- All test endpoints require authentication
|
|
||||||
- Use only in development/staging environments
|
|
||||||
- Remove or disable in production
|
|
||||||
- Rate limiting recommended if exposing to public
|
|
||||||
|
|
||||||
## Cleanup
|
|
||||||
|
|
||||||
After testing, you can:
|
|
||||||
|
|
||||||
1. Remove the test controller (optional)
|
|
||||||
2. Disable test endpoints
|
|
||||||
3. Clear test activities from database
|
|
||||||
4. Reset test relationships
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- Clear test data
|
|
||||||
DELETE FROM fediverse_activities WHERE created_at < NOW() - INTERVAL '1 day';
|
|
||||||
```
|
|
||||||
@@ -1,448 +0,0 @@
|
|||||||
# ActivityPub Testing - Complete Guide
|
|
||||||
|
|
||||||
This is the complete guide for testing ActivityPub federation in Solar Network.
|
|
||||||
|
|
||||||
## 📁 File Overview
|
|
||||||
|
|
||||||
| File | Purpose | When to Use |
|
|
||||||
|------|---------|--------------|
|
|
||||||
| `setup-activitypub-test.sh` | One-command setup of test environment | First time setup |
|
|
||||||
| `test-activitypub.sh` | Quick validation of basic functionality | After setup, before detailed tests |
|
|
||||||
| `ACTIVITYPUB_TESTING_QUICKSTART.md` | Quick start reference | Getting started quickly |
|
|
||||||
| `ACTIVITYPUB_TESTING_GUIDE.md` | Comprehensive testing scenarios | Full testing workflow |
|
|
||||||
| `ACTIVITYPUB_TESTING_QUICKREF.md` | Command and query reference | Daily testing |
|
|
||||||
| `ACTIVITYPUB_TESTING_HELPER_API.md` | Helper API for testing | Programmatic testing |
|
|
||||||
| `ACTIVITYPUB_TEST_RESULTS_TEMPLATE.md` | Track test results | During testing |
|
|
||||||
| `ACTIVITYPUB_IMPLEMENTATION.md` | Implementation details | Understanding the code |
|
|
||||||
| `ACTIVITYPUB_SUMMARY.md` | Feature summary | Reviewing what's implemented |
|
|
||||||
|
|
||||||
## 🚀 Quick Start (5 Minutes)
|
|
||||||
|
|
||||||
### 1. Setup Test Environment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./setup-activitypub-test.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
This will:
|
|
||||||
- ✅ Configure `/etc/hosts`
|
|
||||||
- ✅ Start Mastodon via Docker
|
|
||||||
- ✅ Create test Mastodon account
|
|
||||||
- ✅ Apply database migrations
|
|
||||||
|
|
||||||
### 2. Validate Setup
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./test-activitypub.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
This checks:
|
|
||||||
- ✅ WebFinger endpoint
|
|
||||||
- ✅ Actor profile
|
|
||||||
- ✅ Public keys
|
|
||||||
- ✅ Database tables
|
|
||||||
|
|
||||||
### 3. Start Solar Network
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet run
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Test Federation
|
|
||||||
|
|
||||||
1. Open http://mastodon.local:3001
|
|
||||||
2. Search for `@solaruser@solar.local`
|
|
||||||
3. Click Follow
|
|
||||||
4. Create a post in Solar Network
|
|
||||||
5. Verify it appears in Mastodon
|
|
||||||
|
|
||||||
## 📖 Recommended Reading Order
|
|
||||||
|
|
||||||
### For First-Time Testing
|
|
||||||
|
|
||||||
1. **Start Here**: `ACTIVITYPUB_TESTING_QUICKSTART.md`
|
|
||||||
- Overview of the setup
|
|
||||||
- Quick command reference
|
|
||||||
- Common commands
|
|
||||||
|
|
||||||
2. **Then**: `ACTIVITYPUB_TESTING_GUIDE.md`
|
|
||||||
- Detailed test scenarios
|
|
||||||
- Step-by-step instructions
|
|
||||||
- Troubleshooting
|
|
||||||
|
|
||||||
3. **Reference**: `ACTIVITYPUB_TESTING_QUICKREF.md`
|
|
||||||
- Command snippets
|
|
||||||
- Database queries
|
|
||||||
- Response codes
|
|
||||||
|
|
||||||
### During Testing
|
|
||||||
|
|
||||||
1. **Track Progress**: `ACTIVITYPUB_TEST_RESULTS_TEMPLATE.md`
|
|
||||||
- Checklists for each test
|
|
||||||
- Results tracking
|
|
||||||
- Issue logging
|
|
||||||
|
|
||||||
2. **Helper API**: `ACTIVITYPUB_TESTING_HELPER_API.md`
|
|
||||||
- Manual testing endpoints
|
|
||||||
- Debugging tools
|
|
||||||
- Status monitoring
|
|
||||||
|
|
||||||
### For Understanding
|
|
||||||
|
|
||||||
1. **Implementation**: `ACTIVITYPUB_IMPLEMENTATION.md`
|
|
||||||
- Architecture details
|
|
||||||
- Service descriptions
|
|
||||||
- Data flow diagrams
|
|
||||||
|
|
||||||
2. **Features**: `ACTIVITYPUB_SUMMARY.md`
|
|
||||||
- What's implemented
|
|
||||||
- Model relationships
|
|
||||||
- API endpoints
|
|
||||||
|
|
||||||
## 🔍 Test Scenarios Summary
|
|
||||||
|
|
||||||
### Basic Functionality (All instances must pass)
|
|
||||||
|
|
||||||
- [ ] WebFinger discovery works
|
|
||||||
- [ ] Actor profile is valid JSON-LD
|
|
||||||
- [ ] Public key is present
|
|
||||||
- [ ] Outbox returns public posts
|
|
||||||
- [ ] Inbox accepts activities
|
|
||||||
|
|
||||||
### Federation - Follow
|
|
||||||
|
|
||||||
- [ ] Remote user can follow local user
|
|
||||||
- [ ] Local user can follow remote user
|
|
||||||
- [ ] Accept activity is sent/received
|
|
||||||
- [ ] Relationship state is correct
|
|
||||||
- [ ] Unfollow works correctly
|
|
||||||
|
|
||||||
### Federation - Content
|
|
||||||
|
|
||||||
- [ ] Local posts federate to remote instances
|
|
||||||
- [ ] Remote posts appear in local database
|
|
||||||
- [ ] Post content is preserved
|
|
||||||
- [ ] Timestamps are correct
|
|
||||||
- [ ] Attachments are handled
|
|
||||||
- [ ] Content warnings are respected
|
|
||||||
|
|
||||||
### Federation - Interactions
|
|
||||||
|
|
||||||
- [ ] Likes federate correctly
|
|
||||||
- [ ] Likes appear in both instances
|
|
||||||
- [ ] Replies federate correctly
|
|
||||||
- [ ] Reply threading works
|
|
||||||
- [ ] Boosts/Announces work
|
|
||||||
- [ ] Undo activities work
|
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
- [ ] HTTP signatures are verified
|
|
||||||
- [ ] Invalid signatures are rejected
|
|
||||||
- [ ] Keys are properly stored
|
|
||||||
- [ ] Private keys never exposed
|
|
||||||
|
|
||||||
## 🐛 Common Issues & Solutions
|
|
||||||
|
|
||||||
### Issue: "Failed to verify signature"
|
|
||||||
|
|
||||||
**Causes**:
|
|
||||||
1. Signature header format is wrong
|
|
||||||
2. Public key doesn't match keyId
|
|
||||||
3. Date header is too old (>5 minutes)
|
|
||||||
4. Request body doesn't match digest
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Check signature format: `keyId="...",algorithm="...",headers="...",signature="..."`
|
|
||||||
2. Verify keyId in actor profile
|
|
||||||
3. Ensure Date header is recent
|
|
||||||
4. Check body is exactly what was signed
|
|
||||||
|
|
||||||
### Issue: "Target actor or inbox not found"
|
|
||||||
|
|
||||||
**Causes**:
|
|
||||||
1. Actor hasn't been fetched yet
|
|
||||||
2. Actor URL is incorrect
|
|
||||||
3. Remote instance is inaccessible
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Manually fetch actor first
|
|
||||||
2. Verify actor URL is correct
|
|
||||||
3. Test accessibility with curl
|
|
||||||
|
|
||||||
### Issue: Activities not arriving
|
|
||||||
|
|
||||||
**Causes**:
|
|
||||||
1. Network connectivity issue
|
|
||||||
2. Remote instance is down
|
|
||||||
3. Activity wasn't queued properly
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Check network connectivity
|
|
||||||
2. Verify remote instance is running
|
|
||||||
3. Check fediverse_activities table for status
|
|
||||||
|
|
||||||
## 📊 Monitoring During Tests
|
|
||||||
|
|
||||||
### Check Logs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Solar Network ActivityPub logs
|
|
||||||
dotnet run --project DysonNetwork.Sphere 2>&1 | grep -i activitypub
|
|
||||||
|
|
||||||
# Mastodon federation logs
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f web | grep -i federation
|
|
||||||
```
|
|
||||||
|
|
||||||
### Monitor Database
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Watch activity table
|
|
||||||
watch -n 2 'psql -d dyson_network -c \
|
|
||||||
"SELECT type, status, created_at FROM fediverse_activities ORDER BY created_at DESC LIMIT 5;"'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Network
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Test connectivity between instances
|
|
||||||
curl -v http://mastodon.local:3001
|
|
||||||
curl -v http://solar.local:5000
|
|
||||||
|
|
||||||
# Test with traceroute (if available)
|
|
||||||
traceroute mastodon.local
|
|
||||||
traceroute solar.local
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🎯 Success Criteria
|
|
||||||
|
|
||||||
### Minimal Viable Federation
|
|
||||||
|
|
||||||
To consider ActivityPub implementation "working", all of these must pass:
|
|
||||||
|
|
||||||
- ✅ WebFinger returns actor links
|
|
||||||
- ✅ Actor profile has all required fields
|
|
||||||
- ✅ Follow relationships work bidirectionally
|
|
||||||
- ✅ Public posts federate to followers
|
|
||||||
- ✅ Incoming posts are stored correctly
|
|
||||||
- ✅ HTTP signatures are verified
|
|
||||||
- ✅ Basic interaction types work (Like, Reply)
|
|
||||||
|
|
||||||
### Full Production Ready
|
|
||||||
|
|
||||||
For production, also need:
|
|
||||||
|
|
||||||
- ✅ Activity queue with retry logic
|
|
||||||
- ✅ Rate limiting on outgoing deliveries
|
|
||||||
- ✅ Monitoring and alerting
|
|
||||||
- ✅ Admin interface for federation management
|
|
||||||
- ✅ Content filtering and moderation
|
|
||||||
- ✅ Instance blocking capabilities
|
|
||||||
- ✅ Performance optimization for high volume
|
|
||||||
|
|
||||||
## 🔐 Security Checklist
|
|
||||||
|
|
||||||
During testing, verify:
|
|
||||||
|
|
||||||
- [ ] Private keys are never logged
|
|
||||||
- [ ] Private keys are never returned in API responses
|
|
||||||
- [ ] Only public keys are in actor profiles
|
|
||||||
- [ ] All incoming activities are signature-verified
|
|
||||||
- [ ] Invalid signatures are rejected with 401
|
|
||||||
- [ ] TLS is used in production
|
|
||||||
- [ ] Host header is verified against request URL
|
|
||||||
|
|
||||||
## 📈 Performance Metrics
|
|
||||||
|
|
||||||
Track these during testing:
|
|
||||||
|
|
||||||
| Metric | Target | Actual |
|
|
||||||
|--------|--------|--------|
|
|
||||||
| WebFinger response time | <500ms | ___ ms |
|
|
||||||
| Actor fetch time | <1s | ___ ms |
|
|
||||||
| Signature verification time | <100ms | ___ ms |
|
|
||||||
| Activity processing time | <500ms | ___ ms |
|
|
||||||
| Outgoing delivery success rate | >95% | ___% |
|
|
||||||
| Outgoing delivery time | <5s | ___ ms |
|
|
||||||
|
|
||||||
## 🧪 Testing Checklist
|
|
||||||
|
|
||||||
### Self-Hosted Instance Tests
|
|
||||||
|
|
||||||
**Setup**:
|
|
||||||
- [ ] Setup script completed
|
|
||||||
- [ ] Mast containers running
|
|
||||||
- [ ] Solar Network running
|
|
||||||
- [ ] /etc/hosts configured
|
|
||||||
- [ ] Database migrations applied
|
|
||||||
|
|
||||||
**Basic Federation**:
|
|
||||||
- [ ] WebFinger works
|
|
||||||
- [ ] Actor profile valid
|
|
||||||
- [ ] Public key present
|
|
||||||
- [ ] Outbox accessible
|
|
||||||
|
|
||||||
**Follow Flow**:
|
|
||||||
- [ ] Mastodon → Solar follow works
|
|
||||||
- [ ] Solar → Mastodon follow works
|
|
||||||
- [ ] Accept activity sent
|
|
||||||
- [ ] Relationship state correct
|
|
||||||
|
|
||||||
**Content Flow**:
|
|
||||||
- [ ] Solar posts appear in Mastodon
|
|
||||||
- [ ] Mastodon posts appear in Solar
|
|
||||||
- [ ] Content preserved correctly
|
|
||||||
- [ ] Timestamps correct
|
|
||||||
|
|
||||||
**Interactions**:
|
|
||||||
- [ ] Likes work both ways
|
|
||||||
- [ ] Replies work both ways
|
|
||||||
- [ ] Boosts work both ways
|
|
||||||
- [ ] Undo works
|
|
||||||
|
|
||||||
**Security**:
|
|
||||||
- [ ] HTTP signatures verified
|
|
||||||
- [ ] Invalid signatures rejected
|
|
||||||
- [ ] Keys properly managed
|
|
||||||
|
|
||||||
### Real Instance Tests
|
|
||||||
|
|
||||||
**Discovery**:
|
|
||||||
- [ ] Domain publicly accessible
|
|
||||||
- [ ] WebFinger works from public internet
|
|
||||||
- [ ] Actor discoverable from public instances
|
|
||||||
|
|
||||||
**Federation**:
|
|
||||||
- [ ] Posts federate to public instances
|
|
||||||
- [ ] Follows work with public instances
|
|
||||||
- [ ] Interactions work with public instances
|
|
||||||
|
|
||||||
## 📝 Testing Notes
|
|
||||||
|
|
||||||
### What Worked Well
|
|
||||||
1. _____________________
|
|
||||||
2. _____________________
|
|
||||||
3. _____________________
|
|
||||||
|
|
||||||
### What Needs Improvement
|
|
||||||
1. _____________________
|
|
||||||
2. _____________________
|
|
||||||
3. _____________________
|
|
||||||
|
|
||||||
### Bugs Found
|
|
||||||
| # | Description | Severity | Status |
|
|
||||||
|---|-------------|----------|--------|
|
|
||||||
| 1 | _____________________ | Low/Medium/High | ☐ Open/☐ Fixed |
|
|
||||||
| 2 | _____________________ | Low/Medium/High | ☐ Open/☐ Fixed |
|
|
||||||
| 3 | _____________________ | Low/Medium/High | ☐ Open/☐ Fixed |
|
|
||||||
|
|
||||||
## 🎓 Learning Resources
|
|
||||||
|
|
||||||
### ActivityPub Specification
|
|
||||||
- [W3C ActivityPub Recommendation](https://www.w3.org/TR/activitypub/)
|
|
||||||
- [ActivityStreams 2.0](https://www.w3.org/TR/activitystreams-core/)
|
|
||||||
- [HTTP Signatures Draft](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures)
|
|
||||||
|
|
||||||
### Implementation Guides
|
|
||||||
- [Mastodon Federation Guide](https://docs.joinmastodon.org/admin/federation/)
|
|
||||||
- [ActivityPub Testing Best Practices](https://blog.joinmastodon.org/2018/06/27/how-to-implement-a-basic-activitypub-server/)
|
|
||||||
- [Federation Testing Checklist](https://docs.joinmastodon.org/spec/activitypub/)
|
|
||||||
|
|
||||||
### Tools
|
|
||||||
- [ActivityPub Playground](https://swicth.github.io/activity-pub-playground/)
|
|
||||||
- [FediTest](https://feditest.com/)
|
|
||||||
- [JSONPath Online Evaluator](https://jsonpath.com/)
|
|
||||||
|
|
||||||
## 🔄 Next Steps After Testing
|
|
||||||
|
|
||||||
### Phase 1: Fix Issues
|
|
||||||
- Address all bugs found during testing
|
|
||||||
- Improve error messages
|
|
||||||
- Add better logging
|
|
||||||
|
|
||||||
### Phase 2: Enhance Features
|
|
||||||
- Implement activity queue
|
|
||||||
- Add retry logic
|
|
||||||
- Add rate limiting
|
|
||||||
- Implement instance blocking
|
|
||||||
|
|
||||||
### Phase 3: Production Readiness
|
|
||||||
- Add monitoring and metrics
|
|
||||||
- Add admin interface
|
|
||||||
- Add content filtering
|
|
||||||
- Implement moderation tools
|
|
||||||
|
|
||||||
### Phase 4: Additional Features
|
|
||||||
- Support more activity types
|
|
||||||
- Support media attachments
|
|
||||||
- Support polls
|
|
||||||
- Support custom emojis
|
|
||||||
|
|
||||||
## 📞 Getting Help
|
|
||||||
|
|
||||||
If you encounter issues:
|
|
||||||
|
|
||||||
1. **Check logs**: See the logs section above
|
|
||||||
2. **Review troubleshooting**: See `ACTIVITYPUB_TESTING_GUIDE.md` Part 5
|
|
||||||
3. **Check database queries**: Use queries from `ACTIVITYPUB_TESTING_QUICKREF.md`
|
|
||||||
4. **Validate signatures**: Use helper API in `ACTIVITYPUB_TESTING_HELPER_API.md`
|
|
||||||
|
|
||||||
## ✨ Quick Test Commands
|
|
||||||
|
|
||||||
### All-in-One Test Sequence
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Setup
|
|
||||||
./setup-activitypub-test.sh
|
|
||||||
|
|
||||||
# 2. Validate
|
|
||||||
./test-activitypub.sh
|
|
||||||
|
|
||||||
# 3. Test WebFinger
|
|
||||||
curl "http://solar.local:5000/.well-known/webfinger?resource=acct:solaruser@solar.local"
|
|
||||||
|
|
||||||
# 4. Test Actor
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser
|
|
||||||
|
|
||||||
# 5. Test Follow (from Mastodon UI)
|
|
||||||
# Open http://mastodon.local:3001 and follow @solaruser@solar.local
|
|
||||||
|
|
||||||
# 6. Check database
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_relationships;"
|
|
||||||
|
|
||||||
# 7. Test Post (create in Solar Network UI)
|
|
||||||
# Should appear in http://mastodon.local:3001
|
|
||||||
|
|
||||||
# 8. Verify content
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_contents;"
|
|
||||||
|
|
||||||
# 9. Test Like (like from Mastodon UI)
|
|
||||||
# Should appear in fediverse_reactions table
|
|
||||||
|
|
||||||
# 10. Check activities
|
|
||||||
psql -d dyson_network -c "SELECT type, status FROM fediverse_activities;"
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🎉 Conclusion
|
|
||||||
|
|
||||||
You now have everything needed to test ActivityPub federation for Solar Network:
|
|
||||||
|
|
||||||
- ✅ Self-hosted test environment (Mastodon)
|
|
||||||
- ✅ Setup automation (setup script)
|
|
||||||
- ✅ Quick validation (test script)
|
|
||||||
- ✅ Comprehensive testing guide
|
|
||||||
- ✅ Helper API for programmatic testing
|
|
||||||
- ✅ Quick reference for daily use
|
|
||||||
- ✅ Results template for tracking progress
|
|
||||||
|
|
||||||
**Recommended workflow**:
|
|
||||||
1. Run `setup-activitypub-test.sh`
|
|
||||||
2. Run `test-activitypub.sh` for validation
|
|
||||||
3. Follow scenarios in `ACTIVITYPUB_TESTING_GUIDE.md`
|
|
||||||
4. Use `ACTIVITYPUB_TESTING_HELPER_API.md` for specific tests
|
|
||||||
5. Track results in `ACTIVITYPUB_TEST_RESULTS_TEMPLATE.md`
|
|
||||||
6. Reference `ACTIVITYPUB_TESTING_QUICKREF.md` for commands
|
|
||||||
|
|
||||||
Good luck with your federation testing! 🚀
|
|
||||||
@@ -1,356 +0,0 @@
|
|||||||
# ActivityPub Testing Quick Reference
|
|
||||||
|
|
||||||
## Quick Test Commands
|
|
||||||
|
|
||||||
### 1. Test WebFinger
|
|
||||||
```bash
|
|
||||||
curl "http://solar.local:5000/.well-known/webfinger?resource=acct:username@solar.local"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Fetch Actor Profile
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/username
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Get Outbox
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/username/outbox
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Send Test Follow (from remote)
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/username/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "https://mastodon.local:3001/follow-123",
|
|
||||||
"type": "Follow",
|
|
||||||
"actor": "https://mastodon.local:3001/users/remoteuser",
|
|
||||||
"object": "https://solar.local:5000/activitypub/actors/username"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Send Test Create (post)
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/username/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "https://mastodon.local:3001/post-123",
|
|
||||||
"type": "Create",
|
|
||||||
"actor": "https://mastodon.local:3001/users/remoteuser",
|
|
||||||
"object": {
|
|
||||||
"id": "https://mastodon.local:3001/objects/post-123",
|
|
||||||
"type": "Note",
|
|
||||||
"content": "Hello from Mastodon! @username@solar.local",
|
|
||||||
"attributedTo": "https://mastodon.local:3001/users/remoteuser",
|
|
||||||
"to": ["https://www.w3.org/ns/activitystreams#Public"]
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6. Send Test Like
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/username/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "https://mastodon.local:3001/like-123",
|
|
||||||
"type": "Like",
|
|
||||||
"actor": "https://mastodon.local:3001/users/remoteuser",
|
|
||||||
"object": "https://solar.local:5000/activitypub/objects/post-id"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Database Queries
|
|
||||||
|
|
||||||
### Check Actors
|
|
||||||
```sql
|
|
||||||
SELECT id, uri, username, display_name, instance_id
|
|
||||||
FROM fediverse_actors;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Contents
|
|
||||||
```sql
|
|
||||||
SELECT id, uri, type, content, actor_id, created_at
|
|
||||||
FROM fediverse_contents
|
|
||||||
ORDER BY created_at DESC
|
|
||||||
LIMIT 20;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Relationships
|
|
||||||
```sql
|
|
||||||
SELECT r.id, a1.uri as actor, a2.uri as target, r.state, r.is_following
|
|
||||||
FROM fediverse_relationships r
|
|
||||||
JOIN fediverse_actors a1 ON r.actor_id = a1.id
|
|
||||||
JOIN fediverse_actors a2 ON r.target_actor_id = a2.id;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Activities
|
|
||||||
```sql
|
|
||||||
SELECT type, status, error_message, created_at
|
|
||||||
FROM fediverse_activities
|
|
||||||
ORDER BY created_at DESC
|
|
||||||
LIMIT 20;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check Reactions
|
|
||||||
```sql
|
|
||||||
SELECT r.type, c.uri as content_uri, a.uri as actor_uri
|
|
||||||
FROM fediverse_reactions r
|
|
||||||
JOIN fediverse_contents c ON r.content_id = c.id
|
|
||||||
JOIN fediverse_actors a ON r.actor_id = a.id;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Check Keys in Publisher
|
|
||||||
```sql
|
|
||||||
SELECT id, name, meta
|
|
||||||
FROM publishers
|
|
||||||
WHERE meta IS NOT NULL;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Docker Commands
|
|
||||||
|
|
||||||
### Start Mastodon
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Mastodon Logs
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml logs -f web
|
|
||||||
```
|
|
||||||
|
|
||||||
### Stop Mastodon
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml down
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start GoToSocial
|
|
||||||
```bash
|
|
||||||
docker-compose -f docker-compose.gotosocial.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## Solar Network Commands
|
|
||||||
|
|
||||||
### Run Migrations
|
|
||||||
```bash
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet ef database update
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run with Debug Logging
|
|
||||||
```bash
|
|
||||||
dotnet run --project DysonNetwork.Sphere -- --logging:LogLevel:DysonNetwork.Sphere.ActivityPub=Trace
|
|
||||||
```
|
|
||||||
|
|
||||||
## Common Response Codes
|
|
||||||
|
|
||||||
| Code | Meaning |
|
|
||||||
|------|---------|
|
|
||||||
| 200 | Success |
|
|
||||||
| 202 | Accepted (activity queued) |
|
|
||||||
| 401 | Unauthorized (invalid signature) |
|
|
||||||
| 404 | Not found (user/post doesn't exist) |
|
|
||||||
| 400 | Bad request (invalid activity) |
|
|
||||||
|
|
||||||
## Activity Status Codes
|
|
||||||
|
|
||||||
| Status | Code | Meaning |
|
|
||||||
|--------|------|---------|
|
|
||||||
| Pending | 0 | Activity waiting to be processed |
|
|
||||||
| Processing | 1 | Activity being processed |
|
|
||||||
| Completed | 2 | Activity successfully processed |
|
|
||||||
| Failed | 3 | Activity processing failed |
|
|
||||||
|
|
||||||
## Relationship States
|
|
||||||
|
|
||||||
| State | Code | Meaning |
|
|
||||||
|--------|------|---------|
|
|
||||||
| Pending | 0 | Follow request sent, waiting for Accept |
|
|
||||||
| Accepted | 1 | Follow accepted, relationship active |
|
|
||||||
| Rejected | 2 | Follow rejected |
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### "Failed to verify signature"
|
|
||||||
|
|
||||||
**Check**: Signature header format
|
|
||||||
```bash
|
|
||||||
# Should be:
|
|
||||||
Signature: keyId="...",algorithm="rsa-sha256",headers="...",signature="..."
|
|
||||||
```
|
|
||||||
|
|
||||||
**Check**: Public key in actor profile
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/username | jq '.publicKey'
|
|
||||||
```
|
|
||||||
|
|
||||||
### "Actor not found"
|
|
||||||
|
|
||||||
**Check**: Actor exists in database
|
|
||||||
```bash
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM fediverse_actors WHERE uri = '...';"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Check**: Actor URL is accessible
|
|
||||||
```bash
|
|
||||||
curl -v http://remote-instance.com/users/username
|
|
||||||
```
|
|
||||||
|
|
||||||
### "Content already exists"
|
|
||||||
|
|
||||||
This is normal behavior - the system is deduplicating.
|
|
||||||
|
|
||||||
### "Target publisher not found"
|
|
||||||
|
|
||||||
**Check**: Publisher exists
|
|
||||||
```bash
|
|
||||||
psql -d dyson_network -c \
|
|
||||||
"SELECT * FROM publishers WHERE name = '...';"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Quick Test Sequence
|
|
||||||
|
|
||||||
### Full Federation Test
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Start both instances
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml up -d
|
|
||||||
dotnet run --project DysonNetwork.Sphere
|
|
||||||
|
|
||||||
# 2. Test WebFinger
|
|
||||||
curl "http://solar.local:5000/.well-known/webfinger?resource=acct:solaruser@solar.local"
|
|
||||||
|
|
||||||
# 3. Get Actor
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser
|
|
||||||
|
|
||||||
# 4. Send Follow from Mastodon
|
|
||||||
# (Do this in Mastodon UI or use curl above)
|
|
||||||
|
|
||||||
# 5. Check database
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_relationships;"
|
|
||||||
|
|
||||||
# 6. Send Create (post) from Mastodon
|
|
||||||
# (Use curl command above)
|
|
||||||
|
|
||||||
# 7. Check content
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_contents;"
|
|
||||||
|
|
||||||
# 8. Send Like from Mastodon
|
|
||||||
# (Use curl command above)
|
|
||||||
|
|
||||||
# 9. Check reactions
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_reactions;"
|
|
||||||
|
|
||||||
# 10. Check activities
|
|
||||||
psql -d dyson_network -c "SELECT type, status FROM fediverse_activities;"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test URLs
|
|
||||||
|
|
||||||
| Instance | Web | API | ActivityPub |
|
|
||||||
|----------|-----|-----|-----------|
|
|
||||||
| Solar Network | http://solar.local:5000 | http://solar.local:5000/api | http://solar.local:5000/activitypub |
|
|
||||||
| Mastodon | http://mastodon.local:3001 | http://mastodon.local:3001/api/v1 | http://mastodon.local:3001/inbox |
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
|
|
||||||
### Solar Network
|
|
||||||
```bash
|
|
||||||
export SOLAR_DOMAIN="solar.local"
|
|
||||||
export SOLAR_URL="http://solar.local:5000"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mastodon
|
|
||||||
```bash
|
|
||||||
export MASTODON_DOMAIN="mastodon.local"
|
|
||||||
export MASTODON_URL="http://mastodon.local:3001"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Useful jq Commands
|
|
||||||
|
|
||||||
### Extract Actor ID
|
|
||||||
```bash
|
|
||||||
curl ... | jq '.id'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extract Inbox URL
|
|
||||||
```bash
|
|
||||||
curl ... | jq '.inbox'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extract Public Key
|
|
||||||
```bash
|
|
||||||
curl ... | jq '.publicKey.publicKeyPem'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pretty Print Activity
|
|
||||||
```bash
|
|
||||||
curl ... | jq '.'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extract Activity Type
|
|
||||||
```bash
|
|
||||||
curl ... | jq '.type'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Network Setup
|
|
||||||
|
|
||||||
### /etc/hosts
|
|
||||||
```
|
|
||||||
127.0.0.1 solar.local
|
|
||||||
127.0.0.1 mastodon.local
|
|
||||||
127.0.0.1 gotosocial.local
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ports Used
|
|
||||||
- Solar Network: 5000
|
|
||||||
- Mastodon: 3001 (web), 4000 (streaming)
|
|
||||||
- GoToSocial: 3002
|
|
||||||
- PostgreSQL: 5432
|
|
||||||
- Redis: 6379
|
|
||||||
- Elasticsearch: 9200
|
|
||||||
|
|
||||||
## File Locations
|
|
||||||
|
|
||||||
### Docker Compose Files
|
|
||||||
- `docker-compose.mastodon-test.yml`
|
|
||||||
- `docker-compose.gotosocial.yml`
|
|
||||||
|
|
||||||
### Environment Files
|
|
||||||
- `.env.mastodon`
|
|
||||||
|
|
||||||
### Data Volumes
|
|
||||||
- `./mastodon-data/`
|
|
||||||
- `./gotosocial-data/`
|
|
||||||
|
|
||||||
## Clean Up Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Reset database
|
|
||||||
psql -d dyson_network <<EOF
|
|
||||||
TRUNCATE fediverse_activities CASCADE;
|
|
||||||
TRUNCATE fediverse_relationships CASCADE;
|
|
||||||
TRUNCATE fediverse_reactions CASCADE;
|
|
||||||
TRUNCATE fediverse_contents CASCADE;
|
|
||||||
TRUNCATE fediverse_actors CASCADE;
|
|
||||||
TRUNCATE fediverse_instances CASCADE;
|
|
||||||
UPDATE publishers SET meta = NULL WHERE meta IS NOT NULL;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Reset everything
|
|
||||||
docker-compose -f docker-compose.mastodon-test.yml down -v
|
|
||||||
docker-compose -f docker-compose.gotosocial.yml down -v
|
|
||||||
psql -d dyson_network <<EOF
|
|
||||||
DROP SCHEMA public CASCADE;
|
|
||||||
CREATE SCHEMA public;
|
|
||||||
EOF
|
|
||||||
dotnet ef database drop
|
|
||||||
dotnet ef database update
|
|
||||||
```
|
|
||||||
@@ -1,289 +0,0 @@
|
|||||||
# ActivityPub Testing - Quick Start
|
|
||||||
|
|
||||||
This directory contains everything you need to test ActivityPub federation for Solar Network.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### 1. Run the Setup Script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./setup-activitypub-test.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
This will:
|
|
||||||
- ✅ Check prerequisites (Docker, PostgreSQL)
|
|
||||||
- ✅ Update `/etc/hosts` with test domains
|
|
||||||
- ✅ Generate Mastodon environment file
|
|
||||||
- ✅ Create Docker Compose file
|
|
||||||
- ✅ Start Mastodon containers
|
|
||||||
- ✅ Create test Mastodon account
|
|
||||||
- ✅ Apply Solar Network migrations
|
|
||||||
|
|
||||||
### 2. Start Solar Network
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet run
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Test Federation
|
|
||||||
|
|
||||||
Follow the scenarios in [ACTIVITYPUB_TESTING_GUIDE.md](ACTIVITYPUB_TESTING_GUIDE.md)
|
|
||||||
|
|
||||||
## Test Instances
|
|
||||||
|
|
||||||
| Service | URL | Notes |
|
|
||||||
|---------|-----|-------|
|
|
||||||
| Solar Network | http://solar.local:5000 | Your implementation |
|
|
||||||
| Mastodon | http://mastodon.local:3001 | Test instance |
|
|
||||||
| Mastodon Streaming | http://mastodon.local:4000 | WebSocket |
|
|
||||||
|
|
||||||
## Test Accounts
|
|
||||||
|
|
||||||
### Solar Network
|
|
||||||
- Create via UI or API
|
|
||||||
- Username: `solaruser` (or your choice)
|
|
||||||
|
|
||||||
### Mastodon
|
|
||||||
- Username: `testuser@mastodon.local`
|
|
||||||
- Password: `TestPassword123!`
|
|
||||||
- Role: Admin
|
|
||||||
|
|
||||||
## Quick Test Commands
|
|
||||||
|
|
||||||
### Test WebFinger
|
|
||||||
```bash
|
|
||||||
curl "http://solar.local:5000/.well-known/webfinger?resource=acct:solaruser@solar.local"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Actor
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Outbox
|
|
||||||
```bash
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser/outbox
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Follow (from Mastodon)
|
|
||||||
1. Open http://mastodon.local:3001
|
|
||||||
2. Log in as `testuser@mastodon.local`
|
|
||||||
3. Search for `@solaruser@solar.local`
|
|
||||||
4. Click Follow
|
|
||||||
|
|
||||||
### Test Follow (from Solar Network to Mastodon)
|
|
||||||
```bash
|
|
||||||
# Send Follow activity to Solar Network
|
|
||||||
curl -X POST http://solar.local:5000/activitypub/actors/solaruser/inbox \
|
|
||||||
-H "Content-Type: application/activity+json" \
|
|
||||||
-d '{
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "http://solar.local:5000/follow-1",
|
|
||||||
"type": "Follow",
|
|
||||||
"actor": "https://solar.local:5000/activitypub/actors/solaruser",
|
|
||||||
"object": "http://mastodon.local:3001/users/testuser"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation Files
|
|
||||||
|
|
||||||
| File | Purpose |
|
|
||||||
|------|---------|
|
|
||||||
| `ACTIVITYPUB_TESTING_GUIDE.md` | Comprehensive testing guide |
|
|
||||||
| `ACTIVITYPUB_TESTING_QUICKREF.md` | Quick command reference |
|
|
||||||
| `ACTIVITYPUB_IMPLEMENTATION.md` | Implementation details |
|
|
||||||
| `ACTIVITYPUB_SUMMARY.md` | Feature summary |
|
|
||||||
| `ACTIVITYPUB_PLAN.md` | Original implementation plan |
|
|
||||||
|
|
||||||
## Database Checks
|
|
||||||
|
|
||||||
### Connect to Database
|
|
||||||
```bash
|
|
||||||
psql -d dyson_network
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Actors
|
|
||||||
```sql
|
|
||||||
SELECT uri, username, display_name, created_at
|
|
||||||
FROM fediverse_actors;
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Contents
|
|
||||||
```sql
|
|
||||||
SELECT uri, type, content, actor_id, created_at
|
|
||||||
FROM fediverse_contents
|
|
||||||
ORDER BY created_at DESC
|
|
||||||
LIMIT 10;
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Relationships
|
|
||||||
```sql
|
|
||||||
SELECT state, is_following, is_followed_by, created_at
|
|
||||||
FROM fediverse_relationships;
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Activities
|
|
||||||
```sql
|
|
||||||
SELECT type, status, error_message, created_at
|
|
||||||
FROM fediverse_activities
|
|
||||||
ORDER BY created_at DESC
|
|
||||||
LIMIT 10;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Logs
|
|
||||||
|
|
||||||
### Solar Network Logs
|
|
||||||
```bash
|
|
||||||
# Live logs
|
|
||||||
dotnet run --project DysonNetwork.Sphere
|
|
||||||
|
|
||||||
# Follow ActivityPub activity
|
|
||||||
dotnet run --project DysonNetwork.Sphere 2>&1 | grep -i activitypub
|
|
||||||
|
|
||||||
# Debug logging
|
|
||||||
dotnet run --project DysonNetwork.Sphere --logging:LogLevel:DysonNetwork.Sphere.ActivityPub=Trace
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mastodon Logs
|
|
||||||
```bash
|
|
||||||
# All services
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f
|
|
||||||
|
|
||||||
# Web service only
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f web
|
|
||||||
|
|
||||||
# Filter for federation
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f web | grep -i federation
|
|
||||||
```
|
|
||||||
|
|
||||||
## Stopping Everything
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Stop Mastodon
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml down
|
|
||||||
|
|
||||||
# Stop with volume cleanup
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml down -v
|
|
||||||
|
|
||||||
# Restore /etc/hosts
|
|
||||||
sudo mv /etc/hosts.backup /etc/hosts
|
|
||||||
|
|
||||||
# Remove test databases (optional)
|
|
||||||
psql -d dyson_network <<EOF
|
|
||||||
TRUNCATE fediverse_activities CASCADE;
|
|
||||||
TRUNCATE fediverse_relationships CASCADE;
|
|
||||||
TRUNCATE fediverse_reactions CASCADE;
|
|
||||||
TRUNCATE fediverse_contents CASCADE;
|
|
||||||
TRUNCATE fediverse_actors CASCADE;
|
|
||||||
TRUNCATE fediverse_instances CASCADE;
|
|
||||||
UPDATE publishers SET meta = NULL WHERE meta IS NOT NULL;
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Mastodon won't start
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check logs
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f web
|
|
||||||
|
|
||||||
# Restart
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml restart
|
|
||||||
|
|
||||||
# Recreate
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml down
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
### Can't connect to Solar Network
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check if running
|
|
||||||
curl http://solar.local:5000
|
|
||||||
|
|
||||||
# Check logs
|
|
||||||
dotnet run --project DysonNetwork.Sphere 2>&1 | grep -i error
|
|
||||||
|
|
||||||
# Restart
|
|
||||||
# Ctrl+C in terminal and run again
|
|
||||||
```
|
|
||||||
|
|
||||||
### Activities not arriving
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check database
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_activities WHERE status = 3;"
|
|
||||||
|
|
||||||
# Check signature verification logs
|
|
||||||
dotnet run --project DysonNetwork.Sphere 2>&1 | grep -i "signature"
|
|
||||||
|
|
||||||
# Verify actor keys
|
|
||||||
curl -H "Accept: application/activity+json" \
|
|
||||||
http://solar.local:5000/activitypub/actors/solaruser | jq '.publicKey'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing Checklist
|
|
||||||
|
|
||||||
- [ ] Setup script completed successfully
|
|
||||||
- [ ] Mastodon is running and accessible
|
|
||||||
- [ ] Solar Network is running and accessible
|
|
||||||
- [ ] WebFinger returns correct data
|
|
||||||
- [ ] Actor profile includes public key
|
|
||||||
- [ ] Follow from Mastodon to Solar Network works
|
|
||||||
- [ ] Follow from Solar Network to Mastodon works
|
|
||||||
- [ ] Posts from Solar Network appear in Mastodon
|
|
||||||
- [ ] Posts from Mastodon appear in Solar Network database
|
|
||||||
- [ ] Likes federate correctly
|
|
||||||
- [ ] Replies federate correctly
|
|
||||||
- [ ] HTTP signatures are verified
|
|
||||||
- [ ] No errors in logs
|
|
||||||
- [ ] Database contains expected data
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
1. **Test with a real instance**:
|
|
||||||
- Get a public domain or use ngrok
|
|
||||||
- Update `ActivityPub:Domain` in appsettings.json
|
|
||||||
- Test with mastodon.social or other public instances
|
|
||||||
|
|
||||||
2. **Add more features**:
|
|
||||||
- Activity queue for async processing
|
|
||||||
- Retry logic for failed deliveries
|
|
||||||
- Metrics and monitoring
|
|
||||||
- Admin interface for federation management
|
|
||||||
|
|
||||||
3. **Test with more instances**:
|
|
||||||
- Pleroma
|
|
||||||
- Pixelfed
|
|
||||||
- Lemmy
|
|
||||||
- PeerTube
|
|
||||||
|
|
||||||
## Getting Help
|
|
||||||
|
|
||||||
If something doesn't work:
|
|
||||||
|
|
||||||
1. Check the logs (see Logs section above)
|
|
||||||
2. Review the troubleshooting section in [ACTIVITYPUB_TESTING_GUIDE.md](ACTIVITYPUB_TESTING_GUIDE.md)
|
|
||||||
3. Verify all prerequisites are installed
|
|
||||||
4. Check network connectivity between instances
|
|
||||||
5. Review the [ACTIVITYPUB_IMPLEMENTATION.md](ACTIVITYPUB_IMPLEMENTATION.md) for architecture details
|
|
||||||
|
|
||||||
## Useful URLs
|
|
||||||
|
|
||||||
### Test Instances
|
|
||||||
- Mastodon: http://mastodon.local:3001
|
|
||||||
- Solar Network: http://solar.local:5000
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
- ActivityPub W3C Spec: https://www.w3.org/TR/activitypub/
|
|
||||||
- Mastodon Federation Docs: https://docs.joinmastodon.org/admin/federation/
|
|
||||||
- ActivityPub Playground: https://swicth.github.io/activity-pub-playground/
|
|
||||||
|
|
||||||
### Tools
|
|
||||||
- jq: JSON processor (https://stedolan.github.io/jq/)
|
|
||||||
- httpie: HTTP client (https://httpie.io/)
|
|
||||||
- Docker Compose: (https://docs.docker.com/compose/)
|
|
||||||
@@ -1,275 +0,0 @@
|
|||||||
# ActivityPub Testing Guide
|
|
||||||
|
|
||||||
Complete guide for testing ActivityPub federation in Solar Network.
|
|
||||||
|
|
||||||
## 📚 Documentation Files
|
|
||||||
|
|
||||||
| File | Description | Size |
|
|
||||||
|------|-------------|-------|
|
|
||||||
| `ACTIVITYPUB_TESTING_INDEX.md` | **START HERE** - Master guide with overview | 12K |
|
|
||||||
| `ACTIVITYPUB_TESTING_QUICKSTART.md` | Quick reference for common tasks | 7K |
|
|
||||||
| `ACTIVITYPUB_TESTING_GUIDE.md` | Comprehensive testing scenarios (10 parts) | 19K |
|
|
||||||
| `ACTIVITYPUB_TESTING_QUICKREF.md` | Command and query reference | 8K |
|
|
||||||
| `ACTIVITYPUB_TESTING_HELPER_API.md` | Helper API for programmatic testing | 12K |
|
|
||||||
| `ACTIVITYPUB_TESTING_RESULTS_TEMPLATE.md` | Template to track test results | 10K |
|
|
||||||
|
|
||||||
## 🚀 Quick Start
|
|
||||||
|
|
||||||
### Option A: One-Command Setup (Recommended)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Run setup script
|
|
||||||
./setup-activitypub-test.sh
|
|
||||||
|
|
||||||
# 2. Run validation
|
|
||||||
./test-activitypub.sh
|
|
||||||
|
|
||||||
# 3. Start Solar Network
|
|
||||||
cd DysonNetwork.Sphere
|
|
||||||
dotnet run
|
|
||||||
```
|
|
||||||
|
|
||||||
### Option B: Manual Setup
|
|
||||||
|
|
||||||
1. **Read**: `ACTIVITYPUB_TESTING_QUICKSTART.md`
|
|
||||||
2. **Configure**: Copy `.env.testing.example` to `.env` and adjust
|
|
||||||
3. **Follow**: Step-by-step in `ACTIVITYPUB_TESTING_GUIDE.md`
|
|
||||||
|
|
||||||
## 🎯 What You Can Test
|
|
||||||
|
|
||||||
### With Self-Hosted Instance
|
|
||||||
- ✅ WebFinger discovery
|
|
||||||
- ✅ Actor profile retrieval
|
|
||||||
- ✅ Follow relationships (bidirectional)
|
|
||||||
- ✅ Post federation (Solar → Mastodon)
|
|
||||||
- ✅ Content reception (Mastodon → Solar)
|
|
||||||
- ✅ Like interactions
|
|
||||||
- ✅ Reply threading
|
|
||||||
- ✅ HTTP signature verification
|
|
||||||
- ✅ Content deletion
|
|
||||||
|
|
||||||
### With Real Instance
|
|
||||||
- ✅ Public domain setup (via ngrok or VPS)
|
|
||||||
- ✅ Federation with public instances (mastodon.social, etc.)
|
|
||||||
- ✅ Real-world compatibility testing
|
|
||||||
- ✅ Performance under real load
|
|
||||||
|
|
||||||
## 📋 Testing Workflow
|
|
||||||
|
|
||||||
### Day 1: Basic Functionality
|
|
||||||
- Setup test environment
|
|
||||||
- Test WebFinger and Actor endpoints
|
|
||||||
- Verify HTTP signatures
|
|
||||||
- Test basic follow/unfollow
|
|
||||||
|
|
||||||
### Day 2: Content Federation
|
|
||||||
- Test post creation and delivery
|
|
||||||
- Test content reception
|
|
||||||
- Test media attachments
|
|
||||||
- Test content warnings
|
|
||||||
|
|
||||||
### Day 3: Interactions
|
|
||||||
- Test likes (both directions)
|
|
||||||
- Test replies and threading
|
|
||||||
- Test boosts/announces
|
|
||||||
- Test undo activities
|
|
||||||
|
|
||||||
### Day 4: Real Instance
|
|
||||||
- Set up public domain
|
|
||||||
- Test with mastodon.social
|
|
||||||
- Test with other instances
|
|
||||||
- Verify cross-instance compatibility
|
|
||||||
|
|
||||||
### Day 5: Edge Cases
|
|
||||||
- Test error handling
|
|
||||||
- Test failed deliveries
|
|
||||||
- Test invalid signatures
|
|
||||||
- Test malformed activities
|
|
||||||
|
|
||||||
## 🛠️ Setup Scripts
|
|
||||||
|
|
||||||
| Script | Purpose |
|
|
||||||
|--------|---------|
|
|
||||||
| `setup-activitypub-test.sh` | One-command setup of Mastodon + Solar Network |
|
|
||||||
| `test-activitypub.sh` | Quick validation of core functionality |
|
|
||||||
|
|
||||||
Both scripts are executable (`chmod +x`).
|
|
||||||
|
|
||||||
## 🔧 Configuration
|
|
||||||
|
|
||||||
### Required Tools
|
|
||||||
- ✅ Docker (for Mastodon)
|
|
||||||
- ✅ .NET 10 SDK (for Solar Network)
|
|
||||||
- ✅ PostgreSQL client (psql)
|
|
||||||
- ✅ curl (for API testing)
|
|
||||||
|
|
||||||
### Quick Setup
|
|
||||||
```bash
|
|
||||||
# 1. Install dependencies (Ubuntu/Debian)
|
|
||||||
sudo apt-get install docker.io docker-compose postgresql-client curl jq
|
|
||||||
|
|
||||||
# 2. Run setup
|
|
||||||
./setup-activitypub-test.sh
|
|
||||||
|
|
||||||
# 3. Validate
|
|
||||||
./test-activitypub.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📊 Progress Tracking
|
|
||||||
|
|
||||||
Use the template to track your testing progress:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Copy the template
|
|
||||||
cp ACTIVITYPUB_TESTING_RESULTS_TEMPLATE.md my-test-results.md
|
|
||||||
|
|
||||||
# Edit as you test
|
|
||||||
nano my-test-results.md
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🐛 Troubleshooting
|
|
||||||
|
|
||||||
### Quick Fixes
|
|
||||||
|
|
||||||
**Mastodon won't start**:
|
|
||||||
```bash
|
|
||||||
# Check logs
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml logs -f
|
|
||||||
|
|
||||||
# Restart containers
|
|
||||||
docker compose -f docker-compose.mastodon-test.yml restart
|
|
||||||
```
|
|
||||||
|
|
||||||
**Can't reach Solar Network**:
|
|
||||||
```bash
|
|
||||||
# Check if running
|
|
||||||
curl http://solar.local:5000
|
|
||||||
|
|
||||||
# Check /etc/hosts
|
|
||||||
cat /etc/hosts | grep solar.local
|
|
||||||
```
|
|
||||||
|
|
||||||
**Activities not arriving**:
|
|
||||||
```bash
|
|
||||||
# Check database
|
|
||||||
psql -d dyson_network -c "SELECT * FROM fediverse_activities;"
|
|
||||||
|
|
||||||
# Check logs
|
|
||||||
dotnet run --project DysonNetwork.Sphere | grep -i activitypub
|
|
||||||
```
|
|
||||||
|
|
||||||
For detailed troubleshooting, see `ACTIVITYPUB_TESTING_GUIDE.md` Part 5.
|
|
||||||
|
|
||||||
## 📖 Learning Path
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
1. Read `ACTIVITYPUB_IMPLEMENTATION.md` to understand the architecture
|
|
||||||
2. Read `ACTIVITYPUB_SUMMARY.md` to see what's implemented
|
|
||||||
3. Follow test scenarios in `ACTIVITYPUB_TESTING_GUIDE.md`
|
|
||||||
4. Use helper API in `ACTIVITYPUB_TESTING_HELPER_API.md` for testing
|
|
||||||
|
|
||||||
### For Testers
|
|
||||||
1. Start with `ACTIVITYPUB_TESTING_QUICKSTART.md`
|
|
||||||
2. Use command reference in `ACTIVITYPUB_TESTING_QUICKREF.md`
|
|
||||||
3. Track results with `ACTIVITYPUB_TESTING_RESULTS_TEMPLATE.md`
|
|
||||||
4. Report issues with details from logs
|
|
||||||
|
|
||||||
## 🎓 Success Criteria
|
|
||||||
|
|
||||||
### Minimum Viable
|
|
||||||
- WebFinger works
|
|
||||||
- Actor profile valid
|
|
||||||
- Follow relationships work
|
|
||||||
- Posts federate correctly
|
|
||||||
- HTTP signatures verified
|
|
||||||
|
|
||||||
### Production Ready
|
|
||||||
- Activity queue with retry
|
|
||||||
- Rate limiting
|
|
||||||
- Monitoring/alerting
|
|
||||||
- Admin interface
|
|
||||||
- Instance blocking
|
|
||||||
- Content moderation
|
|
||||||
|
|
||||||
## 🚨 Common Pitfalls
|
|
||||||
|
|
||||||
### Don't Forget
|
|
||||||
- ✅ Update `/etc/hosts` with both instances
|
|
||||||
- ✅ Run migrations before testing
|
|
||||||
- ✅ Check both instances are accessible
|
|
||||||
- ✅ Verify PostgreSQL is running
|
|
||||||
- ✅ Check logs when something fails
|
|
||||||
|
|
||||||
### Watch Out For
|
|
||||||
- ❌ Using `localhost` instead of `solar.local`
|
|
||||||
- ❌ Forgetting to restart after config changes
|
|
||||||
- ❌ Not waiting for Mastodon to start (2-5 minutes)
|
|
||||||
- ❌ Ignoring CORS errors in browser testing
|
|
||||||
- ❌ Testing with deleted/invisible posts
|
|
||||||
|
|
||||||
## 📚 Additional Resources
|
|
||||||
|
|
||||||
### Official Specs
|
|
||||||
- [ActivityPub W3C](https://www.w3.org/TR/activitypub/)
|
|
||||||
- [ActivityStreams](https://www.w3.org/TR/activitystreams-core/)
|
|
||||||
- [HTTP Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures)
|
|
||||||
|
|
||||||
### Community Guides
|
|
||||||
- [Mastodon Federation](https://docs.joinmastodon.org/admin/federation/)
|
|
||||||
- [Federation Testing](https://docs.joinmastodon.org/spec/activitypub/)
|
|
||||||
|
|
||||||
### Tools
|
|
||||||
- [ActivityPub Playground](https://swicth.github.io/activity-pub-playground/)
|
|
||||||
- [FediTest](https://feditest.com/)
|
|
||||||
|
|
||||||
## 🆘 Support
|
|
||||||
|
|
||||||
If you encounter issues:
|
|
||||||
|
|
||||||
1. Check logs (both Solar Network and Mastodon)
|
|
||||||
2. Review troubleshooting section in the guide
|
|
||||||
3. Validate against success criteria
|
|
||||||
4. Check database state with queries
|
|
||||||
5. Review implementation docs
|
|
||||||
|
|
||||||
## ✨ Next Steps
|
|
||||||
|
|
||||||
After testing with self-hosted instance:
|
|
||||||
|
|
||||||
1. Get a public domain or use ngrok
|
|
||||||
2. Update `ActivityPub:Domain` in appsettings.json
|
|
||||||
3. Test with public Mastodon instances
|
|
||||||
4. Add more ActivityPub features (queue, retry, etc.)
|
|
||||||
5. Implement admin interface
|
|
||||||
6. Add monitoring and metrics
|
|
||||||
|
|
||||||
## 📞 File Reference
|
|
||||||
|
|
||||||
All files are in the root of the DysonNetwork project:
|
|
||||||
|
|
||||||
```
|
|
||||||
DysonNetwork/
|
|
||||||
├── ACTIVITYPUB_TESTING_INDEX.md # Start here!
|
|
||||||
├── ACTIVITYPUB_TESTING_QUICKSTART.md # Quick reference
|
|
||||||
├── ACTIVITYPUB_TESTING_GUIDE.md # Full guide
|
|
||||||
├── ACTIVITYPUB_TESTING_QUICKREF.md # Commands
|
|
||||||
├── ACTIVITYPUB_TESTING_HELPER_API.md # Test API
|
|
||||||
├── ACTIVITYPUB_TESTING_RESULTS_TEMPLATE.md
|
|
||||||
├── setup-activitypub-test.sh # Setup script
|
|
||||||
├── test-activitypub.sh # Test script
|
|
||||||
└── .env.testing.example # Config template
|
|
||||||
```
|
|
||||||
|
|
||||||
**Documentation files** (for reference):
|
|
||||||
```
|
|
||||||
DysonNetwork/
|
|
||||||
├── ACTIVITYPUB_IMPLEMENTATION.md # How it's implemented
|
|
||||||
├── ACTIVITYPUB_SUMMARY.md # Feature summary
|
|
||||||
└── ACTIVITYPUB_PLAN.md # Original plan
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Start here**: `ACTIVITYPUB_TESTING_INDEX.md`
|
|
||||||
|
|
||||||
**Good luck with your testing!** 🚀
|
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
# ActivityPub Testing Results Template
|
|
||||||
|
|
||||||
Use this template to track your testing progress.
|
|
||||||
|
|
||||||
## Test Environment
|
|
||||||
|
|
||||||
**Date**: ________________
|
|
||||||
|
|
||||||
**Test Configuration**:
|
|
||||||
- Solar Network URL: `http://solar.local:5000`
|
|
||||||
- Mastodon URL: `http://mastodon.local:3001`
|
|
||||||
- Database: `dyson_network`
|
|
||||||
|
|
||||||
**Solar Network User**:
|
|
||||||
- Username: `_______________`
|
|
||||||
- Publisher ID: `_______________`
|
|
||||||
|
|
||||||
**Mastodon User**:
|
|
||||||
- Username: `testuser@mastodon.local`
|
|
||||||
- Password: `TestPassword123!`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Test Results
|
|
||||||
|
|
||||||
### ✅ Part 1: Infrastructure Setup
|
|
||||||
|
|
||||||
| Test | Status | Notes |
|
|
||||||
|------|--------|-------|
|
|
||||||
| Setup script ran successfully | ☐ ☑ | |
|
|
||||||
| /etc/hosts updated | ☐ ☑ | |
|
|
||||||
| Docker containers started | ☐ ☑ | |
|
|
||||||
| Mastodon web accessible | ☐ ☑ | |
|
|
||||||
| Mastodon admin account created | ☐ ☑ | |
|
|
||||||
| Database migrations applied | ☐ ☑ | |
|
|
||||||
| Solar Network started | ☐ ☑ | |
|
|
||||||
|
|
||||||
### ✅ Part 2: WebFinger & Actor Discovery
|
|
||||||
|
|
||||||
| Test | Status | Expected | Actual |
|
|
||||||
|------|--------|---------|--------|
|
|
||||||
| WebFinger for Solar Network user | ☐ ☑ | Returns subject + links | _______________ |
|
|
||||||
| Actor profile JSON is valid | ☐ ☑ | Has id, type, inbox, outbox | _______________ |
|
|
||||||
| Public key present in actor | ☐ ☑ | publicKey.publicKeyPem exists | _______________ |
|
|
||||||
| Outbox returns public posts | ☐ ☑ | OrderedCollection with items | _______________ |
|
|
||||||
| Outbox totalItems count | ☐ ☑ | Matches public posts | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 3: Follow Relationships
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Mastodon follows Solar Network user | ☐ ☑ | Relationship created in DB | _______________ |
|
|
||||||
| Accept sent to Mastodon | ☐ ☑ | Mastodon receives Accept | _______________ |
|
|
||||||
| Solar Network follows Mastodon user | ☐ ☑ | Relationship created | _______________ |
|
|
||||||
| Follow appears in Mastodon UI | ☐ ☑ | Mastodon shows "Following" | _______________ |
|
|
||||||
| Follow appears in Solar Network DB | ☐ ☑ | is_following = true | _______________ |
|
|
||||||
| Follow state is Accepted | ☐ ☑ | state = 1 (Accepted) | _______________ |
|
|
||||||
| Unfollow works correctly | ☐ ☑ | Relationship deleted/updated | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 4: Content Federation (Create)
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Post created in Solar Network | ☐ ☑ | Post in sn_posts table | _______________ |
|
|
||||||
| Activity sent to Mastodon | ☐ ☑ | Logged as successful | _______________ |
|
|
||||||
| Post appears in Mastodon timeline | ☐ ☑ | Visible in federated timeline | _______________ |
|
|
||||||
| Post content matches | ☐ ☑ | Same text/HTML | _______________ |
|
|
||||||
| Post author is correct | ☐ ☑ | Shows Solar Network user | _______________ |
|
|
||||||
| Post timestamp is correct | ☐ ☑ | Same published time | _______________ |
|
|
||||||
| Multiple posts federate | ☐ ☑ | All posts appear | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 5: Content Reception (Incoming Create)
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Create activity received | ☐ ☑ | Activity logged in DB | _______________ |
|
|
||||||
| Content stored in fediverse_contents | ☐ ☑ | Record with correct type | _______________ |
|
|
||||||
| Content not duplicated | ☐ ☑ | Only one entry per URI | _______________ |
|
|
||||||
| Actor created/retrieved | ☐ ☑ | Actor in fediverse_actors | _______________ |
|
|
||||||
| Instance created/retrieved | ☐ ☑ | Instance in fediverse_instances | _______________ |
|
|
||||||
| Content HTML preserved | ☐ ☑ | contentHtml field populated | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 6: Reaction Federation (Like)
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Like from Mastodon to Solar post | ☐ ☑ | Like activity received | _______________ |
|
|
||||||
| Reaction stored in fediverse_reactions | ☐ ☑ | Record with type = 0 (Like) | _______________ |
|
|
||||||
| Like count incremented | ☐ ☑ | like_count increased | _______________ |
|
|
||||||
| Like appears in UI | ☐ ☑ | Visible on Solar Network | _______________ |
|
|
||||||
| Like appears in Mastodon | ☐ ☑ | Visible on Mastodon | _______________ |
|
|
||||||
| Unlike works correctly | ☐ ☑ | Like removed | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 7: Reply Federation
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Reply from Mastodon to Solar post | ☐ ☑ | Create activity with inReplyTo | _______________ |
|
|
||||||
| Reply stored with parent reference | ☐ ☑ | in_reply_to field set | _______________ |
|
|
||||||
| Reply appears in Solar Network | ☐ ☑ | Visible as comment | _______________ |
|
|
||||||
| Reply shows parent context | ☐ ☑ | Links to original post | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 8: Content Deletion
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Delete from Mastodon | ☐ ☑ | Delete activity received | _______________ |
|
|
||||||
| Content soft-deleted | ☐ ☑ | deleted_at timestamp set | _______________ |
|
|
||||||
| Content no longer visible | ☐ ☑ | Hidden from timelines | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 9: HTTP Signature Verification
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Valid signature accepted | ☐ ☑ | Activity processed | _______________ |
|
|
||||||
| Invalid signature rejected | ☐ ☑ | 401 Unauthorized | _______________ |
|
|
||||||
| Missing signature rejected | ☐ ☑ | 401 Unauthorized | _______________ |
|
|
||||||
| Signature format correct | ☐ ☑ | keyId, algorithm, headers, signature | _______________ |
|
|
||||||
| Signing string correct | ☐ ☑ | Matches HTTP-Signatures draft | _______________ |
|
|
||||||
|
|
||||||
### ✅ Part 10: Error Handling
|
|
||||||
|
|
||||||
| Test | Status | Expected Result | Actual Result |
|
|
||||||
|------|--------|----------------|---------------|
|
|
||||||
| Invalid activity type rejected | ☐ ☑ | 400 Bad Request | _______________ |
|
|
||||||
| Malformed JSON rejected | ☐ ☑ | 400 Bad Request | _______________ |
|
|
||||||
| Non-existent actor rejected | ☐ ☑ | 404 Not Found | _______________ |
|
|
||||||
| Errors logged correctly | ☐ ☑ | error_message populated | _______________ |
|
|
||||||
| Activity status = Failed | ☐ ☑ | status = 3 | _______________ |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Database State After Tests
|
|
||||||
|
|
||||||
### Actors Table
|
|
||||||
```sql
|
|
||||||
SELECT COUNT(*) as total_actors,
|
|
||||||
SUM(CASE WHEN is_local_actor THEN 1 ELSE 0 END) as local,
|
|
||||||
SUM(CASE WHEN NOT is_local_actor THEN 1 ELSE 0 END) as remote
|
|
||||||
FROM fediverse_relationships;
|
|
||||||
```
|
|
||||||
- Total Actors: _______________
|
|
||||||
- Local Actors: _______________
|
|
||||||
- Remote Actors: _______________
|
|
||||||
|
|
||||||
### Contents Table
|
|
||||||
```sql
|
|
||||||
SELECT COUNT(*) as total_contents,
|
|
||||||
AVG(LENGTH(content)) as avg_content_length
|
|
||||||
FROM fediverse_contents WHERE deleted_at IS NULL;
|
|
||||||
```
|
|
||||||
- Total Contents: _______________
|
|
||||||
- Avg Content Length: _______________
|
|
||||||
|
|
||||||
### Activities Table
|
|
||||||
```sql
|
|
||||||
SELECT type, status, COUNT(*)
|
|
||||||
FROM fediverse_activities
|
|
||||||
GROUP BY type, status
|
|
||||||
ORDER BY type, status;
|
|
||||||
```
|
|
||||||
- Activities by Type/Status:
|
|
||||||
- Create: Pending ___, Completed ____, Failed ___
|
|
||||||
- Follow: Pending ___, Completed ____, Failed ___
|
|
||||||
- Like: Pending ___, Completed ____, Failed ___
|
|
||||||
- Accept: Pending ___, Completed ____, Failed ___
|
|
||||||
|
|
||||||
### Relationships Table
|
|
||||||
```sql
|
|
||||||
SELECT state, COUNT(*) as count
|
|
||||||
FROM fediverse_relationships
|
|
||||||
GROUP BY state;
|
|
||||||
```
|
|
||||||
- Pending: _______________
|
|
||||||
- Accepted: _______________
|
|
||||||
- Rejected: _______________
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Logs Analysis
|
|
||||||
|
|
||||||
### Solar Network Errors Found:
|
|
||||||
1. _______________
|
|
||||||
2. _______________
|
|
||||||
3. _______________
|
|
||||||
|
|
||||||
### Mastodon Errors Found:
|
|
||||||
1. _______________
|
|
||||||
2. _______________
|
|
||||||
3. _______________
|
|
||||||
|
|
||||||
### Warnings Found:
|
|
||||||
1. _______________
|
|
||||||
2. _______________
|
|
||||||
3. _______________
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Issues & Bugs Found
|
|
||||||
|
|
||||||
| # | Severity | Description | Status |
|
|
||||||
|---|----------|-------------|--------|
|
|
||||||
| 1 | ☐ Low/Medium/High/Critical | _____________________ | ☐ Open/☐ Fixed |
|
|
||||||
| 2 | ☐ Low/Medium/High/Critical | _____________________ | ☐ Open/☐ Fixed |
|
|
||||||
| 3 | ☐ Low/Medium/High/Critical | _____________________ | ☐ Open/☐ Fixed |
|
|
||||||
| 4 | ☐ Low/Medium/High/Critical | _____________________ | ☐ Open/☐ Fixed |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Performance Notes
|
|
||||||
|
|
||||||
| Metric | Value | Notes |
|
|
||||||
|--------|-------|-------|
|
|
||||||
| Average activity processing time | __________ ms | |
|
|
||||||
| Average HTTP signature verification time | __________ ms | |
|
|
||||||
| Outgoing delivery success rate | __________% | |
|
|
||||||
| Average WebFinger response time | __________ ms | |
|
|
||||||
| Database query performance | __________ | |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Compatibility Notes
|
|
||||||
|
|
||||||
| Instance | Version | Works | Notes |
|
|
||||||
|----------|---------|--------|-------|
|
|
||||||
| Mastodon (self-hosted) | latest | ☐ ☑ | |
|
|
||||||
| Mastodon.social | ~4.0 | ☐ ☑ | |
|
|
||||||
| Pleroma | ~2.5 | ☐ ☑ | |
|
|
||||||
| GoToSocial | ~0.15 | ☐ ☑ | |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Recommendations
|
|
||||||
|
|
||||||
### What Worked Well:
|
|
||||||
1. _____________________
|
|
||||||
2. _____________________
|
|
||||||
3. _____________________
|
|
||||||
|
|
||||||
### What Needs Improvement:
|
|
||||||
1. _____________________
|
|
||||||
2. _____________________
|
|
||||||
3. _____________________
|
|
||||||
|
|
||||||
### Features to Add:
|
|
||||||
1. _____________________
|
|
||||||
2. _____________________
|
|
||||||
3. _____________________
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Next Testing Phase
|
|
||||||
|
|
||||||
- [ ] Test with public Mastodon instance
|
|
||||||
- [ ] Test with Pleroma instance
|
|
||||||
- [ ] Test media attachment federation
|
|
||||||
- [ ] Test with high-volume posts
|
|
||||||
- [ ] Test concurrent activity processing
|
|
||||||
- [ ] Test with different visibility levels
|
|
||||||
- [ ] Test with long posts (>500 chars)
|
|
||||||
- [ ] Test with special characters/emojis
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Sign-off
|
|
||||||
|
|
||||||
**Tested By**: _____________________
|
|
||||||
|
|
||||||
**Test Date**: _____________________
|
|
||||||
|
|
||||||
**Overall Result**: ☐ Pass / ☐ Fail
|
|
||||||
|
|
||||||
**Ready for Production**: ☐ Yes / ☐ No
|
|
||||||
|
|
||||||
**Notes**: ___________________________________________________________________________
|
|
||||||
|
|
||||||
__________________________________________________________________________
|
|
||||||
|
|
||||||
__________________________________________________________________________
|
|
||||||
|
|
||||||
__________________________________________________________________________
|
|
||||||
|
|
||||||
@@ -1,425 +0,0 @@
|
|||||||
# Follow Feature - User Guide
|
|
||||||
|
|
||||||
## Quick Start: How to Follow Fediverse Users
|
|
||||||
|
|
||||||
### Method 1: Via Search (Recommended)
|
|
||||||
|
|
||||||
1. Go to the search bar in Solar Network
|
|
||||||
2. Type the user's full address: `@username@domain.com`
|
|
||||||
- Example: `@alice@mastodon.social`
|
|
||||||
- Example: `@bob@pleroma.site`
|
|
||||||
3. Click on their profile in search results
|
|
||||||
4. Click the "Follow" button
|
|
||||||
5. Wait for acceptance (usually immediate)
|
|
||||||
6. ✅ Done! Their posts will now appear in your timeline
|
|
||||||
|
|
||||||
### Method 2: Via Profile URL
|
|
||||||
|
|
||||||
1. If you know their profile URL, visit it directly:
|
|
||||||
- Example: `https://mastodon.social/@alice`
|
|
||||||
2. Look for the "Follow" button on their profile
|
|
||||||
3. Click it to follow
|
|
||||||
4. ✅ You're now following them!
|
|
||||||
|
|
||||||
## What Happens When You Follow Someone
|
|
||||||
|
|
||||||
### The Technical Flow
|
|
||||||
```
|
|
||||||
You click "Follow"
|
|
||||||
↓
|
|
||||||
Solar Network creates Follow Activity
|
|
||||||
↓
|
|
||||||
Follow Activity is signed with your private key
|
|
||||||
↓
|
|
||||||
Solar Network sends Follow to their instance's inbox
|
|
||||||
↓
|
|
||||||
Their instance verifies your signature
|
|
||||||
↓
|
|
||||||
Their instance processes the Follow
|
|
||||||
↓
|
|
||||||
Their instance sends Accept Activity back
|
|
||||||
↓
|
|
||||||
Solar Network receives and processes Accept
|
|
||||||
↓
|
|
||||||
Relationship is stored in database
|
|
||||||
↓
|
|
||||||
Their public posts federate to Solar Network
|
|
||||||
```
|
|
||||||
|
|
||||||
### What You'll See
|
|
||||||
|
|
||||||
- ✅ **"Following..."** (while waiting for acceptance)
|
|
||||||
- ✅ **"Following" ✓** (when accepted)
|
|
||||||
- ✅ **Their posts** in your home timeline
|
|
||||||
- ✅ **Their likes, replies, boosts** on your posts
|
|
||||||
|
|
||||||
## Different Types of Accounts
|
|
||||||
|
|
||||||
### Regular Users
|
|
||||||
- Full ActivityPub support
|
|
||||||
- Follows work both ways
|
|
||||||
- Content federates normally
|
|
||||||
- Example: `@alice@mastodon.social`
|
|
||||||
|
|
||||||
### Locked Accounts
|
|
||||||
- User must manually approve followers
|
|
||||||
- You'll see "Pending" after clicking follow
|
|
||||||
- User receives notification to approve/deny
|
|
||||||
- Example: `@private@pleroma.site`
|
|
||||||
|
|
||||||
### Bot/Service Accounts
|
|
||||||
- Automated content accounts
|
|
||||||
- Often auto-accept follows
|
|
||||||
- Example: `@newsbot@botsin.space`
|
|
||||||
|
|
||||||
### Organizational Accounts
|
|
||||||
- Group or team accounts
|
|
||||||
- Example: `@team@company.social`
|
|
||||||
|
|
||||||
## Managing Your Follows
|
|
||||||
|
|
||||||
### View Who You're Following
|
|
||||||
|
|
||||||
**Go to**: Following page or `GET /api/activitypub/following`
|
|
||||||
|
|
||||||
You'll see:
|
|
||||||
- Username
|
|
||||||
- Display name
|
|
||||||
- Profile picture
|
|
||||||
- When you followed them
|
|
||||||
- Their instance (e.g., "Mastodon")
|
|
||||||
|
|
||||||
### Unfollowing Someone
|
|
||||||
|
|
||||||
**Method 1: Via UI**
|
|
||||||
1. Go to their profile
|
|
||||||
2. Click "Following" button (shows as active)
|
|
||||||
3. Click to unfollow
|
|
||||||
|
|
||||||
**Method 2: Via API**
|
|
||||||
```bash
|
|
||||||
curl -X POST http://solar.local:5000/api/activitypub/unfollow \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"message": "Unfollowed successfully"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Your Followers
|
|
||||||
|
|
||||||
**Go to**: Followers page or `GET /api/activitypub/followers`
|
|
||||||
|
|
||||||
You'll see:
|
|
||||||
- Users following you
|
|
||||||
- Their instance
|
|
||||||
- When they started following
|
|
||||||
- Whether they're local or from another instance
|
|
||||||
|
|
||||||
## Searching Fediverse Users
|
|
||||||
|
|
||||||
### How Search Works
|
|
||||||
|
|
||||||
1. **Type in search bar**: `@username@domain.com`
|
|
||||||
2. **Solar Network queries their instance**:
|
|
||||||
- Fetches their actor profile
|
|
||||||
- Checks if they're discoverable
|
|
||||||
3. **Shows results**:
|
|
||||||
- Profile picture
|
|
||||||
- Display name
|
|
||||||
- Bio
|
|
||||||
- Instance name
|
|
||||||
|
|
||||||
### Supported Search Formats
|
|
||||||
|
|
||||||
| Format | Example | Works? |
|
|
||||||
|--------|---------|--------|
|
|
||||||
| Full handle | `@alice@mastodon.social` | ✅ Yes |
|
|
||||||
| Username only | `alice` | ⚠️ May search local users first |
|
|
||||||
| Full URL | `https://mastodon.social/@alice` | ✅ Yes |
|
|
||||||
|
|
||||||
## Privacy Considerations
|
|
||||||
|
|
||||||
### Public Posts
|
|
||||||
- **What**: Posts visible to everyone
|
|
||||||
- **Federation**: ✅ Federates to all followers
|
|
||||||
- **Timeline**: Visible in public federated timelines
|
|
||||||
- **Example**: General updates, thoughts, content you want to share
|
|
||||||
|
|
||||||
### Private Posts
|
|
||||||
- **What**: Posts only visible to followers
|
|
||||||
- **Federation**: ✅ Federates to followers (including remote)
|
|
||||||
- **Timeline**: Only visible to your followers
|
|
||||||
- **Example**: Personal updates, questions
|
|
||||||
|
|
||||||
### Unlisted Posts
|
|
||||||
- **What**: Posts not in public timelines
|
|
||||||
- **Federation**: ✅ Federates but marked unlisted
|
|
||||||
- **Timeline**: Only followers see it
|
|
||||||
- **Example**: Limited audience content
|
|
||||||
|
|
||||||
### Followers-Only Posts
|
|
||||||
- **What**: Posts only to followers, no federated boost
|
|
||||||
- **Federation**: ⚠️ May not federate fully
|
|
||||||
- **Timeline**: Only your followers
|
|
||||||
- **Example**: Very sensitive content
|
|
||||||
|
|
||||||
## Following Etiquette
|
|
||||||
|
|
||||||
### Best Practices
|
|
||||||
|
|
||||||
1. **Check before following**:
|
|
||||||
- Read their bio and recent posts
|
|
||||||
- Make sure they're who you think they are
|
|
||||||
- Check if their content aligns with your interests
|
|
||||||
|
|
||||||
2. **Start with interactions**:
|
|
||||||
- Like a few posts first
|
|
||||||
- Reply thoughtfully
|
|
||||||
- Share interesting content
|
|
||||||
- Then follow if you want to see more
|
|
||||||
|
|
||||||
3. **Respect instance culture**:
|
|
||||||
- Each instance has its own norms
|
|
||||||
- Read their community guidelines
|
|
||||||
- Be mindful of local rules
|
|
||||||
|
|
||||||
4. **Don't spam**:
|
|
||||||
- Don't mass-follow users
|
|
||||||
- Don't send unwanted DMs
|
|
||||||
- Don't repeatedly like old posts
|
|
||||||
|
|
||||||
5. **Use appropriate post visibility**:
|
|
||||||
- Public for general content
|
|
||||||
- Unlisted for updates to followers
|
|
||||||
- Private for sensitive topics
|
|
||||||
|
|
||||||
### Red Flags to Watch
|
|
||||||
|
|
||||||
1. **Suspicious accounts**:
|
|
||||||
- Newly created with generic content
|
|
||||||
- Only posting promotional links
|
|
||||||
- Unusual following patterns
|
|
||||||
|
|
||||||
2. **Instances with poor moderation**:
|
|
||||||
- Lots of spam in public timelines
|
|
||||||
- Harassment goes unaddressed
|
|
||||||
- You may want to block the instance
|
|
||||||
|
|
||||||
3. **Content warnings not respected**:
|
|
||||||
- Users posting unmarked sensitive content
|
|
||||||
- You can report/block these users
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### "Follow button doesn't work"
|
|
||||||
|
|
||||||
**Possible causes**:
|
|
||||||
1. User doesn't exist
|
|
||||||
2. Instance is down
|
|
||||||
3. Network connectivity issue
|
|
||||||
|
|
||||||
**What to do**:
|
|
||||||
1. Verify the username/domain is correct
|
|
||||||
2. Try searching for them again
|
|
||||||
3. Check your internet connection
|
|
||||||
4. Try again in a few minutes
|
|
||||||
|
|
||||||
### "User doesn't appear in Following list"
|
|
||||||
|
|
||||||
**Possible causes**:
|
|
||||||
1. Follow was rejected (locked account)
|
|
||||||
2. Follow is still pending
|
|
||||||
3. Error in federation
|
|
||||||
|
|
||||||
**What to do**:
|
|
||||||
1. Check if their account is locked
|
|
||||||
2. Wait a few minutes for acceptance
|
|
||||||
3. Check your ActivityPub logs
|
|
||||||
4. Try following again
|
|
||||||
|
|
||||||
### "Can't find a user via search"
|
|
||||||
|
|
||||||
**Possible causes**:
|
|
||||||
1. Username/domain is wrong
|
|
||||||
2. User's instance is blocking your instance
|
|
||||||
3. User's profile is not discoverable
|
|
||||||
|
|
||||||
**What to do**:
|
|
||||||
1. Double-check the spelling
|
|
||||||
2. Try their full URL: `https://instance.com/@username`
|
|
||||||
3. Check if they're from a blocked instance
|
|
||||||
4. Contact them directly for their handle
|
|
||||||
|
|
||||||
## API Reference
|
|
||||||
|
|
||||||
### Follow a Remote User
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/follow`
|
|
||||||
|
|
||||||
**Request**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Success Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"message": "Follow request sent. Waiting for acceptance.",
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get Your Following
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/following?limit=50`
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "I love tech!",
|
|
||||||
"avatarUrl": "https://...",
|
|
||||||
"followedAt": "2024-01-15T10:30:00Z",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get Your Followers
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/followers?limit=50`
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://pleroma.site/users/bob",
|
|
||||||
"username": "bob",
|
|
||||||
"displayName": "Bob Jones",
|
|
||||||
"bio": "Federated user following me",
|
|
||||||
"avatarUrl": "https://...",
|
|
||||||
"followedAt": "2024-01-10T14:20:00Z",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "pleroma.site"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Search Users
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/search?query=@alice@domain.com&limit=20`
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "Tech enthusiast",
|
|
||||||
"avatarUrl": "https://...",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Real Examples
|
|
||||||
|
|
||||||
### Example 1: Following a Mastodon User
|
|
||||||
|
|
||||||
**What you do**:
|
|
||||||
1. Search for `@alice@mastodon.social`
|
|
||||||
2. Click on Alice's profile
|
|
||||||
3. Click "Follow" button
|
|
||||||
4. Wait 1-2 seconds
|
|
||||||
5. ✅ Alice appears in your "Following" list
|
|
||||||
6. ✅ Alice's public posts appear in your timeline
|
|
||||||
|
|
||||||
**What happens technically**:
|
|
||||||
- Solar Network sends Follow to Alice's Mastodon instance
|
|
||||||
- Alice's Mastodon auto-accepts (unless locked)
|
|
||||||
- Mastodon sends Accept back to Solar Network
|
|
||||||
- Relationship stored in both databases
|
|
||||||
- Alice's future posts federate to Solar Network
|
|
||||||
|
|
||||||
### Example 2: Following a Locked Account
|
|
||||||
|
|
||||||
**What you do**:
|
|
||||||
1. Search for `@private@pleroma.site`
|
|
||||||
2. Click "Follow" button
|
|
||||||
3. ✅ See "Following..." (pending)
|
|
||||||
4. Wait for user to approve
|
|
||||||
|
|
||||||
**What happens technically**:
|
|
||||||
- Solar Network sends Follow to private@pleroma.site
|
|
||||||
- Private user receives notification
|
|
||||||
- Private user manually approves the request
|
|
||||||
- Private user's instance sends Accept
|
|
||||||
- ✅ Now following!
|
|
||||||
|
|
||||||
### Example 3: Following a Bot Account
|
|
||||||
|
|
||||||
**What you do**:
|
|
||||||
1. Search for `@news@botsin.space`
|
|
||||||
2. Click "Follow" button
|
|
||||||
3. ✅ Immediately following (bots auto-accept)
|
|
||||||
|
|
||||||
**What happens technically**:
|
|
||||||
- Follow is auto-accepted
|
|
||||||
- News posts appear in your timeline
|
|
||||||
- Regular updates from the bot
|
|
||||||
|
|
||||||
## Key Differences from Traditional Social Media
|
|
||||||
|
|
||||||
| Aspect | Traditional Social | ActivityPub |
|
|
||||||
|---------|------------------|-------------|
|
|
||||||
| Central server | ❌ No | ✅ Yes (per instance) |
|
|
||||||
| Multiple platforms | ❌ No | ✅ Yes (Mastodon, Pleroma, etc.) |
|
|
||||||
| Data ownership | ❌ On their servers | ✅ On your server |
|
|
||||||
| Blocking | ❌ One platform | ✅ Per instance |
|
|
||||||
| Migration | ❌ Difficult | ✅ Use your own domain |
|
|
||||||
| Federation | ❌ No | ✅ Built-in |
|
|
||||||
|
|
||||||
## Getting Help
|
|
||||||
|
|
||||||
If you have issues following users:
|
|
||||||
|
|
||||||
1. **Check the main guide**: See `HOW_TO_FOLLOW_FEDIVERSE_USERS.md`
|
|
||||||
2. **Check your logs**: Look for ActivityPub errors
|
|
||||||
3. **Test the API**: Use curl to test follow endpoints directly
|
|
||||||
4. **Verify the user**: Make sure the user exists on their instance
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
Following fediverse users in Solar Network:
|
|
||||||
|
|
||||||
1. **Simple**: Just search and click "Follow"
|
|
||||||
2. **Works both ways**: You can follow them, they can follow you
|
|
||||||
3. **Works across instances**: Mastodon, Pleroma, Lemmy, etc.
|
|
||||||
4. **Federated content**: Their posts appear in your timeline
|
|
||||||
5. **Full interactions**: Like, reply, boost their posts
|
|
||||||
|
|
||||||
It works just like following on any other social platform, but with the added benefit of being able to follow users on completely different services! 🌍
|
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
# How to Follow (Subscribe to) Fediverse Users in Solar Network
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
In ActivityPub terminology, "subscribing" to a user is called **"following"**. This guide explains how users in Solar Network can follow users from other federated services (Mastodon, Pleroma, etc.).
|
|
||||||
|
|
||||||
## User Guide: How to Follow Fediverse Users
|
|
||||||
|
|
||||||
### Method 1: Via Search (Recommended)
|
|
||||||
|
|
||||||
1. **Search for the user**:
|
|
||||||
- Type their full address in the search bar: `@username@domain.com`
|
|
||||||
- Example: `@alice@mastodon.social`
|
|
||||||
- Example: `@bob@pleroma.site`
|
|
||||||
|
|
||||||
2. **View their profile**:
|
|
||||||
- Click on the search result
|
|
||||||
- You'll see their profile, bio, and recent posts
|
|
||||||
|
|
||||||
3. **Click "Follow" button**:
|
|
||||||
- Solar Network sends a Follow activity to their instance
|
|
||||||
- The remote instance will send back an Accept
|
|
||||||
- The user now appears in your "Following" list
|
|
||||||
|
|
||||||
### Method 2: Via Profile URL
|
|
||||||
|
|
||||||
1. **Visit their profile directly**:
|
|
||||||
- If you know their profile URL, visit it directly
|
|
||||||
- Example: `https://mastodon.social/@alice`
|
|
||||||
|
|
||||||
2. **Look for "Follow" button**:
|
|
||||||
- Click it to follow
|
|
||||||
|
|
||||||
3. **Confirm the follow**:
|
|
||||||
- Solar Network will send the follow request
|
|
||||||
- Wait for acceptance (usually immediate)
|
|
||||||
|
|
||||||
## What Happens Behind the Scenes
|
|
||||||
|
|
||||||
### The Follow Flow
|
|
||||||
|
|
||||||
```
|
|
||||||
User clicks "Follow"
|
|
||||||
↓
|
|
||||||
Solar Network creates Follow Activity
|
|
||||||
↓
|
|
||||||
Solar Network signs with publisher's private key
|
|
||||||
↓
|
|
||||||
Solar Network sends to remote user's inbox
|
|
||||||
↓
|
|
||||||
Remote instance verifies signature
|
|
||||||
↓
|
|
||||||
Remote instance processes the Follow
|
|
||||||
↓
|
|
||||||
Remote instance sends Accept Activity back
|
|
||||||
↓
|
|
||||||
Solar Network receives and processes Accept
|
|
||||||
↓
|
|
||||||
Relationship is established!
|
|
||||||
```
|
|
||||||
|
|
||||||
### Timeline Integration
|
|
||||||
|
|
||||||
Once you're following a user:
|
|
||||||
- ✅ Their public posts appear in your "Home" timeline
|
|
||||||
- ✅ Their posts are federated to your followers
|
|
||||||
- ✅ Their likes, replies, and boosts are visible
|
|
||||||
- ✅ You can interact with their content
|
|
||||||
|
|
||||||
## Following Different Types of Accounts
|
|
||||||
|
|
||||||
### Individual Users
|
|
||||||
- **What**: Regular users like you
|
|
||||||
- **Example**: `@alice@mastodon.social`
|
|
||||||
- **Works**: ✅ Full support
|
|
||||||
|
|
||||||
### Organizational/Bot Accounts
|
|
||||||
- **What**: Groups, bots, or organizations
|
|
||||||
- **Example**: `@official@newsbot.site`
|
|
||||||
- **Works**: ✅ Full support
|
|
||||||
|
|
||||||
### Locked Accounts
|
|
||||||
- **What**: Users who manually approve followers
|
|
||||||
- **Example**: `@private@pleroma.site`
|
|
||||||
- **Works**: ✅ Follow request sent, waits for approval
|
|
||||||
|
|
||||||
## Managing Your Follows
|
|
||||||
|
|
||||||
### View Who You're Following
|
|
||||||
|
|
||||||
**API Endpoint**: `GET /api/activitypub/following`
|
|
||||||
|
|
||||||
**Response Example**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "I love tech and coffee! ☕",
|
|
||||||
"avatarUrl": "https://cdn.mastodon.social/avatars/...",
|
|
||||||
"followedAt": "2024-01-15T10:30:00Z",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Unfollowing Someone
|
|
||||||
|
|
||||||
**API Endpoint**: `POST /api/activitypub/unfollow`
|
|
||||||
|
|
||||||
**Request Body**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"message": "Unfollowed successfully"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Searching Fediverse Users
|
|
||||||
|
|
||||||
**API Endpoint**: `GET /api/activitypub/search?query=@username@domain.com`
|
|
||||||
|
|
||||||
**Response Example**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "Software developer | Mastodon user",
|
|
||||||
"avatarUrl": "https://cdn.mastodon.social/avatars/...",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Follow States
|
|
||||||
|
|
||||||
| State | Meaning | What User Sees |
|
|
||||||
|--------|---------|----------------|
|
|
||||||
| Pending | Follow request sent, waiting for response | "Following..." (loading) |
|
|
||||||
| Accepted | Remote user accepted | "Following" ✓ |
|
|
||||||
| Rejected | Remote user declined | "Follow" button available again |
|
|
||||||
| Failed | Error occurred | "Error following" message |
|
|
||||||
|
|
||||||
## Privacy & Visibility
|
|
||||||
|
|
||||||
### Public Posts
|
|
||||||
- ✅ Federate to your followers automatically
|
|
||||||
- ✅ Appear in remote instances' timelines
|
|
||||||
- ✅ Can be boosted/liked by remote users
|
|
||||||
|
|
||||||
### Private Posts
|
|
||||||
- ❌ Do not federate
|
|
||||||
- ❌ Only visible to your local followers
|
|
||||||
- ❌ Not sent to remote instances
|
|
||||||
|
|
||||||
### Unlisted Posts
|
|
||||||
- ⚠️ Federate but not in public timelines
|
|
||||||
- ⚠️ Only visible to followers
|
|
||||||
|
|
||||||
## Best Practices for Users
|
|
||||||
|
|
||||||
### When Following Someone
|
|
||||||
|
|
||||||
1. **Check their profile first**:
|
|
||||||
- Make sure they're who you think they are
|
|
||||||
- Read their bio to understand their content
|
|
||||||
|
|
||||||
2. **Start with a few interactions**:
|
|
||||||
- Like a few posts
|
|
||||||
- Reply to something interesting
|
|
||||||
- Don't overwhelm their timeline
|
|
||||||
|
|
||||||
3. **Respect their instance's rules**:
|
|
||||||
- Each instance has its own guidelines
|
|
||||||
- Read community rules before interacting
|
|
||||||
|
|
||||||
4. **Report spam/harassment**:
|
|
||||||
- Use instance blocking features
|
|
||||||
- Report to instance admins
|
|
||||||
|
|
||||||
### Following Across Instances
|
|
||||||
|
|
||||||
1. **Use their full address**:
|
|
||||||
- `@username@instance.com`
|
|
||||||
- This helps identify which instance they're on
|
|
||||||
|
|
||||||
2. **Be aware of instance culture**:
|
|
||||||
- Each instance has its own norms
|
|
||||||
- Some are more technical, others more casual
|
|
||||||
|
|
||||||
3. **Check if they're from your instance**:
|
|
||||||
- Local users show `isLocal: true`
|
|
||||||
- Usually faster interaction
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### "Follow button doesn't work"
|
|
||||||
|
|
||||||
**Possible Causes**:
|
|
||||||
1. User doesn't exist
|
|
||||||
2. Instance is down
|
|
||||||
3. Network issue
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Verify the user's address is correct
|
|
||||||
2. Check if the instance is accessible
|
|
||||||
3. Check your internet connection
|
|
||||||
4. Try again in a few minutes
|
|
||||||
|
|
||||||
### "User doesn't appear in Following list"
|
|
||||||
|
|
||||||
**Possible Causes**:
|
|
||||||
1. Follow was rejected
|
|
||||||
2. Still waiting for acceptance (locked accounts)
|
|
||||||
3. Error in federation
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Check the follow status via API
|
|
||||||
2. Try following again
|
|
||||||
3. Check if their account is locked
|
|
||||||
4. Contact support if issue persists
|
|
||||||
|
|
||||||
### "Can't find a user"
|
|
||||||
|
|
||||||
**Possible Causes**:
|
|
||||||
1. Wrong username or domain
|
|
||||||
2. User doesn't exist
|
|
||||||
3. Instance blocking your instance
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. Double-check the address
|
|
||||||
2. Try searching from a different instance
|
|
||||||
3. Contact the user directly for their handle
|
|
||||||
|
|
||||||
## API Reference
|
|
||||||
|
|
||||||
### Follow a Remote User
|
|
||||||
|
|
||||||
**Endpoint**: `POST /api/activitypub/follow`
|
|
||||||
|
|
||||||
**Request**:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**: `200 OK`
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"success": true,
|
|
||||||
"message": "Follow request sent. Waiting for acceptance.",
|
|
||||||
"targetActorUri": "https://mastodon.social/users/alice"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get Following List
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/following?limit=50`
|
|
||||||
|
|
||||||
**Response**: `200 OK`
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "...",
|
|
||||||
"avatarUrl": "...",
|
|
||||||
"followedAt": "2024-01-15T10:30:00Z",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get Followers List
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/followers?limit=50`
|
|
||||||
|
|
||||||
**Response**: `200 OK`
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "...",
|
|
||||||
"avatarUrl": "...",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Search Users
|
|
||||||
|
|
||||||
**Endpoint**: `GET /api/activitypub/search?query=alice&limit=20`
|
|
||||||
|
|
||||||
**Response**: `200 OK`
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"actorUri": "https://mastodon.social/users/alice",
|
|
||||||
"username": "alice",
|
|
||||||
"displayName": "Alice Smith",
|
|
||||||
"bio": "...",
|
|
||||||
"avatarUrl": "...",
|
|
||||||
"isLocal": false,
|
|
||||||
"instanceDomain": "mastodon.social"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## What's Different About ActivityPub Following?
|
|
||||||
|
|
||||||
Unlike traditional social media:
|
|
||||||
|
|
||||||
| Feature | Traditional Social | ActivityPub |
|
|
||||||
|---------|------------------|-------------|
|
|
||||||
| Central server | ✅ Yes | ❌ No - federated |
|
|
||||||
| All users on same platform | ✅ Yes | ❌ No - multiple platforms |
|
|
||||||
| Blocked instances | ❌ No | ✅ Yes - instance blocking |
|
|
||||||
| Following across platforms | ❌ No | ✅ Yes - works with Mastodon, Pleroma, etc. |
|
|
||||||
| Your data stays on your server | ❌ Maybe | ✅ Yes - you control your data |
|
|
||||||
|
|
||||||
## User Experience Considerations
|
|
||||||
|
|
||||||
### Making It Easy
|
|
||||||
|
|
||||||
1. **Auto-discovery**:
|
|
||||||
- When users search for `@username`, suggest `@username@domain.com`
|
|
||||||
- Offer to search the fediverse
|
|
||||||
|
|
||||||
2. **Clear UI feedback**:
|
|
||||||
- Show "Follow request sent..."
|
|
||||||
- Show "They accepted!" notification
|
|
||||||
- Show "Follow request rejected" message
|
|
||||||
|
|
||||||
3. **Helpful tooltips**:
|
|
||||||
- Explain what ActivityPub is
|
|
||||||
- Show which instance a user is from
|
|
||||||
- Explain locked accounts
|
|
||||||
|
|
||||||
4. **Profile badges**:
|
|
||||||
- Show instance icon/logo
|
|
||||||
- Show if user is from same instance
|
|
||||||
- Show if user is verified
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Following a Mastodon User
|
|
||||||
|
|
||||||
**User searches**: `@alice@mastodon.social`
|
|
||||||
|
|
||||||
**What happens**:
|
|
||||||
1. Solar Network fetches Alice's actor profile
|
|
||||||
2. Solar Network stores Alice in `fediverse_actors`
|
|
||||||
3. Solar Network sends Follow to Alice's inbox
|
|
||||||
4. Alice's instance accepts
|
|
||||||
5. Solar Network stores relationship in `fediverse_relationships`
|
|
||||||
6. Alice's posts now appear in user's timeline
|
|
||||||
|
|
||||||
### Following a Local User
|
|
||||||
|
|
||||||
**User searches**: `@bob`
|
|
||||||
|
|
||||||
**What happens**:
|
|
||||||
1. Solar Network finds Bob's publisher
|
|
||||||
2. Relationship created locally (no federation needed)
|
|
||||||
3. Bob's posts appear in user's timeline immediately
|
|
||||||
4. Same as traditional social media following
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
Following fediverse users in Solar Network:
|
|
||||||
|
|
||||||
1. **Search by `@username@domain.com`** - Works for any ActivityPub instance
|
|
||||||
2. **Click "Follow"** - Sends federated follow request
|
|
||||||
3. **Wait for acceptance** - Remote user can approve or auto-accept
|
|
||||||
4. **See their posts in your timeline** - Content federates to you
|
|
||||||
5. **Interact normally** - Like, reply, boost, etc.
|
|
||||||
|
|
||||||
All of this is handled automatically by the ActivityPub implementation!
|
|
||||||
@@ -1,298 +0,0 @@
|
|||||||
# ActivityPub UI Implementation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Complete UI implementation for ActivityPub features in Solian client, including search, following, and followers screens.
|
|
||||||
|
|
||||||
## Created Files
|
|
||||||
|
|
||||||
### 1. Widgets (`lib/widgets/activitypub/`)
|
|
||||||
|
|
||||||
#### `activitypub.dart`
|
|
||||||
- **Purpose**: Export file for ActivityPub widgets
|
|
||||||
- **Exports**: `ActivityPubUserListItem`
|
|
||||||
|
|
||||||
#### `user_list_item.dart`
|
|
||||||
- **Purpose**: Reusable list item widget for displaying ActivityPub users
|
|
||||||
- **Features**:
|
|
||||||
- Avatar with remote instance indicator (public icon)
|
|
||||||
- Display name with instance badge (e.g., "mastodon.social")
|
|
||||||
- Bio with truncation (max 2 lines)
|
|
||||||
- Followed at timestamp (relative time)
|
|
||||||
- Follow/Unfollow buttons with loading states
|
|
||||||
- Tap callback for navigation to profile
|
|
||||||
|
|
||||||
### 2. Screens (`lib/screens/activitypub/`)
|
|
||||||
|
|
||||||
#### `activitypub.dart`
|
|
||||||
- **Purpose**: Export file for ActivityPub screens
|
|
||||||
- **Exports**: `ActivityPubSearchScreen`, `ActivityPubListScreen`
|
|
||||||
|
|
||||||
#### `search.dart`
|
|
||||||
- **Purpose**: Search and follow ActivityPub users from other instances
|
|
||||||
- **Features**:
|
|
||||||
- Search bar with 500ms debounce
|
|
||||||
- Real-time search results
|
|
||||||
- Instant follow/unfollow actions
|
|
||||||
- Local tracking of followed users
|
|
||||||
- Empty states for no search and no results
|
|
||||||
- Refresh support via pull-to-refresh
|
|
||||||
- User feedback via snack bars
|
|
||||||
- **User Flow**:
|
|
||||||
1. User enters search query (e.g., `@alice@mastodon.social`)
|
|
||||||
2. Results appear after debounce
|
|
||||||
3. User taps "Follow" → Follow request sent
|
|
||||||
4. Success message shown
|
|
||||||
5. Button updates to "Unfollow"
|
|
||||||
|
|
||||||
#### `list.dart`
|
|
||||||
- **Purpose**: Display following/followers lists
|
|
||||||
- **Features**:
|
|
||||||
- Reusable for both Following and Followers
|
|
||||||
- Local state management
|
|
||||||
- Per-user loading states during actions
|
|
||||||
- Empty states with helpful hints
|
|
||||||
- Refresh support
|
|
||||||
- Auto-update lists when actions occur
|
|
||||||
- **Types**:
|
|
||||||
- `ActivityPubListType.following`: Shows users you follow
|
|
||||||
- `ActivityPubListType.followers`: Shows users who follow you
|
|
||||||
- **User Flow**:
|
|
||||||
1. User opens Following/Followers screen
|
|
||||||
2. List loads from API
|
|
||||||
3. User can unfollow (Following tab) or follow (Followers tab)
|
|
||||||
4. List updates automatically
|
|
||||||
5. Success/error messages shown
|
|
||||||
|
|
||||||
## Design Patterns
|
|
||||||
|
|
||||||
### Follows Project Conventions
|
|
||||||
|
|
||||||
1. **Material 3 Design**: All widgets use Material 3 components
|
|
||||||
2. **Styled Widget Package**: Used for `.padding()`, `.textColor()`, etc.
|
|
||||||
3. **Riverpod State Management**: Hooks for local state, providers for global state
|
|
||||||
4. **Error Handling**: `showErrorAlert()` from `alert.dart` for user feedback
|
|
||||||
5. **Success Feedback**: `showSnackBar()` for quick notifications
|
|
||||||
6. **Localization**: All strings use `.tr()` with placeholder args
|
|
||||||
|
|
||||||
### Color Scheme & Theming
|
|
||||||
|
|
||||||
- **Remote Badge**: Uses `Theme.colorScheme.primary` for indicator
|
|
||||||
- **Instance Tag**: Uses `Theme.colorScheme.secondaryContainer`
|
|
||||||
- **Text Colors**: Adaptive based on theme (dark/light)
|
|
||||||
- **States**: Loading indicators with standard `CircularProgressIndicator`
|
|
||||||
|
|
||||||
### Spacing & Layout
|
|
||||||
|
|
||||||
- **List Item Padding**: `EdgeInsets.only(left: 16, right: 12)`
|
|
||||||
- **Avatar Size**: 24px radius (48px diameter)
|
|
||||||
- **Badge Size**: Small (10px font) with 6px horizontal padding
|
|
||||||
- **Button Size**: Minimum 88px width, 36px height
|
|
||||||
|
|
||||||
## Translations Added
|
|
||||||
|
|
||||||
### New Keys in `assets/i18n/en-US.json`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"searchFediverse": "Search Fediverse",
|
|
||||||
"searchFediverseHint": "Search by address, e.g. {}",
|
|
||||||
"searchFediverseEmpty": "Search for users on other ActivityPub instances",
|
|
||||||
"searchFediverseNoResults": "No users found for this search",
|
|
||||||
"following": "Following",
|
|
||||||
"followers": "Followers",
|
|
||||||
"follow": "Follow",
|
|
||||||
"unfollow": "Unfollow",
|
|
||||||
"followedUser": "Followed @{}",
|
|
||||||
"unfollowedUser": "Unfollowed @{}",
|
|
||||||
"followingEmpty": "You're not following anyone yet",
|
|
||||||
"followersEmpty": "No followers yet",
|
|
||||||
"followingEmptyHint": "Start by searching for users or explore other instances"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage Examples
|
|
||||||
|
|
||||||
### Using Search Screen
|
|
||||||
|
|
||||||
```dart
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:island/screens/activitypub/activitypub.dart';
|
|
||||||
|
|
||||||
// In navigation or route
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => const ActivityPubSearchScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Or using go_router
|
|
||||||
context.push('/activitypub/search');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using List Screen
|
|
||||||
|
|
||||||
```dart
|
|
||||||
// Following
|
|
||||||
ActivityPubListScreen(
|
|
||||||
type: ActivityPubListType.following,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Followers
|
|
||||||
ActivityPubListScreen(
|
|
||||||
type: ActivityPubListType.followers,
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using User List Item Widget
|
|
||||||
|
|
||||||
```dart
|
|
||||||
ActivityPubUserListItem(
|
|
||||||
user: user,
|
|
||||||
isFollowing: isFollowing,
|
|
||||||
isLoading: isLoading,
|
|
||||||
onFollow: () => handleFollow(user),
|
|
||||||
onUnfollow: () => handleUnfollow(user),
|
|
||||||
onTap: () => navigateToProfile(user),
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Integration Points
|
|
||||||
|
|
||||||
### Navigation Integration
|
|
||||||
|
|
||||||
To add ActivityPub screens to navigation:
|
|
||||||
|
|
||||||
1. **Option A**: Add to existing tab/navigation structure
|
|
||||||
2. **Option B**: Add as standalone routes in `go_router`
|
|
||||||
3. **Option C**: Add to profile menu overflow menu
|
|
||||||
|
|
||||||
### Service Integration
|
|
||||||
|
|
||||||
All screens use `activityPubServiceProvider`:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
import 'package:island/services/activitypub_service.dart';
|
|
||||||
|
|
||||||
final service = ref.read(activityPubServiceProvider);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
|
|
||||||
All errors are caught and displayed using:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
try {
|
|
||||||
// API call
|
|
||||||
} catch (err) {
|
|
||||||
showErrorAlert(err);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing Checklist
|
|
||||||
|
|
||||||
- [ ] Search for existing Mastodon user
|
|
||||||
- [ ] Search for Pleroma user
|
|
||||||
- [ ] Follow a user
|
|
||||||
- [ ] Unfollow a user
|
|
||||||
- [ ] View following list
|
|
||||||
- [ ] View followers list
|
|
||||||
- [ ] Test empty states
|
|
||||||
- [ ] Test loading states
|
|
||||||
- [ ] Test error handling
|
|
||||||
- [ ] Test dark mode
|
|
||||||
- [ ] Test RTL languages (if supported)
|
|
||||||
|
|
||||||
## Technical Details
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
**Already in project**:
|
|
||||||
- ✅ `cached_network_image` - For avatar images
|
|
||||||
- ✅ `easy_localization` - For translations
|
|
||||||
- ✅ `hooks_riverpod` - For state management
|
|
||||||
- ✅ `flutter_hooks` - For hooks (useState, useEffect, etc.)
|
|
||||||
- ✅ `material_symbols_icons` - For icons
|
|
||||||
- ✅ `relative_time` - For timestamp formatting
|
|
||||||
- ✅ `island/services/activitypub_service.dart` - API service (created earlier)
|
|
||||||
- ✅ `island/widgets/alert.dart` - Error/success dialogs
|
|
||||||
- ✅ `island/models/activitypub.dart` - Data models (created earlier)
|
|
||||||
|
|
||||||
### Performance Considerations
|
|
||||||
|
|
||||||
1. **Debounced Search**: 500ms delay prevents excessive API calls
|
|
||||||
2. **Local State Tracking**: `followingUris` Set prevents duplicate API calls
|
|
||||||
3. **Conditional Rebuilds**: Widget only rebuilds when necessary
|
|
||||||
4. **Image Caching**: Uses `CachedNetworkImageProvider` for avatars
|
|
||||||
|
|
||||||
### Accessibility
|
|
||||||
|
|
||||||
1. **Semantic Labels**: All ListTile widgets have proper content
|
|
||||||
2. **Touch Targets**: Minimum 44px touch targets for buttons
|
|
||||||
3. **Color Contrast**: Follows Material 3 color guidelines
|
|
||||||
4. **Loading Indicators**: Visual feedback during async operations
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
### Potential Additions
|
|
||||||
|
|
||||||
1. **Profile Integration**: Show ActivityPub profile details
|
|
||||||
2. **Post Timeline**: Show federated posts from followed users
|
|
||||||
3. **Instance Blocking**: Block entire ActivityPub instances
|
|
||||||
4. **Advanced Search**: Filter by instance, user type, etc.
|
|
||||||
5. **Batch Actions**: Follow/unfollow multiple users at once
|
|
||||||
6. **Suggested Users**: Show recommended users to follow
|
|
||||||
7. **Recent Activity**: Show recent interactions
|
|
||||||
8. **Notifications**: Follow/unfollow notifications
|
|
||||||
|
|
||||||
### Localization
|
|
||||||
|
|
||||||
Need to add same keys to other language files:
|
|
||||||
- `es-ES.json`
|
|
||||||
- `ja-JP.json`
|
|
||||||
- `ko-KR.json`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
## Browser Testing
|
|
||||||
|
|
||||||
Test with real ActivityPub instances:
|
|
||||||
- mastodon.social
|
|
||||||
- pixelfed.social
|
|
||||||
- lemmy.world
|
|
||||||
- pleroma.site
|
|
||||||
- fosstodon.org
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
1. **Search returns no results**
|
|
||||||
- Check if user exists on remote instance
|
|
||||||
- Verify instance is accessible
|
|
||||||
- Try full URL instead of handle
|
|
||||||
|
|
||||||
2. **Follow button not working**
|
|
||||||
- Check if user is already following
|
|
||||||
- Verify server is online
|
|
||||||
- Check API logs
|
|
||||||
|
|
||||||
3. **Avatar not loading**
|
|
||||||
- Check remote avatar URL
|
|
||||||
- Verify network connection
|
|
||||||
- Check image cache
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
✅ **Fully functional ActivityPub UI** with:
|
|
||||||
- Search screen for discovering fediverse users
|
|
||||||
- Following/Followers list screens
|
|
||||||
- Reusable user list item component
|
|
||||||
- Proper error handling and user feedback
|
|
||||||
- Material 3 design
|
|
||||||
- Responsive layout
|
|
||||||
- Local state management
|
|
||||||
- Debounced search
|
|
||||||
- Empty states and loading indicators
|
|
||||||
|
|
||||||
**Ready for integration into main app navigation!** 🎉
|
|
||||||
@@ -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,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ final List<RouteItem> kAvailableRoutes = [
|
|||||||
icon: Symbols.explore,
|
icon: Symbols.explore,
|
||||||
),
|
),
|
||||||
RouteItem(
|
RouteItem(
|
||||||
name: 'searchPosts'.tr(),
|
name: 'universalSearch'.tr(),
|
||||||
path: '/posts/search',
|
path: '/search',
|
||||||
description: 'searchPostsDescription'.tr(),
|
description: 'universalSearchDescription'.tr(),
|
||||||
searchableAliases: ['search', 'posts'],
|
searchableAliases: ['search', 'universal', 'fediverse'],
|
||||||
icon: Symbols.search,
|
icon: Symbols.search,
|
||||||
),
|
),
|
||||||
RouteItem(
|
RouteItem(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'activity_rpc.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(presenceActivities)
|
@ProviderFor(presenceActivities)
|
||||||
const presenceActivitiesProvider = PresenceActivitiesFamily._();
|
final presenceActivitiesProvider = PresenceActivitiesFamily._();
|
||||||
|
|
||||||
final class PresenceActivitiesProvider
|
final class PresenceActivitiesProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class PresenceActivitiesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnPresenceActivity>>,
|
$FutureModifier<List<SnPresenceActivity>>,
|
||||||
$FutureProvider<List<SnPresenceActivity>> {
|
$FutureProvider<List<SnPresenceActivity>> {
|
||||||
const PresenceActivitiesProvider._({
|
PresenceActivitiesProvider._({
|
||||||
required PresenceActivitiesFamily super.from,
|
required PresenceActivitiesFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -71,7 +71,7 @@ String _$presenceActivitiesHash() =>
|
|||||||
|
|
||||||
final class PresenceActivitiesFamily extends $Family
|
final class PresenceActivitiesFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<SnPresenceActivity>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<SnPresenceActivity>>, String> {
|
||||||
const PresenceActivitiesFamily._()
|
PresenceActivitiesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'presenceActivitiesProvider',
|
name: r'presenceActivitiesProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ final articleDetailProvider = FutureProvider.autoDispose
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await dio.get<Map<String, dynamic>>(
|
final response = await dio.get<Map<String, dynamic>>(
|
||||||
'/sphere/feeds/articles/$articleId',
|
'/insight/feeds/articles/$articleId',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200 && response.data != null) {
|
if (response.statusCode == 200 && response.data != null) {
|
||||||
|
|||||||
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,11 +10,11 @@ part of 'call.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(CallNotifier)
|
@ProviderFor(CallNotifier)
|
||||||
const callProvider = CallNotifierProvider._();
|
final callProvider = CallNotifierProvider._();
|
||||||
|
|
||||||
final class CallNotifierProvider
|
final class CallNotifierProvider
|
||||||
extends $NotifierProvider<CallNotifier, CallState> {
|
extends $NotifierProvider<CallNotifier, CallState> {
|
||||||
const CallNotifierProvider._()
|
CallNotifierProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -48,7 +48,6 @@ abstract class _$CallNotifier extends $Notifier<CallState> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
final ref = this.ref as $Ref<CallState, CallState>;
|
final ref = this.ref as $Ref<CallState, CallState>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -58,6 +57,6 @@ abstract class _$CallNotifier extends $Notifier<CallState> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'chat_online_count.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(ChatOnlineCountNotifier)
|
@ProviderFor(ChatOnlineCountNotifier)
|
||||||
const chatOnlineCountProvider = ChatOnlineCountNotifierFamily._();
|
final chatOnlineCountProvider = ChatOnlineCountNotifierFamily._();
|
||||||
|
|
||||||
final class ChatOnlineCountNotifierProvider
|
final class ChatOnlineCountNotifierProvider
|
||||||
extends $AsyncNotifierProvider<ChatOnlineCountNotifier, int> {
|
extends $AsyncNotifierProvider<ChatOnlineCountNotifier, int> {
|
||||||
const ChatOnlineCountNotifierProvider._({
|
ChatOnlineCountNotifierProvider._({
|
||||||
required ChatOnlineCountNotifierFamily super.from,
|
required ChatOnlineCountNotifierFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -63,7 +63,7 @@ final class ChatOnlineCountNotifierFamily extends $Family
|
|||||||
FutureOr<int>,
|
FutureOr<int>,
|
||||||
String
|
String
|
||||||
> {
|
> {
|
||||||
const ChatOnlineCountNotifierFamily._()
|
ChatOnlineCountNotifierFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'chatOnlineCountProvider',
|
name: r'chatOnlineCountProvider',
|
||||||
@@ -87,7 +87,6 @@ abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier<int> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -97,6 +96,6 @@ abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier<int> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'chat_room.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(ChatRoomJoinedNotifier)
|
@ProviderFor(ChatRoomJoinedNotifier)
|
||||||
const chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._();
|
final chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._();
|
||||||
|
|
||||||
final class ChatRoomJoinedNotifierProvider
|
final class ChatRoomJoinedNotifierProvider
|
||||||
extends $AsyncNotifierProvider<ChatRoomJoinedNotifier, List<SnChatRoom>> {
|
extends $AsyncNotifierProvider<ChatRoomJoinedNotifier, List<SnChatRoom>> {
|
||||||
const ChatRoomJoinedNotifierProvider._()
|
ChatRoomJoinedNotifierProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -42,7 +42,6 @@ abstract class _$ChatRoomJoinedNotifier
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
final ref =
|
final ref =
|
||||||
this.ref as $Ref<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>;
|
this.ref as $Ref<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>;
|
||||||
final element =
|
final element =
|
||||||
@@ -53,16 +52,16 @@ abstract class _$ChatRoomJoinedNotifier
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(ChatRoomNotifier)
|
@ProviderFor(ChatRoomNotifier)
|
||||||
const chatRoomProvider = ChatRoomNotifierFamily._();
|
final chatRoomProvider = ChatRoomNotifierFamily._();
|
||||||
|
|
||||||
final class ChatRoomNotifierProvider
|
final class ChatRoomNotifierProvider
|
||||||
extends $AsyncNotifierProvider<ChatRoomNotifier, SnChatRoom?> {
|
extends $AsyncNotifierProvider<ChatRoomNotifier, SnChatRoom?> {
|
||||||
const ChatRoomNotifierProvider._({
|
ChatRoomNotifierProvider._({
|
||||||
required ChatRoomNotifierFamily super.from,
|
required ChatRoomNotifierFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -109,7 +108,7 @@ final class ChatRoomNotifierFamily extends $Family
|
|||||||
FutureOr<SnChatRoom?>,
|
FutureOr<SnChatRoom?>,
|
||||||
String?
|
String?
|
||||||
> {
|
> {
|
||||||
const ChatRoomNotifierFamily._()
|
ChatRoomNotifierFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'chatRoomProvider',
|
name: r'chatRoomProvider',
|
||||||
@@ -133,7 +132,6 @@ abstract class _$ChatRoomNotifier extends $AsyncNotifier<SnChatRoom?> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref = this.ref as $Ref<AsyncValue<SnChatRoom?>, SnChatRoom?>;
|
final ref = this.ref as $Ref<AsyncValue<SnChatRoom?>, SnChatRoom?>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -143,16 +141,16 @@ abstract class _$ChatRoomNotifier extends $AsyncNotifier<SnChatRoom?> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(ChatRoomIdentityNotifier)
|
@ProviderFor(ChatRoomIdentityNotifier)
|
||||||
const chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._();
|
final chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._();
|
||||||
|
|
||||||
final class ChatRoomIdentityNotifierProvider
|
final class ChatRoomIdentityNotifierProvider
|
||||||
extends $AsyncNotifierProvider<ChatRoomIdentityNotifier, SnChatMember?> {
|
extends $AsyncNotifierProvider<ChatRoomIdentityNotifier, SnChatMember?> {
|
||||||
const ChatRoomIdentityNotifierProvider._({
|
ChatRoomIdentityNotifierProvider._({
|
||||||
required ChatRoomIdentityNotifierFamily super.from,
|
required ChatRoomIdentityNotifierFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -201,7 +199,7 @@ final class ChatRoomIdentityNotifierFamily extends $Family
|
|||||||
FutureOr<SnChatMember?>,
|
FutureOr<SnChatMember?>,
|
||||||
String?
|
String?
|
||||||
> {
|
> {
|
||||||
const ChatRoomIdentityNotifierFamily._()
|
ChatRoomIdentityNotifierFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'chatRoomIdentityProvider',
|
name: r'chatRoomIdentityProvider',
|
||||||
@@ -226,7 +224,6 @@ abstract class _$ChatRoomIdentityNotifier
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref = this.ref as $Ref<AsyncValue<SnChatMember?>, SnChatMember?>;
|
final ref = this.ref as $Ref<AsyncValue<SnChatMember?>, SnChatMember?>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -236,12 +233,12 @@ abstract class _$ChatRoomIdentityNotifier
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(chatroomInvites)
|
@ProviderFor(chatroomInvites)
|
||||||
const chatroomInvitesProvider = ChatroomInvitesProvider._();
|
final chatroomInvitesProvider = ChatroomInvitesProvider._();
|
||||||
|
|
||||||
final class ChatroomInvitesProvider
|
final class ChatroomInvitesProvider
|
||||||
extends
|
extends
|
||||||
@@ -253,7 +250,7 @@ final class ChatroomInvitesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnChatMember>>,
|
$FutureModifier<List<SnChatMember>>,
|
||||||
$FutureProvider<List<SnChatMember>> {
|
$FutureProvider<List<SnChatMember>> {
|
||||||
const ChatroomInvitesProvider._()
|
ChatroomInvitesProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ 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";
|
||||||
import "package:island/pods/chat/messages_notifier.dart";
|
import "package:island/pods/chat/messages_notifier.dart";
|
||||||
import "package:island/pods/websocket.dart";
|
import "package:island/pods/websocket.dart";
|
||||||
|
import "package:island/talker.dart";
|
||||||
import "package:island/widgets/chat/call_button.dart";
|
import "package:island/widgets/chat/call_button.dart";
|
||||||
import "package:riverpod_annotation/riverpod_annotation.dart";
|
import "package:riverpod_annotation/riverpod_annotation.dart";
|
||||||
|
|
||||||
@@ -35,6 +38,22 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
Timer? _typingCooldownTimer;
|
Timer? _typingCooldownTimer;
|
||||||
Timer? _periodicSubscribeTimer;
|
Timer? _periodicSubscribeTimer;
|
||||||
StreamSubscription? _wsSubscription;
|
StreamSubscription? _wsSubscription;
|
||||||
|
Function? _sendMessage;
|
||||||
|
|
||||||
|
void _cleanupResources() {
|
||||||
|
if (_wsSubscription != null) {
|
||||||
|
_wsSubscription!.cancel();
|
||||||
|
_wsSubscription = null;
|
||||||
|
}
|
||||||
|
if (_typingCleanupTimer != null) {
|
||||||
|
_typingCleanupTimer!.cancel();
|
||||||
|
_typingCleanupTimer = null;
|
||||||
|
}
|
||||||
|
if (_periodicSubscribeTimer != null) {
|
||||||
|
_periodicSubscribeTimer!.cancel();
|
||||||
|
_periodicSubscribeTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<SnChatMember> build(String roomId) {
|
List<SnChatMember> build(String roomId) {
|
||||||
@@ -43,6 +62,8 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId));
|
final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
_messagesNotifier = ref.watch(messagesProvider(roomId).notifier);
|
_messagesNotifier = ref.watch(messagesProvider(roomId).notifier);
|
||||||
|
|
||||||
|
_cleanupResources();
|
||||||
|
|
||||||
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -56,7 +77,9 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
// Subscribe to messages
|
// Subscribe to messages
|
||||||
final wsState = ref.read(websocketStateProvider.notifier);
|
final wsState = ref.read(websocketStateProvider.notifier);
|
||||||
wsState.sendMessage(
|
_sendMessage = wsState.sendMessage;
|
||||||
|
talker.info('[MessageSubscriber] Subscribing room $roomId');
|
||||||
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.subscribe',
|
type: 'messages.subscribe',
|
||||||
@@ -93,7 +116,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
// Set up periodic subscribe timer (every 5 minutes)
|
// Set up periodic subscribe timer (every 5 minutes)
|
||||||
_periodicSubscribeTimer = Timer.periodic(const Duration(minutes: 5), (_) {
|
_periodicSubscribeTimer = Timer.periodic(const Duration(minutes: 5), (_) {
|
||||||
wsState.sendMessage(
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.subscribe',
|
type: 'messages.subscribe',
|
||||||
@@ -104,14 +127,13 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen to app lifecycle changes
|
|
||||||
ref.listen(appLifecycleStateProvider, (previous, next) {
|
ref.listen(appLifecycleStateProvider, (previous, next) {
|
||||||
final lifecycleState = next.value;
|
final lifecycleState = next.value;
|
||||||
if (lifecycleState == AppLifecycleState.paused ||
|
if (lifecycleState == AppLifecycleState.paused ||
|
||||||
lifecycleState == AppLifecycleState.inactive) {
|
lifecycleState == AppLifecycleState.inactive) {
|
||||||
// Unsubscribe when app goes to background
|
// Unsubscribe when app goes to background
|
||||||
final wsState = ref.read(websocketStateProvider.notifier);
|
talker.info('[MessageSubscriber] Unsubscribing room $roomId');
|
||||||
wsState.sendMessage(
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.unsubscribe',
|
type: 'messages.unsubscribe',
|
||||||
@@ -122,8 +144,8 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
);
|
);
|
||||||
} else if (lifecycleState == AppLifecycleState.resumed) {
|
} else if (lifecycleState == AppLifecycleState.resumed) {
|
||||||
// Resubscribe when app comes back to foreground
|
// Resubscribe when app comes back to foreground
|
||||||
final wsState = ref.read(websocketStateProvider.notifier);
|
talker.info('[MessageSubscriber] Subscribing room $roomId');
|
||||||
wsState.sendMessage(
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.subscribe',
|
type: 'messages.subscribe',
|
||||||
@@ -135,10 +157,15 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup on dispose
|
final subscribedNotifier = ref.watch(
|
||||||
ref.onDispose(() {
|
currentSubscribedChatIdProvider.notifier,
|
||||||
ref.read(currentSubscribedChatIdProvider.notifier).set(null);
|
);
|
||||||
wsState.sendMessage(
|
|
||||||
|
ref.onCancel(() {
|
||||||
|
talker.info('[MessageSubscriber] Unsubscribing room $roomId');
|
||||||
|
subscribedNotifier.set(null);
|
||||||
|
try {
|
||||||
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.unsubscribe',
|
type: 'messages.unsubscribe',
|
||||||
@@ -147,16 +174,33 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
_wsSubscription?.cancel();
|
} catch (e, stackTrace) {
|
||||||
_typingCleanupTimer?.cancel();
|
talker.error(
|
||||||
_typingCooldownTimer?.cancel();
|
'[MessageSubscriber] Error sending unsubscribe message for room $roomId: $e\n$stackTrace',
|
||||||
_periodicSubscribeTimer?.cancel();
|
);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
_cleanupResources();
|
||||||
|
} catch (e, stackTrace) {
|
||||||
|
talker.error(
|
||||||
|
'[MessageSubscriber] Error during cleanup for room $roomId: $e\n$stackTrace',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (_typingCooldownTimer != null) {
|
||||||
|
_typingCooldownTimer!.cancel();
|
||||||
|
}
|
||||||
|
} catch (e, stackTrace) {
|
||||||
|
talker.error(
|
||||||
|
'[MessageSubscriber] Error cancelling typing cooldown timer for room $roomId: $e\n$stackTrace',
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -179,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +240,27 @@ 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendReadReceipt() {
|
void sendReadReceipt() {
|
||||||
// Send websocket packet
|
// Send websocket packet
|
||||||
final wsState = ref.read(websocketStateProvider.notifier);
|
if (_sendMessage == null) return;
|
||||||
wsState.sendMessage(
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.read',
|
type: 'messages.read',
|
||||||
@@ -218,8 +276,8 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
if (_typingCooldownTimer != null) return;
|
if (_typingCooldownTimer != null) return;
|
||||||
|
|
||||||
// Send typing status immediately
|
// Send typing status immediately
|
||||||
final wsState = ref.read(websocketStateProvider.notifier);
|
if (_sendMessage == null) return;
|
||||||
wsState.sendMessage(
|
_sendMessage!(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
type: 'messages.typing',
|
type: 'messages.typing',
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'chat_subscribe.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(ChatSubscribeNotifier)
|
@ProviderFor(ChatSubscribeNotifier)
|
||||||
const chatSubscribeProvider = ChatSubscribeNotifierFamily._();
|
final chatSubscribeProvider = ChatSubscribeNotifierFamily._();
|
||||||
|
|
||||||
final class ChatSubscribeNotifierProvider
|
final class ChatSubscribeNotifierProvider
|
||||||
extends $NotifierProvider<ChatSubscribeNotifier, List<SnChatMember>> {
|
extends $NotifierProvider<ChatSubscribeNotifier, List<SnChatMember>> {
|
||||||
const ChatSubscribeNotifierProvider._({
|
ChatSubscribeNotifierProvider._({
|
||||||
required ChatSubscribeNotifierFamily super.from,
|
required ChatSubscribeNotifierFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -59,7 +59,7 @@ final class ChatSubscribeNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatSubscribeNotifierHash() =>
|
String _$chatSubscribeNotifierHash() =>
|
||||||
r'a05739450e6d23eb3d8c0a96078887b2b58ffd10';
|
r'f2f5059a975fc44a41850459d6b7d041ff9d41cb';
|
||||||
|
|
||||||
final class ChatSubscribeNotifierFamily extends $Family
|
final class ChatSubscribeNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
@@ -70,7 +70,7 @@ final class ChatSubscribeNotifierFamily extends $Family
|
|||||||
List<SnChatMember>,
|
List<SnChatMember>,
|
||||||
String
|
String
|
||||||
> {
|
> {
|
||||||
const ChatSubscribeNotifierFamily._()
|
ChatSubscribeNotifierFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'chatSubscribeProvider',
|
name: r'chatSubscribeProvider',
|
||||||
@@ -94,7 +94,6 @@ abstract class _$ChatSubscribeNotifier extends $Notifier<List<SnChatMember>> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref = this.ref as $Ref<List<SnChatMember>, List<SnChatMember>>;
|
final ref = this.ref as $Ref<List<SnChatMember>, List<SnChatMember>>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -104,6 +103,6 @@ abstract class _$ChatSubscribeNotifier extends $Notifier<List<SnChatMember>> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user