Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
188b6821a2
|
|||
|
0ebbe0bd5a
|
|||
|
46a826ff86
|
|||
|
1d99ac6441
|
|||
|
e2efdc4064
|
|||
|
cba1a3884b
|
|||
|
7147ce1efa
|
|||
|
78c1a284a5
|
|||
|
f1f5113b01
|
|||
|
a44552f105
|
|||
|
8c1ad94555
|
|||
|
84f5677260
|
|||
|
aa1ffdbf10
|
|||
|
c24d13461b
|
|||
|
3b60fcb87c
|
|||
|
3605b997b1
|
|||
|
800815c721
|
|||
|
3b13a63e7b
|
|||
|
81d69ce10f
|
|||
|
c16d8a5912
|
|||
|
cb9eca0424
|
|||
|
d7858bab67
|
|||
|
5ce590029b
|
|||
|
4d92dec45c
|
|||
|
0a4e797eec
|
|||
|
38dffa414f
|
|||
|
eea56a742e
|
|||
|
56b7ee1d69
|
|||
|
3b564f7e7f
|
|||
|
93d2670063
|
|||
|
788165ac5b
|
|||
|
ec71125fa9
|
|||
|
adb231278c
|
|||
|
b3ae4ab36f
|
|||
|
3670fe0f10
|
|||
|
bb1a5155ed
|
|||
|
eb90dbbc5a
|
|||
|
a73d9f8ec0
|
|||
|
4c8f2e3251
|
@@ -255,6 +255,24 @@
|
|||||||
"walletCurrencyShortGolds": "NSD",
|
"walletCurrencyShortGolds": "NSD",
|
||||||
"retry": "Retry",
|
"retry": "Retry",
|
||||||
"creatorHubUnselectedHint": "Pick / create a publisher to get started.",
|
"creatorHubUnselectedHint": "Pick / create a publisher to get started.",
|
||||||
|
"publisherFediverse": "Fediverse Actor",
|
||||||
|
"publisherFediverseDescription": "Configure your publisher's ActivityPub actor for federated social networking",
|
||||||
|
"publisherFediverseEnabled": "Enabled",
|
||||||
|
"publisherFediverseDisabled": "Disabled",
|
||||||
|
"publisherFediverseNotConfigured": "Not configured",
|
||||||
|
"publisherFediverseEnableHint": "Enable your publisher to interact with fediverse",
|
||||||
|
"publisherFediverseDisableHint": "Disable your publisher's fediverse actor",
|
||||||
|
"publisherFediverseEnableConfirm": "Enable fediverse actor?",
|
||||||
|
"publisherFediverseDisableConfirm": "Disable fediverse actor?",
|
||||||
|
"publisherFediverseEnabledSuccess": "Fediverse actor enabled successfully",
|
||||||
|
"publisherFediverseDisabledSuccess": "Fediverse actor disabled successfully",
|
||||||
|
"publisherFediverseFailedToEnable": "Failed to enable fediverse actor",
|
||||||
|
"publisherFediverseFailedToDisable": "Failed to disable fediverse actor",
|
||||||
|
"publisherFediverseWhatIs": "What is Fediverse?",
|
||||||
|
"publisherFediverseAbout": "The fediverse is a federated network of social platforms. Enabling this feature allows your publisher to interact with users across different ActivityPub-compatible services like Mastodon, PeerTube, and more.",
|
||||||
|
"publisherFediverseActorUri": "Actor URI",
|
||||||
|
"publisherFediverseFollowerCount": "Followers",
|
||||||
|
"publisherFediverseNoFollowers": "No followers yet",
|
||||||
"relationships": "Relationships",
|
"relationships": "Relationships",
|
||||||
"addFriend": "Send a Friend Request",
|
"addFriend": "Send a Friend Request",
|
||||||
"addFriendShort": "Add as Friend",
|
"addFriendShort": "Add as Friend",
|
||||||
@@ -340,7 +358,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",
|
||||||
@@ -906,6 +924,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",
|
||||||
@@ -1546,5 +1565,24 @@
|
|||||||
"embedLinks": {
|
"embedLinks": {
|
||||||
"one": "{} link",
|
"one": "{} link",
|
||||||
"other": "{} links"
|
"other": "{} links"
|
||||||
}
|
},
|
||||||
|
"searchFediverse": "Search Fediverse",
|
||||||
|
"searchFediverseHint": "Search by address, e.g. {}",
|
||||||
|
"searchFediverseEmpty": "Search for users on other ActivityPub instances",
|
||||||
|
"searchFediverseNoResults": "No users found for this search",
|
||||||
|
"fediverseUsers": "Fediverse Users",
|
||||||
|
"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",
|
||||||
|
"fediversePost": "Fediverse Post",
|
||||||
|
"fediversePostDescribe": "Post from the Fediverse Network",
|
||||||
|
"settingsShowFediverseContent": "Show Fediverse Content",
|
||||||
|
"universalSearch": "Universal Search",
|
||||||
|
"universalSearchDescription": "Search content across the Solar Network and the fediverse network."
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class NotifyDelegate: UIResponder, UNUserNotificationCenterDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let serverUrl = UserDefaults.standard.getServerUrl()
|
let serverUrl = UserDefaults.standard.getServerUrl()
|
||||||
let url = "\(serverUrl)/sphere/chat/\(metadata["room_id"] ?? "")/messages"
|
let url = "\(serverUrl)/messager/chat/\(metadata["room_id"] ?? "")/messages"
|
||||||
|
|
||||||
let parameters: [String: Any?] = [
|
let parameters: [String: Any?] = [
|
||||||
"content": textResponse.userText,
|
"content": textResponse.userText,
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ class NetworkService {
|
|||||||
guard let baseURL = URL(string: serverUrl) else {
|
guard let baseURL = URL(string: serverUrl) else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
let url = baseURL.appendingPathComponent("/sphere/chat")
|
let url = baseURL.appendingPathComponent("/messager/chat")
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
request.httpMethod = "GET"
|
request.httpMethod = "GET"
|
||||||
@@ -283,7 +283,7 @@ class NetworkService {
|
|||||||
guard let baseURL = URL(string: serverUrl) else {
|
guard let baseURL = URL(string: serverUrl) else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
let url = baseURL.appendingPathComponent("/sphere/chat/\(identifier)")
|
let url = baseURL.appendingPathComponent("/messager/chat/\(identifier)")
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
request.httpMethod = "GET"
|
request.httpMethod = "GET"
|
||||||
@@ -308,7 +308,7 @@ class NetworkService {
|
|||||||
guard let baseURL = URL(string: serverUrl) else {
|
guard let baseURL = URL(string: serverUrl) else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
let url = baseURL.appendingPathComponent("/sphere/chat/invites")
|
let url = baseURL.appendingPathComponent("/messager/chat/invites")
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
request.httpMethod = "GET"
|
request.httpMethod = "GET"
|
||||||
@@ -330,7 +330,7 @@ class NetworkService {
|
|||||||
guard let baseURL = URL(string: serverUrl) else {
|
guard let baseURL = URL(string: serverUrl) else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
let url = baseURL.appendingPathComponent("/sphere/chat/invites/\(chatRoomId)/accept")
|
let url = baseURL.appendingPathComponent("/messager/chat/invites/\(chatRoomId)/accept")
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
request.httpMethod = "POST"
|
request.httpMethod = "POST"
|
||||||
@@ -351,7 +351,7 @@ class NetworkService {
|
|||||||
guard let baseURL = URL(string: serverUrl) else {
|
guard let baseURL = URL(string: serverUrl) else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
let url = baseURL.appendingPathComponent("/sphere/chat/invites/\(chatRoomId)/decline")
|
let url = baseURL.appendingPathComponent("/messager/chat/invites/\(chatRoomId)/decline")
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
request.httpMethod = "POST"
|
request.httpMethod = "POST"
|
||||||
@@ -375,9 +375,9 @@ class NetworkService {
|
|||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try a different pattern: /sphere/chat/messages with roomId as query param
|
// Try a different pattern: /messager/chat/messages with roomId as query param
|
||||||
var components = URLComponents(
|
var components = URLComponents(
|
||||||
url: baseURL.appendingPathComponent("/sphere/chat/\(chatRoomId)/messages"),
|
url: baseURL.appendingPathComponent("/messager/chat/\(chatRoomId)/messages"),
|
||||||
resolvingAgainstBaseURL: false
|
resolvingAgainstBaseURL: false
|
||||||
)!
|
)!
|
||||||
var queryItems = [
|
var queryItems = [
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ struct ChatRoomView: View {
|
|||||||
]
|
]
|
||||||
|
|
||||||
// Create the URL
|
// Create the URL
|
||||||
guard let url = URL(string: "\(serverUrl)/sphere/chat/\(room.id)/messages") else {
|
guard let url = URL(string: "\(serverUrl)/messager/chat/\(room.id)/messages") else {
|
||||||
throw URLError(.badURL)
|
throw URLError(.badURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
108
lib/models/activitypub.dart
Normal file
108
lib/models/activitypub.dart
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'activitypub.freezed.dart';
|
||||||
|
part 'activitypub.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnActivityPubInstance with _$SnActivityPubInstance {
|
||||||
|
const factory SnActivityPubInstance({
|
||||||
|
required String id,
|
||||||
|
required String domain,
|
||||||
|
String? name,
|
||||||
|
String? description,
|
||||||
|
String? software,
|
||||||
|
String? version,
|
||||||
|
String? iconUrl,
|
||||||
|
String? thumbnailUrl,
|
||||||
|
String? contactEmail,
|
||||||
|
String? contactAccountUsername,
|
||||||
|
int? activeUsers,
|
||||||
|
@Default(false) bool isBlocked,
|
||||||
|
@Default(false) bool isSilenced,
|
||||||
|
String? blockReason,
|
||||||
|
Map<String, dynamic>? metadata,
|
||||||
|
DateTime? lastFetchedAt,
|
||||||
|
DateTime? lastActivityAt,
|
||||||
|
DateTime? metadataFetchedAt,
|
||||||
|
}) = _SnActivityPubInstance;
|
||||||
|
|
||||||
|
factory SnActivityPubInstance.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnActivityPubInstanceFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnActivityPubUser with _$SnActivityPubUser {
|
||||||
|
const factory SnActivityPubUser({
|
||||||
|
required String actorUri,
|
||||||
|
required String username,
|
||||||
|
required String displayName,
|
||||||
|
required String bio,
|
||||||
|
required String avatarUrl,
|
||||||
|
required DateTime followedAt,
|
||||||
|
required bool isLocal,
|
||||||
|
required String instanceDomain,
|
||||||
|
}) = _SnActivityPubUser;
|
||||||
|
|
||||||
|
factory SnActivityPubUser.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnActivityPubUserFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnActivityPubActor with _$SnActivityPubActor {
|
||||||
|
const factory SnActivityPubActor({
|
||||||
|
required String id,
|
||||||
|
required String uri,
|
||||||
|
@Default('') String type,
|
||||||
|
String? displayName,
|
||||||
|
String? username,
|
||||||
|
String? summary,
|
||||||
|
String? inboxUri,
|
||||||
|
String? outboxUri,
|
||||||
|
String? followersUri,
|
||||||
|
String? followingUri,
|
||||||
|
String? featuredUri,
|
||||||
|
String? avatarUrl,
|
||||||
|
String? headerUrl,
|
||||||
|
String? publicKeyId,
|
||||||
|
String? publicKey,
|
||||||
|
@Default(false) bool isBot,
|
||||||
|
@Default(false) bool isLocked,
|
||||||
|
@Default(true) bool discoverable,
|
||||||
|
@Default(false) bool manuallyApprovesFollowers,
|
||||||
|
Map<String, dynamic>? endpoints,
|
||||||
|
Map<String, dynamic>? publicKeyData,
|
||||||
|
Map<String, dynamic>? metadata,
|
||||||
|
DateTime? lastFetchedAt,
|
||||||
|
DateTime? lastActivityAt,
|
||||||
|
required SnActivityPubInstance instance,
|
||||||
|
required String instanceId,
|
||||||
|
bool? isFollowing,
|
||||||
|
}) = _SnActivityPubActor;
|
||||||
|
|
||||||
|
factory SnActivityPubActor.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnActivityPubActorFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnActivityPubFollowResponse with _$SnActivityPubFollowResponse {
|
||||||
|
const factory SnActivityPubFollowResponse({
|
||||||
|
required bool success,
|
||||||
|
required String message,
|
||||||
|
}) = _SnActivityPubFollowResponse;
|
||||||
|
|
||||||
|
factory SnActivityPubFollowResponse.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnActivityPubFollowResponseFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class SnActorStatusResponse with _$SnActorStatusResponse {
|
||||||
|
const factory SnActorStatusResponse({
|
||||||
|
required bool enabled,
|
||||||
|
@Default(0) int followerCount,
|
||||||
|
SnActivityPubActor? actor,
|
||||||
|
String? actorUri,
|
||||||
|
}) = _SnActorStatusResponse;
|
||||||
|
|
||||||
|
factory SnActorStatusResponse.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$SnActorStatusResponseFromJson(json);
|
||||||
|
}
|
||||||
1535
lib/models/activitypub.freezed.dart
Normal file
1535
lib/models/activitypub.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
186
lib/models/activitypub.g.dart
Normal file
186
lib/models/activitypub.g.dart
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'activitypub.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_SnActivityPubInstance _$SnActivityPubInstanceFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _SnActivityPubInstance(
|
||||||
|
id: json['id'] as String,
|
||||||
|
domain: json['domain'] as String,
|
||||||
|
name: json['name'] as String?,
|
||||||
|
description: json['description'] as String?,
|
||||||
|
software: json['software'] as String?,
|
||||||
|
version: json['version'] as String?,
|
||||||
|
iconUrl: json['icon_url'] as String?,
|
||||||
|
thumbnailUrl: json['thumbnail_url'] as String?,
|
||||||
|
contactEmail: json['contact_email'] as String?,
|
||||||
|
contactAccountUsername: json['contact_account_username'] as String?,
|
||||||
|
activeUsers: (json['active_users'] as num?)?.toInt(),
|
||||||
|
isBlocked: json['is_blocked'] as bool? ?? false,
|
||||||
|
isSilenced: json['is_silenced'] as bool? ?? false,
|
||||||
|
blockReason: json['block_reason'] as String?,
|
||||||
|
metadata: json['metadata'] as Map<String, dynamic>?,
|
||||||
|
lastFetchedAt: json['last_fetched_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['last_fetched_at'] as String),
|
||||||
|
lastActivityAt: json['last_activity_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['last_activity_at'] as String),
|
||||||
|
metadataFetchedAt: json['metadata_fetched_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['metadata_fetched_at'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnActivityPubInstanceToJson(
|
||||||
|
_SnActivityPubInstance instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'domain': instance.domain,
|
||||||
|
'name': instance.name,
|
||||||
|
'description': instance.description,
|
||||||
|
'software': instance.software,
|
||||||
|
'version': instance.version,
|
||||||
|
'icon_url': instance.iconUrl,
|
||||||
|
'thumbnail_url': instance.thumbnailUrl,
|
||||||
|
'contact_email': instance.contactEmail,
|
||||||
|
'contact_account_username': instance.contactAccountUsername,
|
||||||
|
'active_users': instance.activeUsers,
|
||||||
|
'is_blocked': instance.isBlocked,
|
||||||
|
'is_silenced': instance.isSilenced,
|
||||||
|
'block_reason': instance.blockReason,
|
||||||
|
'metadata': instance.metadata,
|
||||||
|
'last_fetched_at': instance.lastFetchedAt?.toIso8601String(),
|
||||||
|
'last_activity_at': instance.lastActivityAt?.toIso8601String(),
|
||||||
|
'metadata_fetched_at': instance.metadataFetchedAt?.toIso8601String(),
|
||||||
|
};
|
||||||
|
|
||||||
|
_SnActivityPubUser _$SnActivityPubUserFromJson(Map<String, dynamic> json) =>
|
||||||
|
_SnActivityPubUser(
|
||||||
|
actorUri: json['actor_uri'] as String,
|
||||||
|
username: json['username'] as String,
|
||||||
|
displayName: json['display_name'] as String,
|
||||||
|
bio: json['bio'] as String,
|
||||||
|
avatarUrl: json['avatar_url'] as String,
|
||||||
|
followedAt: DateTime.parse(json['followed_at'] as String),
|
||||||
|
isLocal: json['is_local'] as bool,
|
||||||
|
instanceDomain: json['instance_domain'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnActivityPubUserToJson(_SnActivityPubUser instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'actor_uri': instance.actorUri,
|
||||||
|
'username': instance.username,
|
||||||
|
'display_name': instance.displayName,
|
||||||
|
'bio': instance.bio,
|
||||||
|
'avatar_url': instance.avatarUrl,
|
||||||
|
'followed_at': instance.followedAt.toIso8601String(),
|
||||||
|
'is_local': instance.isLocal,
|
||||||
|
'instance_domain': instance.instanceDomain,
|
||||||
|
};
|
||||||
|
|
||||||
|
_SnActivityPubActor _$SnActivityPubActorFromJson(Map<String, dynamic> json) =>
|
||||||
|
_SnActivityPubActor(
|
||||||
|
id: json['id'] as String,
|
||||||
|
uri: json['uri'] as String,
|
||||||
|
type: json['type'] as String? ?? '',
|
||||||
|
displayName: json['display_name'] as String?,
|
||||||
|
username: json['username'] as String?,
|
||||||
|
summary: json['summary'] as String?,
|
||||||
|
inboxUri: json['inbox_uri'] as String?,
|
||||||
|
outboxUri: json['outbox_uri'] as String?,
|
||||||
|
followersUri: json['followers_uri'] as String?,
|
||||||
|
followingUri: json['following_uri'] as String?,
|
||||||
|
featuredUri: json['featured_uri'] as String?,
|
||||||
|
avatarUrl: json['avatar_url'] as String?,
|
||||||
|
headerUrl: json['header_url'] as String?,
|
||||||
|
publicKeyId: json['public_key_id'] as String?,
|
||||||
|
publicKey: json['public_key'] as String?,
|
||||||
|
isBot: json['is_bot'] as bool? ?? false,
|
||||||
|
isLocked: json['is_locked'] as bool? ?? false,
|
||||||
|
discoverable: json['discoverable'] as bool? ?? true,
|
||||||
|
manuallyApprovesFollowers:
|
||||||
|
json['manually_approves_followers'] as bool? ?? false,
|
||||||
|
endpoints: json['endpoints'] as Map<String, dynamic>?,
|
||||||
|
publicKeyData: json['public_key_data'] as Map<String, dynamic>?,
|
||||||
|
metadata: json['metadata'] as Map<String, dynamic>?,
|
||||||
|
lastFetchedAt: json['last_fetched_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['last_fetched_at'] as String),
|
||||||
|
lastActivityAt: json['last_activity_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['last_activity_at'] as String),
|
||||||
|
instance: SnActivityPubInstance.fromJson(
|
||||||
|
json['instance'] as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
instanceId: json['instance_id'] as String,
|
||||||
|
isFollowing: json['is_following'] as bool?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnActivityPubActorToJson(_SnActivityPubActor instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'uri': instance.uri,
|
||||||
|
'type': instance.type,
|
||||||
|
'display_name': instance.displayName,
|
||||||
|
'username': instance.username,
|
||||||
|
'summary': instance.summary,
|
||||||
|
'inbox_uri': instance.inboxUri,
|
||||||
|
'outbox_uri': instance.outboxUri,
|
||||||
|
'followers_uri': instance.followersUri,
|
||||||
|
'following_uri': instance.followingUri,
|
||||||
|
'featured_uri': instance.featuredUri,
|
||||||
|
'avatar_url': instance.avatarUrl,
|
||||||
|
'header_url': instance.headerUrl,
|
||||||
|
'public_key_id': instance.publicKeyId,
|
||||||
|
'public_key': instance.publicKey,
|
||||||
|
'is_bot': instance.isBot,
|
||||||
|
'is_locked': instance.isLocked,
|
||||||
|
'discoverable': instance.discoverable,
|
||||||
|
'manually_approves_followers': instance.manuallyApprovesFollowers,
|
||||||
|
'endpoints': instance.endpoints,
|
||||||
|
'public_key_data': instance.publicKeyData,
|
||||||
|
'metadata': instance.metadata,
|
||||||
|
'last_fetched_at': instance.lastFetchedAt?.toIso8601String(),
|
||||||
|
'last_activity_at': instance.lastActivityAt?.toIso8601String(),
|
||||||
|
'instance': instance.instance.toJson(),
|
||||||
|
'instance_id': instance.instanceId,
|
||||||
|
'is_following': instance.isFollowing,
|
||||||
|
};
|
||||||
|
|
||||||
|
_SnActivityPubFollowResponse _$SnActivityPubFollowResponseFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _SnActivityPubFollowResponse(
|
||||||
|
success: json['success'] as bool,
|
||||||
|
message: json['message'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnActivityPubFollowResponseToJson(
|
||||||
|
_SnActivityPubFollowResponse instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'success': instance.success,
|
||||||
|
'message': instance.message,
|
||||||
|
};
|
||||||
|
|
||||||
|
_SnActorStatusResponse _$SnActorStatusResponseFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _SnActorStatusResponse(
|
||||||
|
enabled: json['enabled'] as bool,
|
||||||
|
followerCount: (json['follower_count'] as num?)?.toInt() ?? 0,
|
||||||
|
actor: json['actor'] == null
|
||||||
|
? null
|
||||||
|
: SnActivityPubActor.fromJson(json['actor'] as Map<String, dynamic>),
|
||||||
|
actorUri: json['actor_uri'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$SnActorStatusResponseToJson(
|
||||||
|
_SnActorStatusResponse instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'enabled': instance.enabled,
|
||||||
|
'follower_count': instance.followerCount,
|
||||||
|
'actor': instance.actor?.toJson(),
|
||||||
|
'actor_uri': instance.actorUri,
|
||||||
|
};
|
||||||
@@ -55,6 +55,7 @@ sealed class SnCloudFile with _$SnCloudFile {
|
|||||||
required DateTime createdAt,
|
required DateTime createdAt,
|
||||||
required DateTime updatedAt,
|
required DateTime updatedAt,
|
||||||
required DateTime? deletedAt,
|
required DateTime? deletedAt,
|
||||||
|
String? url,
|
||||||
}) = _SnCloudFile;
|
}) = _SnCloudFile;
|
||||||
|
|
||||||
factory SnCloudFile.fromJson(Map<String, dynamic> json) =>
|
factory SnCloudFile.fromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ as String?,
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnCloudFile {
|
mixin _$SnCloudFile {
|
||||||
|
|
||||||
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 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;
|
||||||
/// 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.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -294,16 +294,16 @@ $SnCloudFileCopyWith<SnCloudFile> get copyWith => _$SnCloudFileCopyWithImpl<SnCl
|
|||||||
|
|
||||||
@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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
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);
|
||||||
|
|
||||||
@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)';
|
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)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ abstract mixin class $SnCloudFileCopyWith<$Res> {
|
|||||||
factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl;
|
factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl;
|
||||||
@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 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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ 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.
|
||||||
@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,}) {
|
@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,}) {
|
||||||
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,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -348,7 +348,8 @@ as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo /
|
|||||||
as String?,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?,
|
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/// Create a copy of SnCloudFile
|
/// Create a copy of SnCloudFile
|
||||||
@@ -442,10 +443,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)? $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, 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;
|
||||||
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);case _:
|
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 orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -463,10 +464,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) $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, 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;
|
||||||
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);}
|
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);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -480,10 +481,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)? $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, 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;
|
||||||
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);case _:
|
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 null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -495,7 +496,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}): _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, 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;
|
||||||
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;
|
||||||
@@ -535,6 +536,7 @@ class _SnCloudFile implements SnCloudFile {
|
|||||||
@override final DateTime createdAt;
|
@override final DateTime createdAt;
|
||||||
@override final DateTime updatedAt;
|
@override final DateTime updatedAt;
|
||||||
@override final DateTime? deletedAt;
|
@override final DateTime? deletedAt;
|
||||||
|
@override final String? url;
|
||||||
|
|
||||||
/// 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.
|
||||||
@@ -549,16 +551,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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
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);
|
||||||
|
|
||||||
@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)';
|
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)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -569,7 +571,7 @@ 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 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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -586,7 +588,7 @@ 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,}) {
|
@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,}) {
|
||||||
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
|
||||||
@@ -603,7 +605,8 @@ as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo /
|
|||||||
as String?,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?,
|
as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
|||||||
deletedAt: json['deleted_at'] == null
|
deletedAt: json['deleted_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
|
url: json['url'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnCloudFileToJson(_SnCloudFile instance) =>
|
Map<String, dynamic> _$SnCloudFileToJson(_SnCloudFile instance) =>
|
||||||
@@ -74,6 +75,7 @@ Map<String, dynamic> _$SnCloudFileToJson(_SnCloudFile instance) =>
|
|||||||
'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(),
|
||||||
|
'url': instance.url,
|
||||||
};
|
};
|
||||||
|
|
||||||
_SnCloudFileIndex _$SnCloudFileIndexFromJson(Map<String, dynamic> json) =>
|
_SnCloudFileIndex _$SnCloudFileIndexFromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:island/models/account.dart';
|
import 'package:island/models/account.dart';
|
||||||
|
import 'package:island/models/activitypub.dart';
|
||||||
import 'package:island/models/file.dart';
|
import 'package:island/models/file.dart';
|
||||||
import 'package:island/models/post_category.dart';
|
import 'package:island/models/post_category.dart';
|
||||||
import 'package:island/models/post_tag.dart';
|
import 'package:island/models/post_tag.dart';
|
||||||
@@ -39,8 +40,14 @@ sealed class SnPost with _$SnPost {
|
|||||||
SnPost? forwardedPost,
|
SnPost? forwardedPost,
|
||||||
String? realmId,
|
String? realmId,
|
||||||
SnRealm? realm,
|
SnRealm? realm,
|
||||||
|
String? publisherId,
|
||||||
|
SnPublisher? publisher,
|
||||||
|
String? actorid,
|
||||||
|
SnActivityPubActor? actor,
|
||||||
|
String? fediverseUri,
|
||||||
|
int? fediverseType,
|
||||||
|
@Default(0) int contentType,
|
||||||
@Default([]) List<SnCloudFile> attachments,
|
@Default([]) List<SnCloudFile> attachments,
|
||||||
required SnPublisher publisher,
|
|
||||||
@Default({}) Map<String, int> reactionsCount,
|
@Default({}) Map<String, int> reactionsCount,
|
||||||
@Default({}) Map<String, bool> reactionsMade,
|
@Default({}) Map<String, bool> reactionsMade,
|
||||||
@Default([]) List<dynamic> reactions,
|
@Default([]) List<dynamic> reactions,
|
||||||
@@ -155,10 +162,12 @@ sealed class SnPostReaction with _$SnPostReaction {
|
|||||||
required String symbol,
|
required String symbol,
|
||||||
required int attitude,
|
required int attitude,
|
||||||
required String postId,
|
required String postId,
|
||||||
required String accountId,
|
|
||||||
required DateTime createdAt,
|
required DateTime createdAt,
|
||||||
required DateTime updatedAt,
|
required DateTime updatedAt,
|
||||||
@Default(null) SnAccount? account,
|
String? actorId,
|
||||||
|
SnActivityPubActor? actor,
|
||||||
|
String? accountId,
|
||||||
|
SnAccount? account,
|
||||||
DateTime? deletedAt,
|
DateTime? deletedAt,
|
||||||
}) = _SnPostReaction;
|
}) = _SnPostReaction;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnPost {
|
mixin _$SnPost {
|
||||||
|
|
||||||
String get id; String? get title; String? get description; String? get language; DateTime? get editedAt; DateTime? get publishedAt; int get visibility; String? get content; String? get slug; int get type; Map<String, dynamic>? get meta; SnPostEmbedView? get embedView; int get viewsUnique; int get viewsTotal; int get upvotes; int get downvotes; int get repliesCount; int get awardedScore; int? get pinMode; String? get threadedPostId; SnPost? get threadedPost; String? get repliedPostId; SnPost? get repliedPost; String? get forwardedPostId; SnPost? get forwardedPost; String? get realmId; SnRealm? get realm; List<SnCloudFile> get attachments; SnPublisher get publisher; Map<String, int> get reactionsCount; Map<String, bool> get reactionsMade; List<dynamic> get reactions; List<SnPostTag> get tags; List<SnPostCategory> get categories; List<dynamic> get collections; List<SnPostFeaturedRecord> get featuredRecords; DateTime? get createdAt; DateTime? get updatedAt; DateTime? get deletedAt; bool get repliedGone; bool get forwardedGone; bool get isTruncated;
|
String get id; String? get title; String? get description; String? get language; DateTime? get editedAt; DateTime? get publishedAt; int get visibility; String? get content; String? get slug; int get type; Map<String, dynamic>? get meta; SnPostEmbedView? get embedView; int get viewsUnique; int get viewsTotal; int get upvotes; int get downvotes; int get repliesCount; int get awardedScore; int? get pinMode; String? get threadedPostId; SnPost? get threadedPost; String? get repliedPostId; SnPost? get repliedPost; String? get forwardedPostId; SnPost? get forwardedPost; String? get realmId; SnRealm? get realm; String? get publisherId; SnPublisher? get publisher; String? get actorid; SnActivityPubActor? get actor; String? get fediverseUri; int? get fediverseType; int get contentType; List<SnCloudFile> get attachments; Map<String, int> get reactionsCount; Map<String, bool> get reactionsMade; List<dynamic> get reactions; List<SnPostTag> get tags; List<SnPostCategory> get categories; List<dynamic> get collections; List<SnPostFeaturedRecord> get featuredRecords; DateTime? get createdAt; DateTime? get updatedAt; DateTime? get deletedAt; bool get repliedGone; bool get forwardedGone; bool get isTruncated;
|
||||||
/// Create a copy of SnPost
|
/// Create a copy of SnPost
|
||||||
/// 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)
|
||||||
@@ -28,16 +28,16 @@ $SnPostCopyWith<SnPost> get copyWith => _$SnPostCopyWithImpl<SnPost>(this as SnP
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPost&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.language, language) || other.language == language)&&(identical(other.editedAt, editedAt) || other.editedAt == editedAt)&&(identical(other.publishedAt, publishedAt) || other.publishedAt == publishedAt)&&(identical(other.visibility, visibility) || other.visibility == visibility)&&(identical(other.content, content) || other.content == content)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.meta, meta)&&(identical(other.embedView, embedView) || other.embedView == embedView)&&(identical(other.viewsUnique, viewsUnique) || other.viewsUnique == viewsUnique)&&(identical(other.viewsTotal, viewsTotal) || other.viewsTotal == viewsTotal)&&(identical(other.upvotes, upvotes) || other.upvotes == upvotes)&&(identical(other.downvotes, downvotes) || other.downvotes == downvotes)&&(identical(other.repliesCount, repliesCount) || other.repliesCount == repliesCount)&&(identical(other.awardedScore, awardedScore) || other.awardedScore == awardedScore)&&(identical(other.pinMode, pinMode) || other.pinMode == pinMode)&&(identical(other.threadedPostId, threadedPostId) || other.threadedPostId == threadedPostId)&&(identical(other.threadedPost, threadedPost) || other.threadedPost == threadedPost)&&(identical(other.repliedPostId, repliedPostId) || other.repliedPostId == repliedPostId)&&(identical(other.repliedPost, repliedPost) || other.repliedPost == repliedPost)&&(identical(other.forwardedPostId, forwardedPostId) || other.forwardedPostId == forwardedPostId)&&(identical(other.forwardedPost, forwardedPost) || other.forwardedPost == forwardedPost)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&const DeepCollectionEquality().equals(other.attachments, attachments)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&const DeepCollectionEquality().equals(other.reactionsCount, reactionsCount)&&const DeepCollectionEquality().equals(other.reactionsMade, reactionsMade)&&const DeepCollectionEquality().equals(other.reactions, reactions)&&const DeepCollectionEquality().equals(other.tags, tags)&&const DeepCollectionEquality().equals(other.categories, categories)&&const DeepCollectionEquality().equals(other.collections, collections)&&const DeepCollectionEquality().equals(other.featuredRecords, featuredRecords)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.repliedGone, repliedGone) || other.repliedGone == repliedGone)&&(identical(other.forwardedGone, forwardedGone) || other.forwardedGone == forwardedGone)&&(identical(other.isTruncated, isTruncated) || other.isTruncated == isTruncated));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPost&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.language, language) || other.language == language)&&(identical(other.editedAt, editedAt) || other.editedAt == editedAt)&&(identical(other.publishedAt, publishedAt) || other.publishedAt == publishedAt)&&(identical(other.visibility, visibility) || other.visibility == visibility)&&(identical(other.content, content) || other.content == content)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.meta, meta)&&(identical(other.embedView, embedView) || other.embedView == embedView)&&(identical(other.viewsUnique, viewsUnique) || other.viewsUnique == viewsUnique)&&(identical(other.viewsTotal, viewsTotal) || other.viewsTotal == viewsTotal)&&(identical(other.upvotes, upvotes) || other.upvotes == upvotes)&&(identical(other.downvotes, downvotes) || other.downvotes == downvotes)&&(identical(other.repliesCount, repliesCount) || other.repliesCount == repliesCount)&&(identical(other.awardedScore, awardedScore) || other.awardedScore == awardedScore)&&(identical(other.pinMode, pinMode) || other.pinMode == pinMode)&&(identical(other.threadedPostId, threadedPostId) || other.threadedPostId == threadedPostId)&&(identical(other.threadedPost, threadedPost) || other.threadedPost == threadedPost)&&(identical(other.repliedPostId, repliedPostId) || other.repliedPostId == repliedPostId)&&(identical(other.repliedPost, repliedPost) || other.repliedPost == repliedPost)&&(identical(other.forwardedPostId, forwardedPostId) || other.forwardedPostId == forwardedPostId)&&(identical(other.forwardedPost, forwardedPost) || other.forwardedPost == forwardedPost)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.actorid, actorid) || other.actorid == actorid)&&(identical(other.actor, actor) || other.actor == actor)&&(identical(other.fediverseUri, fediverseUri) || other.fediverseUri == fediverseUri)&&(identical(other.fediverseType, fediverseType) || other.fediverseType == fediverseType)&&(identical(other.contentType, contentType) || other.contentType == contentType)&&const DeepCollectionEquality().equals(other.attachments, attachments)&&const DeepCollectionEquality().equals(other.reactionsCount, reactionsCount)&&const DeepCollectionEquality().equals(other.reactionsMade, reactionsMade)&&const DeepCollectionEquality().equals(other.reactions, reactions)&&const DeepCollectionEquality().equals(other.tags, tags)&&const DeepCollectionEquality().equals(other.categories, categories)&&const DeepCollectionEquality().equals(other.collections, collections)&&const DeepCollectionEquality().equals(other.featuredRecords, featuredRecords)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.repliedGone, repliedGone) || other.repliedGone == repliedGone)&&(identical(other.forwardedGone, forwardedGone) || other.forwardedGone == forwardedGone)&&(identical(other.isTruncated, isTruncated) || other.isTruncated == isTruncated));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,id,title,description,language,editedAt,publishedAt,visibility,content,slug,type,const DeepCollectionEquality().hash(meta),embedView,viewsUnique,viewsTotal,upvotes,downvotes,repliesCount,awardedScore,pinMode,threadedPostId,threadedPost,repliedPostId,repliedPost,forwardedPostId,forwardedPost,realmId,realm,const DeepCollectionEquality().hash(attachments),publisher,const DeepCollectionEquality().hash(reactionsCount),const DeepCollectionEquality().hash(reactionsMade),const DeepCollectionEquality().hash(reactions),const DeepCollectionEquality().hash(tags),const DeepCollectionEquality().hash(categories),const DeepCollectionEquality().hash(collections),const DeepCollectionEquality().hash(featuredRecords),createdAt,updatedAt,deletedAt,repliedGone,forwardedGone,isTruncated]);
|
int get hashCode => Object.hashAll([runtimeType,id,title,description,language,editedAt,publishedAt,visibility,content,slug,type,const DeepCollectionEquality().hash(meta),embedView,viewsUnique,viewsTotal,upvotes,downvotes,repliesCount,awardedScore,pinMode,threadedPostId,threadedPost,repliedPostId,repliedPost,forwardedPostId,forwardedPost,realmId,realm,publisherId,publisher,actorid,actor,fediverseUri,fediverseType,contentType,const DeepCollectionEquality().hash(attachments),const DeepCollectionEquality().hash(reactionsCount),const DeepCollectionEquality().hash(reactionsMade),const DeepCollectionEquality().hash(reactions),const DeepCollectionEquality().hash(tags),const DeepCollectionEquality().hash(categories),const DeepCollectionEquality().hash(collections),const DeepCollectionEquality().hash(featuredRecords),createdAt,updatedAt,deletedAt,repliedGone,forwardedGone,isTruncated]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPost(id: $id, title: $title, description: $description, language: $language, editedAt: $editedAt, publishedAt: $publishedAt, visibility: $visibility, content: $content, slug: $slug, type: $type, meta: $meta, embedView: $embedView, viewsUnique: $viewsUnique, viewsTotal: $viewsTotal, upvotes: $upvotes, downvotes: $downvotes, repliesCount: $repliesCount, awardedScore: $awardedScore, pinMode: $pinMode, threadedPostId: $threadedPostId, threadedPost: $threadedPost, repliedPostId: $repliedPostId, repliedPost: $repliedPost, forwardedPostId: $forwardedPostId, forwardedPost: $forwardedPost, realmId: $realmId, realm: $realm, attachments: $attachments, publisher: $publisher, reactionsCount: $reactionsCount, reactionsMade: $reactionsMade, reactions: $reactions, tags: $tags, categories: $categories, collections: $collections, featuredRecords: $featuredRecords, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, repliedGone: $repliedGone, forwardedGone: $forwardedGone, isTruncated: $isTruncated)';
|
return 'SnPost(id: $id, title: $title, description: $description, language: $language, editedAt: $editedAt, publishedAt: $publishedAt, visibility: $visibility, content: $content, slug: $slug, type: $type, meta: $meta, embedView: $embedView, viewsUnique: $viewsUnique, viewsTotal: $viewsTotal, upvotes: $upvotes, downvotes: $downvotes, repliesCount: $repliesCount, awardedScore: $awardedScore, pinMode: $pinMode, threadedPostId: $threadedPostId, threadedPost: $threadedPost, repliedPostId: $repliedPostId, repliedPost: $repliedPost, forwardedPostId: $forwardedPostId, forwardedPost: $forwardedPost, realmId: $realmId, realm: $realm, publisherId: $publisherId, publisher: $publisher, actorid: $actorid, actor: $actor, fediverseUri: $fediverseUri, fediverseType: $fediverseType, contentType: $contentType, attachments: $attachments, reactionsCount: $reactionsCount, reactionsMade: $reactionsMade, reactions: $reactions, tags: $tags, categories: $categories, collections: $collections, featuredRecords: $featuredRecords, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, repliedGone: $repliedGone, forwardedGone: $forwardedGone, isTruncated: $isTruncated)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,11 +48,11 @@ abstract mixin class $SnPostCopyWith<$Res> {
|
|||||||
factory $SnPostCopyWith(SnPost value, $Res Function(SnPost) _then) = _$SnPostCopyWithImpl;
|
factory $SnPostCopyWith(SnPost value, $Res Function(SnPost) _then) = _$SnPostCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, List<SnCloudFile> attachments, SnPublisher publisher, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated
|
String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, String? publisherId, SnPublisher? publisher, String? actorid, SnActivityPubActor? actor, String? fediverseUri, int? fediverseType, int contentType, List<SnCloudFile> attachments, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$SnPostEmbedViewCopyWith<$Res>? get embedView;$SnPostCopyWith<$Res>? get threadedPost;$SnPostCopyWith<$Res>? get repliedPost;$SnPostCopyWith<$Res>? get forwardedPost;$SnRealmCopyWith<$Res>? get realm;$SnPublisherCopyWith<$Res> get publisher;
|
$SnPostEmbedViewCopyWith<$Res>? get embedView;$SnPostCopyWith<$Res>? get threadedPost;$SnPostCopyWith<$Res>? get repliedPost;$SnPostCopyWith<$Res>? get forwardedPost;$SnRealmCopyWith<$Res>? get realm;$SnPublisherCopyWith<$Res>? get publisher;$SnActivityPubActorCopyWith<$Res>? get actor;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -65,7 +65,7 @@ class _$SnPostCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnPost
|
/// Create a copy of SnPost
|
||||||
/// 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? title = freezed,Object? description = freezed,Object? language = freezed,Object? editedAt = freezed,Object? publishedAt = freezed,Object? visibility = null,Object? content = freezed,Object? slug = freezed,Object? type = null,Object? meta = freezed,Object? embedView = freezed,Object? viewsUnique = null,Object? viewsTotal = null,Object? upvotes = null,Object? downvotes = null,Object? repliesCount = null,Object? awardedScore = null,Object? pinMode = freezed,Object? threadedPostId = freezed,Object? threadedPost = freezed,Object? repliedPostId = freezed,Object? repliedPost = freezed,Object? forwardedPostId = freezed,Object? forwardedPost = freezed,Object? realmId = freezed,Object? realm = freezed,Object? attachments = null,Object? publisher = null,Object? reactionsCount = null,Object? reactionsMade = null,Object? reactions = null,Object? tags = null,Object? categories = null,Object? collections = null,Object? featuredRecords = null,Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? repliedGone = null,Object? forwardedGone = null,Object? isTruncated = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? title = freezed,Object? description = freezed,Object? language = freezed,Object? editedAt = freezed,Object? publishedAt = freezed,Object? visibility = null,Object? content = freezed,Object? slug = freezed,Object? type = null,Object? meta = freezed,Object? embedView = freezed,Object? viewsUnique = null,Object? viewsTotal = null,Object? upvotes = null,Object? downvotes = null,Object? repliesCount = null,Object? awardedScore = null,Object? pinMode = freezed,Object? threadedPostId = freezed,Object? threadedPost = freezed,Object? repliedPostId = freezed,Object? repliedPost = freezed,Object? forwardedPostId = freezed,Object? forwardedPost = freezed,Object? realmId = freezed,Object? realm = freezed,Object? publisherId = freezed,Object? publisher = freezed,Object? actorid = freezed,Object? actor = freezed,Object? fediverseUri = freezed,Object? fediverseType = freezed,Object? contentType = null,Object? attachments = null,Object? reactionsCount = null,Object? reactionsMade = null,Object? reactions = null,Object? tags = null,Object? categories = null,Object? collections = null,Object? featuredRecords = null,Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? repliedGone = null,Object? forwardedGone = null,Object? isTruncated = null,}) {
|
||||||
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,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -94,9 +94,15 @@ as SnPost?,forwardedPostId: freezed == forwardedPostId ? _self.forwardedPostId :
|
|||||||
as String?,forwardedPost: freezed == forwardedPost ? _self.forwardedPost : forwardedPost // ignore: cast_nullable_to_non_nullable
|
as String?,forwardedPost: freezed == forwardedPost ? _self.forwardedPost : forwardedPost // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPost?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable
|
as SnPost?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
||||||
as SnRealm?,attachments: null == attachments ? _self.attachments : attachments // ignore: cast_nullable_to_non_nullable
|
as SnRealm?,publisherId: freezed == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
as List<SnCloudFile>,publisher: null == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
as String?,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPublisher,reactionsCount: null == reactionsCount ? _self.reactionsCount : reactionsCount // ignore: cast_nullable_to_non_nullable
|
as SnPublisher?,actorid: freezed == actorid ? _self.actorid : actorid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,actor: freezed == actor ? _self.actor : actor // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnActivityPubActor?,fediverseUri: freezed == fediverseUri ? _self.fediverseUri : fediverseUri // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,fediverseType: freezed == fediverseType ? _self.fediverseType : fediverseType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,contentType: null == contentType ? _self.contentType : contentType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,attachments: null == attachments ? _self.attachments : attachments // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SnCloudFile>,reactionsCount: null == reactionsCount ? _self.reactionsCount : reactionsCount // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, int>,reactionsMade: null == reactionsMade ? _self.reactionsMade : reactionsMade // ignore: cast_nullable_to_non_nullable
|
as Map<String, int>,reactionsMade: null == reactionsMade ? _self.reactionsMade : reactionsMade // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, bool>,reactions: null == reactions ? _self.reactions : reactions // ignore: cast_nullable_to_non_nullable
|
as Map<String, bool>,reactions: null == reactions ? _self.reactions : reactions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,tags: null == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,tags: null == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -176,11 +182,26 @@ $SnRealmCopyWith<$Res>? get realm {
|
|||||||
/// 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')
|
||||||
$SnPublisherCopyWith<$Res> get publisher {
|
$SnPublisherCopyWith<$Res>? get publisher {
|
||||||
|
if (_self.publisher == null) {
|
||||||
return $SnPublisherCopyWith<$Res>(_self.publisher, (value) {
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnPublisherCopyWith<$Res>(_self.publisher!, (value) {
|
||||||
return _then(_self.copyWith(publisher: value));
|
return _then(_self.copyWith(publisher: value));
|
||||||
});
|
});
|
||||||
|
}/// Create a copy of SnPost
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnActivityPubActorCopyWith<$Res>? get actor {
|
||||||
|
if (_self.actor == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnActivityPubActorCopyWith<$Res>(_self.actor!, (value) {
|
||||||
|
return _then(_self.copyWith(actor: value));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,10 +281,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, List<SnCloudFile> attachments, SnPublisher publisher, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, String? publisherId, SnPublisher? publisher, String? actorid, SnActivityPubActor? actor, String? fediverseUri, int? fediverseType, int contentType, List<SnCloudFile> attachments, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPost() when $default != null:
|
case _SnPost() when $default != null:
|
||||||
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.attachments,_that.publisher,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);case _:
|
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.publisherId,_that.publisher,_that.actorid,_that.actor,_that.fediverseUri,_that.fediverseType,_that.contentType,_that.attachments,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -281,10 +302,10 @@ return $default(_that.id,_that.title,_that.description,_that.language,_that.edit
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, List<SnCloudFile> attachments, SnPublisher publisher, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, String? publisherId, SnPublisher? publisher, String? actorid, SnActivityPubActor? actor, String? fediverseUri, int? fediverseType, int contentType, List<SnCloudFile> attachments, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPost():
|
case _SnPost():
|
||||||
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.attachments,_that.publisher,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);}
|
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.publisherId,_that.publisher,_that.actorid,_that.actor,_that.fediverseUri,_that.fediverseType,_that.contentType,_that.attachments,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -298,10 +319,10 @@ return $default(_that.id,_that.title,_that.description,_that.language,_that.edit
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, List<SnCloudFile> attachments, SnPublisher publisher, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, String? publisherId, SnPublisher? publisher, String? actorid, SnActivityPubActor? actor, String? fediverseUri, int? fediverseType, int contentType, List<SnCloudFile> attachments, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPost() when $default != null:
|
case _SnPost() when $default != null:
|
||||||
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.attachments,_that.publisher,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);case _:
|
return $default(_that.id,_that.title,_that.description,_that.language,_that.editedAt,_that.publishedAt,_that.visibility,_that.content,_that.slug,_that.type,_that.meta,_that.embedView,_that.viewsUnique,_that.viewsTotal,_that.upvotes,_that.downvotes,_that.repliesCount,_that.awardedScore,_that.pinMode,_that.threadedPostId,_that.threadedPost,_that.repliedPostId,_that.repliedPost,_that.forwardedPostId,_that.forwardedPost,_that.realmId,_that.realm,_that.publisherId,_that.publisher,_that.actorid,_that.actor,_that.fediverseUri,_that.fediverseType,_that.contentType,_that.attachments,_that.reactionsCount,_that.reactionsMade,_that.reactions,_that.tags,_that.categories,_that.collections,_that.featuredRecords,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.repliedGone,_that.forwardedGone,_that.isTruncated);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -313,7 +334,7 @@ return $default(_that.id,_that.title,_that.description,_that.language,_that.edit
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnPost implements SnPost {
|
class _SnPost implements SnPost {
|
||||||
const _SnPost({required this.id, this.title, this.description, this.language, this.editedAt, this.publishedAt = null, this.visibility = 0, this.content, this.slug, this.type = 0, final Map<String, dynamic>? meta, this.embedView, this.viewsUnique = 0, this.viewsTotal = 0, this.upvotes = 0, this.downvotes = 0, this.repliesCount = 0, this.awardedScore = 0, this.pinMode, this.threadedPostId, this.threadedPost, this.repliedPostId, this.repliedPost, this.forwardedPostId, this.forwardedPost, this.realmId, this.realm, final List<SnCloudFile> attachments = const [], required this.publisher, final Map<String, int> reactionsCount = const {}, final Map<String, bool> reactionsMade = const {}, final List<dynamic> reactions = const [], final List<SnPostTag> tags = const [], final List<SnPostCategory> categories = const [], final List<dynamic> collections = const [], final List<SnPostFeaturedRecord> featuredRecords = const [], this.createdAt = null, this.updatedAt = null, this.deletedAt, this.repliedGone = false, this.forwardedGone = false, this.isTruncated = false}): _meta = meta,_attachments = attachments,_reactionsCount = reactionsCount,_reactionsMade = reactionsMade,_reactions = reactions,_tags = tags,_categories = categories,_collections = collections,_featuredRecords = featuredRecords;
|
const _SnPost({required this.id, this.title, this.description, this.language, this.editedAt, this.publishedAt = null, this.visibility = 0, this.content, this.slug, this.type = 0, final Map<String, dynamic>? meta, this.embedView, this.viewsUnique = 0, this.viewsTotal = 0, this.upvotes = 0, this.downvotes = 0, this.repliesCount = 0, this.awardedScore = 0, this.pinMode, this.threadedPostId, this.threadedPost, this.repliedPostId, this.repliedPost, this.forwardedPostId, this.forwardedPost, this.realmId, this.realm, this.publisherId, this.publisher, this.actorid, this.actor, this.fediverseUri, this.fediverseType, this.contentType = 0, final List<SnCloudFile> attachments = const [], final Map<String, int> reactionsCount = const {}, final Map<String, bool> reactionsMade = const {}, final List<dynamic> reactions = const [], final List<SnPostTag> tags = const [], final List<SnPostCategory> categories = const [], final List<dynamic> collections = const [], final List<SnPostFeaturedRecord> featuredRecords = const [], this.createdAt = null, this.updatedAt = null, this.deletedAt, this.repliedGone = false, this.forwardedGone = false, this.isTruncated = false}): _meta = meta,_attachments = attachments,_reactionsCount = reactionsCount,_reactionsMade = reactionsMade,_reactions = reactions,_tags = tags,_categories = categories,_collections = collections,_featuredRecords = featuredRecords;
|
||||||
factory _SnPost.fromJson(Map<String, dynamic> json) => _$SnPostFromJson(json);
|
factory _SnPost.fromJson(Map<String, dynamic> json) => _$SnPostFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@@ -351,6 +372,13 @@ class _SnPost implements SnPost {
|
|||||||
@override final SnPost? forwardedPost;
|
@override final SnPost? forwardedPost;
|
||||||
@override final String? realmId;
|
@override final String? realmId;
|
||||||
@override final SnRealm? realm;
|
@override final SnRealm? realm;
|
||||||
|
@override final String? publisherId;
|
||||||
|
@override final SnPublisher? publisher;
|
||||||
|
@override final String? actorid;
|
||||||
|
@override final SnActivityPubActor? actor;
|
||||||
|
@override final String? fediverseUri;
|
||||||
|
@override final int? fediverseType;
|
||||||
|
@override@JsonKey() final int contentType;
|
||||||
final List<SnCloudFile> _attachments;
|
final List<SnCloudFile> _attachments;
|
||||||
@override@JsonKey() List<SnCloudFile> get attachments {
|
@override@JsonKey() List<SnCloudFile> get attachments {
|
||||||
if (_attachments is EqualUnmodifiableListView) return _attachments;
|
if (_attachments is EqualUnmodifiableListView) return _attachments;
|
||||||
@@ -358,7 +386,6 @@ class _SnPost implements SnPost {
|
|||||||
return EqualUnmodifiableListView(_attachments);
|
return EqualUnmodifiableListView(_attachments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override final SnPublisher publisher;
|
|
||||||
final Map<String, int> _reactionsCount;
|
final Map<String, int> _reactionsCount;
|
||||||
@override@JsonKey() Map<String, int> get reactionsCount {
|
@override@JsonKey() Map<String, int> get reactionsCount {
|
||||||
if (_reactionsCount is EqualUnmodifiableMapView) return _reactionsCount;
|
if (_reactionsCount is EqualUnmodifiableMapView) return _reactionsCount;
|
||||||
@@ -428,16 +455,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPost&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.language, language) || other.language == language)&&(identical(other.editedAt, editedAt) || other.editedAt == editedAt)&&(identical(other.publishedAt, publishedAt) || other.publishedAt == publishedAt)&&(identical(other.visibility, visibility) || other.visibility == visibility)&&(identical(other.content, content) || other.content == content)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._meta, _meta)&&(identical(other.embedView, embedView) || other.embedView == embedView)&&(identical(other.viewsUnique, viewsUnique) || other.viewsUnique == viewsUnique)&&(identical(other.viewsTotal, viewsTotal) || other.viewsTotal == viewsTotal)&&(identical(other.upvotes, upvotes) || other.upvotes == upvotes)&&(identical(other.downvotes, downvotes) || other.downvotes == downvotes)&&(identical(other.repliesCount, repliesCount) || other.repliesCount == repliesCount)&&(identical(other.awardedScore, awardedScore) || other.awardedScore == awardedScore)&&(identical(other.pinMode, pinMode) || other.pinMode == pinMode)&&(identical(other.threadedPostId, threadedPostId) || other.threadedPostId == threadedPostId)&&(identical(other.threadedPost, threadedPost) || other.threadedPost == threadedPost)&&(identical(other.repliedPostId, repliedPostId) || other.repliedPostId == repliedPostId)&&(identical(other.repliedPost, repliedPost) || other.repliedPost == repliedPost)&&(identical(other.forwardedPostId, forwardedPostId) || other.forwardedPostId == forwardedPostId)&&(identical(other.forwardedPost, forwardedPost) || other.forwardedPost == forwardedPost)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&const DeepCollectionEquality().equals(other._attachments, _attachments)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&const DeepCollectionEquality().equals(other._reactionsCount, _reactionsCount)&&const DeepCollectionEquality().equals(other._reactionsMade, _reactionsMade)&&const DeepCollectionEquality().equals(other._reactions, _reactions)&&const DeepCollectionEquality().equals(other._tags, _tags)&&const DeepCollectionEquality().equals(other._categories, _categories)&&const DeepCollectionEquality().equals(other._collections, _collections)&&const DeepCollectionEquality().equals(other._featuredRecords, _featuredRecords)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.repliedGone, repliedGone) || other.repliedGone == repliedGone)&&(identical(other.forwardedGone, forwardedGone) || other.forwardedGone == forwardedGone)&&(identical(other.isTruncated, isTruncated) || other.isTruncated == isTruncated));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPost&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.language, language) || other.language == language)&&(identical(other.editedAt, editedAt) || other.editedAt == editedAt)&&(identical(other.publishedAt, publishedAt) || other.publishedAt == publishedAt)&&(identical(other.visibility, visibility) || other.visibility == visibility)&&(identical(other.content, content) || other.content == content)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._meta, _meta)&&(identical(other.embedView, embedView) || other.embedView == embedView)&&(identical(other.viewsUnique, viewsUnique) || other.viewsUnique == viewsUnique)&&(identical(other.viewsTotal, viewsTotal) || other.viewsTotal == viewsTotal)&&(identical(other.upvotes, upvotes) || other.upvotes == upvotes)&&(identical(other.downvotes, downvotes) || other.downvotes == downvotes)&&(identical(other.repliesCount, repliesCount) || other.repliesCount == repliesCount)&&(identical(other.awardedScore, awardedScore) || other.awardedScore == awardedScore)&&(identical(other.pinMode, pinMode) || other.pinMode == pinMode)&&(identical(other.threadedPostId, threadedPostId) || other.threadedPostId == threadedPostId)&&(identical(other.threadedPost, threadedPost) || other.threadedPost == threadedPost)&&(identical(other.repliedPostId, repliedPostId) || other.repliedPostId == repliedPostId)&&(identical(other.repliedPost, repliedPost) || other.repliedPost == repliedPost)&&(identical(other.forwardedPostId, forwardedPostId) || other.forwardedPostId == forwardedPostId)&&(identical(other.forwardedPost, forwardedPost) || other.forwardedPost == forwardedPost)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.publisherId, publisherId) || other.publisherId == publisherId)&&(identical(other.publisher, publisher) || other.publisher == publisher)&&(identical(other.actorid, actorid) || other.actorid == actorid)&&(identical(other.actor, actor) || other.actor == actor)&&(identical(other.fediverseUri, fediverseUri) || other.fediverseUri == fediverseUri)&&(identical(other.fediverseType, fediverseType) || other.fediverseType == fediverseType)&&(identical(other.contentType, contentType) || other.contentType == contentType)&&const DeepCollectionEquality().equals(other._attachments, _attachments)&&const DeepCollectionEquality().equals(other._reactionsCount, _reactionsCount)&&const DeepCollectionEquality().equals(other._reactionsMade, _reactionsMade)&&const DeepCollectionEquality().equals(other._reactions, _reactions)&&const DeepCollectionEquality().equals(other._tags, _tags)&&const DeepCollectionEquality().equals(other._categories, _categories)&&const DeepCollectionEquality().equals(other._collections, _collections)&&const DeepCollectionEquality().equals(other._featuredRecords, _featuredRecords)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.repliedGone, repliedGone) || other.repliedGone == repliedGone)&&(identical(other.forwardedGone, forwardedGone) || other.forwardedGone == forwardedGone)&&(identical(other.isTruncated, isTruncated) || other.isTruncated == isTruncated));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,id,title,description,language,editedAt,publishedAt,visibility,content,slug,type,const DeepCollectionEquality().hash(_meta),embedView,viewsUnique,viewsTotal,upvotes,downvotes,repliesCount,awardedScore,pinMode,threadedPostId,threadedPost,repliedPostId,repliedPost,forwardedPostId,forwardedPost,realmId,realm,const DeepCollectionEquality().hash(_attachments),publisher,const DeepCollectionEquality().hash(_reactionsCount),const DeepCollectionEquality().hash(_reactionsMade),const DeepCollectionEquality().hash(_reactions),const DeepCollectionEquality().hash(_tags),const DeepCollectionEquality().hash(_categories),const DeepCollectionEquality().hash(_collections),const DeepCollectionEquality().hash(_featuredRecords),createdAt,updatedAt,deletedAt,repliedGone,forwardedGone,isTruncated]);
|
int get hashCode => Object.hashAll([runtimeType,id,title,description,language,editedAt,publishedAt,visibility,content,slug,type,const DeepCollectionEquality().hash(_meta),embedView,viewsUnique,viewsTotal,upvotes,downvotes,repliesCount,awardedScore,pinMode,threadedPostId,threadedPost,repliedPostId,repliedPost,forwardedPostId,forwardedPost,realmId,realm,publisherId,publisher,actorid,actor,fediverseUri,fediverseType,contentType,const DeepCollectionEquality().hash(_attachments),const DeepCollectionEquality().hash(_reactionsCount),const DeepCollectionEquality().hash(_reactionsMade),const DeepCollectionEquality().hash(_reactions),const DeepCollectionEquality().hash(_tags),const DeepCollectionEquality().hash(_categories),const DeepCollectionEquality().hash(_collections),const DeepCollectionEquality().hash(_featuredRecords),createdAt,updatedAt,deletedAt,repliedGone,forwardedGone,isTruncated]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPost(id: $id, title: $title, description: $description, language: $language, editedAt: $editedAt, publishedAt: $publishedAt, visibility: $visibility, content: $content, slug: $slug, type: $type, meta: $meta, embedView: $embedView, viewsUnique: $viewsUnique, viewsTotal: $viewsTotal, upvotes: $upvotes, downvotes: $downvotes, repliesCount: $repliesCount, awardedScore: $awardedScore, pinMode: $pinMode, threadedPostId: $threadedPostId, threadedPost: $threadedPost, repliedPostId: $repliedPostId, repliedPost: $repliedPost, forwardedPostId: $forwardedPostId, forwardedPost: $forwardedPost, realmId: $realmId, realm: $realm, attachments: $attachments, publisher: $publisher, reactionsCount: $reactionsCount, reactionsMade: $reactionsMade, reactions: $reactions, tags: $tags, categories: $categories, collections: $collections, featuredRecords: $featuredRecords, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, repliedGone: $repliedGone, forwardedGone: $forwardedGone, isTruncated: $isTruncated)';
|
return 'SnPost(id: $id, title: $title, description: $description, language: $language, editedAt: $editedAt, publishedAt: $publishedAt, visibility: $visibility, content: $content, slug: $slug, type: $type, meta: $meta, embedView: $embedView, viewsUnique: $viewsUnique, viewsTotal: $viewsTotal, upvotes: $upvotes, downvotes: $downvotes, repliesCount: $repliesCount, awardedScore: $awardedScore, pinMode: $pinMode, threadedPostId: $threadedPostId, threadedPost: $threadedPost, repliedPostId: $repliedPostId, repliedPost: $repliedPost, forwardedPostId: $forwardedPostId, forwardedPost: $forwardedPost, realmId: $realmId, realm: $realm, publisherId: $publisherId, publisher: $publisher, actorid: $actorid, actor: $actor, fediverseUri: $fediverseUri, fediverseType: $fediverseType, contentType: $contentType, attachments: $attachments, reactionsCount: $reactionsCount, reactionsMade: $reactionsMade, reactions: $reactions, tags: $tags, categories: $categories, collections: $collections, featuredRecords: $featuredRecords, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, repliedGone: $repliedGone, forwardedGone: $forwardedGone, isTruncated: $isTruncated)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -448,11 +475,11 @@ abstract mixin class _$SnPostCopyWith<$Res> implements $SnPostCopyWith<$Res> {
|
|||||||
factory _$SnPostCopyWith(_SnPost value, $Res Function(_SnPost) _then) = __$SnPostCopyWithImpl;
|
factory _$SnPostCopyWith(_SnPost value, $Res Function(_SnPost) _then) = __$SnPostCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, List<SnCloudFile> attachments, SnPublisher publisher, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated
|
String id, String? title, String? description, String? language, DateTime? editedAt, DateTime? publishedAt, int visibility, String? content, String? slug, int type, Map<String, dynamic>? meta, SnPostEmbedView? embedView, int viewsUnique, int viewsTotal, int upvotes, int downvotes, int repliesCount, int awardedScore, int? pinMode, String? threadedPostId, SnPost? threadedPost, String? repliedPostId, SnPost? repliedPost, String? forwardedPostId, SnPost? forwardedPost, String? realmId, SnRealm? realm, String? publisherId, SnPublisher? publisher, String? actorid, SnActivityPubActor? actor, String? fediverseUri, int? fediverseType, int contentType, List<SnCloudFile> attachments, Map<String, int> reactionsCount, Map<String, bool> reactionsMade, List<dynamic> reactions, List<SnPostTag> tags, List<SnPostCategory> categories, List<dynamic> collections, List<SnPostFeaturedRecord> featuredRecords, DateTime? createdAt, DateTime? updatedAt, DateTime? deletedAt, bool repliedGone, bool forwardedGone, bool isTruncated
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $SnPostEmbedViewCopyWith<$Res>? get embedView;@override $SnPostCopyWith<$Res>? get threadedPost;@override $SnPostCopyWith<$Res>? get repliedPost;@override $SnPostCopyWith<$Res>? get forwardedPost;@override $SnRealmCopyWith<$Res>? get realm;@override $SnPublisherCopyWith<$Res> get publisher;
|
@override $SnPostEmbedViewCopyWith<$Res>? get embedView;@override $SnPostCopyWith<$Res>? get threadedPost;@override $SnPostCopyWith<$Res>? get repliedPost;@override $SnPostCopyWith<$Res>? get forwardedPost;@override $SnRealmCopyWith<$Res>? get realm;@override $SnPublisherCopyWith<$Res>? get publisher;@override $SnActivityPubActorCopyWith<$Res>? get actor;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -465,7 +492,7 @@ class __$SnPostCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnPost
|
/// Create a copy of SnPost
|
||||||
/// 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? title = freezed,Object? description = freezed,Object? language = freezed,Object? editedAt = freezed,Object? publishedAt = freezed,Object? visibility = null,Object? content = freezed,Object? slug = freezed,Object? type = null,Object? meta = freezed,Object? embedView = freezed,Object? viewsUnique = null,Object? viewsTotal = null,Object? upvotes = null,Object? downvotes = null,Object? repliesCount = null,Object? awardedScore = null,Object? pinMode = freezed,Object? threadedPostId = freezed,Object? threadedPost = freezed,Object? repliedPostId = freezed,Object? repliedPost = freezed,Object? forwardedPostId = freezed,Object? forwardedPost = freezed,Object? realmId = freezed,Object? realm = freezed,Object? attachments = null,Object? publisher = null,Object? reactionsCount = null,Object? reactionsMade = null,Object? reactions = null,Object? tags = null,Object? categories = null,Object? collections = null,Object? featuredRecords = null,Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? repliedGone = null,Object? forwardedGone = null,Object? isTruncated = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? title = freezed,Object? description = freezed,Object? language = freezed,Object? editedAt = freezed,Object? publishedAt = freezed,Object? visibility = null,Object? content = freezed,Object? slug = freezed,Object? type = null,Object? meta = freezed,Object? embedView = freezed,Object? viewsUnique = null,Object? viewsTotal = null,Object? upvotes = null,Object? downvotes = null,Object? repliesCount = null,Object? awardedScore = null,Object? pinMode = freezed,Object? threadedPostId = freezed,Object? threadedPost = freezed,Object? repliedPostId = freezed,Object? repliedPost = freezed,Object? forwardedPostId = freezed,Object? forwardedPost = freezed,Object? realmId = freezed,Object? realm = freezed,Object? publisherId = freezed,Object? publisher = freezed,Object? actorid = freezed,Object? actor = freezed,Object? fediverseUri = freezed,Object? fediverseType = freezed,Object? contentType = null,Object? attachments = null,Object? reactionsCount = null,Object? reactionsMade = null,Object? reactions = null,Object? tags = null,Object? categories = null,Object? collections = null,Object? featuredRecords = null,Object? createdAt = freezed,Object? updatedAt = freezed,Object? deletedAt = freezed,Object? repliedGone = null,Object? forwardedGone = null,Object? isTruncated = null,}) {
|
||||||
return _then(_SnPost(
|
return _then(_SnPost(
|
||||||
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,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -494,9 +521,15 @@ as SnPost?,forwardedPostId: freezed == forwardedPostId ? _self.forwardedPostId :
|
|||||||
as String?,forwardedPost: freezed == forwardedPost ? _self.forwardedPost : forwardedPost // ignore: cast_nullable_to_non_nullable
|
as String?,forwardedPost: freezed == forwardedPost ? _self.forwardedPost : forwardedPost // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPost?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable
|
as SnPost?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
||||||
as SnRealm?,attachments: null == attachments ? _self._attachments : attachments // ignore: cast_nullable_to_non_nullable
|
as SnRealm?,publisherId: freezed == publisherId ? _self.publisherId : publisherId // ignore: cast_nullable_to_non_nullable
|
||||||
as List<SnCloudFile>,publisher: null == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
as String?,publisher: freezed == publisher ? _self.publisher : publisher // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPublisher,reactionsCount: null == reactionsCount ? _self._reactionsCount : reactionsCount // ignore: cast_nullable_to_non_nullable
|
as SnPublisher?,actorid: freezed == actorid ? _self.actorid : actorid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,actor: freezed == actor ? _self.actor : actor // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnActivityPubActor?,fediverseUri: freezed == fediverseUri ? _self.fediverseUri : fediverseUri // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,fediverseType: freezed == fediverseType ? _self.fediverseType : fediverseType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,contentType: null == contentType ? _self.contentType : contentType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,attachments: null == attachments ? _self._attachments : attachments // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<SnCloudFile>,reactionsCount: null == reactionsCount ? _self._reactionsCount : reactionsCount // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, int>,reactionsMade: null == reactionsMade ? _self._reactionsMade : reactionsMade // ignore: cast_nullable_to_non_nullable
|
as Map<String, int>,reactionsMade: null == reactionsMade ? _self._reactionsMade : reactionsMade // ignore: cast_nullable_to_non_nullable
|
||||||
as Map<String, bool>,reactions: null == reactions ? _self._reactions : reactions // ignore: cast_nullable_to_non_nullable
|
as Map<String, bool>,reactions: null == reactions ? _self._reactions : reactions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<dynamic>,tags: null == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
as List<dynamic>,tags: null == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -577,11 +610,26 @@ $SnRealmCopyWith<$Res>? get realm {
|
|||||||
/// 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')
|
||||||
$SnPublisherCopyWith<$Res> get publisher {
|
$SnPublisherCopyWith<$Res>? get publisher {
|
||||||
|
if (_self.publisher == null) {
|
||||||
return $SnPublisherCopyWith<$Res>(_self.publisher, (value) {
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnPublisherCopyWith<$Res>(_self.publisher!, (value) {
|
||||||
return _then(_self.copyWith(publisher: value));
|
return _then(_self.copyWith(publisher: value));
|
||||||
});
|
});
|
||||||
|
}/// Create a copy of SnPost
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$SnActivityPubActorCopyWith<$Res>? get actor {
|
||||||
|
if (_self.actor == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnActivityPubActorCopyWith<$Res>(_self.actor!, (value) {
|
||||||
|
return _then(_self.copyWith(actor: value));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1937,7 +1985,7 @@ as DateTime?,
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$SnPostReaction {
|
mixin _$SnPostReaction {
|
||||||
|
|
||||||
String get id; String get symbol; int get attitude; String get postId; String get accountId; DateTime get createdAt; DateTime get updatedAt; SnAccount? get account; DateTime? get deletedAt;
|
String get id; String get symbol; int get attitude; String get postId; DateTime get createdAt; DateTime get updatedAt; String? get actorId; SnActivityPubActor? get actor; String? get accountId; SnAccount? get account; DateTime? get deletedAt;
|
||||||
/// Create a copy of SnPostReaction
|
/// Create a copy of SnPostReaction
|
||||||
/// 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)
|
||||||
@@ -1950,16 +1998,16 @@ $SnPostReactionCopyWith<SnPostReaction> get copyWith => _$SnPostReactionCopyWith
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPostReaction&&(identical(other.id, id) || other.id == id)&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.attitude, attitude) || other.attitude == attitude)&&(identical(other.postId, postId) || other.postId == postId)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.account, account) || other.account == account)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPostReaction&&(identical(other.id, id) || other.id == id)&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.attitude, attitude) || other.attitude == attitude)&&(identical(other.postId, postId) || other.postId == postId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.actorId, actorId) || other.actorId == actorId)&&(identical(other.actor, actor) || other.actor == actor)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.account, account) || other.account == account)&&(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,symbol,attitude,postId,accountId,createdAt,updatedAt,account,deletedAt);
|
int get hashCode => Object.hash(runtimeType,id,symbol,attitude,postId,createdAt,updatedAt,actorId,actor,accountId,account,deletedAt);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPostReaction(id: $id, symbol: $symbol, attitude: $attitude, postId: $postId, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, account: $account, deletedAt: $deletedAt)';
|
return 'SnPostReaction(id: $id, symbol: $symbol, attitude: $attitude, postId: $postId, createdAt: $createdAt, updatedAt: $updatedAt, actorId: $actorId, actor: $actor, accountId: $accountId, account: $account, deletedAt: $deletedAt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1970,11 +2018,11 @@ abstract mixin class $SnPostReactionCopyWith<$Res> {
|
|||||||
factory $SnPostReactionCopyWith(SnPostReaction value, $Res Function(SnPostReaction) _then) = _$SnPostReactionCopyWithImpl;
|
factory $SnPostReactionCopyWith(SnPostReaction value, $Res Function(SnPostReaction) _then) = _$SnPostReactionCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String symbol, int attitude, String postId, String accountId, DateTime createdAt, DateTime updatedAt, SnAccount? account, DateTime? deletedAt
|
String id, String symbol, int attitude, String postId, DateTime createdAt, DateTime updatedAt, String? actorId, SnActivityPubActor? actor, String? accountId, SnAccount? account, DateTime? deletedAt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$SnAccountCopyWith<$Res>? get account;
|
$SnActivityPubActorCopyWith<$Res>? get actor;$SnAccountCopyWith<$Res>? get account;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -1987,16 +2035,18 @@ class _$SnPostReactionCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnPostReaction
|
/// Create a copy of SnPostReaction
|
||||||
/// 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? symbol = null,Object? attitude = null,Object? postId = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? account = freezed,Object? deletedAt = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? symbol = null,Object? attitude = null,Object? postId = null,Object? createdAt = null,Object? updatedAt = null,Object? actorId = freezed,Object? actor = freezed,Object? accountId = freezed,Object? account = freezed,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,symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable
|
as String,symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable
|
||||||
as String,attitude: null == attitude ? _self.attitude : attitude // ignore: cast_nullable_to_non_nullable
|
as String,attitude: null == attitude ? _self.attitude : attitude // ignore: cast_nullable_to_non_nullable
|
||||||
as int,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable
|
as int,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,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,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
as DateTime,actorId: freezed == actorId ? _self.actorId : actorId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,actor: freezed == actor ? _self.actor : actor // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnActivityPubActor?,accountId: freezed == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,
|
as DateTime?,
|
||||||
));
|
));
|
||||||
@@ -2005,6 +2055,18 @@ as DateTime?,
|
|||||||
/// 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')
|
||||||
|
$SnActivityPubActorCopyWith<$Res>? get actor {
|
||||||
|
if (_self.actor == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnActivityPubActorCopyWith<$Res>(_self.actor!, (value) {
|
||||||
|
return _then(_self.copyWith(actor: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of SnPostReaction
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res>? get account {
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
if (_self.account == null) {
|
if (_self.account == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -2092,10 +2154,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String symbol, int attitude, String postId, String accountId, DateTime createdAt, DateTime updatedAt, SnAccount? account, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String symbol, int attitude, String postId, DateTime createdAt, DateTime updatedAt, String? actorId, SnActivityPubActor? actor, String? accountId, SnAccount? account, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPostReaction() when $default != null:
|
case _SnPostReaction() when $default != null:
|
||||||
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountId,_that.createdAt,_that.updatedAt,_that.account,_that.deletedAt);case _:
|
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.createdAt,_that.updatedAt,_that.actorId,_that.actor,_that.accountId,_that.account,_that.deletedAt);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2113,10 +2175,10 @@ return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountI
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String symbol, int attitude, String postId, String accountId, DateTime createdAt, DateTime updatedAt, SnAccount? account, DateTime? deletedAt) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String symbol, int attitude, String postId, DateTime createdAt, DateTime updatedAt, String? actorId, SnActivityPubActor? actor, String? accountId, SnAccount? account, DateTime? deletedAt) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPostReaction():
|
case _SnPostReaction():
|
||||||
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountId,_that.createdAt,_that.updatedAt,_that.account,_that.deletedAt);}
|
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.createdAt,_that.updatedAt,_that.actorId,_that.actor,_that.accountId,_that.account,_that.deletedAt);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -2130,10 +2192,10 @@ return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountI
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String symbol, int attitude, String postId, String accountId, DateTime createdAt, DateTime updatedAt, SnAccount? account, DateTime? deletedAt)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String symbol, int attitude, String postId, DateTime createdAt, DateTime updatedAt, String? actorId, SnActivityPubActor? actor, String? accountId, SnAccount? account, DateTime? deletedAt)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _SnPostReaction() when $default != null:
|
case _SnPostReaction() when $default != null:
|
||||||
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountId,_that.createdAt,_that.updatedAt,_that.account,_that.deletedAt);case _:
|
return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.createdAt,_that.updatedAt,_that.actorId,_that.actor,_that.accountId,_that.account,_that.deletedAt);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2145,17 +2207,19 @@ return $default(_that.id,_that.symbol,_that.attitude,_that.postId,_that.accountI
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _SnPostReaction implements SnPostReaction {
|
class _SnPostReaction implements SnPostReaction {
|
||||||
const _SnPostReaction({required this.id, required this.symbol, required this.attitude, required this.postId, required this.accountId, required this.createdAt, required this.updatedAt, this.account = null, this.deletedAt});
|
const _SnPostReaction({required this.id, required this.symbol, required this.attitude, required this.postId, required this.createdAt, required this.updatedAt, this.actorId, this.actor, this.accountId, this.account, this.deletedAt});
|
||||||
factory _SnPostReaction.fromJson(Map<String, dynamic> json) => _$SnPostReactionFromJson(json);
|
factory _SnPostReaction.fromJson(Map<String, dynamic> json) => _$SnPostReactionFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@override final String symbol;
|
@override final String symbol;
|
||||||
@override final int attitude;
|
@override final int attitude;
|
||||||
@override final String postId;
|
@override final String postId;
|
||||||
@override final String accountId;
|
|
||||||
@override final DateTime createdAt;
|
@override final DateTime createdAt;
|
||||||
@override final DateTime updatedAt;
|
@override final DateTime updatedAt;
|
||||||
@override@JsonKey() final SnAccount? account;
|
@override final String? actorId;
|
||||||
|
@override final SnActivityPubActor? actor;
|
||||||
|
@override final String? accountId;
|
||||||
|
@override final SnAccount? account;
|
||||||
@override final DateTime? deletedAt;
|
@override final DateTime? deletedAt;
|
||||||
|
|
||||||
/// Create a copy of SnPostReaction
|
/// Create a copy of SnPostReaction
|
||||||
@@ -2171,16 +2235,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPostReaction&&(identical(other.id, id) || other.id == id)&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.attitude, attitude) || other.attitude == attitude)&&(identical(other.postId, postId) || other.postId == postId)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.account, account) || other.account == account)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPostReaction&&(identical(other.id, id) || other.id == id)&&(identical(other.symbol, symbol) || other.symbol == symbol)&&(identical(other.attitude, attitude) || other.attitude == attitude)&&(identical(other.postId, postId) || other.postId == postId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.actorId, actorId) || other.actorId == actorId)&&(identical(other.actor, actor) || other.actor == actor)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.account, account) || other.account == account)&&(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,symbol,attitude,postId,accountId,createdAt,updatedAt,account,deletedAt);
|
int get hashCode => Object.hash(runtimeType,id,symbol,attitude,postId,createdAt,updatedAt,actorId,actor,accountId,account,deletedAt);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPostReaction(id: $id, symbol: $symbol, attitude: $attitude, postId: $postId, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, account: $account, deletedAt: $deletedAt)';
|
return 'SnPostReaction(id: $id, symbol: $symbol, attitude: $attitude, postId: $postId, createdAt: $createdAt, updatedAt: $updatedAt, actorId: $actorId, actor: $actor, accountId: $accountId, account: $account, deletedAt: $deletedAt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2191,11 +2255,11 @@ abstract mixin class _$SnPostReactionCopyWith<$Res> implements $SnPostReactionCo
|
|||||||
factory _$SnPostReactionCopyWith(_SnPostReaction value, $Res Function(_SnPostReaction) _then) = __$SnPostReactionCopyWithImpl;
|
factory _$SnPostReactionCopyWith(_SnPostReaction value, $Res Function(_SnPostReaction) _then) = __$SnPostReactionCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String symbol, int attitude, String postId, String accountId, DateTime createdAt, DateTime updatedAt, SnAccount? account, DateTime? deletedAt
|
String id, String symbol, int attitude, String postId, DateTime createdAt, DateTime updatedAt, String? actorId, SnActivityPubActor? actor, String? accountId, SnAccount? account, DateTime? deletedAt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $SnAccountCopyWith<$Res>? get account;
|
@override $SnActivityPubActorCopyWith<$Res>? get actor;@override $SnAccountCopyWith<$Res>? get account;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -2208,16 +2272,18 @@ class __$SnPostReactionCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of SnPostReaction
|
/// Create a copy of SnPostReaction
|
||||||
/// 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? symbol = null,Object? attitude = null,Object? postId = null,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? account = freezed,Object? deletedAt = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? symbol = null,Object? attitude = null,Object? postId = null,Object? createdAt = null,Object? updatedAt = null,Object? actorId = freezed,Object? actor = freezed,Object? accountId = freezed,Object? account = freezed,Object? deletedAt = freezed,}) {
|
||||||
return _then(_SnPostReaction(
|
return _then(_SnPostReaction(
|
||||||
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,symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable
|
as String,symbol: null == symbol ? _self.symbol : symbol // ignore: cast_nullable_to_non_nullable
|
||||||
as String,attitude: null == attitude ? _self.attitude : attitude // ignore: cast_nullable_to_non_nullable
|
as String,attitude: null == attitude ? _self.attitude : attitude // ignore: cast_nullable_to_non_nullable
|
||||||
as int,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable
|
as int,postId: null == postId ? _self.postId : postId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,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,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
as DateTime,actorId: freezed == actorId ? _self.actorId : actorId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,actor: freezed == actor ? _self.actor : actor // ignore: cast_nullable_to_non_nullable
|
||||||
|
as SnActivityPubActor?,accountId: freezed == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
|
||||||
as SnAccount?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
as SnAccount?,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
|
||||||
as DateTime?,
|
as DateTime?,
|
||||||
));
|
));
|
||||||
@@ -2227,6 +2293,18 @@ as DateTime?,
|
|||||||
/// 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')
|
||||||
|
$SnActivityPubActorCopyWith<$Res>? get actor {
|
||||||
|
if (_self.actor == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $SnActivityPubActorCopyWith<$Res>(_self.actor!, (value) {
|
||||||
|
return _then(_self.copyWith(actor: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of SnPostReaction
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
$SnAccountCopyWith<$Res>? get account {
|
$SnAccountCopyWith<$Res>? get account {
|
||||||
if (_self.account == null) {
|
if (_self.account == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -48,12 +48,22 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
|||||||
realm: json['realm'] == null
|
realm: json['realm'] == null
|
||||||
? null
|
? null
|
||||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||||
|
publisherId: json['publisher_id'] as String?,
|
||||||
|
publisher: json['publisher'] == null
|
||||||
|
? null
|
||||||
|
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||||
|
actorid: json['actorid'] as String?,
|
||||||
|
actor: json['actor'] == null
|
||||||
|
? null
|
||||||
|
: SnActivityPubActor.fromJson(json['actor'] as Map<String, dynamic>),
|
||||||
|
fediverseUri: json['fediverse_uri'] as String?,
|
||||||
|
fediverseType: (json['fediverse_type'] as num?)?.toInt(),
|
||||||
|
contentType: (json['content_type'] as num?)?.toInt() ?? 0,
|
||||||
attachments:
|
attachments:
|
||||||
(json['attachments'] as List<dynamic>?)
|
(json['attachments'] as List<dynamic>?)
|
||||||
?.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
publisher: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
|
||||||
reactionsCount:
|
reactionsCount:
|
||||||
(json['reactions_count'] as Map<String, dynamic>?)?.map(
|
(json['reactions_count'] as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(k, (e as num).toInt()),
|
(k, e) => MapEntry(k, (e as num).toInt()),
|
||||||
@@ -123,8 +133,14 @@ Map<String, dynamic> _$SnPostToJson(_SnPost instance) => <String, dynamic>{
|
|||||||
'forwarded_post': instance.forwardedPost?.toJson(),
|
'forwarded_post': instance.forwardedPost?.toJson(),
|
||||||
'realm_id': instance.realmId,
|
'realm_id': instance.realmId,
|
||||||
'realm': instance.realm?.toJson(),
|
'realm': instance.realm?.toJson(),
|
||||||
|
'publisher_id': instance.publisherId,
|
||||||
|
'publisher': instance.publisher?.toJson(),
|
||||||
|
'actorid': instance.actorid,
|
||||||
|
'actor': instance.actor?.toJson(),
|
||||||
|
'fediverse_uri': instance.fediverseUri,
|
||||||
|
'fediverse_type': instance.fediverseType,
|
||||||
|
'content_type': instance.contentType,
|
||||||
'attachments': instance.attachments.map((e) => e.toJson()).toList(),
|
'attachments': instance.attachments.map((e) => e.toJson()).toList(),
|
||||||
'publisher': instance.publisher.toJson(),
|
|
||||||
'reactions_count': instance.reactionsCount,
|
'reactions_count': instance.reactionsCount,
|
||||||
'reactions_made': instance.reactionsMade,
|
'reactions_made': instance.reactionsMade,
|
||||||
'reactions': instance.reactions,
|
'reactions': instance.reactions,
|
||||||
@@ -232,9 +248,13 @@ _SnPostReaction _$SnPostReactionFromJson(Map<String, dynamic> json) =>
|
|||||||
symbol: json['symbol'] as String,
|
symbol: json['symbol'] as String,
|
||||||
attitude: (json['attitude'] as num).toInt(),
|
attitude: (json['attitude'] as num).toInt(),
|
||||||
postId: json['post_id'] as String,
|
postId: json['post_id'] as String,
|
||||||
accountId: json['account_id'] 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),
|
||||||
|
actorId: json['actor_id'] as String?,
|
||||||
|
actor: json['actor'] == null
|
||||||
|
? null
|
||||||
|
: SnActivityPubActor.fromJson(json['actor'] as Map<String, dynamic>),
|
||||||
|
accountId: json['account_id'] as String?,
|
||||||
account: json['account'] == null
|
account: json['account'] == null
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
@@ -249,9 +269,11 @@ Map<String, dynamic> _$SnPostReactionToJson(_SnPostReaction instance) =>
|
|||||||
'symbol': instance.symbol,
|
'symbol': instance.symbol,
|
||||||
'attitude': instance.attitude,
|
'attitude': instance.attitude,
|
||||||
'post_id': instance.postId,
|
'post_id': instance.postId,
|
||||||
'account_id': instance.accountId,
|
|
||||||
'created_at': instance.createdAt.toIso8601String(),
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
'updated_at': instance.updatedAt.toIso8601String(),
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
'actor_id': instance.actorId,
|
||||||
|
'actor': instance.actor?.toJson(),
|
||||||
|
'account_id': instance.accountId,
|
||||||
'account': instance.account?.toJson(),
|
'account': instance.account?.toJson(),
|
||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ class CallNotifier extends _$CallNotifier {
|
|||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
final ongoingCall = await ref.read(ongoingCallProvider(roomId).future);
|
final ongoingCall = await ref.read(ongoingCallProvider(roomId).future);
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/chat/realtime/$roomId/join',
|
'/messager/chat/realtime/$roomId/join',
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200 && response.data != null) {
|
if (response.statusCode == 200 && response.data != null) {
|
||||||
final data = response.data;
|
final data = response.data;
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -41,14 +41,13 @@ final class CallNotifierProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$callNotifierHash() => r'40bd884d3918b8e817329589c921774ab3c62ea2';
|
String _$callNotifierHash() => r'caa03913d98c6d98448af44059db5ef72b5d58f6';
|
||||||
|
|
||||||
abstract class _$CallNotifier extends $Notifier<CallState> {
|
abstract class _$CallNotifier extends $Notifier<CallState> {
|
||||||
CallState build();
|
CallState build();
|
||||||
@$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ChatOnlineCountNotifier extends _$ChatOnlineCountNotifier {
|
|||||||
|
|
||||||
// Fetch initial online count
|
// Fetch initial online count
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/chat/$chatroomId/members/online',
|
'/messager/chat/$chatroomId/members/online',
|
||||||
);
|
);
|
||||||
final initialCount = response.data as int;
|
final initialCount = response.data as int;
|
||||||
|
|
||||||
|
|||||||
@@ -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(
|
||||||
@@ -52,7 +52,7 @@ final class ChatOnlineCountNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatOnlineCountNotifierHash() =>
|
String _$chatOnlineCountNotifierHash() =>
|
||||||
r'19af8fd0e9f62c65e12a68215406776085235fa3';
|
r'b2f9f17bfece1937ec90590b8f11db2bec923156';
|
||||||
|
|
||||||
final class ChatOnlineCountNotifierFamily extends $Family
|
final class ChatOnlineCountNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {
|
|||||||
Future(() async {
|
Future(() async {
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat');
|
final resp = await client.get('/messager/chat');
|
||||||
final remoteRooms = resp.data
|
final remoteRooms = resp.data
|
||||||
.map((e) => SnChatRoom.fromJson(e))
|
.map((e) => SnChatRoom.fromJson(e))
|
||||||
.cast<SnChatRoom>()
|
.cast<SnChatRoom>()
|
||||||
@@ -122,7 +122,7 @@ class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {
|
|||||||
|
|
||||||
// Fallback to API
|
// Fallback to API
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat');
|
final resp = await client.get('/messager/chat');
|
||||||
final rooms = resp.data
|
final rooms = resp.data
|
||||||
.map((e) => SnChatRoom.fromJson(e))
|
.map((e) => SnChatRoom.fromJson(e))
|
||||||
.cast<SnChatRoom>()
|
.cast<SnChatRoom>()
|
||||||
@@ -306,7 +306,7 @@ class ChatRoomNotifier extends _$ChatRoomNotifier {
|
|||||||
Future(() async {
|
Future(() async {
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat/$identifier');
|
final resp = await client.get('/messager/chat/$identifier');
|
||||||
final remoteRoom = SnChatRoom.fromJson(resp.data);
|
final remoteRoom = SnChatRoom.fromJson(resp.data);
|
||||||
// Update state with fresh data directly without saving to DB
|
// Update state with fresh data directly without saving to DB
|
||||||
// DB will be updated by ChatRoomJoinedNotifier's full sync
|
// DB will be updated by ChatRoomJoinedNotifier's full sync
|
||||||
@@ -321,7 +321,7 @@ class ChatRoomNotifier extends _$ChatRoomNotifier {
|
|||||||
// Fallback to API
|
// Fallback to API
|
||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat/$identifier');
|
final resp = await client.get('/messager/chat/$identifier');
|
||||||
final room = SnChatRoom.fromJson(resp.data);
|
final room = SnChatRoom.fromJson(resp.data);
|
||||||
await db.saveChatRooms([room]);
|
await db.saveChatRooms([room]);
|
||||||
return room;
|
return room;
|
||||||
@@ -375,7 +375,7 @@ class ChatRoomIdentityNotifier extends _$ChatRoomIdentityNotifier {
|
|||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final resp = await client.get(
|
final resp = await client.get(
|
||||||
'/sphere/chat/$identifier/members/me',
|
'/messager/chat/$identifier/members/me',
|
||||||
);
|
);
|
||||||
final remoteMember = SnChatMember.fromJson(resp.data);
|
final remoteMember = SnChatMember.fromJson(resp.data);
|
||||||
await db.saveMember(remoteMember);
|
await db.saveMember(remoteMember);
|
||||||
@@ -396,7 +396,7 @@ class ChatRoomIdentityNotifier extends _$ChatRoomIdentityNotifier {
|
|||||||
// Fallback to API
|
// Fallback to API
|
||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat/$identifier/members/me');
|
final resp = await client.get('/messager/chat/$identifier/members/me');
|
||||||
final member = SnChatMember.fromJson(resp.data);
|
final member = SnChatMember.fromJson(resp.data);
|
||||||
await db.saveMember(member);
|
await db.saveMember(member);
|
||||||
return member;
|
return member;
|
||||||
@@ -444,7 +444,7 @@ class ChatRoomIdentityNotifier extends _$ChatRoomIdentityNotifier {
|
|||||||
@riverpod
|
@riverpod
|
||||||
Future<List<SnChatMember>> chatroomInvites(Ref ref) async {
|
Future<List<SnChatMember>> chatroomInvites(Ref ref) async {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat/invites');
|
final resp = await client.get('/messager/chat/invites');
|
||||||
return resp.data
|
return resp.data
|
||||||
.map((e) => SnChatMember.fromJson(e))
|
.map((e) => SnChatMember.fromJson(e))
|
||||||
.cast<SnChatMember>()
|
.cast<SnChatMember>()
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -34,7 +34,7 @@ final class ChatRoomJoinedNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatRoomJoinedNotifierHash() =>
|
String _$chatRoomJoinedNotifierHash() =>
|
||||||
r'e69955be56ef2c04a8062a8a65925e0a23bfcbaa';
|
r'b3726e10298b99a8529c5e28a5c402b95016f096';
|
||||||
|
|
||||||
abstract class _$ChatRoomJoinedNotifier
|
abstract class _$ChatRoomJoinedNotifier
|
||||||
extends $AsyncNotifier<List<SnChatRoom>> {
|
extends $AsyncNotifier<List<SnChatRoom>> {
|
||||||
@@ -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(
|
||||||
@@ -98,7 +97,7 @@ final class ChatRoomNotifierProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38';
|
String _$chatRoomNotifierHash() => r'9f7a8bdd4af381c6b60e65e74363a0af3c1a650e';
|
||||||
|
|
||||||
final class ChatRoomNotifierFamily extends $Family
|
final class ChatRoomNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
@@ -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(
|
||||||
@@ -190,7 +188,7 @@ final class ChatRoomIdentityNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatRoomIdentityNotifierHash() =>
|
String _$chatRoomIdentityNotifierHash() =>
|
||||||
r'27c17d55366d39be81d7209837e5c01f80a68a24';
|
r'1ce75462a19cc037c97ee6084a30fee1f5335875';
|
||||||
|
|
||||||
final class ChatRoomIdentityNotifierFamily extends $Family
|
final class ChatRoomIdentityNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
@@ -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,
|
||||||
@@ -279,4 +276,4 @@ final class ChatroomInvitesProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
|
String _$chatroomInvitesHash() => r'fc23231d5f111b1c3796ffae2b471384b951861a';
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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 +36,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 +60,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,12 +75,14 @@ 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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -93,64 +114,85 @@ 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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} 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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup on dispose
|
final subscribedNotifier = ref.watch(
|
||||||
ref.onDispose(() {
|
currentSubscribedChatIdProvider.notifier,
|
||||||
ref.read(currentSubscribedChatIdProvider.notifier).set(null);
|
);
|
||||||
wsState.sendMessage(
|
|
||||||
jsonEncode(
|
ref.onCancel(() {
|
||||||
WebSocketPacket(
|
talker.info('[MessageSubscriber] Unsubscribing room $roomId');
|
||||||
type: 'messages.unsubscribe',
|
subscribedNotifier.set(null);
|
||||||
data: {'chat_room_id': roomId},
|
try {
|
||||||
endpoint: 'sphere',
|
_sendMessage!(
|
||||||
|
jsonEncode(
|
||||||
|
WebSocketPacket(
|
||||||
|
type: 'messages.unsubscribe',
|
||||||
|
data: {'chat_room_id': roomId},
|
||||||
|
endpoint: 'messager',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
} catch (e, stackTrace) {
|
||||||
_wsSubscription?.cancel();
|
talker.error(
|
||||||
_typingCleanupTimer?.cancel();
|
'[MessageSubscriber] Error sending unsubscribe message for room $roomId: $e\n$stackTrace',
|
||||||
_typingCooldownTimer?.cancel();
|
);
|
||||||
_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;
|
||||||
@@ -201,13 +243,13 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -218,13 +260,13 @@ 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',
|
||||||
data: {'chat_room_id': roomId},
|
data: {'chat_room_id': roomId},
|
||||||
endpoint: 'sphere',
|
endpoint: 'messager',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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'1aa164429aaab1628b5edbae11e33b0860abdcdc';
|
r'b7624ae45ace2944a88f8b4d14ddce556c236371';
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ChatUnreadCountNotifier extends _$ChatUnreadCountNotifier {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final response = await client.get('/sphere/chat/unread');
|
final response = await client.get('/messager/chat/unread');
|
||||||
return (response.data as num).toInt();
|
return (response.data as num).toInt();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -65,7 +65,7 @@ class ChatSummary extends _$ChatSummary {
|
|||||||
@override
|
@override
|
||||||
Future<Map<String, SnChatSummary>> build() async {
|
Future<Map<String, SnChatSummary>> build() async {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.get('/sphere/chat/summary');
|
final resp = await client.get('/messager/chat/summary');
|
||||||
|
|
||||||
final Map<String, dynamic> data = resp.data;
|
final Map<String, dynamic> data = resp.data;
|
||||||
final summaries = data.map(
|
final summaries = data.map(
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'chat_summary.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(ChatUnreadCountNotifier)
|
@ProviderFor(ChatUnreadCountNotifier)
|
||||||
const chatUnreadCountProvider = ChatUnreadCountNotifierProvider._();
|
final chatUnreadCountProvider = ChatUnreadCountNotifierProvider._();
|
||||||
|
|
||||||
final class ChatUnreadCountNotifierProvider
|
final class ChatUnreadCountNotifierProvider
|
||||||
extends $AsyncNotifierProvider<ChatUnreadCountNotifier, int> {
|
extends $AsyncNotifierProvider<ChatUnreadCountNotifier, int> {
|
||||||
const ChatUnreadCountNotifierProvider._()
|
ChatUnreadCountNotifierProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -34,14 +34,13 @@ final class ChatUnreadCountNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$chatUnreadCountNotifierHash() =>
|
String _$chatUnreadCountNotifierHash() =>
|
||||||
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
|
r'169b28f8759ebd9de75f7de17f60d493737ee7a8';
|
||||||
|
|
||||||
abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
|
abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
|
||||||
FutureOr<int> build();
|
FutureOr<int> build();
|
||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
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
|
||||||
@@ -51,16 +50,16 @@ abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(ChatSummary)
|
@ProviderFor(ChatSummary)
|
||||||
const chatSummaryProvider = ChatSummaryProvider._();
|
final chatSummaryProvider = ChatSummaryProvider._();
|
||||||
|
|
||||||
final class ChatSummaryProvider
|
final class ChatSummaryProvider
|
||||||
extends $AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>> {
|
extends $AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>> {
|
||||||
const ChatSummaryProvider._()
|
ChatSummaryProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -79,7 +78,7 @@ final class ChatSummaryProvider
|
|||||||
ChatSummary create() => ChatSummary();
|
ChatSummary create() => ChatSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$chatSummaryHash() => r'dfa5e487586482ebdafef8d711f74db68ee86f84';
|
String _$chatSummaryHash() => r'82f516d4ce8b67dadb815523df57a3c30a33ef91';
|
||||||
|
|
||||||
abstract class _$ChatSummary
|
abstract class _$ChatSummary
|
||||||
extends $AsyncNotifier<Map<String, SnChatSummary>> {
|
extends $AsyncNotifier<Map<String, SnChatSummary>> {
|
||||||
@@ -87,7 +86,6 @@ abstract class _$ChatSummary
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
final ref =
|
final ref =
|
||||||
this.ref
|
this.ref
|
||||||
as $Ref<
|
as $Ref<
|
||||||
@@ -105,6 +103,6 @@ abstract class _$ChatSummary
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
talker.log('Fetching messages from API, offset $offset, take $take');
|
talker.log('Fetching messages from API, offset $offset, take $take');
|
||||||
if (_totalCount == null) {
|
if (_totalCount == null) {
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$roomId/messages',
|
'/messager/chat/$roomId/messages',
|
||||||
queryParameters: {'offset': 0, 'take': 1},
|
queryParameters: {'offset': 0, 'take': 1},
|
||||||
);
|
);
|
||||||
_totalCount = int.parse(response.headers['x-total']?.firstOrNull ?? '0');
|
_totalCount = int.parse(response.headers['x-total']?.firstOrNull ?? '0');
|
||||||
@@ -293,7 +293,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$roomId/messages',
|
'/messager/chat/$roomId/messages',
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
queryParameters: {'offset': offset, 'take': take},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
final resp = await _apiClient.post(
|
final resp = await _apiClient.post(
|
||||||
'/sphere/chat/${_room.id}/sync',
|
'/messager/chat/${_room.id}/sync',
|
||||||
data: {'last_sync_timestamp': lastSyncTimestamp},
|
data: {'last_sync_timestamp': lastSyncTimestamp},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -603,8 +603,8 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
|
|
||||||
final response = await _apiClient.request(
|
final response = await _apiClient.request(
|
||||||
editingTo == null
|
editingTo == null
|
||||||
? '/sphere/chat/$roomId/messages'
|
? '/messager/chat/$roomId/messages'
|
||||||
: '/sphere/chat/$roomId/messages/${editingTo.id}',
|
: '/messager/chat/$roomId/messages/${editingTo.id}',
|
||||||
data: {
|
data: {
|
||||||
'content': content,
|
'content': content,
|
||||||
'attachments_id': cloudAttachments.map((e) => e.id).toList(),
|
'attachments_id': cloudAttachments.map((e) => e.id).toList(),
|
||||||
@@ -688,7 +688,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
try {
|
try {
|
||||||
var remoteMessage = message.toRemoteMessage();
|
var remoteMessage = message.toRemoteMessage();
|
||||||
final response = await _apiClient.post(
|
final response = await _apiClient.post(
|
||||||
'/sphere/chat/${message.roomId}/messages',
|
'/messager/chat/${message.roomId}/messages',
|
||||||
data: {
|
data: {
|
||||||
'content': remoteMessage.content,
|
'content': remoteMessage.content,
|
||||||
'attachments_id': remoteMessage.attachments,
|
'attachments_id': remoteMessage.attachments,
|
||||||
@@ -925,7 +925,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await _apiClient.delete('/sphere/chat/$roomId/messages/$messageId');
|
await _apiClient.delete('/messager/chat/$roomId/messages/$messageId');
|
||||||
await receiveMessageDeletion(messageId);
|
await receiveMessageDeletion(messageId);
|
||||||
} catch (err, stackTrace) {
|
} catch (err, stackTrace) {
|
||||||
talker.log(
|
talker.log(
|
||||||
@@ -1033,7 +1033,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final response = await _apiClient.get(
|
final response = await _apiClient.get(
|
||||||
'/sphere/chat/$roomId/messages/$messageId',
|
'/messager/chat/$roomId/messages/$messageId',
|
||||||
);
|
);
|
||||||
final remoteMessage = SnChatMessage.fromJson(response.data);
|
final remoteMessage = SnChatMessage.fromJson(response.data);
|
||||||
final message = LocalChatMessage.fromRemoteMessage(
|
final message = LocalChatMessage.fromRemoteMessage(
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'messages_notifier.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(MessagesNotifier)
|
@ProviderFor(MessagesNotifier)
|
||||||
const messagesProvider = MessagesNotifierFamily._();
|
final messagesProvider = MessagesNotifierFamily._();
|
||||||
|
|
||||||
final class MessagesNotifierProvider
|
final class MessagesNotifierProvider
|
||||||
extends $AsyncNotifierProvider<MessagesNotifier, List<LocalChatMessage>> {
|
extends $AsyncNotifierProvider<MessagesNotifier, List<LocalChatMessage>> {
|
||||||
const MessagesNotifierProvider._({
|
MessagesNotifierProvider._({
|
||||||
required MessagesNotifierFamily super.from,
|
required MessagesNotifierFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -50,7 +50,7 @@ final class MessagesNotifierProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$messagesNotifierHash() => r'c7e2cd7f5b8673af88f5076814393dbfbd0d43c5';
|
String _$messagesNotifierHash() => r'a721a4b92b48ee7c2289cdcd7130bbf1ca9dcb40';
|
||||||
|
|
||||||
final class MessagesNotifierFamily extends $Family
|
final class MessagesNotifierFamily extends $Family
|
||||||
with
|
with
|
||||||
@@ -61,7 +61,7 @@ final class MessagesNotifierFamily extends $Family
|
|||||||
FutureOr<List<LocalChatMessage>>,
|
FutureOr<List<LocalChatMessage>>,
|
||||||
String
|
String
|
||||||
> {
|
> {
|
||||||
const MessagesNotifierFamily._()
|
MessagesNotifierFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'messagesProvider',
|
name: r'messagesProvider',
|
||||||
@@ -86,7 +86,6 @@ abstract class _$MessagesNotifier
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref =
|
final ref =
|
||||||
this.ref
|
this.ref
|
||||||
as $Ref<AsyncValue<List<LocalChatMessage>>, List<LocalChatMessage>>;
|
as $Ref<AsyncValue<List<LocalChatMessage>>, List<LocalChatMessage>>;
|
||||||
@@ -101,6 +100,6 @@ abstract class _$MessagesNotifier
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const kAppFirstLaunchAt = 'app_first_launch_at';
|
|||||||
const kAppAskedReview = 'app_asked_review';
|
const kAppAskedReview = 'app_asked_review';
|
||||||
const kAppDashSearchEngine = 'app_dash_search_engine';
|
const kAppDashSearchEngine = 'app_dash_search_engine';
|
||||||
const kAppDefaultScreen = 'app_default_screen';
|
const kAppDefaultScreen = 'app_default_screen';
|
||||||
|
const kAppShowFediverseContent = 'app_show_fediverse_content';
|
||||||
|
|
||||||
// Will be overrided by the ProviderScope
|
// Will be overrided by the ProviderScope
|
||||||
final sharedPreferencesProvider = Provider<SharedPreferences>((ref) {
|
final sharedPreferencesProvider = Provider<SharedPreferences>((ref) {
|
||||||
@@ -91,6 +92,7 @@ sealed class AppSettings with _$AppSettings {
|
|||||||
required bool askedReview,
|
required bool askedReview,
|
||||||
required String? dashSearchEngine,
|
required String? dashSearchEngine,
|
||||||
required String? defaultScreen,
|
required String? defaultScreen,
|
||||||
|
required bool showFediverseContent,
|
||||||
}) = _AppSettings;
|
}) = _AppSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +124,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
firstLaunchAt: prefs.getString(kAppFirstLaunchAt),
|
firstLaunchAt: prefs.getString(kAppFirstLaunchAt),
|
||||||
dashSearchEngine: prefs.getString(kAppDashSearchEngine),
|
dashSearchEngine: prefs.getString(kAppDashSearchEngine),
|
||||||
defaultScreen: prefs.getString(kAppDefaultScreen),
|
defaultScreen: prefs.getString(kAppDefaultScreen),
|
||||||
|
showFediverseContent: prefs.getBool(kAppShowFediverseContent) ?? true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +314,12 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
}
|
}
|
||||||
state = state.copyWith(dashSearchEngine: value);
|
state = state.copyWith(dashSearchEngine: value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setShowFediverseContent(bool value) {
|
||||||
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
|
prefs.setBool(kAppShowFediverseContent, value);
|
||||||
|
state = state.copyWith(showFediverseContent: value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final updateInfoProvider =
|
final updateInfoProvider =
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ mixin _$AppSettings {
|
|||||||
ThemeColors? get customColors; Size? get windowSize;// The window size for desktop platforms
|
ThemeColors? get customColors; Size? get windowSize;// The window size for desktop platforms
|
||||||
double get windowOpacity;// The window opacity for desktop platforms
|
double get windowOpacity;// The window opacity for desktop platforms
|
||||||
double get cardTransparency;// The card background opacity
|
double get cardTransparency;// The card background opacity
|
||||||
String? get defaultPoolId; String get messageDisplayStyle; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen;
|
String? get defaultPoolId; String get messageDisplayStyle; String? get themeMode; bool get disableAnimation; bool get groupedChatList; String? get firstLaunchAt; bool get askedReview; String? get dashSearchEngine; String? get defaultScreen; bool get showFediverseContent;
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -301,16 +301,16 @@ $AppSettingsCopyWith<AppSettings> get copyWith => _$AppSettingsCopyWithImpl<AppS
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen]);
|
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen)';
|
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ abstract mixin class $AppSettingsCopyWith<$Res> {
|
|||||||
factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl;
|
factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen
|
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ class _$AppSettingsCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -362,7 +362,8 @@ as bool,firstLaunchAt: freezed == firstLaunchAt ? _self.firstLaunchAt : firstLau
|
|||||||
as String?,askedReview: null == askedReview ? _self.askedReview : askedReview // ignore: cast_nullable_to_non_nullable
|
as String?,askedReview: null == askedReview ? _self.askedReview : askedReview // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
@@ -456,10 +457,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings() when $default != null:
|
case _AppSettings() when $default != null:
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen);case _:
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -477,10 +478,10 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings():
|
case _AppSettings():
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen);}
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
@@ -494,10 +495,10 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _AppSettings() when $default != null:
|
case _AppSettings() when $default != null:
|
||||||
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen);case _:
|
return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_that.enterToSend,_that.appBarTransparent,_that.showBackgroundImage,_that.notifyWithHaptic,_that.customFonts,_that.appColorScheme,_that.customColors,_that.windowSize,_that.windowOpacity,_that.cardTransparency,_that.defaultPoolId,_that.messageDisplayStyle,_that.themeMode,_that.disableAnimation,_that.groupedChatList,_that.firstLaunchAt,_that.askedReview,_that.dashSearchEngine,_that.defaultScreen,_that.showFediverseContent);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -509,7 +510,7 @@ return $default(_that.dataSavingMode,_that.soundEffects,_that.festivalFeatures,_
|
|||||||
|
|
||||||
|
|
||||||
class _AppSettings implements AppSettings {
|
class _AppSettings implements AppSettings {
|
||||||
const _AppSettings({required this.dataSavingMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen});
|
const _AppSettings({required this.dataSavingMode, required this.soundEffects, required this.festivalFeatures, required this.enterToSend, required this.appBarTransparent, required this.showBackgroundImage, required this.notifyWithHaptic, required this.customFonts, required this.appColorScheme, required this.customColors, required this.windowSize, required this.windowOpacity, required this.cardTransparency, required this.defaultPoolId, required this.messageDisplayStyle, required this.themeMode, required this.disableAnimation, required this.groupedChatList, required this.firstLaunchAt, required this.askedReview, required this.dashSearchEngine, required this.defaultScreen, required this.showFediverseContent});
|
||||||
|
|
||||||
|
|
||||||
@override final bool dataSavingMode;
|
@override final bool dataSavingMode;
|
||||||
@@ -538,6 +539,7 @@ class _AppSettings implements AppSettings {
|
|||||||
@override final bool askedReview;
|
@override final bool askedReview;
|
||||||
@override final String? dashSearchEngine;
|
@override final String? dashSearchEngine;
|
||||||
@override final String? defaultScreen;
|
@override final String? defaultScreen;
|
||||||
|
@override final bool showFediverseContent;
|
||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@@ -549,16 +551,16 @@ _$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.dataSavingMode, dataSavingMode) || other.dataSavingMode == dataSavingMode)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.festivalFeatures, festivalFeatures) || other.festivalFeatures == festivalFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)&&(identical(other.appBarTransparent, appBarTransparent) || other.appBarTransparent == appBarTransparent)&&(identical(other.showBackgroundImage, showBackgroundImage) || other.showBackgroundImage == showBackgroundImage)&&(identical(other.notifyWithHaptic, notifyWithHaptic) || other.notifyWithHaptic == notifyWithHaptic)&&(identical(other.customFonts, customFonts) || other.customFonts == customFonts)&&(identical(other.appColorScheme, appColorScheme) || other.appColorScheme == appColorScheme)&&(identical(other.customColors, customColors) || other.customColors == customColors)&&(identical(other.windowSize, windowSize) || other.windowSize == windowSize)&&(identical(other.windowOpacity, windowOpacity) || other.windowOpacity == windowOpacity)&&(identical(other.cardTransparency, cardTransparency) || other.cardTransparency == cardTransparency)&&(identical(other.defaultPoolId, defaultPoolId) || other.defaultPoolId == defaultPoolId)&&(identical(other.messageDisplayStyle, messageDisplayStyle) || other.messageDisplayStyle == messageDisplayStyle)&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.disableAnimation, disableAnimation) || other.disableAnimation == disableAnimation)&&(identical(other.groupedChatList, groupedChatList) || other.groupedChatList == groupedChatList)&&(identical(other.firstLaunchAt, firstLaunchAt) || other.firstLaunchAt == firstLaunchAt)&&(identical(other.askedReview, askedReview) || other.askedReview == askedReview)&&(identical(other.dashSearchEngine, dashSearchEngine) || other.dashSearchEngine == dashSearchEngine)&&(identical(other.defaultScreen, defaultScreen) || other.defaultScreen == defaultScreen)&&(identical(other.showFediverseContent, showFediverseContent) || other.showFediverseContent == showFediverseContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen]);
|
int get hashCode => Object.hashAll([runtimeType,dataSavingMode,soundEffects,festivalFeatures,enterToSend,appBarTransparent,showBackgroundImage,notifyWithHaptic,customFonts,appColorScheme,customColors,windowSize,windowOpacity,cardTransparency,defaultPoolId,messageDisplayStyle,themeMode,disableAnimation,groupedChatList,firstLaunchAt,askedReview,dashSearchEngine,defaultScreen,showFediverseContent]);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen)';
|
return 'AppSettings(dataSavingMode: $dataSavingMode, soundEffects: $soundEffects, festivalFeatures: $festivalFeatures, enterToSend: $enterToSend, appBarTransparent: $appBarTransparent, showBackgroundImage: $showBackgroundImage, notifyWithHaptic: $notifyWithHaptic, customFonts: $customFonts, appColorScheme: $appColorScheme, customColors: $customColors, windowSize: $windowSize, windowOpacity: $windowOpacity, cardTransparency: $cardTransparency, defaultPoolId: $defaultPoolId, messageDisplayStyle: $messageDisplayStyle, themeMode: $themeMode, disableAnimation: $disableAnimation, groupedChatList: $groupedChatList, firstLaunchAt: $firstLaunchAt, askedReview: $askedReview, dashSearchEngine: $dashSearchEngine, defaultScreen: $defaultScreen, showFediverseContent: $showFediverseContent)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -569,7 +571,7 @@ abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith
|
|||||||
factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl;
|
factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen
|
bool dataSavingMode, bool soundEffects, bool festivalFeatures, bool enterToSend, bool appBarTransparent, bool showBackgroundImage, bool notifyWithHaptic, String? customFonts, int? appColorScheme, ThemeColors? customColors, Size? windowSize, double windowOpacity, double cardTransparency, String? defaultPoolId, String messageDisplayStyle, String? themeMode, bool disableAnimation, bool groupedChatList, String? firstLaunchAt, bool askedReview, String? dashSearchEngine, String? defaultScreen, bool showFediverseContent
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -586,7 +588,7 @@ class __$AppSettingsCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of AppSettings
|
/// Create a copy of AppSettings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? dataSavingMode = null,Object? soundEffects = null,Object? festivalFeatures = null,Object? enterToSend = null,Object? appBarTransparent = null,Object? showBackgroundImage = null,Object? notifyWithHaptic = null,Object? customFonts = freezed,Object? appColorScheme = freezed,Object? customColors = freezed,Object? windowSize = freezed,Object? windowOpacity = null,Object? cardTransparency = null,Object? defaultPoolId = freezed,Object? messageDisplayStyle = null,Object? themeMode = freezed,Object? disableAnimation = null,Object? groupedChatList = null,Object? firstLaunchAt = freezed,Object? askedReview = null,Object? dashSearchEngine = freezed,Object? defaultScreen = freezed,Object? showFediverseContent = null,}) {
|
||||||
return _then(_AppSettings(
|
return _then(_AppSettings(
|
||||||
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
dataSavingMode: null == dataSavingMode ? _self.dataSavingMode : dataSavingMode // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -610,7 +612,8 @@ as bool,firstLaunchAt: freezed == firstLaunchAt ? _self.firstLaunchAt : firstLau
|
|||||||
as String?,askedReview: null == askedReview ? _self.askedReview : askedReview // ignore: cast_nullable_to_non_nullable
|
as String?,askedReview: null == askedReview ? _self.askedReview : askedReview // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
as bool,dashSearchEngine: freezed == dashSearchEngine ? _self.dashSearchEngine : dashSearchEngine // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
as String?,defaultScreen: freezed == defaultScreen ? _self.defaultScreen : defaultScreen // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,showFediverseContent: null == showFediverseContent ? _self.showFediverseContent : showFediverseContent // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ Map<String, dynamic> _$ThemeColorsToJson(_ThemeColors instance) =>
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(AppSettingsNotifier)
|
@ProviderFor(AppSettingsNotifier)
|
||||||
const appSettingsProvider = AppSettingsNotifierProvider._();
|
final appSettingsProvider = AppSettingsNotifierProvider._();
|
||||||
|
|
||||||
final class AppSettingsNotifierProvider
|
final class AppSettingsNotifierProvider
|
||||||
extends $NotifierProvider<AppSettingsNotifier, AppSettings> {
|
extends $NotifierProvider<AppSettingsNotifier, AppSettings> {
|
||||||
const AppSettingsNotifierProvider._()
|
AppSettingsNotifierProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -65,14 +65,13 @@ final class AppSettingsNotifierProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$appSettingsNotifierHash() =>
|
String _$appSettingsNotifierHash() =>
|
||||||
r'6592261baf8182fe78d3e58e2fd9bb53d3287736';
|
r'2437c621dcb1625a120ed1f21ab5c29906ba98be';
|
||||||
|
|
||||||
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
||||||
AppSettings build();
|
AppSettings build();
|
||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
final ref = this.ref as $Ref<AppSettings, AppSettings>;
|
final ref = this.ref as $Ref<AppSettings, AppSettings>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -82,6 +81,6 @@ abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ final indexedCloudFileListProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
IndexedCloudFileListNotifier.new,
|
IndexedCloudFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
class IndexedCloudFileListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<FileListItem>>
|
||||||
with AsyncPaginationController<FileListItem> {
|
with AsyncPaginationController<FileListItem> {
|
||||||
String _currentPath = '/';
|
String _currentPath = '/';
|
||||||
String? _poolId;
|
String? _poolId;
|
||||||
@@ -51,6 +52,19 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
ref.invalidateSelf();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<FileListItem>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: null,
|
||||||
|
hasMore: false,
|
||||||
|
cursor: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<FileListItem>> fetch() async {
|
Future<List<FileListItem>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
@@ -96,7 +110,8 @@ final unindexedFileListProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
UnindexedFileListNotifier.new,
|
UnindexedFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class UnindexedFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
class UnindexedFileListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<FileListItem>>
|
||||||
with AsyncPaginationController<FileListItem> {
|
with AsyncPaginationController<FileListItem> {
|
||||||
String? _poolId;
|
String? _poolId;
|
||||||
bool _recycled = false;
|
bool _recycled = false;
|
||||||
@@ -131,6 +146,19 @@ class UnindexedFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
|
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<FileListItem>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<FileListItem>> fetch() async {
|
Future<List<FileListItem>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'file_list.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(billingUsage)
|
@ProviderFor(billingUsage)
|
||||||
const billingUsageProvider = BillingUsageProvider._();
|
final billingUsageProvider = BillingUsageProvider._();
|
||||||
|
|
||||||
final class BillingUsageProvider
|
final class BillingUsageProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class BillingUsageProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<Map<String, dynamic>?>,
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
$FutureProvider<Map<String, dynamic>?> {
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
const BillingUsageProvider._()
|
BillingUsageProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -51,7 +51,7 @@ final class BillingUsageProvider
|
|||||||
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
||||||
|
|
||||||
@ProviderFor(billingQuota)
|
@ProviderFor(billingQuota)
|
||||||
const billingQuotaProvider = BillingQuotaProvider._();
|
final billingQuotaProvider = BillingQuotaProvider._();
|
||||||
|
|
||||||
final class BillingQuotaProvider
|
final class BillingQuotaProvider
|
||||||
extends
|
extends
|
||||||
@@ -63,7 +63,7 @@ final class BillingQuotaProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<Map<String, dynamic>?>,
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
$FutureProvider<Map<String, dynamic>?> {
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
const BillingQuotaProvider._()
|
BillingQuotaProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'file_references.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(fileReferences)
|
@ProviderFor(fileReferences)
|
||||||
const fileReferencesProvider = FileReferencesFamily._();
|
final fileReferencesProvider = FileReferencesFamily._();
|
||||||
|
|
||||||
final class FileReferencesProvider
|
final class FileReferencesProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class FileReferencesProvider
|
|||||||
FutureOr<List<Reference>>
|
FutureOr<List<Reference>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
|
with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
|
||||||
const FileReferencesProvider._({
|
FileReferencesProvider._({
|
||||||
required FileReferencesFamily super.from,
|
required FileReferencesFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
|||||||
|
|
||||||
final class FileReferencesFamily extends $Family
|
final class FileReferencesFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
|
||||||
const FileReferencesFamily._()
|
FileReferencesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'fileReferencesProvider',
|
name: r'fileReferencesProvider',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ part of 'event_calendar.dart';
|
|||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
|
|
||||||
@ProviderFor(eventCalendar)
|
@ProviderFor(eventCalendar)
|
||||||
const eventCalendarProvider = EventCalendarFamily._();
|
final eventCalendarProvider = EventCalendarFamily._();
|
||||||
|
|
||||||
/// Provider for fetching event calendar data
|
/// Provider for fetching event calendar data
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
@@ -29,7 +29,7 @@ final class EventCalendarProvider
|
|||||||
$FutureProvider<List<SnEventCalendarEntry>> {
|
$FutureProvider<List<SnEventCalendarEntry>> {
|
||||||
/// Provider for fetching event calendar data
|
/// Provider for fetching event calendar data
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
const EventCalendarProvider._({
|
EventCalendarProvider._({
|
||||||
required EventCalendarFamily super.from,
|
required EventCalendarFamily super.from,
|
||||||
required EventCalendarQuery super.argument,
|
required EventCalendarQuery super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -84,7 +84,7 @@ final class EventCalendarFamily extends $Family
|
|||||||
FutureOr<List<SnEventCalendarEntry>>,
|
FutureOr<List<SnEventCalendarEntry>>,
|
||||||
EventCalendarQuery
|
EventCalendarQuery
|
||||||
> {
|
> {
|
||||||
const EventCalendarFamily._()
|
EventCalendarFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'eventCalendarProvider',
|
name: r'eventCalendarProvider',
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'link_preview.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(LinkPreview)
|
@ProviderFor(LinkPreview)
|
||||||
const linkPreviewProvider = LinkPreviewFamily._();
|
final linkPreviewProvider = LinkPreviewFamily._();
|
||||||
|
|
||||||
final class LinkPreviewProvider
|
final class LinkPreviewProvider
|
||||||
extends $AsyncNotifierProvider<LinkPreview, SnScrappedLink?> {
|
extends $AsyncNotifierProvider<LinkPreview, SnScrappedLink?> {
|
||||||
const LinkPreviewProvider._({
|
LinkPreviewProvider._({
|
||||||
required LinkPreviewFamily super.from,
|
required LinkPreviewFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -61,7 +61,7 @@ final class LinkPreviewFamily extends $Family
|
|||||||
FutureOr<SnScrappedLink?>,
|
FutureOr<SnScrappedLink?>,
|
||||||
String
|
String
|
||||||
> {
|
> {
|
||||||
const LinkPreviewFamily._()
|
LinkPreviewFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'linkPreviewProvider',
|
name: r'linkPreviewProvider',
|
||||||
@@ -85,7 +85,6 @@ abstract class _$LinkPreview extends $AsyncNotifier<SnScrappedLink?> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build(_$args);
|
|
||||||
final ref = this.ref as $Ref<AsyncValue<SnScrappedLink?>, SnScrappedLink?>;
|
final ref = this.ref as $Ref<AsyncValue<SnScrappedLink?>, SnScrappedLink?>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -95,6 +94,6 @@ abstract class _$LinkPreview extends $AsyncNotifier<SnScrappedLink?> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, () => build(_$args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ part of 'network.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(NetworkStatusNotifier)
|
@ProviderFor(NetworkStatusNotifier)
|
||||||
const networkStatusProvider = NetworkStatusNotifierProvider._();
|
final networkStatusProvider = NetworkStatusNotifierProvider._();
|
||||||
|
|
||||||
final class NetworkStatusNotifierProvider
|
final class NetworkStatusNotifierProvider
|
||||||
extends $NotifierProvider<NetworkStatusNotifier, NetworkStatus> {
|
extends $NotifierProvider<NetworkStatusNotifier, NetworkStatus> {
|
||||||
const NetworkStatusNotifierProvider._()
|
NetworkStatusNotifierProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -49,7 +49,6 @@ abstract class _$NetworkStatusNotifier extends $Notifier<NetworkStatus> {
|
|||||||
@$mustCallSuper
|
@$mustCallSuper
|
||||||
@override
|
@override
|
||||||
void runBuild() {
|
void runBuild() {
|
||||||
final created = build();
|
|
||||||
final ref = this.ref as $Ref<NetworkStatus, NetworkStatus>;
|
final ref = this.ref as $Ref<NetworkStatus, NetworkStatus>;
|
||||||
final element =
|
final element =
|
||||||
ref.element
|
ref.element
|
||||||
@@ -59,6 +58,6 @@ abstract class _$NetworkStatusNotifier extends $Notifier<NetworkStatus> {
|
|||||||
Object?,
|
Object?,
|
||||||
Object?
|
Object?
|
||||||
>;
|
>;
|
||||||
element.handleValue(ref, created);
|
element.handleCreate(ref, build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,49 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
class PaginationState<T> {
|
||||||
|
final List<T> items;
|
||||||
|
final bool isLoading;
|
||||||
|
final bool isReloading;
|
||||||
|
final int? totalCount;
|
||||||
|
final bool hasMore;
|
||||||
|
final String? cursor;
|
||||||
|
|
||||||
|
const PaginationState({
|
||||||
|
required this.items,
|
||||||
|
required this.isLoading,
|
||||||
|
required this.isReloading,
|
||||||
|
required this.totalCount,
|
||||||
|
required this.hasMore,
|
||||||
|
required this.cursor,
|
||||||
|
});
|
||||||
|
|
||||||
|
PaginationState<T> copyWith({
|
||||||
|
List<T>? items,
|
||||||
|
bool? isLoading,
|
||||||
|
bool? isReloading,
|
||||||
|
int? totalCount,
|
||||||
|
bool? hasMore,
|
||||||
|
String? cursor,
|
||||||
|
}) {
|
||||||
|
return PaginationState<T>(
|
||||||
|
items: items ?? this.items,
|
||||||
|
isLoading: isLoading ?? this.isLoading,
|
||||||
|
isReloading: isReloading ?? this.isReloading,
|
||||||
|
totalCount: totalCount ?? this.totalCount,
|
||||||
|
hasMore: hasMore ?? this.hasMore,
|
||||||
|
cursor: cursor ?? this.cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class PaginationController<T> {
|
abstract class PaginationController<T> {
|
||||||
int? get totalCount;
|
int? get totalCount;
|
||||||
int get fetchedCount;
|
int get fetchedCount;
|
||||||
|
|
||||||
bool get fetchedAll;
|
bool get fetchedAll;
|
||||||
bool get isLoading;
|
bool get isLoading;
|
||||||
|
bool get isReloading;
|
||||||
bool get hasMore;
|
bool get hasMore;
|
||||||
set hasMore(bool value);
|
set hasMore(bool value);
|
||||||
String? get cursor;
|
String? get cursor;
|
||||||
@@ -26,46 +63,86 @@ abstract class PaginationFiltered<F> {
|
|||||||
Future<void> applyFilter(F filter);
|
Future<void> applyFilter(F filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin AsyncPaginationController<T> on AsyncNotifier<List<T>>
|
mixin AsyncPaginationController<T> on AsyncNotifier<PaginationState<T>>
|
||||||
implements PaginationController<T> {
|
implements PaginationController<T> {
|
||||||
@override
|
@override
|
||||||
int? totalCount;
|
int? totalCount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get fetchedCount => state.value?.length ?? 0;
|
int get fetchedCount =>
|
||||||
|
state.value?.isReloading == true ? 0 : state.value?.items.length ?? 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get fetchedAll =>
|
bool get fetchedAll =>
|
||||||
!hasMore || (totalCount != null && fetchedCount >= totalCount!);
|
!(state.value?.hasMore ?? true) ||
|
||||||
|
((state.value?.totalCount != null &&
|
||||||
|
fetchedCount >= state.value!.totalCount!));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool isLoading = false;
|
bool get isLoading => state.value?.isLoading ?? false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool hasMore = true;
|
bool get isReloading => state.value?.isReloading ?? false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? cursor;
|
bool get hasMore => state.value?.hasMore ?? true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<T>> build() async {
|
String? get cursor => state.value?.cursor;
|
||||||
cursor = null;
|
|
||||||
return fetch();
|
@override
|
||||||
|
set hasMore(bool value) {
|
||||||
|
if (state is AsyncData) {
|
||||||
|
state = AsyncData((state as AsyncData).value.copyWith(hasMore: value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
set cursor(String? value) {
|
||||||
|
if (state is AsyncData) {
|
||||||
|
state = AsyncData((state as AsyncData).value.copyWith(cursor: value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<T>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
isLoading = true;
|
state = AsyncData(
|
||||||
totalCount = null;
|
PaginationState(
|
||||||
hasMore = true;
|
items: [],
|
||||||
cursor = null;
|
isLoading: true,
|
||||||
state = AsyncLoading<List<T>>();
|
isReloading: true,
|
||||||
|
totalCount: null,
|
||||||
|
hasMore: true,
|
||||||
|
cursor: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newItems = await fetch();
|
||||||
return await fetch();
|
|
||||||
});
|
if (!ref.mounted) return;
|
||||||
state = newState;
|
state = AsyncData(
|
||||||
isLoading = false;
|
PaginationState(
|
||||||
|
items: newItems,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -73,16 +150,17 @@ mixin AsyncPaginationController<T> on AsyncNotifier<List<T>>
|
|||||||
if (fetchedAll) return;
|
if (fetchedAll) return;
|
||||||
if (isLoading) return;
|
if (isLoading) return;
|
||||||
|
|
||||||
isLoading = true;
|
state = AsyncData(state.value!.copyWith(isLoading: true));
|
||||||
state = AsyncLoading<List<T>>();
|
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newItems = await fetch();
|
||||||
final elements = await fetch();
|
|
||||||
return [...?state.value, ...elements];
|
|
||||||
});
|
|
||||||
|
|
||||||
state = newState;
|
if (!ref.mounted) return;
|
||||||
isLoading = false;
|
state = AsyncData(
|
||||||
|
state.value!.copyWith(
|
||||||
|
items: [...state.value!.items, ...newItems],
|
||||||
|
isLoading: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,18 +169,31 @@ mixin AsyncPaginationFilter<F, T> on AsyncPaginationController<T>
|
|||||||
@override
|
@override
|
||||||
Future<void> applyFilter(F filter) async {
|
Future<void> applyFilter(F filter) async {
|
||||||
if (currentFilter == filter) return;
|
if (currentFilter == filter) return;
|
||||||
// Reset the data
|
|
||||||
isLoading = true;
|
state = AsyncData(
|
||||||
totalCount = null;
|
PaginationState(
|
||||||
hasMore = true;
|
items: [],
|
||||||
cursor = null;
|
isLoading: true,
|
||||||
state = AsyncLoading<List<T>>();
|
isReloading: true,
|
||||||
|
totalCount: null,
|
||||||
|
hasMore: true,
|
||||||
|
cursor: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
currentFilter = filter;
|
currentFilter = filter;
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newItems = await fetch();
|
||||||
return await fetch();
|
|
||||||
});
|
if (!ref.mounted) return;
|
||||||
state = newState;
|
state = AsyncData(
|
||||||
isLoading = false;
|
PaginationState(
|
||||||
|
items: newItems,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// Post Categories Notifier
|
// Post Categories Notifier
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/post_category.dart';
|
import 'package:island/models/post_category.dart';
|
||||||
import 'package:island/models/post_tag.dart';
|
import 'package:island/models/post_tag.dart';
|
||||||
@@ -8,11 +10,25 @@ import 'package:island/pods/paging.dart';
|
|||||||
final postCategoriesProvider =
|
final postCategoriesProvider =
|
||||||
AsyncNotifierProvider.autoDispose<
|
AsyncNotifierProvider.autoDispose<
|
||||||
PostCategoriesNotifier,
|
PostCategoriesNotifier,
|
||||||
List<SnPostCategory>
|
PaginationState<SnPostCategory>
|
||||||
>(PostCategoriesNotifier.new);
|
>(PostCategoriesNotifier.new);
|
||||||
|
|
||||||
class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
|
class PostCategoriesNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnPostCategory>>
|
||||||
with AsyncPaginationController<SnPostCategory> {
|
with AsyncPaginationController<SnPostCategory> {
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnPostCategory>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPostCategory>> fetch() async {
|
Future<List<SnPostCategory>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
@@ -30,12 +46,26 @@ class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
|
|||||||
|
|
||||||
// Post Tags Notifier
|
// Post Tags Notifier
|
||||||
final postTagsProvider =
|
final postTagsProvider =
|
||||||
AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>(
|
AsyncNotifierProvider.autoDispose<
|
||||||
PostTagsNotifier.new,
|
PostTagsNotifier,
|
||||||
);
|
PaginationState<SnPostTag>
|
||||||
|
>(PostTagsNotifier.new);
|
||||||
|
|
||||||
class PostTagsNotifier extends AsyncNotifier<List<SnPostTag>>
|
class PostTagsNotifier extends AsyncNotifier<PaginationState<SnPostTag>>
|
||||||
with AsyncPaginationController<SnPostTag> {
|
with AsyncPaginationController<SnPostTag> {
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnPostTag>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPostTag>> fetch() async {
|
Future<List<SnPostTag>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/post.dart';
|
import 'package:island/models/post.dart';
|
||||||
@@ -39,7 +41,7 @@ final postListProvider = AsyncNotifierProvider.autoDispose.family(
|
|||||||
PostListNotifier.new,
|
PostListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class PostListNotifier extends AsyncNotifier<List<SnPost>>
|
class PostListNotifier extends AsyncNotifier<PaginationState<SnPost>>
|
||||||
with
|
with
|
||||||
AsyncPaginationController<SnPost>,
|
AsyncPaginationController<SnPost>,
|
||||||
AsyncPaginationFilter<PostListQuery, SnPost> {
|
AsyncPaginationFilter<PostListQuery, SnPost> {
|
||||||
@@ -53,9 +55,17 @@ class PostListNotifier extends AsyncNotifier<List<SnPost>>
|
|||||||
late PostListQuery currentFilter;
|
late PostListQuery currentFilter;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPost>> build() async {
|
FutureOr<PaginationState<SnPost>> build() async {
|
||||||
currentFilter = config.initialFilter;
|
currentFilter = config.initialFilter;
|
||||||
return fetch();
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'site_files.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(siteFiles)
|
@ProviderFor(siteFiles)
|
||||||
const siteFilesProvider = SiteFilesFamily._();
|
final siteFilesProvider = SiteFilesFamily._();
|
||||||
|
|
||||||
final class SiteFilesProvider
|
final class SiteFilesProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class SiteFilesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnSiteFileEntry>>,
|
$FutureModifier<List<SnSiteFileEntry>>,
|
||||||
$FutureProvider<List<SnSiteFileEntry>> {
|
$FutureProvider<List<SnSiteFileEntry>> {
|
||||||
const SiteFilesProvider._({
|
SiteFilesProvider._({
|
||||||
required SiteFilesFamily super.from,
|
required SiteFilesFamily super.from,
|
||||||
required ({String siteId, String? path}) super.argument,
|
required ({String siteId, String? path}) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -74,7 +74,7 @@ final class SiteFilesFamily extends $Family
|
|||||||
FutureOr<List<SnSiteFileEntry>>,
|
FutureOr<List<SnSiteFileEntry>>,
|
||||||
({String siteId, String? path})
|
({String siteId, String? path})
|
||||||
> {
|
> {
|
||||||
const SiteFilesFamily._()
|
SiteFilesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'siteFilesProvider',
|
name: r'siteFilesProvider',
|
||||||
@@ -91,7 +91,7 @@ final class SiteFilesFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(siteFileContent)
|
@ProviderFor(siteFileContent)
|
||||||
const siteFileContentProvider = SiteFileContentFamily._();
|
final siteFileContentProvider = SiteFileContentFamily._();
|
||||||
|
|
||||||
final class SiteFileContentProvider
|
final class SiteFileContentProvider
|
||||||
extends
|
extends
|
||||||
@@ -101,7 +101,7 @@ final class SiteFileContentProvider
|
|||||||
FutureOr<SnFileContent>
|
FutureOr<SnFileContent>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnFileContent>, $FutureProvider<SnFileContent> {
|
with $FutureModifier<SnFileContent>, $FutureProvider<SnFileContent> {
|
||||||
const SiteFileContentProvider._({
|
SiteFileContentProvider._({
|
||||||
required SiteFileContentFamily super.from,
|
required SiteFileContentFamily super.from,
|
||||||
required ({String siteId, String relativePath}) super.argument,
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -157,7 +157,7 @@ final class SiteFileContentFamily extends $Family
|
|||||||
FutureOr<SnFileContent>,
|
FutureOr<SnFileContent>,
|
||||||
({String siteId, String relativePath})
|
({String siteId, String relativePath})
|
||||||
> {
|
> {
|
||||||
const SiteFileContentFamily._()
|
SiteFileContentFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'siteFileContentProvider',
|
name: r'siteFileContentProvider',
|
||||||
@@ -179,12 +179,12 @@ final class SiteFileContentFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(siteFileContentRaw)
|
@ProviderFor(siteFileContentRaw)
|
||||||
const siteFileContentRawProvider = SiteFileContentRawFamily._();
|
final siteFileContentRawProvider = SiteFileContentRawFamily._();
|
||||||
|
|
||||||
final class SiteFileContentRawProvider
|
final class SiteFileContentRawProvider
|
||||||
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
with $FutureModifier<String>, $FutureProvider<String> {
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
const SiteFileContentRawProvider._({
|
SiteFileContentRawProvider._({
|
||||||
required SiteFileContentRawFamily super.from,
|
required SiteFileContentRawFamily super.from,
|
||||||
required ({String siteId, String relativePath}) super.argument,
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -240,7 +240,7 @@ final class SiteFileContentRawFamily extends $Family
|
|||||||
FutureOr<String>,
|
FutureOr<String>,
|
||||||
({String siteId, String relativePath})
|
({String siteId, String relativePath})
|
||||||
> {
|
> {
|
||||||
const SiteFileContentRawFamily._()
|
SiteFileContentRawFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'siteFileContentRawProvider',
|
name: r'siteFileContentRawProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'site_pages.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(sitePages)
|
@ProviderFor(sitePages)
|
||||||
const sitePagesProvider = SitePagesFamily._();
|
final sitePagesProvider = SitePagesFamily._();
|
||||||
|
|
||||||
final class SitePagesProvider
|
final class SitePagesProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class SitePagesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnPublicationPage>>,
|
$FutureModifier<List<SnPublicationPage>>,
|
||||||
$FutureProvider<List<SnPublicationPage>> {
|
$FutureProvider<List<SnPublicationPage>> {
|
||||||
const SitePagesProvider._({
|
SitePagesProvider._({
|
||||||
required SitePagesFamily super.from,
|
required SitePagesFamily super.from,
|
||||||
required (String, String) super.argument,
|
required (String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -74,7 +74,7 @@ final class SitePagesFamily extends $Family
|
|||||||
FutureOr<List<SnPublicationPage>>,
|
FutureOr<List<SnPublicationPage>>,
|
||||||
(String, String)
|
(String, String)
|
||||||
> {
|
> {
|
||||||
const SitePagesFamily._()
|
SitePagesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'sitePagesProvider',
|
name: r'sitePagesProvider',
|
||||||
@@ -91,7 +91,7 @@ final class SitePagesFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(sitePage)
|
@ProviderFor(sitePage)
|
||||||
const sitePageProvider = SitePageFamily._();
|
final sitePageProvider = SitePageFamily._();
|
||||||
|
|
||||||
final class SitePageProvider
|
final class SitePageProvider
|
||||||
extends
|
extends
|
||||||
@@ -103,7 +103,7 @@ final class SitePageProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<SnPublicationPage>,
|
$FutureModifier<SnPublicationPage>,
|
||||||
$FutureProvider<SnPublicationPage> {
|
$FutureProvider<SnPublicationPage> {
|
||||||
const SitePageProvider._({
|
SitePageProvider._({
|
||||||
required SitePageFamily super.from,
|
required SitePageFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -151,7 +151,7 @@ String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
|
|||||||
|
|
||||||
final class SitePageFamily extends $Family
|
final class SitePageFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnPublicationPage>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnPublicationPage>, String> {
|
||||||
const SitePageFamily._()
|
SitePageFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'sitePageProvider',
|
name: r'sitePageProvider',
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ part of 'theme.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(theme)
|
@ProviderFor(theme)
|
||||||
const themeProvider = ThemeProvider._();
|
final themeProvider = ThemeProvider._();
|
||||||
|
|
||||||
final class ThemeProvider
|
final class ThemeProvider
|
||||||
extends $FunctionalProvider<ThemeSet, ThemeSet, ThemeSet>
|
extends $FunctionalProvider<ThemeSet, ThemeSet, ThemeSet>
|
||||||
with $Provider<ThemeSet> {
|
with $Provider<ThemeSet> {
|
||||||
const ThemeProvider._()
|
ThemeProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/activity.dart';
|
import 'package:island/models/activity.dart';
|
||||||
|
import 'package:island/pods/config.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/pods/paging.dart';
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
@@ -7,23 +10,39 @@ final activityListProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
ActivityListNotifier.new,
|
ActivityListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
class ActivityListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnTimelineEvent>>
|
||||||
with
|
with
|
||||||
AsyncPaginationController<SnTimelineEvent>,
|
AsyncPaginationController<SnTimelineEvent>,
|
||||||
AsyncPaginationFilter<String?, SnTimelineEvent> {
|
AsyncPaginationFilter<String?, SnTimelineEvent> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnTimelineEvent>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? currentFilter;
|
String? currentFilter;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnTimelineEvent>> fetch() async {
|
Future<List<SnTimelineEvent>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
final settings = ref.read(appSettingsProvider);
|
||||||
|
|
||||||
final queryParameters = {
|
final queryParameters = {
|
||||||
if (cursor != null) 'cursor': cursor,
|
if (cursor != null) 'cursor': cursor,
|
||||||
'take': pageSize,
|
'take': pageSize,
|
||||||
if (currentFilter != null) 'filter': currentFilter,
|
if (currentFilter != null) 'filter': currentFilter,
|
||||||
|
'showFediverse': settings.showFediverseContent,
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
@@ -53,9 +72,9 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
|||||||
final currentState = state.value;
|
final currentState = state.value;
|
||||||
if (currentState == null) return;
|
if (currentState == null) return;
|
||||||
|
|
||||||
final updatedItems = [...currentState];
|
final updatedItems = [...currentState.items];
|
||||||
updatedItems[index] = activity;
|
updatedItems[index] = activity;
|
||||||
|
|
||||||
state = AsyncData(updatedItems);
|
state = AsyncData(currentState.copyWith(items: updatedItems));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ part of 'translate.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(translateString)
|
@ProviderFor(translateString)
|
||||||
const translateStringProvider = TranslateStringFamily._();
|
final translateStringProvider = TranslateStringFamily._();
|
||||||
|
|
||||||
final class TranslateStringProvider
|
final class TranslateStringProvider
|
||||||
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
with $FutureModifier<String>, $FutureProvider<String> {
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
const TranslateStringProvider._({
|
TranslateStringProvider._({
|
||||||
required TranslateStringFamily super.from,
|
required TranslateStringFamily super.from,
|
||||||
required TranslateQuery super.argument,
|
required TranslateQuery super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -62,7 +62,7 @@ String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
|
|||||||
|
|
||||||
final class TranslateStringFamily extends $Family
|
final class TranslateStringFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<String>, TranslateQuery> {
|
with $FunctionalFamilyOverride<FutureOr<String>, TranslateQuery> {
|
||||||
const TranslateStringFamily._()
|
TranslateStringFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'translateStringProvider',
|
name: r'translateStringProvider',
|
||||||
@@ -79,12 +79,12 @@ final class TranslateStringFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(detectStringLanguage)
|
@ProviderFor(detectStringLanguage)
|
||||||
const detectStringLanguageProvider = DetectStringLanguageFamily._();
|
final detectStringLanguageProvider = DetectStringLanguageFamily._();
|
||||||
|
|
||||||
final class DetectStringLanguageProvider
|
final class DetectStringLanguageProvider
|
||||||
extends $FunctionalProvider<String?, String?, String?>
|
extends $FunctionalProvider<String?, String?, String?>
|
||||||
with $Provider<String?> {
|
with $Provider<String?> {
|
||||||
const DetectStringLanguageProvider._({
|
DetectStringLanguageProvider._({
|
||||||
required DetectStringLanguageFamily super.from,
|
required DetectStringLanguageFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -140,7 +140,7 @@ String _$detectStringLanguageHash() =>
|
|||||||
|
|
||||||
final class DetectStringLanguageFamily extends $Family
|
final class DetectStringLanguageFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<String?, String> {
|
with $FunctionalFamilyOverride<String?, String> {
|
||||||
const DetectStringLanguageFamily._()
|
DetectStringLanguageFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'detectStringLanguageProvider',
|
name: r'detectStringLanguageProvider',
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:island/pods/network.dart';
|
|||||||
final webFeedListProvider = FutureProvider.autoDispose
|
final webFeedListProvider = FutureProvider.autoDispose
|
||||||
.family<List<SnWebFeed>, String>((ref, pubName) async {
|
.family<List<SnWebFeed>, String>((ref, pubName) async {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final response = await client.get('/sphere/publishers/$pubName/feeds');
|
final response = await client.get('/insight/publishers/$pubName/feeds');
|
||||||
return (response.data as List)
|
return (response.data as List)
|
||||||
.map((json) => SnWebFeed.fromJson(json))
|
.map((json) => SnWebFeed.fromJson(json))
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
104
lib/route.dart
104
lib/route.dart
@@ -18,7 +18,7 @@ import 'package:island/screens/files/file_list.dart';
|
|||||||
import 'package:island/screens/files/file_detail.dart';
|
import 'package:island/screens/files/file_detail.dart';
|
||||||
import 'package:island/screens/posts/post_categories_list.dart';
|
import 'package:island/screens/posts/post_categories_list.dart';
|
||||||
import 'package:island/screens/posts/post_category_detail.dart';
|
import 'package:island/screens/posts/post_category_detail.dart';
|
||||||
import 'package:island/screens/posts/post_search.dart';
|
import 'package:island/screens/search.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/app_wrapper.dart';
|
import 'package:island/widgets/app_wrapper.dart';
|
||||||
import 'package:island/screens/tabs.dart';
|
import 'package:island/screens/tabs.dart';
|
||||||
@@ -169,6 +169,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
builder: (context, state) => const AboutScreen(),
|
builder: (context, state) => const AboutScreen(),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// File routes
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'fileDetail',
|
name: 'fileDetail',
|
||||||
path: '/files/:id',
|
path: '/files/:id',
|
||||||
@@ -185,6 +186,56 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Post routes
|
||||||
|
GoRoute(
|
||||||
|
name: 'postShuffle',
|
||||||
|
path: '/posts/shuffle',
|
||||||
|
builder: (context, state) => const PostShuffleScreen(),
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'postCategories',
|
||||||
|
path: '/posts/categories',
|
||||||
|
builder: (context, state) => const PostCategoriesListScreen(),
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'postCategoryDetail',
|
||||||
|
path: '/posts/categories/:slug',
|
||||||
|
builder: (context, state) {
|
||||||
|
final slug = state.pathParameters['slug']!;
|
||||||
|
return PostCategoryDetailScreen(slug: slug, isCategory: true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'postTagDetail',
|
||||||
|
path: '/posts/tags/:slug',
|
||||||
|
builder: (context, state) {
|
||||||
|
final slug = state.pathParameters['slug']!;
|
||||||
|
return PostCategoryDetailScreen(slug: slug, isCategory: false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'postDetail',
|
||||||
|
path: '/posts/:id',
|
||||||
|
builder: (context, state) {
|
||||||
|
final id = state.pathParameters['id']!;
|
||||||
|
return PostDetailScreen(id: id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'publisherProfile',
|
||||||
|
path: '/publishers/:name',
|
||||||
|
builder: (context, state) {
|
||||||
|
final name = state.pathParameters['name']!;
|
||||||
|
return PublisherProfileScreen(name: name);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
GoRoute(
|
||||||
|
name: 'universalSearch',
|
||||||
|
path: '/search',
|
||||||
|
builder: (context, state) => const UniversalSearchScreen(),
|
||||||
|
),
|
||||||
|
|
||||||
// Main tabs with TabsScreen shell
|
// Main tabs with TabsScreen shell
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
navigatorKey: _tabsShellKey,
|
navigatorKey: _tabsShellKey,
|
||||||
@@ -212,56 +263,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
transitionsBuilder: _tabPagesTransitionBuilder,
|
transitionsBuilder: _tabPagesTransitionBuilder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
|
||||||
name: 'postSearch',
|
|
||||||
path: '/posts/search',
|
|
||||||
builder: (context, state) => const PostSearchScreen(),
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'postShuffle',
|
|
||||||
path: '/posts/shuffle',
|
|
||||||
builder: (context, state) => const PostShuffleScreen(),
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'postCategories',
|
|
||||||
path: '/posts/categories',
|
|
||||||
builder: (context, state) => const PostCategoriesListScreen(),
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'postCategoryDetail',
|
|
||||||
path: '/posts/categories/:slug',
|
|
||||||
builder: (context, state) {
|
|
||||||
final slug = state.pathParameters['slug']!;
|
|
||||||
return PostCategoryDetailScreen(slug: slug, isCategory: true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'postTagDetail',
|
|
||||||
path: '/posts/tags/:slug',
|
|
||||||
builder: (context, state) {
|
|
||||||
final slug = state.pathParameters['slug']!;
|
|
||||||
return PostCategoryDetailScreen(
|
|
||||||
slug: slug,
|
|
||||||
isCategory: false,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'postDetail',
|
|
||||||
path: '/posts/:id',
|
|
||||||
builder: (context, state) {
|
|
||||||
final id = state.pathParameters['id']!;
|
|
||||||
return PostDetailScreen(id: id);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GoRoute(
|
|
||||||
name: 'publisherProfile',
|
|
||||||
path: '/publishers/:name',
|
|
||||||
builder: (context, state) {
|
|
||||||
final name = state.pathParameters['name']!;
|
|
||||||
return PublisherProfileScreen(name: name);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'discoveryRealms',
|
name: 'discoveryRealms',
|
||||||
path: '/discovery/realms',
|
path: '/discovery/realms',
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (user.value?.profile.background?.id != null)
|
if (user.value?.profile.background != null)
|
||||||
Stack(
|
Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
@@ -112,7 +112,7 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
Builder(
|
Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final hasBackground =
|
final hasBackground =
|
||||||
user.value?.profile.background?.id != null;
|
user.value?.profile.background != null;
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
spacing: hasBackground ? 0 : 16,
|
spacing: hasBackground ? 0 : 16,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
@@ -28,10 +30,23 @@ final socialCreditHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
);
|
);
|
||||||
|
|
||||||
class SocialCreditHistoryNotifier
|
class SocialCreditHistoryNotifier
|
||||||
extends AsyncNotifier<List<SnSocialCreditRecord>>
|
extends AsyncNotifier<PaginationState<SnSocialCreditRecord>>
|
||||||
with AsyncPaginationController<SnSocialCreditRecord> {
|
with AsyncPaginationController<SnSocialCreditRecord> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnSocialCreditRecord>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnSocialCreditRecord>> fetch() async {
|
Future<List<SnSocialCreditRecord>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ part of 'credits.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(socialCredits)
|
@ProviderFor(socialCredits)
|
||||||
const socialCreditsProvider = SocialCreditsProvider._();
|
final socialCreditsProvider = SocialCreditsProvider._();
|
||||||
|
|
||||||
final class SocialCreditsProvider
|
final class SocialCreditsProvider
|
||||||
extends $FunctionalProvider<AsyncValue<double>, double, FutureOr<double>>
|
extends $FunctionalProvider<AsyncValue<double>, double, FutureOr<double>>
|
||||||
with $FutureModifier<double>, $FutureProvider<double> {
|
with $FutureModifier<double>, $FutureProvider<double> {
|
||||||
const SocialCreditsProvider._()
|
SocialCreditsProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
@@ -14,14 +16,30 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:island/widgets/paging/pagination_list.dart';
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
final levelingHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
final levelingHistoryNotifierProvider =
|
||||||
LevelingHistoryNotifier.new,
|
AsyncNotifierProvider.autoDispose<
|
||||||
);
|
LevelingHistoryNotifier,
|
||||||
|
PaginationState<SnExperienceRecord>
|
||||||
|
>(LevelingHistoryNotifier.new);
|
||||||
|
|
||||||
class LevelingHistoryNotifier extends AsyncNotifier<List<SnExperienceRecord>>
|
class LevelingHistoryNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnExperienceRecord>>
|
||||||
with AsyncPaginationController<SnExperienceRecord> {
|
with AsyncPaginationController<SnExperienceRecord> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnExperienceRecord>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnExperienceRecord>> fetch() async {
|
Future<List<SnExperienceRecord>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'account_settings.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(authFactors)
|
@ProviderFor(authFactors)
|
||||||
const authFactorsProvider = AuthFactorsProvider._();
|
final authFactorsProvider = AuthFactorsProvider._();
|
||||||
|
|
||||||
final class AuthFactorsProvider
|
final class AuthFactorsProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class AuthFactorsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnAuthFactor>>,
|
$FutureModifier<List<SnAuthFactor>>,
|
||||||
$FutureProvider<List<SnAuthFactor>> {
|
$FutureProvider<List<SnAuthFactor>> {
|
||||||
const AuthFactorsProvider._()
|
AuthFactorsProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -51,7 +51,7 @@ final class AuthFactorsProvider
|
|||||||
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
||||||
|
|
||||||
@ProviderFor(contactMethods)
|
@ProviderFor(contactMethods)
|
||||||
const contactMethodsProvider = ContactMethodsProvider._();
|
final contactMethodsProvider = ContactMethodsProvider._();
|
||||||
|
|
||||||
final class ContactMethodsProvider
|
final class ContactMethodsProvider
|
||||||
extends
|
extends
|
||||||
@@ -63,7 +63,7 @@ final class ContactMethodsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnContactMethod>>,
|
$FutureModifier<List<SnContactMethod>>,
|
||||||
$FutureProvider<List<SnContactMethod>> {
|
$FutureProvider<List<SnContactMethod>> {
|
||||||
const ContactMethodsProvider._()
|
ContactMethodsProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -92,7 +92,7 @@ final class ContactMethodsProvider
|
|||||||
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
||||||
|
|
||||||
@ProviderFor(accountConnections)
|
@ProviderFor(accountConnections)
|
||||||
const accountConnectionsProvider = AccountConnectionsProvider._();
|
final accountConnectionsProvider = AccountConnectionsProvider._();
|
||||||
|
|
||||||
final class AccountConnectionsProvider
|
final class AccountConnectionsProvider
|
||||||
extends
|
extends
|
||||||
@@ -104,7 +104,7 @@ final class AccountConnectionsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnAccountConnection>>,
|
$FutureModifier<List<SnAccountConnection>>,
|
||||||
$FutureProvider<List<SnAccountConnection>> {
|
$FutureProvider<List<SnAccountConnection>> {
|
||||||
const AccountConnectionsProvider._()
|
AccountConnectionsProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -74,14 +74,10 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
try {
|
try {
|
||||||
final cloudFile =
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
await FileUploader.createCloudFile(
|
ref: ref,
|
||||||
ref: ref,
|
fileData: UniversalFile(data: result, type: UniversalFileType.image),
|
||||||
fileData: UniversalFile(
|
).future;
|
||||||
data: result,
|
|
||||||
type: UniversalFileType.image,
|
|
||||||
),
|
|
||||||
).future;
|
|
||||||
if (cloudFile == null) {
|
if (cloudFile == null) {
|
||||||
throw ArgumentError('Failed to upload the file...');
|
throw ArgumentError('Failed to upload the file...');
|
||||||
}
|
}
|
||||||
@@ -188,8 +184,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
if (usernameColorType.value == 'gradient') ...{
|
if (usernameColorType.value == 'gradient') ...{
|
||||||
if (usernameColorDirection.text.isNotEmpty)
|
if (usernameColorDirection.text.isNotEmpty)
|
||||||
'direction': usernameColorDirection.text,
|
'direction': usernameColorDirection.text,
|
||||||
'colors':
|
'colors': usernameColorColors.value
|
||||||
usernameColorColors.value.where((c) => c.isNotEmpty).toList(),
|
.where((c) => c.isNotEmpty)
|
||||||
|
.toList(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -206,18 +203,16 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
'time_zone': timeZoneController.text,
|
'time_zone': timeZoneController.text,
|
||||||
'birthday': birthday.value?.toUtc().toIso8601String(),
|
'birthday': birthday.value?.toUtc().toIso8601String(),
|
||||||
'username_color': usernameColorData,
|
'username_color': usernameColorData,
|
||||||
'links':
|
'links': links.value
|
||||||
links.value
|
.where((e) => e.name.isNotEmpty && e.url.isNotEmpty)
|
||||||
.where((e) => e.name.isNotEmpty && e.url.isNotEmpty)
|
.toList(),
|
||||||
.toList(),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
final userNotifier = ref.read(userInfoProvider.notifier);
|
final userNotifier = ref.read(userInfoProvider.notifier);
|
||||||
userNotifier.fetchUser();
|
userNotifier.fetchUser();
|
||||||
links.value =
|
links.value = links.value
|
||||||
links.value
|
.where((e) => e.name.isNotEmpty && e.url.isNotEmpty)
|
||||||
.where((e) => e.name.isNotEmpty && e.url.isNotEmpty)
|
.toList();
|
||||||
.toList();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -244,13 +239,12 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
child:
|
child: user.value!.profile.background != null
|
||||||
user.value!.profile.background?.id != null
|
? CloudImageWidget(
|
||||||
? CloudImageWidget(
|
file: user.value!.profile.background,
|
||||||
fileId: user.value!.profile.background!.id,
|
fit: BoxFit.cover,
|
||||||
fit: BoxFit.cover,
|
)
|
||||||
)
|
: const SizedBox.shrink(),
|
||||||
: const SizedBox.shrink(),
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
updateProfilePicture('background');
|
updateProfilePicture('background');
|
||||||
@@ -261,7 +255,7 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
bottom: -32,
|
bottom: -32,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
fileId: user.value!.profile.picture?.id,
|
file: user.value!.profile.picture,
|
||||||
radius: 40,
|
radius: 40,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -291,14 +285,14 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
controller: usernameController,
|
controller: usernameController,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(labelText: 'nickname'.tr()),
|
decoration: InputDecoration(labelText: 'nickname'.tr()),
|
||||||
controller: nicknameController,
|
controller: nicknameController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
DropdownButtonFormField2<String>(
|
DropdownButtonFormField2<String>(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -385,9 +379,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
labelText: 'firstName'.tr(),
|
labelText: 'firstName'.tr(),
|
||||||
),
|
),
|
||||||
controller: firstNameController,
|
controller: firstNameController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) =>
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -396,9 +389,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
labelText: 'middleName'.tr(),
|
labelText: 'middleName'.tr(),
|
||||||
),
|
),
|
||||||
controller: middleNameController,
|
controller: middleNameController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) =>
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -407,9 +399,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
labelText: 'lastName'.tr(),
|
labelText: 'lastName'.tr(),
|
||||||
),
|
),
|
||||||
controller: lastNameController,
|
controller: lastNameController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) =>
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -423,8 +414,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
maxLines: null,
|
maxLines: null,
|
||||||
minLines: 3,
|
minLines: 3,
|
||||||
controller: bioController,
|
controller: bioController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
@@ -445,33 +436,34 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
onSelected: (String selection) {
|
onSelected: (String selection) {
|
||||||
genderController.text = selection;
|
genderController.text = selection;
|
||||||
},
|
},
|
||||||
fieldViewBuilder: (
|
fieldViewBuilder:
|
||||||
context,
|
(
|
||||||
controller,
|
context,
|
||||||
focusNode,
|
controller,
|
||||||
onFieldSubmitted,
|
focusNode,
|
||||||
) {
|
onFieldSubmitted,
|
||||||
// Initialize the controller with the current value
|
) {
|
||||||
if (controller.text.isEmpty &&
|
// Initialize the controller with the current value
|
||||||
genderController.text.isNotEmpty) {
|
if (controller.text.isEmpty &&
|
||||||
controller.text = genderController.text;
|
genderController.text.isNotEmpty) {
|
||||||
}
|
controller.text = genderController.text;
|
||||||
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'gender'.tr(),
|
labelText: 'gender'.tr(),
|
||||||
),
|
),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
genderController.text = value;
|
genderController.text = value;
|
||||||
|
},
|
||||||
|
onTapOutside: (_) => FocusManager
|
||||||
|
.instance
|
||||||
|
.primaryFocus
|
||||||
|
?.unfocus(),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus
|
|
||||||
?.unfocus(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -480,9 +472,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
labelText: 'pronouns'.tr(),
|
labelText: 'pronouns'.tr(),
|
||||||
),
|
),
|
||||||
controller: pronounsController,
|
controller: pronounsController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) =>
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -496,9 +487,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
labelText: 'location'.tr(),
|
labelText: 'location'.tr(),
|
||||||
),
|
),
|
||||||
controller: locationController,
|
controller: locationController,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) =>
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -507,8 +497,8 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
if (textEditingValue.text.isEmpty) {
|
if (textEditingValue.text.isEmpty) {
|
||||||
return const Iterable<String>.empty();
|
return const Iterable<String>.empty();
|
||||||
}
|
}
|
||||||
final lowercaseQuery =
|
final lowercaseQuery = textEditingValue.text
|
||||||
textEditingValue.text.toLowerCase();
|
.toLowerCase();
|
||||||
return getAvailableTz().where((tz) {
|
return getAvailableTz().where((tz) {
|
||||||
return tz.toLowerCase().contains(lowercaseQuery);
|
return tz.toLowerCase().contains(lowercaseQuery);
|
||||||
});
|
});
|
||||||
@@ -516,46 +506,49 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
onSelected: (String selection) {
|
onSelected: (String selection) {
|
||||||
timeZoneController.text = selection;
|
timeZoneController.text = selection;
|
||||||
},
|
},
|
||||||
fieldViewBuilder: (
|
fieldViewBuilder:
|
||||||
context,
|
(
|
||||||
controller,
|
context,
|
||||||
focusNode,
|
controller,
|
||||||
onFieldSubmitted,
|
focusNode,
|
||||||
) {
|
onFieldSubmitted,
|
||||||
// Sync the controller with timeZoneController when the widget is built
|
) {
|
||||||
if (controller.text != timeZoneController.text) {
|
// Sync the controller with timeZoneController when the widget is built
|
||||||
controller.text = timeZoneController.text;
|
if (controller.text !=
|
||||||
}
|
timeZoneController.text) {
|
||||||
|
controller.text = timeZoneController.text;
|
||||||
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'timeZone'.tr(),
|
labelText: 'timeZone'.tr(),
|
||||||
suffix: InkWell(
|
suffix: InkWell(
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Symbols.my_location,
|
Symbols.my_location,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
try {
|
||||||
|
showLoadingModal(context);
|
||||||
|
final machineTz =
|
||||||
|
await getMachineTz();
|
||||||
|
controller.text = machineTz;
|
||||||
|
timeZoneController.text = machineTz;
|
||||||
|
} finally {
|
||||||
|
if (context.mounted) {
|
||||||
|
hideLoadingModal(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onChanged: (value) {
|
||||||
try {
|
timeZoneController.text = value;
|
||||||
showLoadingModal(context);
|
|
||||||
final machineTz = await getMachineTz();
|
|
||||||
controller.text = machineTz;
|
|
||||||
timeZoneController.text = machineTz;
|
|
||||||
} finally {
|
|
||||||
if (context.mounted) {
|
|
||||||
hideLoadingModal(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
);
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
timeZoneController.text = value;
|
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
optionsViewBuilder: (context, onSelected, options) {
|
optionsViewBuilder: (context, onSelected, options) {
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@@ -569,21 +562,21 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
itemCount: options.length,
|
itemCount: options.length,
|
||||||
itemBuilder: (
|
itemBuilder:
|
||||||
BuildContext context,
|
(BuildContext context, int index) {
|
||||||
int index,
|
final option = options.elementAt(
|
||||||
) {
|
index,
|
||||||
final option = options.elementAt(index);
|
);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
option,
|
option,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
onSelected(option);
|
onSelected(option);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -644,10 +637,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color: Theme.of(
|
||||||
Theme.of(
|
context,
|
||||||
context,
|
).colorScheme.surfaceContainerHighest,
|
||||||
).colorScheme.surfaceContainerHighest,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -664,25 +656,23 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
type: usernameColorType.value,
|
type: usernameColorType.value,
|
||||||
value:
|
value:
|
||||||
usernameColorType.value == 'plain' &&
|
usernameColorType.value == 'plain' &&
|
||||||
usernameColorValue
|
usernameColorValue.text.isNotEmpty
|
||||||
.text
|
? usernameColorValue.text
|
||||||
.isNotEmpty
|
: null,
|
||||||
? usernameColorValue.text
|
|
||||||
: null,
|
|
||||||
direction:
|
direction:
|
||||||
usernameColorType.value ==
|
usernameColorType.value ==
|
||||||
'gradient' &&
|
'gradient' &&
|
||||||
usernameColorDirection
|
usernameColorDirection
|
||||||
.text
|
.text
|
||||||
.isNotEmpty
|
.isNotEmpty
|
||||||
? usernameColorDirection.text
|
? usernameColorDirection.text
|
||||||
: null,
|
: null,
|
||||||
colors:
|
colors:
|
||||||
usernameColorType.value == 'gradient'
|
usernameColorType.value == 'gradient'
|
||||||
? usernameColorColors.value
|
? usernameColorColors.value
|
||||||
.where((c) => c.isNotEmpty)
|
.where((c) => c.isNotEmpty)
|
||||||
.toList()
|
.toList()
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -724,10 +714,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
? Symbols.check_circle
|
? Symbols.check_circle
|
||||||
: Symbols.error,
|
: Symbols.error,
|
||||||
size: 16,
|
size: 16,
|
||||||
color:
|
color: canUseColor
|
||||||
canUseColor
|
? Colors.green
|
||||||
? Colors.green
|
: Colors.red,
|
||||||
: Colors.red,
|
|
||||||
),
|
),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
Text(
|
Text(
|
||||||
@@ -736,10 +725,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
: 'upgradeRequired'.tr(),
|
: 'upgradeRequired'.tr(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color:
|
color: canUseColor
|
||||||
canUseColor
|
? Colors.green
|
||||||
? Colors.green
|
: Colors.red,
|
||||||
: Colors.red,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -792,34 +780,35 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
onSelected: (String selection) {
|
onSelected: (String selection) {
|
||||||
usernameColorValue.text = selection;
|
usernameColorValue.text = selection;
|
||||||
},
|
},
|
||||||
fieldViewBuilder: (
|
fieldViewBuilder:
|
||||||
context,
|
(
|
||||||
controller,
|
context,
|
||||||
focusNode,
|
controller,
|
||||||
onFieldSubmitted,
|
focusNode,
|
||||||
) {
|
onFieldSubmitted,
|
||||||
// Initialize the controller with the current value
|
) {
|
||||||
if (controller.text.isEmpty &&
|
// Initialize the controller with the current value
|
||||||
usernameColorValue.text.isNotEmpty) {
|
if (controller.text.isEmpty &&
|
||||||
controller.text = usernameColorValue.text;
|
usernameColorValue.text.isNotEmpty) {
|
||||||
}
|
controller.text = usernameColorValue.text;
|
||||||
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'colorValue'.tr(),
|
labelText: 'colorValue'.tr(),
|
||||||
hintText: 'e.g. red or #ff6600',
|
hintText: 'e.g. red or #ff6600',
|
||||||
),
|
),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
usernameColorValue.text = value;
|
usernameColorValue.text = value;
|
||||||
|
},
|
||||||
|
onTapOutside: (_) => FocusManager
|
||||||
|
.instance
|
||||||
|
.primaryFocus
|
||||||
|
?.unfocus(),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus
|
|
||||||
?.unfocus(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
if (usernameColorType.value == 'gradient') ...[
|
if (usernameColorType.value == 'gradient') ...[
|
||||||
DropdownButtonFormField2<String>(
|
DropdownButtonFormField2<String>(
|
||||||
@@ -862,10 +851,9 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
child: Text('gradientDirectionToTopLeft'.tr()),
|
child: Text('gradientDirectionToTopLeft'.tr()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
value:
|
value: usernameColorDirection.text.isNotEmpty
|
||||||
usernameColorDirection.text.isNotEmpty
|
? usernameColorDirection.text
|
||||||
? usernameColorDirection.text
|
: 'to right',
|
||||||
: 'to right',
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
usernameColorDirection.text = value ?? 'to right';
|
usernameColorDirection.text = value ?? 'to right';
|
||||||
},
|
},
|
||||||
@@ -911,21 +899,19 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
usernameColorColors.value[i] = value;
|
usernameColorColors.value[i] = value;
|
||||||
},
|
},
|
||||||
onTapOutside:
|
onTapOutside: (_) => FocusManager
|
||||||
(_) =>
|
.instance
|
||||||
FocusManager.instance.primaryFocus
|
.primaryFocus
|
||||||
?.unfocus(),
|
?.unfocus(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.delete),
|
icon: const Icon(Symbols.delete),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
usernameColorColors.value =
|
usernameColorColors
|
||||||
usernameColorColors.value
|
.value = usernameColorColors.value
|
||||||
.whereIndexed(
|
.whereIndexed((idx, _) => idx != i)
|
||||||
(idx, _) => idx != i,
|
.toList();
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -968,10 +954,10 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
name: value,
|
name: value,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTapOutside:
|
onTapOutside: (_) => FocusManager
|
||||||
(_) =>
|
.instance
|
||||||
FocusManager.instance.primaryFocus
|
.primaryFocus
|
||||||
?.unfocus(),
|
?.unfocus(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
@@ -987,19 +973,18 @@ class UpdateProfileScreen extends HookConsumerWidget {
|
|||||||
url: value,
|
url: value,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTapOutside:
|
onTapOutside: (_) => FocusManager
|
||||||
(_) =>
|
.instance
|
||||||
FocusManager.instance.primaryFocus
|
.primaryFocus
|
||||||
?.unfocus(),
|
?.unfocus(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.delete),
|
icon: const Icon(Symbols.delete),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
links.value =
|
links.value = links.value
|
||||||
links.value
|
.whereIndexed((idx, _) => idx != i)
|
||||||
.whereIndexed((idx, _) => idx != i)
|
.toList();
|
||||||
.toList();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class _AccountBasicInfo extends StatelessWidget {
|
|||||||
return Card(
|
return Card(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final hasBackground = data.profile.background?.id != null;
|
final hasBackground = data.profile.background != null;
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -476,9 +476,9 @@ class _AccountPublisherList extends StatelessWidget {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
publisher.bio.isNotEmpty
|
publisher.bio.isNotEmpty
|
||||||
? publisher.bio
|
? publisher.bio
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.where((line) => line.trim().isNotEmpty)
|
.where((line) => line.trim().isNotEmpty)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
: 'descriptionNone'.tr(),
|
: 'descriptionNone'.tr(),
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
@@ -550,16 +550,14 @@ class _AccountAction extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: relationshipAction,
|
onPressed: relationshipAction,
|
||||||
label:
|
label: Text(
|
||||||
Text(
|
accountRelationship.value == null
|
||||||
accountRelationship.value == null
|
? 'addFriendShort'
|
||||||
? 'addFriendShort'
|
: 'added',
|
||||||
: 'added',
|
).tr(),
|
||||||
).tr(),
|
icon: accountRelationship.value == null
|
||||||
icon:
|
? const Icon(Symbols.person_add)
|
||||||
accountRelationship.value == null
|
: const Icon(Symbols.person_check),
|
||||||
? const Icon(Symbols.person_add)
|
|
||||||
: const Icon(Symbols.person_check),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (accountRelationship.value == null ||
|
if (accountRelationship.value == null ||
|
||||||
@@ -579,16 +577,14 @@ class _AccountAction extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: blockAction,
|
onPressed: blockAction,
|
||||||
label:
|
label: Text(
|
||||||
Text(
|
accountRelationship.value == null
|
||||||
accountRelationship.value == null
|
? 'blockUser'
|
||||||
? 'blockUser'
|
: 'unblockUser',
|
||||||
: 'unblockUser',
|
).tr(),
|
||||||
).tr(),
|
icon: accountRelationship.value == null
|
||||||
icon:
|
? const Icon(Symbols.block)
|
||||||
accountRelationship.value == null
|
: const Icon(Symbols.person_cancel),
|
||||||
? const Icon(Symbols.block)
|
|
||||||
: const Icon(Symbols.person_cancel),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -600,13 +596,12 @@ class _AccountAction extends StatelessWidget {
|
|||||||
child: FilledButton.icon(
|
child: FilledButton.icon(
|
||||||
onPressed: directMessageAction,
|
onPressed: directMessageAction,
|
||||||
icon: const Icon(Symbols.message),
|
icon: const Icon(Symbols.message),
|
||||||
label:
|
label: Text(
|
||||||
Text(
|
accountChat.value == null
|
||||||
accountChat.value == null
|
? 'createDirectMessage'
|
||||||
? 'createDirectMessage'
|
: 'gotoDirectMessage',
|
||||||
: 'gotoDirectMessage',
|
maxLines: 1,
|
||||||
maxLines: 1,
|
).tr(),
|
||||||
).tr(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton.filled(
|
IconButton.filled(
|
||||||
@@ -664,7 +659,7 @@ Future<Color?> accountAppbarForcegroundColor(Ref ref, String uname) async {
|
|||||||
if (account.profile.background == null) return null;
|
if (account.profile.background == null) return null;
|
||||||
final colors = await ColorExtractionService.getColorsFromImage(
|
final colors = await ColorExtractionService.getColorsFromImage(
|
||||||
CloudImageWidget.provider(
|
CloudImageWidget.provider(
|
||||||
fileId: account.profile.background!.id,
|
file: account.profile.background!,
|
||||||
serverUrl: ref.watch(serverUrlProvider),
|
serverUrl: ref.watch(serverUrlProvider),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -683,7 +678,7 @@ Future<SnChatRoom?> accountDirectChat(Ref ref, String uname) async {
|
|||||||
final account = await ref.watch(accountProvider(uname).future);
|
final account = await ref.watch(accountProvider(uname).future);
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
try {
|
try {
|
||||||
final resp = await apiClient.get("/sphere/chat/direct/${account.id}");
|
final resp = await apiClient.get("/messager/chat/direct/${account.id}");
|
||||||
return SnChatRoom.fromJson(resp.data);
|
return SnChatRoom.fromJson(resp.data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err is DioException && err.response?.statusCode == 404) {
|
if (err is DioException && err.response?.statusCode == 404) {
|
||||||
@@ -812,7 +807,7 @@ class AccountProfileScreen extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.post(
|
final resp = await client.post(
|
||||||
'/sphere/chat/direct',
|
'/messager/chat/direct',
|
||||||
data: {'related_user_id': account.value!.id},
|
data: {'related_user_id': account.value!.id},
|
||||||
);
|
);
|
||||||
final chat = SnChatRoom.fromJson(resp.data);
|
final chat = SnChatRoom.fromJson(resp.data);
|
||||||
@@ -838,262 +833,256 @@ class AccountProfileScreen extends HookConsumerWidget {
|
|||||||
final accountPublishers = ref.watch(accountPublishersProvider(data.id));
|
final accountPublishers = ref.watch(accountPublishersProvider(data.id));
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
isNoBackground: false,
|
isNoBackground: false,
|
||||||
appBar:
|
appBar: isWideScreen(context)
|
||||||
isWideScreen(context)
|
? AppBar(
|
||||||
? AppBar(
|
foregroundColor: appbarColor.value,
|
||||||
foregroundColor: appbarColor.value,
|
leading: PageBackButton(
|
||||||
leading: PageBackButton(
|
color: appbarColor.value,
|
||||||
color: appbarColor.value,
|
shadows: [appbarShadow],
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
data.nick,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
appbarColor.value ??
|
||||||
|
Theme.of(context).appBarTheme.foregroundColor,
|
||||||
shadows: [appbarShadow],
|
shadows: [appbarShadow],
|
||||||
),
|
),
|
||||||
title: Text(
|
),
|
||||||
data.nick,
|
)
|
||||||
style: TextStyle(
|
: null,
|
||||||
color:
|
body: isWideScreen(context)
|
||||||
appbarColor.value ??
|
? Row(
|
||||||
Theme.of(context).appBarTheme.foregroundColor,
|
children: [
|
||||||
shadows: [appbarShadow],
|
Flexible(
|
||||||
),
|
child: CustomScrollView(
|
||||||
),
|
slivers: [
|
||||||
)
|
SliverToBoxAdapter(
|
||||||
: null,
|
child: _AccountBasicInfo(
|
||||||
body:
|
data: data,
|
||||||
isWideScreen(context)
|
uname: name,
|
||||||
? Row(
|
accountDeveloper: accountDeveloper,
|
||||||
children: [
|
).padding(horizontal: 4, top: 20),
|
||||||
Flexible(
|
),
|
||||||
child: CustomScrollView(
|
if (data.badges.isNotEmpty)
|
||||||
slivers: [
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountBasicInfo(
|
|
||||||
data: data,
|
|
||||||
uname: name,
|
|
||||||
accountDeveloper: accountDeveloper,
|
|
||||||
).padding(horizontal: 4, top: 20),
|
|
||||||
),
|
|
||||||
if (data.badges.isNotEmpty)
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Card(
|
|
||||||
child: BadgeList(
|
|
||||||
badges: data.badges,
|
|
||||||
).padding(horizontal: 26, vertical: 20),
|
|
||||||
).padding(left: 2, right: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Column(
|
|
||||||
spacing: 12,
|
|
||||||
children: [
|
|
||||||
LevelingProgressCard(
|
|
||||||
level: data.profile.level,
|
|
||||||
experience: data.profile.experience,
|
|
||||||
progress: data.profile.levelingProgress,
|
|
||||||
).padding(left: 2, right: 4),
|
|
||||||
if (data.profile.verification != null)
|
|
||||||
Card(
|
|
||||||
margin: EdgeInsets.zero,
|
|
||||||
child: VerificationStatusCard(
|
|
||||||
mark: data.profile.verification!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 4, top: 8),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileBio(
|
|
||||||
data: data,
|
|
||||||
).padding(top: 4),
|
|
||||||
),
|
|
||||||
if (data.profile.links.isNotEmpty)
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileLinks(data: data),
|
|
||||||
),
|
|
||||||
if (data.contacts.any((c) => c.isPublic))
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileContacts(data: data),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileDetail(data: data),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: CustomScrollView(
|
|
||||||
slivers: [
|
|
||||||
SliverGap(18),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: ActivityPresenceWidget(
|
|
||||||
uname: name,
|
|
||||||
).padding(horizontal: 4, top: 4, bottom: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountPublisherList(
|
|
||||||
publishers: accountPublishers.value ?? [],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (user.value != null && !isCurrentUser)
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountAction(
|
|
||||||
data: data,
|
|
||||||
accountRelationship: accountRelationship,
|
|
||||||
accountChat: accountChat,
|
|
||||||
relationshipAction: relationshipAction,
|
|
||||||
blockAction: blockAction,
|
|
||||||
directMessageAction: directMessageAction,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Card(
|
child: Card(
|
||||||
child: FortuneGraphWidget(
|
child: BadgeList(
|
||||||
events: accountEvents,
|
badges: data.badges,
|
||||||
eventCalandarUser: data.name,
|
).padding(horizontal: 26, vertical: 20),
|
||||||
margin: EdgeInsets.zero,
|
).padding(left: 2, right: 4),
|
||||||
),
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: Column(
|
||||||
|
spacing: 12,
|
||||||
|
children: [
|
||||||
|
LevelingProgressCard(
|
||||||
|
level: data.profile.level,
|
||||||
|
experience: data.profile.experience,
|
||||||
|
progress: data.profile.levelingProgress,
|
||||||
|
).padding(left: 2, right: 4),
|
||||||
|
if (data.profile.verification != null)
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: VerificationStatusCard(
|
||||||
|
mark: data.profile.verification!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 4, top: 8),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileBio(
|
||||||
|
data: data,
|
||||||
|
).padding(top: 4),
|
||||||
|
),
|
||||||
|
if (data.profile.links.isNotEmpty)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileLinks(data: data),
|
||||||
|
),
|
||||||
|
if (data.contacts.any((c) => c.isPublic))
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileContacts(data: data),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileDetail(data: data),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverGap(18),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: ActivityPresenceWidget(
|
||||||
|
uname: name,
|
||||||
|
).padding(horizontal: 4, top: 4, bottom: 4),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountPublisherList(
|
||||||
|
publishers: accountPublishers.value ?? [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (user.value != null && !isCurrentUser)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountAction(
|
||||||
|
data: data,
|
||||||
|
accountRelationship: accountRelationship,
|
||||||
|
accountChat: accountChat,
|
||||||
|
relationshipAction: relationshipAction,
|
||||||
|
blockAction: blockAction,
|
||||||
|
directMessageAction: directMessageAction,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
SliverToBoxAdapter(
|
||||||
),
|
child: Card(
|
||||||
),
|
child: FortuneGraphWidget(
|
||||||
],
|
events: accountEvents,
|
||||||
).padding(horizontal: 24)
|
eventCalandarUser: data.name,
|
||||||
: CustomScrollView(
|
margin: EdgeInsets.zero,
|
||||||
slivers: [
|
|
||||||
SliverAppBar(
|
|
||||||
foregroundColor: appbarColor.value,
|
|
||||||
expandedHeight: 180,
|
|
||||||
pinned: true,
|
|
||||||
leading: PageBackButton(
|
|
||||||
color: appbarColor.value,
|
|
||||||
shadows: [appbarShadow],
|
|
||||||
),
|
|
||||||
flexibleSpace: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned.fill(
|
|
||||||
child:
|
|
||||||
data.profile.background?.id != null
|
|
||||||
? CloudImageWidget(
|
|
||||||
file: data.profile.background,
|
|
||||||
)
|
|
||||||
: Container(
|
|
||||||
color:
|
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).appBarTheme.backgroundColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
FlexibleSpaceBar(
|
|
||||||
title: Text(
|
|
||||||
data.nick,
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
appbarColor.value ??
|
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).appBarTheme.foregroundColor,
|
|
||||||
shadows: [appbarShadow],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
),
|
||||||
child: _AccountBasicInfo(
|
],
|
||||||
data: data,
|
).padding(horizontal: 24)
|
||||||
uname: name,
|
: CustomScrollView(
|
||||||
accountDeveloper: accountDeveloper,
|
slivers: [
|
||||||
).padding(horizontal: 4, top: 8),
|
SliverAppBar(
|
||||||
|
foregroundColor: appbarColor.value,
|
||||||
|
expandedHeight: 180,
|
||||||
|
pinned: true,
|
||||||
|
leading: PageBackButton(
|
||||||
|
color: appbarColor.value,
|
||||||
|
shadows: [appbarShadow],
|
||||||
),
|
),
|
||||||
if (data.badges.isNotEmpty)
|
flexibleSpace: Stack(
|
||||||
SliverToBoxAdapter(
|
children: [
|
||||||
child: Card(
|
Positioned.fill(
|
||||||
child: BadgeList(
|
child: data.profile.background != null
|
||||||
badges: data.badges,
|
? CloudImageWidget(
|
||||||
).padding(horizontal: 26, vertical: 20),
|
file: data.profile.background,
|
||||||
).padding(horizontal: 4),
|
)
|
||||||
),
|
: Container(
|
||||||
SliverToBoxAdapter(
|
color: Theme.of(
|
||||||
child: Column(
|
context,
|
||||||
children: [
|
).appBarTheme.backgroundColor,
|
||||||
LevelingProgressCard(
|
),
|
||||||
level: data.profile.level,
|
),
|
||||||
experience: data.profile.experience,
|
FlexibleSpaceBar(
|
||||||
progress: data.profile.levelingProgress,
|
title: Text(
|
||||||
).padding(top: 8, horizontal: 8, bottom: 4),
|
data.nick,
|
||||||
if (data.profile.verification != null)
|
style: TextStyle(
|
||||||
Card(
|
color:
|
||||||
child: VerificationStatusCard(
|
appbarColor.value ??
|
||||||
mark: data.profile.verification!,
|
Theme.of(
|
||||||
),
|
context,
|
||||||
).padding(horizontal: 4),
|
).appBarTheme.foregroundColor,
|
||||||
],
|
shadows: [appbarShadow],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
),
|
||||||
child: _AccountProfileBio(
|
SliverToBoxAdapter(
|
||||||
data: data,
|
child: _AccountBasicInfo(
|
||||||
).padding(horizontal: 4),
|
data: data,
|
||||||
),
|
uname: name,
|
||||||
if (data.profile.links.isNotEmpty)
|
accountDeveloper: accountDeveloper,
|
||||||
SliverToBoxAdapter(
|
).padding(horizontal: 4, top: 8),
|
||||||
child: _AccountProfileLinks(
|
),
|
||||||
data: data,
|
if (data.badges.isNotEmpty)
|
||||||
).padding(horizontal: 4),
|
|
||||||
),
|
|
||||||
if (data.contacts.any((c) => c.isPublic))
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileContacts(
|
|
||||||
data: data,
|
|
||||||
).padding(horizontal: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: ActivityPresenceWidget(
|
|
||||||
uname: name,
|
|
||||||
).padding(horizontal: 8, top: 4, bottom: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountPublisherList(
|
|
||||||
publishers: accountPublishers.value ?? [],
|
|
||||||
).padding(horizontal: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountProfileDetail(
|
|
||||||
data: data,
|
|
||||||
).padding(horizontal: 4),
|
|
||||||
),
|
|
||||||
if (user.value != null && !isCurrentUser)
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: _AccountAction(
|
|
||||||
data: data,
|
|
||||||
accountRelationship: accountRelationship,
|
|
||||||
accountChat: accountChat,
|
|
||||||
relationshipAction: relationshipAction,
|
|
||||||
blockAction: blockAction,
|
|
||||||
directMessageAction: directMessageAction,
|
|
||||||
).padding(horizontal: 4),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Card(
|
child: Card(
|
||||||
child: FortuneGraphWidget(
|
child: BadgeList(
|
||||||
events: accountEvents,
|
badges: data.badges,
|
||||||
eventCalandarUser: data.name,
|
).padding(horizontal: 26, vertical: 20),
|
||||||
),
|
|
||||||
).padding(horizontal: 4),
|
).padding(horizontal: 4),
|
||||||
),
|
),
|
||||||
],
|
SliverToBoxAdapter(
|
||||||
),
|
child: Column(
|
||||||
|
children: [
|
||||||
|
LevelingProgressCard(
|
||||||
|
level: data.profile.level,
|
||||||
|
experience: data.profile.experience,
|
||||||
|
progress: data.profile.levelingProgress,
|
||||||
|
).padding(top: 8, horizontal: 8, bottom: 4),
|
||||||
|
if (data.profile.verification != null)
|
||||||
|
Card(
|
||||||
|
child: VerificationStatusCard(
|
||||||
|
mark: data.profile.verification!,
|
||||||
|
),
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileBio(
|
||||||
|
data: data,
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
if (data.profile.links.isNotEmpty)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileLinks(
|
||||||
|
data: data,
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
if (data.contacts.any((c) => c.isPublic))
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileContacts(
|
||||||
|
data: data,
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: ActivityPresenceWidget(
|
||||||
|
uname: name,
|
||||||
|
).padding(horizontal: 8, top: 4, bottom: 4),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountPublisherList(
|
||||||
|
publishers: accountPublishers.value ?? [],
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountProfileDetail(
|
||||||
|
data: data,
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
if (user.value != null && !isCurrentUser)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: _AccountAction(
|
||||||
|
data: data,
|
||||||
|
accountRelationship: accountRelationship,
|
||||||
|
accountChat: accountChat,
|
||||||
|
relationshipAction: relationshipAction,
|
||||||
|
blockAction: blockAction,
|
||||||
|
directMessageAction: directMessageAction,
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: Card(
|
||||||
|
child: FortuneGraphWidget(
|
||||||
|
events: accountEvents,
|
||||||
|
eventCalandarUser: data.name,
|
||||||
|
),
|
||||||
|
).padding(horizontal: 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
error:
|
error: (error, stackTrace) => AppScaffold(
|
||||||
(error, stackTrace) => AppScaffold(
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
appBar: AppBar(leading: const PageBackButton()),
|
body: Center(child: Text(error.toString())),
|
||||||
body: Center(child: Text(error.toString())),
|
),
|
||||||
),
|
loading: () => AppScaffold(
|
||||||
loading:
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
() => AppScaffold(
|
body: Center(child: CircularProgressIndicator()),
|
||||||
appBar: AppBar(leading: const PageBackButton()),
|
),
|
||||||
body: Center(child: CircularProgressIndicator()),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'profile.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(account)
|
@ProviderFor(account)
|
||||||
const accountProvider = AccountFamily._();
|
final accountProvider = AccountFamily._();
|
||||||
|
|
||||||
final class AccountProvider
|
final class AccountProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class AccountProvider
|
|||||||
FutureOr<SnAccount>
|
FutureOr<SnAccount>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnAccount>, $FutureProvider<SnAccount> {
|
with $FutureModifier<SnAccount>, $FutureProvider<SnAccount> {
|
||||||
const AccountProvider._({
|
AccountProvider._({
|
||||||
required AccountFamily super.from,
|
required AccountFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -67,7 +67,7 @@ String _$accountHash() => r'5e2b7bd59151b4638a5561f495537c259f767123';
|
|||||||
|
|
||||||
final class AccountFamily extends $Family
|
final class AccountFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnAccount>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnAccount>, String> {
|
||||||
const AccountFamily._()
|
AccountFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountProvider',
|
name: r'accountProvider',
|
||||||
@@ -84,7 +84,7 @@ final class AccountFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountBadges)
|
@ProviderFor(accountBadges)
|
||||||
const accountBadgesProvider = AccountBadgesFamily._();
|
final accountBadgesProvider = AccountBadgesFamily._();
|
||||||
|
|
||||||
final class AccountBadgesProvider
|
final class AccountBadgesProvider
|
||||||
extends
|
extends
|
||||||
@@ -96,7 +96,7 @@ final class AccountBadgesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnAccountBadge>>,
|
$FutureModifier<List<SnAccountBadge>>,
|
||||||
$FutureProvider<List<SnAccountBadge>> {
|
$FutureProvider<List<SnAccountBadge>> {
|
||||||
const AccountBadgesProvider._({
|
AccountBadgesProvider._({
|
||||||
required AccountBadgesFamily super.from,
|
required AccountBadgesFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -144,7 +144,7 @@ String _$accountBadgesHash() => r'68db63f49827020beecbdbf20529520d0cd14a7d';
|
|||||||
|
|
||||||
final class AccountBadgesFamily extends $Family
|
final class AccountBadgesFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<SnAccountBadge>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<SnAccountBadge>>, String> {
|
||||||
const AccountBadgesFamily._()
|
AccountBadgesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountBadgesProvider',
|
name: r'accountBadgesProvider',
|
||||||
@@ -161,13 +161,13 @@ final class AccountBadgesFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountAppbarForcegroundColor)
|
@ProviderFor(accountAppbarForcegroundColor)
|
||||||
const accountAppbarForcegroundColorProvider =
|
final accountAppbarForcegroundColorProvider =
|
||||||
AccountAppbarForcegroundColorFamily._();
|
AccountAppbarForcegroundColorFamily._();
|
||||||
|
|
||||||
final class AccountAppbarForcegroundColorProvider
|
final class AccountAppbarForcegroundColorProvider
|
||||||
extends $FunctionalProvider<AsyncValue<Color?>, Color?, FutureOr<Color?>>
|
extends $FunctionalProvider<AsyncValue<Color?>, Color?, FutureOr<Color?>>
|
||||||
with $FutureModifier<Color?>, $FutureProvider<Color?> {
|
with $FutureModifier<Color?>, $FutureProvider<Color?> {
|
||||||
const AccountAppbarForcegroundColorProvider._({
|
AccountAppbarForcegroundColorProvider._({
|
||||||
required AccountAppbarForcegroundColorFamily super.from,
|
required AccountAppbarForcegroundColorFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -212,11 +212,11 @@ final class AccountAppbarForcegroundColorProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$accountAppbarForcegroundColorHash() =>
|
String _$accountAppbarForcegroundColorHash() =>
|
||||||
r'127fcc7fd6ec6a41ac4a6975276b5271aa4fa7d0';
|
r'59e0049a5158ea653f0afd724df9ff2312b90050';
|
||||||
|
|
||||||
final class AccountAppbarForcegroundColorFamily extends $Family
|
final class AccountAppbarForcegroundColorFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<Color?>, String> {
|
with $FunctionalFamilyOverride<FutureOr<Color?>, String> {
|
||||||
const AccountAppbarForcegroundColorFamily._()
|
AccountAppbarForcegroundColorFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountAppbarForcegroundColorProvider',
|
name: r'accountAppbarForcegroundColorProvider',
|
||||||
@@ -233,7 +233,7 @@ final class AccountAppbarForcegroundColorFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountDirectChat)
|
@ProviderFor(accountDirectChat)
|
||||||
const accountDirectChatProvider = AccountDirectChatFamily._();
|
final accountDirectChatProvider = AccountDirectChatFamily._();
|
||||||
|
|
||||||
final class AccountDirectChatProvider
|
final class AccountDirectChatProvider
|
||||||
extends
|
extends
|
||||||
@@ -243,7 +243,7 @@ final class AccountDirectChatProvider
|
|||||||
FutureOr<SnChatRoom?>
|
FutureOr<SnChatRoom?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnChatRoom?>, $FutureProvider<SnChatRoom?> {
|
with $FutureModifier<SnChatRoom?>, $FutureProvider<SnChatRoom?> {
|
||||||
const AccountDirectChatProvider._({
|
AccountDirectChatProvider._({
|
||||||
required AccountDirectChatFamily super.from,
|
required AccountDirectChatFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -287,11 +287,11 @@ final class AccountDirectChatProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$accountDirectChatHash() => r'149ea3a3730672cfbbb8c16fe1f2caa0bb9f0e17';
|
String _$accountDirectChatHash() => r'71bc9eed34a436a3743e8ef87f7aaae861fc5746';
|
||||||
|
|
||||||
final class AccountDirectChatFamily extends $Family
|
final class AccountDirectChatFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnChatRoom?>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnChatRoom?>, String> {
|
||||||
const AccountDirectChatFamily._()
|
AccountDirectChatFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountDirectChatProvider',
|
name: r'accountDirectChatProvider',
|
||||||
@@ -308,7 +308,7 @@ final class AccountDirectChatFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountRelationship)
|
@ProviderFor(accountRelationship)
|
||||||
const accountRelationshipProvider = AccountRelationshipFamily._();
|
final accountRelationshipProvider = AccountRelationshipFamily._();
|
||||||
|
|
||||||
final class AccountRelationshipProvider
|
final class AccountRelationshipProvider
|
||||||
extends
|
extends
|
||||||
@@ -318,7 +318,7 @@ final class AccountRelationshipProvider
|
|||||||
FutureOr<SnRelationship?>
|
FutureOr<SnRelationship?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnRelationship?>, $FutureProvider<SnRelationship?> {
|
with $FutureModifier<SnRelationship?>, $FutureProvider<SnRelationship?> {
|
||||||
const AccountRelationshipProvider._({
|
AccountRelationshipProvider._({
|
||||||
required AccountRelationshipFamily super.from,
|
required AccountRelationshipFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -367,7 +367,7 @@ String _$accountRelationshipHash() =>
|
|||||||
|
|
||||||
final class AccountRelationshipFamily extends $Family
|
final class AccountRelationshipFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnRelationship?>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnRelationship?>, String> {
|
||||||
const AccountRelationshipFamily._()
|
AccountRelationshipFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountRelationshipProvider',
|
name: r'accountRelationshipProvider',
|
||||||
@@ -384,7 +384,7 @@ final class AccountRelationshipFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountBotDeveloper)
|
@ProviderFor(accountBotDeveloper)
|
||||||
const accountBotDeveloperProvider = AccountBotDeveloperFamily._();
|
final accountBotDeveloperProvider = AccountBotDeveloperFamily._();
|
||||||
|
|
||||||
final class AccountBotDeveloperProvider
|
final class AccountBotDeveloperProvider
|
||||||
extends
|
extends
|
||||||
@@ -394,7 +394,7 @@ final class AccountBotDeveloperProvider
|
|||||||
FutureOr<SnDeveloper?>
|
FutureOr<SnDeveloper?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnDeveloper?>, $FutureProvider<SnDeveloper?> {
|
with $FutureModifier<SnDeveloper?>, $FutureProvider<SnDeveloper?> {
|
||||||
const AccountBotDeveloperProvider._({
|
AccountBotDeveloperProvider._({
|
||||||
required AccountBotDeveloperFamily super.from,
|
required AccountBotDeveloperFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -443,7 +443,7 @@ String _$accountBotDeveloperHash() =>
|
|||||||
|
|
||||||
final class AccountBotDeveloperFamily extends $Family
|
final class AccountBotDeveloperFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnDeveloper?>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnDeveloper?>, String> {
|
||||||
const AccountBotDeveloperFamily._()
|
AccountBotDeveloperFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountBotDeveloperProvider',
|
name: r'accountBotDeveloperProvider',
|
||||||
@@ -460,7 +460,7 @@ final class AccountBotDeveloperFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(accountPublishers)
|
@ProviderFor(accountPublishers)
|
||||||
const accountPublishersProvider = AccountPublishersFamily._();
|
final accountPublishersProvider = AccountPublishersFamily._();
|
||||||
|
|
||||||
final class AccountPublishersProvider
|
final class AccountPublishersProvider
|
||||||
extends
|
extends
|
||||||
@@ -472,7 +472,7 @@ final class AccountPublishersProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnPublisher>>,
|
$FutureModifier<List<SnPublisher>>,
|
||||||
$FutureProvider<List<SnPublisher>> {
|
$FutureProvider<List<SnPublisher>> {
|
||||||
const AccountPublishersProvider._({
|
AccountPublishersProvider._({
|
||||||
required AccountPublishersFamily super.from,
|
required AccountPublishersFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -520,7 +520,7 @@ String _$accountPublishersHash() => r'25f5695b4a5154163d77f1769876d826bf736609';
|
|||||||
|
|
||||||
final class AccountPublishersFamily extends $Family
|
final class AccountPublishersFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<SnPublisher>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<SnPublisher>>, String> {
|
||||||
const AccountPublishersFamily._()
|
AccountPublishersFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'accountPublishersProvider',
|
name: r'accountPublishersProvider',
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@@ -29,12 +31,28 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final relationshipListNotifierProvider = AsyncNotifierProvider.autoDispose(
|
final relationshipListNotifierProvider =
|
||||||
RelationshipListNotifier.new,
|
AsyncNotifierProvider.autoDispose<
|
||||||
);
|
RelationshipListNotifier,
|
||||||
|
PaginationState<SnRelationship>
|
||||||
|
>(RelationshipListNotifier.new);
|
||||||
|
|
||||||
class RelationshipListNotifier extends AsyncNotifier<List<SnRelationship>>
|
class RelationshipListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnRelationship>>
|
||||||
with AsyncPaginationController<SnRelationship> {
|
with AsyncPaginationController<SnRelationship> {
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnRelationship>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnRelationship>> fetch() async {
|
Future<List<SnRelationship>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
@@ -95,7 +113,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
contentPadding: const EdgeInsets.only(left: 16, right: 12),
|
contentPadding: const EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: AccountPfcGestureDetector(
|
leading: AccountPfcGestureDetector(
|
||||||
uname: account.name,
|
uname: account.name,
|
||||||
child: ProfilePictureWidget(fileId: account.profile.picture?.id),
|
child: ProfilePictureWidget(file: account.profile.picture),
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'relationship.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(sentFriendRequest)
|
@ProviderFor(sentFriendRequest)
|
||||||
const sentFriendRequestProvider = SentFriendRequestProvider._();
|
final sentFriendRequestProvider = SentFriendRequestProvider._();
|
||||||
|
|
||||||
final class SentFriendRequestProvider
|
final class SentFriendRequestProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class SentFriendRequestProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnRelationship>>,
|
$FutureModifier<List<SnRelationship>>,
|
||||||
$FutureProvider<List<SnRelationship>> {
|
$FutureProvider<List<SnRelationship>> {
|
||||||
const SentFriendRequestProvider._()
|
SentFriendRequestProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
180
lib/screens/activitypub/search.dart
Normal file
180
lib/screens/activitypub/search.dart
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/activitypub.dart';
|
||||||
|
import 'package:island/services/activitypub_service.dart';
|
||||||
|
import 'package:island/widgets/activitypub/actor_list_item.dart';
|
||||||
|
import 'package:island/widgets/alert.dart';
|
||||||
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:island/widgets/extended_refresh_indicator.dart';
|
||||||
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
|
class ApSearchScreen extends HookConsumerWidget {
|
||||||
|
const ApSearchScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final searchController = useTextEditingController();
|
||||||
|
final debounce = useMemoized(() => const Duration(milliseconds: 500));
|
||||||
|
final debounceTimer = useRef<Timer?>(null);
|
||||||
|
final searchResults = useState<List<SnActivityPubActor>>([]);
|
||||||
|
final isSearching = useState(false);
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
return () {
|
||||||
|
searchController.dispose();
|
||||||
|
debounceTimer.value?.cancel();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
Future<void> performSearch(String query) async {
|
||||||
|
if (query.trim().isEmpty) {
|
||||||
|
searchResults.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSearching.value = true;
|
||||||
|
try {
|
||||||
|
final service = ref.read(activityPubServiceProvider);
|
||||||
|
final results = await service.searchUsers(query);
|
||||||
|
searchResults.value = results;
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
} finally {
|
||||||
|
isSearching.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSearchChanged(String query) {
|
||||||
|
if (debounceTimer.value?.isActive ?? false) {
|
||||||
|
debounceTimer.value!.cancel();
|
||||||
|
}
|
||||||
|
debounceTimer.value = Timer(debounce, () {
|
||||||
|
performSearch(query);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateActorIsFollowing(String actorId, bool isFollowing) {
|
||||||
|
searchResults.value = searchResults.value
|
||||||
|
.map(
|
||||||
|
(a) => a.id == actorId ? a.copyWith(isFollowing: isFollowing) : a,
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> handleFollow(SnActivityPubActor actor) async {
|
||||||
|
try {
|
||||||
|
updateActorIsFollowing(actor.id, true);
|
||||||
|
final service = ref.read(activityPubServiceProvider);
|
||||||
|
await service.followRemoteUser(actor.uri);
|
||||||
|
showSnackBar(
|
||||||
|
'followedUser'.tr(
|
||||||
|
args: [
|
||||||
|
'${actor.username?.isNotEmpty ?? false ? actor.username : actor.displayName}',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
updateActorIsFollowing(actor.id, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> handleUnfollow(SnActivityPubActor actor) async {
|
||||||
|
try {
|
||||||
|
updateActorIsFollowing(actor.id, false);
|
||||||
|
final service = ref.read(activityPubServiceProvider);
|
||||||
|
await service.unfollowRemoteUser(actor.uri);
|
||||||
|
showSnackBar(
|
||||||
|
'unfollowedUser'.tr(
|
||||||
|
args: [
|
||||||
|
'${actor.username?.isNotEmpty ?? false ? actor.username : actor.displayName}',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
updateActorIsFollowing(actor.id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AppScaffold(
|
||||||
|
isNoBackground: false,
|
||||||
|
appBar: AppBar(title: Text('searchFediverse'.tr()), elevation: 0),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: SearchBar(
|
||||||
|
controller: searchController,
|
||||||
|
hintText: 'searchFediverseHint'.tr(
|
||||||
|
args: ['@username@instance.com'],
|
||||||
|
),
|
||||||
|
leading: const Icon(Symbols.search).padding(horizontal: 24),
|
||||||
|
onChanged: onSearchChanged,
|
||||||
|
onSubmitted: (value) {
|
||||||
|
onSearchChanged(value);
|
||||||
|
performSearch(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: isSearching.value
|
||||||
|
? const Center(child: CircularProgressIndicator())
|
||||||
|
: searchResults.value.isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Symbols.search,
|
||||||
|
size: 64,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
if (searchController.text.isEmpty)
|
||||||
|
Text(
|
||||||
|
'searchFediverseEmpty'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Text(
|
||||||
|
'searchFediverseNoResults'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ExtendedRefreshIndicator(
|
||||||
|
onRefresh: () => performSearch(searchController.text),
|
||||||
|
child: ListView.separated(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
itemCount: searchResults.value.length,
|
||||||
|
separatorBuilder: (context, index) => const Gap(8),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final actor = searchResults.value[index];
|
||||||
|
return Center(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 560),
|
||||||
|
child: ApActorListItem(
|
||||||
|
actor: actor,
|
||||||
|
isFollowing: actor.isFollowing ?? false,
|
||||||
|
isLoading: false,
|
||||||
|
onFollow: () => handleFollow(actor),
|
||||||
|
onUnfollow: () => handleUnfollow(actor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,12 @@ part of 'captcha.config.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(captchaUrl)
|
@ProviderFor(captchaUrl)
|
||||||
const captchaUrlProvider = CaptchaUrlProvider._();
|
final captchaUrlProvider = CaptchaUrlProvider._();
|
||||||
|
|
||||||
final class CaptchaUrlProvider
|
final class CaptchaUrlProvider
|
||||||
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
with $FutureModifier<String>, $FutureProvider<String> {
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
const CaptchaUrlProvider._()
|
CaptchaUrlProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
try {
|
try {
|
||||||
await client.post(
|
await client.post(
|
||||||
'/sphere/chat/direct',
|
'/messager/chat/direct',
|
||||||
data: {'related_user_id': result.id},
|
data: {'related_user_id': result.id},
|
||||||
);
|
);
|
||||||
eventBus.fire(const ChatRoomsRefreshEvent());
|
eventBus.fire(const ChatRoomsRefreshEvent());
|
||||||
@@ -519,7 +519,7 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).padding(bottom: isWideScreen(context) ? null : 56)
|
).padding(bottom: MediaQuery.of(context).padding.bottom)
|
||||||
: null,
|
: null,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
flexibleSpace: Container(
|
flexibleSpace: Container(
|
||||||
@@ -599,11 +599,13 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: ChatListBodyWidget(
|
body: userInfo.value == null
|
||||||
isFloating: false,
|
? const ResponseUnauthorizedWidget()
|
||||||
tabController: tabController,
|
: ChatListBodyWidget(
|
||||||
selectedTab: selectedTab,
|
isFloating: false,
|
||||||
),
|
tabController: tabController,
|
||||||
|
selectedTab: selectedTab,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -618,7 +620,9 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
Future<void> acceptInvite(SnChatMember invite) async {
|
Future<void> acceptInvite(SnChatMember invite) async {
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
|
await client.post(
|
||||||
|
'/messager/chat/invites/${invite.chatRoom!.id}/accept',
|
||||||
|
);
|
||||||
ref.invalidate(chatroomInvitesProvider);
|
ref.invalidate(chatroomInvitesProvider);
|
||||||
ref.invalidate(chatRoomJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -630,7 +634,7 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post(
|
await client.post(
|
||||||
'/sphere/chat/invites/${invite.chatRoom!.id}/decline',
|
'/messager/chat/invites/${invite.chatRoom!.id}/decline',
|
||||||
);
|
);
|
||||||
ref.invalidate(chatroomInvitesProvider);
|
ref.invalidate(chatroomInvitesProvider);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -97,14 +97,10 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
try {
|
try {
|
||||||
final cloudFile =
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
await FileUploader.createCloudFile(
|
ref: ref,
|
||||||
ref: ref,
|
fileData: UniversalFile(data: result, type: UniversalFileType.image),
|
||||||
fileData: UniversalFile(
|
).future;
|
||||||
data: result,
|
|
||||||
type: UniversalFileType.image,
|
|
||||||
),
|
|
||||||
).future;
|
|
||||||
if (cloudFile == null) {
|
if (cloudFile == null) {
|
||||||
throw ArgumentError('Failed to upload the file...');
|
throw ArgumentError('Failed to upload the file...');
|
||||||
}
|
}
|
||||||
@@ -129,7 +125,7 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final resp = await client.request(
|
final resp = await client.request(
|
||||||
id == null ? '/sphere/chat' : '/sphere/chat/$id',
|
id == null ? '/messager/chat' : '/messager/chat/$id',
|
||||||
data: {
|
data: {
|
||||||
'name': nameController.text,
|
'name': nameController.text,
|
||||||
'description': descriptionController.text,
|
'description': descriptionController.text,
|
||||||
@@ -166,13 +162,12 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
child:
|
child: background.value != null
|
||||||
background.value != null
|
? CloudFileWidget(
|
||||||
? CloudFileWidget(
|
item: background.value!,
|
||||||
item: background.value!,
|
fit: BoxFit.cover,
|
||||||
fit: BoxFit.cover,
|
)
|
||||||
)
|
: const SizedBox.shrink(),
|
||||||
: const SizedBox.shrink(),
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setPicture('background');
|
setPicture('background');
|
||||||
@@ -183,7 +178,7 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
bottom: -32,
|
bottom: -32,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
fileId: picture.value?.id,
|
file: picture.value,
|
||||||
radius: 40,
|
radius: 40,
|
||||||
fallbackIcon: Symbols.group,
|
fallbackIcon: Symbols.group,
|
||||||
),
|
),
|
||||||
@@ -208,8 +203,8 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
@@ -223,8 +218,8 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
minLines: 3,
|
minLines: 3,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
DropdownButtonFormField<SnRealm>(
|
DropdownButtonFormField<SnRealm>(
|
||||||
@@ -241,22 +236,20 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
child: Text('none'.tr()),
|
child: Text('none'.tr()),
|
||||||
),
|
),
|
||||||
...joinedRealms.maybeWhen(
|
...joinedRealms.maybeWhen(
|
||||||
data:
|
data: (realms) => realms.map(
|
||||||
(realms) => realms.map(
|
(realm) => DropdownMenuItem(
|
||||||
(realm) => DropdownMenuItem(
|
value: realm,
|
||||||
value: realm,
|
child: Text(realm.name),
|
||||||
child: Text(realm.name),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
orElse: () => [],
|
orElse: () => [],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged:
|
onChanged: joinedRealms.isLoading
|
||||||
joinedRealms.isLoading
|
? null
|
||||||
? null
|
: (SnRealm? value) {
|
||||||
: (SnRealm? value) {
|
currentRealm.value = value;
|
||||||
currentRealm.value = value;
|
},
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Card(
|
Card(
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
extentEstimation: (_, _) => 40,
|
extentEstimation: (_, _) => 40,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final message = messageList[index];
|
final message = messageList[index];
|
||||||
final nextMessage =
|
final nextMessage = index < messageList.length - 1
|
||||||
index < messageList.length - 1 ? messageList[index + 1] : null;
|
? messageList[index + 1]
|
||||||
|
: null;
|
||||||
final isLastInGroup =
|
final isLastInGroup =
|
||||||
nextMessage == null ||
|
nextMessage == null ||
|
||||||
nextMessage.senderId != message.senderId ||
|
nextMessage.senderId != message.senderId ||
|
||||||
@@ -97,25 +98,23 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 26,
|
height: 26,
|
||||||
width: 26,
|
width: 26,
|
||||||
child:
|
child: (room.type == 1 && room.picture == null)
|
||||||
(room.type == 1 && room.picture?.id == null)
|
? SplitAvatarWidget(
|
||||||
? SplitAvatarWidget(
|
files: room.members!
|
||||||
filesId:
|
.map((e) => e.account.profile.picture)
|
||||||
room.members!
|
.toList(),
|
||||||
.map((e) => e.account.profile.picture?.id)
|
)
|
||||||
.toList(),
|
: room.picture != null
|
||||||
)
|
? ProfilePictureWidget(
|
||||||
: room.picture?.id != null
|
file: room.picture,
|
||||||
? ProfilePictureWidget(
|
fallbackIcon: Symbols.chat,
|
||||||
fileId: room.picture?.id,
|
)
|
||||||
fallbackIcon: Symbols.chat,
|
: CircleAvatar(
|
||||||
)
|
child: Text(
|
||||||
: CircleAvatar(
|
room.name![0].toUpperCase(),
|
||||||
child: Text(
|
style: const TextStyle(fontSize: 12),
|
||||||
room.name![0].toUpperCase(),
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
@@ -132,25 +131,23 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 26,
|
height: 26,
|
||||||
width: 26,
|
width: 26,
|
||||||
child:
|
child: (room.type == 1 && room.picture == null)
|
||||||
(room.type == 1 && room.picture?.id == null)
|
? SplitAvatarWidget(
|
||||||
? SplitAvatarWidget(
|
files: room.members!
|
||||||
filesId:
|
.map((e) => e.account.profile.picture)
|
||||||
room.members!
|
.toList(),
|
||||||
.map((e) => e.account.profile.picture?.id)
|
)
|
||||||
.toList(),
|
: room.picture != null
|
||||||
)
|
? ProfilePictureWidget(
|
||||||
: room.picture?.id != null
|
file: room.picture,
|
||||||
? ProfilePictureWidget(
|
fallbackIcon: Symbols.chat,
|
||||||
fileId: room.picture?.id,
|
)
|
||||||
fallbackIcon: Symbols.chat,
|
: CircleAvatar(
|
||||||
)
|
child: Text(
|
||||||
: CircleAvatar(
|
room.name![0].toUpperCase(),
|
||||||
child: Text(
|
style: const TextStyle(fontSize: 12),
|
||||||
room.name![0].toUpperCase(),
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
@@ -181,17 +178,14 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: messages.when(
|
child: messages.when(
|
||||||
data:
|
data: (messageList) => messageList.isEmpty
|
||||||
(messageList) =>
|
? Center(child: Text('No messages yet'.tr()))
|
||||||
messageList.isEmpty
|
: chatMessageListWidget(messageList),
|
||||||
? Center(child: Text('No messages yet'.tr()))
|
|
||||||
: chatMessageListWidget(messageList),
|
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error:
|
error: (error, _) => ResponseErrorWidget(
|
||||||
(error, _) => ResponseErrorWidget(
|
error: error,
|
||||||
error: error,
|
onRetry: () => messagesNotifier.loadInitial(),
|
||||||
onRetry: () => messagesNotifier.loadInitial(),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Join button at the bottom for public rooms
|
// Join button at the bottom for public rooms
|
||||||
@@ -202,7 +196,7 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
showLoadingModal(context);
|
showLoadingModal(context);
|
||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
await apiClient.post('/sphere/chat/${room.id}/members/me');
|
await apiClient.post('/messager/chat/${room.id}/members/me');
|
||||||
ref.invalidate(chatRoomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final mediaQuery = MediaQuery.of(context);
|
||||||
final chatRoom = ref.watch(chatRoomProvider(id));
|
final chatRoom = ref.watch(chatRoomProvider(id));
|
||||||
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final isSyncing = ref.watch(chatSyncingProvider);
|
final isSyncing = ref.watch(chatSyncingProvider);
|
||||||
@@ -71,67 +72,64 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBar: AppBar(leading: const PageBackButton()),
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
body: Center(
|
body: Center(
|
||||||
child:
|
child: ConstrainedBox(
|
||||||
ConstrainedBox(
|
constraints: const BoxConstraints(maxWidth: 280),
|
||||||
constraints: const BoxConstraints(maxWidth: 280),
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Icon(
|
||||||
Icon(
|
room.isCommunity == true
|
||||||
room.isCommunity == true
|
? Symbols.person_add
|
||||||
? Symbols.person_add
|
: Symbols.person_remove,
|
||||||
: Symbols.person_remove,
|
size: 36,
|
||||||
size: 36,
|
fill: 1,
|
||||||
fill: 1,
|
).padding(bottom: 4),
|
||||||
).padding(bottom: 4),
|
Text('chatNotJoined').tr(),
|
||||||
Text('chatNotJoined').tr(),
|
if (room.isCommunity != true)
|
||||||
if (room.isCommunity != true)
|
Text(
|
||||||
Text(
|
'chatUnableJoin',
|
||||||
'chatUnableJoin',
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
).tr().bold()
|
||||||
).tr().bold()
|
else
|
||||||
else
|
FilledButton.tonalIcon(
|
||||||
FilledButton.tonalIcon(
|
onPressed: () async {
|
||||||
onPressed: () async {
|
try {
|
||||||
try {
|
showLoadingModal(context);
|
||||||
showLoadingModal(context);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
final apiClient = ref.read(apiClientProvider);
|
await apiClient.post(
|
||||||
await apiClient.post(
|
'/messager/chat/${room.id}/members/me',
|
||||||
'/sphere/chat/${room.id}/members/me',
|
);
|
||||||
);
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
ref.invalidate(chatRoomIdentityProvider(id));
|
} catch (err) {
|
||||||
} catch (err) {
|
showErrorAlert(err);
|
||||||
showErrorAlert(err);
|
} finally {
|
||||||
} finally {
|
if (context.mounted) {
|
||||||
if (context.mounted) {
|
hideLoadingModal(context);
|
||||||
hideLoadingModal(context);
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
label: Text('chatJoin').tr(),
|
||||||
label: Text('chatJoin').tr(),
|
icon: const Icon(Icons.add),
|
||||||
icon: const Icon(Icons.add),
|
).padding(top: 8),
|
||||||
).padding(top: 8),
|
],
|
||||||
],
|
),
|
||||||
),
|
).center(),
|
||||||
).center(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loading:
|
loading: () => AppScaffold(
|
||||||
() => AppScaffold(
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
appBar: AppBar(leading: const PageBackButton()),
|
body: CircularProgressIndicator().center(),
|
||||||
body: CircularProgressIndicator().center(),
|
),
|
||||||
),
|
error: (error, _) => AppScaffold(
|
||||||
error:
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
(error, _) => AppScaffold(
|
body: ResponseErrorWidget(
|
||||||
appBar: AppBar(leading: const PageBackButton()),
|
error: error,
|
||||||
body: ResponseErrorWidget(
|
onRetry: () => ref.refresh(chatRoomProvider(id)),
|
||||||
error: error,
|
),
|
||||||
onRetry: () => ref.refresh(chatRoomProvider(id)),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +184,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
case MessageItemAction.edit:
|
case MessageItemAction.edit:
|
||||||
messageEditingTo.value = message.toRemoteMessage();
|
messageEditingTo.value = message.toRemoteMessage();
|
||||||
messageController.text = messageEditingTo.value?.content ?? '';
|
messageController.text = messageEditingTo.value?.content ?? '';
|
||||||
attachments.value =
|
attachments.value = messageEditingTo.value!.attachments
|
||||||
messageEditingTo.value!.attachments
|
.map((e) => UniversalFile.fromAttachment(e))
|
||||||
.map((e) => UniversalFile.fromAttachment(e))
|
.toList();
|
||||||
.toList();
|
|
||||||
case MessageItemAction.forward:
|
case MessageItemAction.forward:
|
||||||
messageForwardingTo.value = message.toRemoteMessage();
|
messageForwardingTo.value = message.toRemoteMessage();
|
||||||
case MessageItemAction.reply:
|
case MessageItemAction.reply:
|
||||||
@@ -424,38 +421,37 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
label: Text('${(onlineCount.value ?? 0)}'),
|
label: Text('${(onlineCount.value ?? 0)}'),
|
||||||
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
backgroundColor:
|
backgroundColor: (onlineCount.value ?? 0) > 1
|
||||||
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
|
? Colors.green
|
||||||
|
: Colors.grey,
|
||||||
offset: Offset(6, 14),
|
offset: Offset(6, 14),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 26,
|
height: 26,
|
||||||
width: 26,
|
width: 26,
|
||||||
child:
|
child: (room!.type == 1 && room.picture == null)
|
||||||
(room!.type == 1 && room.picture?.id == null)
|
? SplitAvatarWidget(
|
||||||
? SplitAvatarWidget(
|
files: getValidMembers(
|
||||||
filesId:
|
room.members!,
|
||||||
getValidMembers(
|
).map((e) => e.account.profile.picture).toList(),
|
||||||
room.members!,
|
)
|
||||||
).map((e) => e.account.profile.picture?.id).toList(),
|
: room.picture != null
|
||||||
)
|
? ProfilePictureWidget(
|
||||||
: room.picture?.id != null
|
file: room.picture,
|
||||||
? ProfilePictureWidget(
|
fallbackIcon: Symbols.chat,
|
||||||
fileId: room.picture?.id,
|
)
|
||||||
fallbackIcon: Symbols.chat,
|
: CircleAvatar(
|
||||||
)
|
child: Text(
|
||||||
: CircleAvatar(
|
room.name![0].toUpperCase(),
|
||||||
child: Text(
|
style: const TextStyle(fontSize: 12),
|
||||||
room.name![0].toUpperCase(),
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
? getValidMembers(
|
? getValidMembers(
|
||||||
room.members!,
|
room.members!,
|
||||||
).map((e) => e.account.nick).join(', ')
|
).map((e) => e.account.nick).join(', ')
|
||||||
: room.name!,
|
: room.name!,
|
||||||
).fontSize(15),
|
).fontSize(15),
|
||||||
],
|
],
|
||||||
@@ -470,39 +466,38 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
isLabelVisible: (onlineCount.value ?? 0) > 1,
|
isLabelVisible: (onlineCount.value ?? 0) > 1,
|
||||||
label: Text('${(onlineCount.value ?? 0)}'),
|
label: Text('${(onlineCount.value ?? 0)}'),
|
||||||
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
textStyle: GoogleFonts.robotoMono(fontSize: 10),
|
||||||
backgroundColor:
|
backgroundColor: (onlineCount.value ?? 0) > 1
|
||||||
(onlineCount.value ?? 0) > 1 ? Colors.green : Colors.grey,
|
? Colors.green
|
||||||
|
: Colors.grey,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
offset: Offset(6, 14),
|
offset: Offset(6, 14),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 28,
|
height: 28,
|
||||||
width: 28,
|
width: 28,
|
||||||
child:
|
child: (room!.type == 1 && room.picture == null)
|
||||||
(room!.type == 1 && room.picture?.id == null)
|
? SplitAvatarWidget(
|
||||||
? SplitAvatarWidget(
|
files: getValidMembers(
|
||||||
filesId:
|
room.members!,
|
||||||
getValidMembers(
|
).map((e) => e.account.profile.picture).toList(),
|
||||||
room.members!,
|
)
|
||||||
).map((e) => e.account.profile.picture?.id).toList(),
|
: room.picture != null
|
||||||
)
|
? ProfilePictureWidget(
|
||||||
: room.picture?.id != null
|
file: room.picture,
|
||||||
? ProfilePictureWidget(
|
fallbackIcon: Symbols.chat,
|
||||||
fileId: room.picture?.id,
|
)
|
||||||
fallbackIcon: Symbols.chat,
|
: CircleAvatar(
|
||||||
)
|
child: Text(
|
||||||
: CircleAvatar(
|
room.name![0].toUpperCase(),
|
||||||
child: Text(
|
style: const TextStyle(fontSize: 12),
|
||||||
room.name![0].toUpperCase(),
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(room.type == 1 && room.name == null)
|
(room.type == 1 && room.name == null)
|
||||||
? getValidMembers(
|
? getValidMembers(
|
||||||
room.members!,
|
room.members!,
|
||||||
).map((e) => e.account.nick).join(', ')
|
).map((e) => e.account.nick).join(', ')
|
||||||
: room.name!,
|
: room.name!,
|
||||||
).fontSize(19),
|
).fontSize(19),
|
||||||
],
|
],
|
||||||
@@ -531,11 +526,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
index: index,
|
index: index,
|
||||||
scrollController: scrollController,
|
scrollController: scrollController,
|
||||||
alignment: 0.5,
|
alignment: 0.5,
|
||||||
duration:
|
duration: (estimatedDistance) => Duration(
|
||||||
(estimatedDistance) => Duration(
|
milliseconds: (estimatedDistance * 0.5).clamp(200, 800).toInt(),
|
||||||
milliseconds:
|
),
|
||||||
(estimatedDistance * 0.5).clamp(200, 800).toInt(),
|
|
||||||
),
|
|
||||||
curve: (estimatedDistance) => Curves.easeOutCubic,
|
curve: (estimatedDistance) => Curves.easeOutCubic,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -605,12 +598,11 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
final config = await showModalBottomSheet<AttachmentUploadConfig>(
|
final config = await showModalBottomSheet<AttachmentUploadConfig>(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder:
|
builder: (context) => AttachmentUploaderSheet(
|
||||||
(context) => AttachmentUploaderSheet(
|
ref: ref,
|
||||||
ref: ref,
|
attachments: attachments.value,
|
||||||
attachments: attachments.value,
|
index: index,
|
||||||
index: index,
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (config == null) return;
|
if (config == null) return;
|
||||||
|
|
||||||
@@ -621,22 +613,20 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
'chat-upload': {index: 0},
|
'chat-upload': {index: 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
final cloudFile =
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
await FileUploader.createCloudFile(
|
ref: ref,
|
||||||
ref: ref,
|
fileData: attachment,
|
||||||
fileData: attachment,
|
poolId: config.poolId,
|
||||||
poolId: config.poolId,
|
mode: attachment.type == UniversalFileType.file
|
||||||
mode:
|
? FileUploadMode.generic
|
||||||
attachment.type == UniversalFileType.file
|
: FileUploadMode.mediaSafe,
|
||||||
? FileUploadMode.generic
|
onProgress: (progress, _) {
|
||||||
: FileUploadMode.mediaSafe,
|
attachmentProgress.value = {
|
||||||
onProgress: (progress, _) {
|
...attachmentProgress.value,
|
||||||
attachmentProgress.value = {
|
'chat-upload': {index: progress ?? 0.0},
|
||||||
...attachmentProgress.value,
|
};
|
||||||
'chat-upload': {index: progress ?? 0.0},
|
},
|
||||||
};
|
).future;
|
||||||
},
|
|
||||||
).future;
|
|
||||||
|
|
||||||
if (cloudFile == null) {
|
if (cloudFile == null) {
|
||||||
throw ArgumentError('Failed to upload the file...');
|
throw ArgumentError('Failed to upload the file...');
|
||||||
@@ -662,12 +652,12 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
curve: Curves.easeOut,
|
curve: Curves.easeOut,
|
||||||
tween: EdgeInsetsTween(
|
tween: EdgeInsetsTween(
|
||||||
begin: EdgeInsets.only(
|
begin: EdgeInsets.only(
|
||||||
top: MediaQuery.of(context).padding.top,
|
top: mediaQuery.padding.top,
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 8 + height,
|
bottom: mediaQuery.padding.bottom + 8 + height,
|
||||||
),
|
),
|
||||||
end: EdgeInsets.only(
|
end: EdgeInsets.only(
|
||||||
top: MediaQuery.of(context).padding.top,
|
top: mediaQuery.padding.top,
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 8 + height,
|
bottom: mediaQuery.padding.bottom + 8 + height,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
builder: (context, padding, child) {
|
builder: (context, padding, child) {
|
||||||
@@ -690,10 +680,9 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
extentEstimation: (_, _) => 40,
|
extentEstimation: (_, _) => 40,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final message = messageList[index];
|
final message = messageList[index];
|
||||||
final nextMessage =
|
final nextMessage = index < messageList.length - 1
|
||||||
index < messageList.length - 1
|
? messageList[index + 1]
|
||||||
? messageList[index + 1]
|
: null;
|
||||||
: null;
|
|
||||||
final isLastInGroup =
|
final isLastInGroup =
|
||||||
nextMessage == null ||
|
nextMessage == null ||
|
||||||
nextMessage.senderId != message.senderId ||
|
nextMessage.senderId != message.senderId ||
|
||||||
@@ -718,15 +707,14 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
toggleSelectionMode: toggleSelectionMode,
|
toggleSelectionMode: toggleSelectionMode,
|
||||||
toggleMessageSelection: toggleMessageSelection,
|
toggleMessageSelection: toggleMessageSelection,
|
||||||
onMessageAction: onMessageAction,
|
onMessageAction: onMessageAction,
|
||||||
onJump:
|
onJump: (messageId) => scrollToMessage(
|
||||||
(messageId) => scrollToMessage(
|
messageId: messageId,
|
||||||
messageId: messageId,
|
messageList: messageList,
|
||||||
messageList: messageList,
|
messagesNotifier: messagesNotifier,
|
||||||
messagesNotifier: messagesNotifier,
|
listController: listController,
|
||||||
listController: listController,
|
scrollController: scrollController,
|
||||||
scrollController: scrollController,
|
ref: ref,
|
||||||
ref: ref,
|
),
|
||||||
),
|
|
||||||
attachmentProgress: attachmentProgress.value,
|
attachmentProgress: attachmentProgress.value,
|
||||||
disableAnimation: settings.disableAnimation,
|
disableAnimation: settings.disableAnimation,
|
||||||
roomOpenTime: roomOpenTime,
|
roomOpenTime: roomOpenTime,
|
||||||
@@ -744,17 +732,14 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
toolbarHeight: compactHeader ? null : 74,
|
toolbarHeight: compactHeader ? null : 74,
|
||||||
title: chatRoom.when(
|
title: chatRoom.when(
|
||||||
data:
|
data: (room) => compactHeader
|
||||||
(room) =>
|
? compactHeaderWidget(room)
|
||||||
compactHeader
|
: comfortHeaderWidget(room),
|
||||||
? compactHeaderWidget(room)
|
|
||||||
: comfortHeaderWidget(room),
|
|
||||||
loading: () => const Text('Loading...'),
|
loading: () => const Text('Loading...'),
|
||||||
error:
|
error: (err, _) => ResponseErrorWidget(
|
||||||
(err, _) => ResponseErrorWidget(
|
error: err,
|
||||||
error: err,
|
onRetry: () => messagesNotifier.loadInitial(),
|
||||||
onRetry: () => messagesNotifier.loadInitial(),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
chatRoom.when(
|
chatRoom.when(
|
||||||
@@ -787,13 +772,11 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
index: index,
|
index: index,
|
||||||
scrollController: scrollController,
|
scrollController: scrollController,
|
||||||
alignment: 0.5,
|
alignment: 0.5,
|
||||||
duration:
|
duration: (estimatedDistance) => Duration(
|
||||||
(estimatedDistance) => Duration(
|
milliseconds: (estimatedDistance * 0.5)
|
||||||
milliseconds:
|
.clamp(200, 800)
|
||||||
(estimatedDistance * 0.5)
|
.toInt(),
|
||||||
.clamp(200, 800)
|
),
|
||||||
.toInt(),
|
|
||||||
),
|
|
||||||
curve: (estimatedDistance) => Curves.easeOutCubic,
|
curve: (estimatedDistance) => Curves.easeOutCubic,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -819,38 +802,35 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
switchInCurve: Curves.easeOutCubic,
|
switchInCurve: Curves.easeOutCubic,
|
||||||
switchOutCurve: Curves.easeInCubic,
|
switchOutCurve: Curves.easeInCubic,
|
||||||
transitionBuilder: (
|
transitionBuilder:
|
||||||
Widget child,
|
(Widget child, Animation<double> animation) {
|
||||||
Animation<double> animation,
|
return SlideTransition(
|
||||||
) {
|
position: Tween<Offset>(
|
||||||
return SlideTransition(
|
begin: const Offset(0, 0.05),
|
||||||
position: Tween<Offset>(
|
end: Offset.zero,
|
||||||
begin: const Offset(0, 0.05),
|
).animate(animation),
|
||||||
end: Offset.zero,
|
child: FadeTransition(
|
||||||
).animate(animation),
|
opacity: animation,
|
||||||
child: FadeTransition(opacity: animation, child: child),
|
child: child,
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
|
},
|
||||||
child: messages.when(
|
child: messages.when(
|
||||||
data:
|
data: (messageList) => messageList.isEmpty
|
||||||
(messageList) =>
|
? Center(
|
||||||
messageList.isEmpty
|
key: const ValueKey('empty-messages'),
|
||||||
? Center(
|
child: Text('No messages yet'.tr()),
|
||||||
key: const ValueKey('empty-messages'),
|
)
|
||||||
child: Text('No messages yet'.tr()),
|
: chatMessageListWidget(messageList),
|
||||||
)
|
loading: () => const Center(
|
||||||
: chatMessageListWidget(messageList),
|
key: ValueKey('loading-messages'),
|
||||||
loading:
|
child: CircularProgressIndicator(),
|
||||||
() => const Center(
|
),
|
||||||
key: ValueKey('loading-messages'),
|
error: (error, _) => ResponseErrorWidget(
|
||||||
child: CircularProgressIndicator(),
|
key: const ValueKey('error-messages'),
|
||||||
),
|
error: error,
|
||||||
error:
|
onRetry: () => messagesNotifier.loadInitial(),
|
||||||
(error, _) => ResponseErrorWidget(
|
),
|
||||||
key: const ValueKey('error-messages'),
|
|
||||||
error: error,
|
|
||||||
onRetry: () => messagesNotifier.loadInitial(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -862,10 +842,8 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
child: chatRoom.when(
|
child: chatRoom.when(
|
||||||
data:
|
data: (data) =>
|
||||||
(data) => CallOverlayBar(
|
CallOverlayBar(room: data!).padding(horizontal: 8, top: 12),
|
||||||
room: data!,
|
|
||||||
).padding(horizontal: 8, top: 12),
|
|
||||||
error: (_, _) => const SizedBox.shrink(),
|
error: (_, _) => const SizedBox.shrink(),
|
||||||
loading: () => const SizedBox.shrink(),
|
loading: () => const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
@@ -875,7 +853,12 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
top: 8,
|
top: 8,
|
||||||
right: 16,
|
right: 16,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: EdgeInsets.fromLTRB(
|
||||||
|
8,
|
||||||
|
8,
|
||||||
|
8,
|
||||||
|
8 + mediaQuery.padding.bottom,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
context,
|
context,
|
||||||
@@ -903,111 +886,100 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
if (!isSelectionMode.value)
|
if (!isSelectionMode.value)
|
||||||
AnimatedBuilder(
|
AnimatedBuilder(
|
||||||
animation: bottomGradientNotifier.value,
|
animation: bottomGradientNotifier.value,
|
||||||
builder:
|
builder: (context, child) => Positioned(
|
||||||
(context, child) => Positioned(
|
left: 0,
|
||||||
left: 0,
|
right: 0,
|
||||||
right: 0,
|
bottom: 0,
|
||||||
bottom: 0,
|
child: Opacity(
|
||||||
child: Opacity(
|
opacity: bottomGradientNotifier.value.value,
|
||||||
opacity: bottomGradientNotifier.value.value,
|
child: Container(
|
||||||
child: Container(
|
height: math.min(mediaQuery.size.height * 0.1, 128),
|
||||||
height: math.min(
|
decoration: BoxDecoration(
|
||||||
MediaQuery.of(context).size.height * 0.1,
|
gradient: LinearGradient(
|
||||||
128,
|
begin: Alignment.bottomCenter,
|
||||||
),
|
end: Alignment.topCenter,
|
||||||
decoration: BoxDecoration(
|
colors: [
|
||||||
gradient: LinearGradient(
|
Theme.of(
|
||||||
begin: Alignment.bottomCenter,
|
context,
|
||||||
end: Alignment.topCenter,
|
).colorScheme.surfaceContainer.withOpacity(0.8),
|
||||||
colors: [
|
Theme.of(
|
||||||
Theme.of(
|
context,
|
||||||
context,
|
).colorScheme.surfaceContainer.withOpacity(0.0),
|
||||||
).colorScheme.surfaceContainer.withOpacity(0.8),
|
],
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.surfaceContainer.withOpacity(0.0),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
// Chat Input positioned above gradient (higher z-index)
|
// Chat Input positioned above gradient (higher z-index)
|
||||||
if (!isSelectionMode.value)
|
if (!isSelectionMode.value)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0, // At the very bottom, above gradient
|
bottom: mediaQuery
|
||||||
|
.padding
|
||||||
|
.bottom, // At the very bottom, above gradient
|
||||||
child: chatRoom.when(
|
child: chatRoom.when(
|
||||||
data:
|
data: (room) => ChatInput(
|
||||||
(room) => Column(
|
key: inputKey,
|
||||||
key: inputKey,
|
messageController: messageController,
|
||||||
mainAxisSize: MainAxisSize.min,
|
chatRoom: room!,
|
||||||
children: [
|
onSend: sendMessage,
|
||||||
ChatInput(
|
onClear: () {
|
||||||
messageController: messageController,
|
if (messageEditingTo.value != null) {
|
||||||
chatRoom: room!,
|
attachments.value.clear();
|
||||||
onSend: sendMessage,
|
messageController.clear();
|
||||||
onClear: () {
|
}
|
||||||
if (messageEditingTo.value != null) {
|
messageEditingTo.value = null;
|
||||||
attachments.value.clear();
|
messageReplyingTo.value = null;
|
||||||
messageController.clear();
|
messageForwardingTo.value = null;
|
||||||
}
|
selectedPoll.value = null;
|
||||||
messageEditingTo.value = null;
|
selectedFund.value = null;
|
||||||
messageReplyingTo.value = null;
|
},
|
||||||
messageForwardingTo.value = null;
|
messageEditingTo: messageEditingTo.value,
|
||||||
selectedPoll.value = null;
|
messageReplyingTo: messageReplyingTo.value,
|
||||||
selectedFund.value = null;
|
messageForwardingTo: messageForwardingTo.value,
|
||||||
},
|
selectedPoll: selectedPoll.value,
|
||||||
messageEditingTo: messageEditingTo.value,
|
onPollSelected: (poll) => selectedPoll.value = poll,
|
||||||
messageReplyingTo: messageReplyingTo.value,
|
selectedFund: selectedFund.value,
|
||||||
messageForwardingTo: messageForwardingTo.value,
|
onFundSelected: (fund) => selectedFund.value = fund,
|
||||||
selectedPoll: selectedPoll.value,
|
onPickFile: (bool isPhoto) {
|
||||||
onPollSelected: (poll) => selectedPoll.value = poll,
|
if (isPhoto) {
|
||||||
selectedFund: selectedFund.value,
|
pickPhotoMedia();
|
||||||
onFundSelected: (fund) => selectedFund.value = fund,
|
} else {
|
||||||
onPickFile: (bool isPhoto) {
|
pickVideoMedia();
|
||||||
if (isPhoto) {
|
}
|
||||||
pickPhotoMedia();
|
},
|
||||||
} else {
|
onPickAudio: pickAudioMedia,
|
||||||
pickVideoMedia();
|
onPickGeneralFile: pickGeneralFile,
|
||||||
}
|
onLinkAttachment: linkAttachment,
|
||||||
},
|
attachments: attachments.value,
|
||||||
onPickAudio: pickAudioMedia,
|
onUploadAttachment: uploadAttachment,
|
||||||
onPickGeneralFile: pickGeneralFile,
|
onDeleteAttachment: (index) async {
|
||||||
onLinkAttachment: linkAttachment,
|
final attachment = attachments.value[index];
|
||||||
attachments: attachments.value,
|
if (attachment.isOnCloud && !attachment.isLink) {
|
||||||
onUploadAttachment: uploadAttachment,
|
final client = ref.watch(apiClientProvider);
|
||||||
onDeleteAttachment: (index) async {
|
await client.delete('/drive/files/${attachment.data.id}');
|
||||||
final attachment = attachments.value[index];
|
}
|
||||||
if (attachment.isOnCloud && !attachment.isLink) {
|
final clone = List.of(attachments.value);
|
||||||
final client = ref.watch(apiClientProvider);
|
clone.removeAt(index);
|
||||||
await client.delete(
|
attachments.value = clone;
|
||||||
'/drive/files/${attachment.data.id}',
|
},
|
||||||
);
|
onMoveAttachment: (idx, delta) {
|
||||||
}
|
if (idx + delta < 0 ||
|
||||||
final clone = List.of(attachments.value);
|
idx + delta >= attachments.value.length) {
|
||||||
clone.removeAt(index);
|
return;
|
||||||
attachments.value = clone;
|
}
|
||||||
},
|
final clone = List.of(attachments.value);
|
||||||
onMoveAttachment: (idx, delta) {
|
clone.insert(idx + delta, clone.removeAt(idx));
|
||||||
if (idx + delta < 0 ||
|
attachments.value = clone;
|
||||||
idx + delta >= attachments.value.length) {
|
},
|
||||||
return;
|
onAttachmentsChanged: (newAttachments) {
|
||||||
}
|
attachments.value = newAttachments;
|
||||||
final clone = List.of(attachments.value);
|
},
|
||||||
clone.insert(idx + delta, clone.removeAt(idx));
|
attachmentProgress: attachmentProgress.value,
|
||||||
attachments.value = clone;
|
),
|
||||||
},
|
|
||||||
onAttachmentsChanged: (newAttachments) {
|
|
||||||
attachments.value = newAttachments;
|
|
||||||
},
|
|
||||||
attachmentProgress: attachmentProgress.value,
|
|
||||||
),
|
|
||||||
Gap(MediaQuery.of(context).padding.bottom),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
error: (_, _) => const SizedBox.shrink(),
|
error: (_, _) => const SizedBox.shrink(),
|
||||||
loading: () => const SizedBox.shrink(),
|
loading: () => const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
@@ -1024,7 +996,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
left: 16,
|
left: 16,
|
||||||
right: 16,
|
right: 16,
|
||||||
top: 8,
|
top: 8,
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 8,
|
bottom: mediaQuery.padding.bottom + 8,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.patch(
|
await client.patch(
|
||||||
'/sphere/chat/$id/members/me/notify',
|
'/messager/chat/$id/members/me/notify',
|
||||||
data: {'notify_level': level},
|
data: {'notify_level': level},
|
||||||
);
|
);
|
||||||
ref.invalidate(chatRoomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
@@ -85,7 +85,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.patch(
|
await client.patch(
|
||||||
'/sphere/chat/$id/members/me/notify',
|
'/messager/chat/$id/members/me/notify',
|
||||||
data: {'break_until': until.toUtc().toIso8601String()},
|
data: {'break_until': until.toUtc().toIso8601String()},
|
||||||
);
|
);
|
||||||
ref.invalidate(chatRoomIdentityProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
@@ -279,9 +279,8 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
leading: PageBackButton(shadows: [iconShadow]),
|
leading: PageBackButton(shadows: [iconShadow]),
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background:
|
background:
|
||||||
(currentRoom!.type == 1 &&
|
(currentRoom!.type == 1 && currentRoom.background != null)
|
||||||
currentRoom.background?.id != null)
|
? CloudImageWidget(file: currentRoom.background!)
|
||||||
? CloudImageWidget(fileId: currentRoom.background!.id)
|
|
||||||
: (currentRoom.type == 1 &&
|
: (currentRoom.type == 1 &&
|
||||||
currentRoom.members!.length == 1 &&
|
currentRoom.members!.length == 1 &&
|
||||||
currentRoom
|
currentRoom
|
||||||
@@ -293,17 +292,16 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
?.id !=
|
?.id !=
|
||||||
null)
|
null)
|
||||||
? CloudImageWidget(
|
? CloudImageWidget(
|
||||||
fileId: currentRoom
|
file: currentRoom
|
||||||
.members!
|
.members!
|
||||||
.first
|
.first
|
||||||
.account
|
.account
|
||||||
.profile
|
.profile
|
||||||
.background!
|
.background!,
|
||||||
.id,
|
|
||||||
)
|
)
|
||||||
: currentRoom.background?.id != null
|
: currentRoom.background != null
|
||||||
? CloudImageWidget(
|
? CloudImageWidget(
|
||||||
fileId: currentRoom.background!.id,
|
file: currentRoom.background!,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(
|
||||||
@@ -529,7 +527,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.delete('/sphere/chat/$id');
|
await client.delete('/messager/chat/$id');
|
||||||
ref.invalidate(chatRoomJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
@@ -560,7 +558,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.delete('/sphere/chat/$id/members/me');
|
await client.delete('/messager/chat/$id/members/me');
|
||||||
ref.invalidate(chatRoomJoinedProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
@@ -588,7 +586,8 @@ final chatMemberListProvider = AsyncNotifierProvider.autoDispose.family(
|
|||||||
ChatMemberListNotifier.new,
|
ChatMemberListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class ChatMemberListNotifier extends AsyncNotifier<List<SnChatMember>>
|
class ChatMemberListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnChatMember>>
|
||||||
with AsyncPaginationController<SnChatMember> {
|
with AsyncPaginationController<SnChatMember> {
|
||||||
static const pageSize = 20;
|
static const pageSize = 20;
|
||||||
|
|
||||||
@@ -599,7 +598,7 @@ class ChatMemberListNotifier extends AsyncNotifier<List<SnChatMember>>
|
|||||||
Future<List<SnChatMember>> fetch() async {
|
Future<List<SnChatMember>> fetch() async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/chat/$arg/members',
|
'/messager/chat/$arg/members',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'offset': fetchedCount.toString(),
|
'offset': fetchedCount.toString(),
|
||||||
'take': pageSize,
|
'take': pageSize,
|
||||||
@@ -623,7 +622,8 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final memberNotifier = ref.read(chatMemberListProvider(roomId).notifier);
|
final memberState = ref.watch(chatMemberListProvider(roomId));
|
||||||
|
final memberNotifier = ref.watch(chatMemberListProvider(roomId).notifier);
|
||||||
|
|
||||||
final roomIdentity = ref.watch(chatRoomIdentityProvider(roomId));
|
final roomIdentity = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
final chatRoom = ref.watch(chatRoomProvider(roomId));
|
final chatRoom = ref.watch(chatRoomProvider(roomId));
|
||||||
@@ -643,7 +643,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
await apiClient.post(
|
await apiClient.post(
|
||||||
'/sphere/chat/invites/$roomId',
|
'/messager/chat/invites/$roomId',
|
||||||
data: {'related_user_id': result.id, 'role': 0},
|
data: {'related_user_id': result.id, 'role': 0},
|
||||||
);
|
);
|
||||||
memberNotifier.refresh();
|
memberNotifier.refresh();
|
||||||
@@ -663,7 +663,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'members'.plural(memberNotifier.totalCount ?? 0),
|
'members'.plural(memberState.value?.totalCount ?? 0),
|
||||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
letterSpacing: -0.5,
|
letterSpacing: -0.5,
|
||||||
@@ -700,7 +700,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
leading: AccountPfcGestureDetector(
|
leading: AccountPfcGestureDetector(
|
||||||
uname: member.account.name,
|
uname: member.account.name,
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
fileId: member.account.profile.picture?.id,
|
file: member.account.profile.picture,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
@@ -733,7 +733,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
await apiClient.delete(
|
await apiClient.delete(
|
||||||
'/sphere/chat/$roomId/members/${member.accountId}',
|
'/messager/chat/$roomId/members/${member.accountId}',
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
// Refresh both providers
|
||||||
memberNotifier.refresh();
|
memberNotifier.refresh();
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ part of 'room_detail.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(totalMessagesCount)
|
@ProviderFor(totalMessagesCount)
|
||||||
const totalMessagesCountProvider = TotalMessagesCountFamily._();
|
final totalMessagesCountProvider = TotalMessagesCountFamily._();
|
||||||
|
|
||||||
final class TotalMessagesCountProvider
|
final class TotalMessagesCountProvider
|
||||||
extends $FunctionalProvider<AsyncValue<int>, int, FutureOr<int>>
|
extends $FunctionalProvider<AsyncValue<int>, int, FutureOr<int>>
|
||||||
with $FutureModifier<int>, $FutureProvider<int> {
|
with $FutureModifier<int>, $FutureProvider<int> {
|
||||||
const TotalMessagesCountProvider._({
|
TotalMessagesCountProvider._({
|
||||||
required TotalMessagesCountFamily super.from,
|
required TotalMessagesCountFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -63,7 +63,7 @@ String _$totalMessagesCountHash() =>
|
|||||||
|
|
||||||
final class TotalMessagesCountFamily extends $Family
|
final class TotalMessagesCountFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<int>, String> {
|
with $FunctionalFamilyOverride<FutureOr<int>, String> {
|
||||||
const TotalMessagesCountFamily._()
|
TotalMessagesCountFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'totalMessagesCountProvider',
|
name: r'totalMessagesCountProvider',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/activitypub.dart';
|
||||||
import 'package:island/models/post.dart';
|
import 'package:island/models/post.dart';
|
||||||
import 'package:island/models/publisher.dart';
|
import 'package:island/models/publisher.dart';
|
||||||
import 'package:island/models/heatmap.dart';
|
import 'package:island/models/heatmap.dart';
|
||||||
@@ -15,6 +16,7 @@ import 'package:island/screens/creators/publishers_form.dart';
|
|||||||
import 'package:island/services/responsive.dart';
|
import 'package:island/services/responsive.dart';
|
||||||
import 'package:island/utils/text.dart';
|
import 'package:island/utils/text.dart';
|
||||||
import 'package:island/widgets/account/account_picker.dart';
|
import 'package:island/widgets/account/account_picker.dart';
|
||||||
|
import 'package:island/widgets/activitypub/actor_profile.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:island/widgets/content/cloud_files.dart';
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
@@ -78,16 +80,43 @@ Future<List<SnPublisherMember>> publisherInvites(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
Future<SnActorStatusResponse> publisherActorStatus(
|
||||||
|
Ref ref,
|
||||||
|
String? publisherName,
|
||||||
|
) async {
|
||||||
|
if (publisherName == null) throw Exception('Publisher name is required');
|
||||||
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
|
final response = await apiClient.get(
|
||||||
|
'/sphere/publishers/$publisherName/fediverse',
|
||||||
|
);
|
||||||
|
return SnActorStatusResponse.fromJson(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
|
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
|
||||||
.autoDispose(PublisherMemberListNotifier.new);
|
.autoDispose(PublisherMemberListNotifier.new);
|
||||||
|
|
||||||
class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
|
class PublisherMemberListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnPublisherMember>>
|
||||||
with AsyncPaginationController<SnPublisherMember> {
|
with AsyncPaginationController<SnPublisherMember> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
final String arg;
|
final String arg;
|
||||||
PublisherMemberListNotifier(this.arg);
|
PublisherMemberListNotifier(this.arg);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnPublisherMember>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPublisherMember>> fetch() async {
|
Future<List<SnPublisherMember>> fetch() async {
|
||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
@@ -126,7 +155,7 @@ class PublisherSelector extends StatelessWidget {
|
|||||||
if (isReadOnly || currentPublisher == null) {
|
if (isReadOnly || currentPublisher == null) {
|
||||||
return ProfilePictureWidget(
|
return ProfilePictureWidget(
|
||||||
radius: 16,
|
radius: 16,
|
||||||
fileId: currentPublisher?.picture?.id,
|
file: currentPublisher?.picture,
|
||||||
).center().padding(right: 8);
|
).center().padding(right: 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +179,7 @@ class PublisherSelector extends StatelessWidget {
|
|||||||
.map(
|
.map(
|
||||||
(e) => ProfilePictureWidget(
|
(e) => ProfilePictureWidget(
|
||||||
radius: 16,
|
radius: 16,
|
||||||
fileId: e.value?.picture?.id,
|
file: e.value?.picture,
|
||||||
).center().padding(right: 8),
|
).center().padding(right: 8),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
@@ -326,10 +355,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
value: item,
|
value: item,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
minTileHeight: 48,
|
minTileHeight: 48,
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(radius: 16, file: item.picture),
|
||||||
radius: 16,
|
|
||||||
fileId: item.picture?.id,
|
|
||||||
),
|
|
||||||
title: Text(item.nick),
|
title: Text(item.nick),
|
||||||
subtitle: Text('@${item.name}'),
|
subtitle: Text('@${item.name}'),
|
||||||
trailing: currentPublisher.value?.id == item.id
|
trailing: currentPublisher.value?.id == item.id
|
||||||
@@ -501,6 +527,24 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
leading: const Icon(Symbols.edit),
|
leading: const Icon(Symbols.edit),
|
||||||
onTap: updatePublisher,
|
onTap: updatePublisher,
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
),
|
||||||
|
minTileHeight: 48,
|
||||||
|
title: Text('publisherFediverse').tr(),
|
||||||
|
trailing: Icon(Symbols.chevron_right),
|
||||||
|
leading: const Icon(Symbols.public),
|
||||||
|
onTap: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
isScrollControlled: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) => _PublisherFediverseSheet(
|
||||||
|
publisherUname: currentPublisher.value!.name,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
@@ -842,7 +886,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
fileId: member.account!.profile.picture?.id,
|
file: member.account!.profile.picture,
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
@@ -1090,7 +1134,7 @@ class _PublisherInviteSheet extends HookConsumerWidget {
|
|||||||
final invite = items[index];
|
final invite = items[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
fileId: invite.publisher!.picture?.id,
|
file: invite.publisher!.picture,
|
||||||
fallbackIcon: Symbols.group,
|
fallbackIcon: Symbols.group,
|
||||||
),
|
),
|
||||||
title: Text(invite.publisher!.nick),
|
title: Text(invite.publisher!.nick),
|
||||||
@@ -1126,3 +1170,152 @@ class _PublisherInviteSheet extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _PublisherFediverseSheet extends HookConsumerWidget {
|
||||||
|
final String publisherUname;
|
||||||
|
|
||||||
|
const _PublisherFediverseSheet({required this.publisherUname});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final actorStatus = ref.watch(publisherActorStatusProvider(publisherUname));
|
||||||
|
final apiClient = ref.read(apiClientProvider);
|
||||||
|
final isLoading = useState(false);
|
||||||
|
|
||||||
|
Future<void> toggleActor() async {
|
||||||
|
final currentStatus = actorStatus.value;
|
||||||
|
if (currentStatus == null) return;
|
||||||
|
|
||||||
|
final confirm = await showConfirmAlert(
|
||||||
|
currentStatus.enabled
|
||||||
|
? 'publisherFediverseDisableConfirm'.tr()
|
||||||
|
: 'publisherFediverseEnableConfirm'.tr(),
|
||||||
|
currentStatus.enabled
|
||||||
|
? 'publisherFediverseDisabled'.tr()
|
||||||
|
: 'publisherFediverseEnabled'.tr(),
|
||||||
|
isDanger: !currentStatus.enabled,
|
||||||
|
);
|
||||||
|
if (confirm != true) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
isLoading.value = true;
|
||||||
|
if (currentStatus.enabled) {
|
||||||
|
await apiClient.delete(
|
||||||
|
'/sphere/publishers/$publisherUname/fediverse',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await apiClient.post('/sphere/publishers/$publisherUname/fediverse');
|
||||||
|
}
|
||||||
|
ref.invalidate(publisherActorStatusProvider(publisherUname));
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
showErrorAlert(err);
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SheetScaffold(
|
||||||
|
titleText: 'publisherFediverse'.tr(),
|
||||||
|
child: actorStatus.when(
|
||||||
|
data: (status) => SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
|
child: Column(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
Card.outlined(
|
||||||
|
child: SwitchListTile(
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
),
|
||||||
|
value: status.enabled,
|
||||||
|
onChanged: isLoading.value ? null : (_) => toggleActor(),
|
||||||
|
title: Text(
|
||||||
|
status.enabled
|
||||||
|
? 'publisherFediverseEnabled'.tr()
|
||||||
|
: 'publisherFediverseDisabled'.tr(),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
status.enabled
|
||||||
|
? 'publisherFediverseDisableHint'.tr()
|
||||||
|
: 'publisherFediverseEnableHint'.tr(),
|
||||||
|
),
|
||||||
|
secondary: isLoading.value
|
||||||
|
? const SizedBox(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
)
|
||||||
|
: Icon(
|
||||||
|
status.enabled
|
||||||
|
? Icons.check_circle
|
||||||
|
: Icons.circle_outlined,
|
||||||
|
color: status.enabled ? Colors.green : Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).padding(horizontal: 16),
|
||||||
|
if (status.enabled) ...[
|
||||||
|
if (status.actor != null) ...[
|
||||||
|
ListTile(
|
||||||
|
leading: ActorPictureWidget(
|
||||||
|
actor: status.actor!,
|
||||||
|
radius: 24,
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
status.actor!.displayName ??
|
||||||
|
status.actor!.username ??
|
||||||
|
'unknown'.tr(),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
'@${status.actor!.username}@${status.actor!.instance.domain}',
|
||||||
|
),
|
||||||
|
isThreeLine: true,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 28),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Symbols.link),
|
||||||
|
title: Text('publisherFediverseActorUri').tr(),
|
||||||
|
subtitle: Text(status.actorUri ?? 'N/A'),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Symbols.group),
|
||||||
|
title: Text('publisherFediverseFollowerCount').tr(),
|
||||||
|
subtitle: Text(
|
||||||
|
status.followerCount > 0
|
||||||
|
? status.followerCount.toString()
|
||||||
|
: 'publisherFediverseNoFollowers'.tr(),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ExpansionTile(
|
||||||
|
leading: const Icon(Symbols.info),
|
||||||
|
title: Text('publisherFediverseWhatIs').tr(),
|
||||||
|
tilePadding: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 16,
|
||||||
|
horizontal: 32,
|
||||||
|
),
|
||||||
|
child: Text('publisherFediverseAbout').tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
|
error: (error, _) => ResponseErrorWidget(
|
||||||
|
error: error,
|
||||||
|
onRetry: () =>
|
||||||
|
ref.invalidate(publisherActorStatusProvider(publisherUname)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'hub.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(publisherStats)
|
@ProviderFor(publisherStats)
|
||||||
const publisherStatsProvider = PublisherStatsFamily._();
|
final publisherStatsProvider = PublisherStatsFamily._();
|
||||||
|
|
||||||
final class PublisherStatsProvider
|
final class PublisherStatsProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class PublisherStatsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<SnPublisherStats?>,
|
$FutureModifier<SnPublisherStats?>,
|
||||||
$FutureProvider<SnPublisherStats?> {
|
$FutureProvider<SnPublisherStats?> {
|
||||||
const PublisherStatsProvider._({
|
PublisherStatsProvider._({
|
||||||
required PublisherStatsFamily super.from,
|
required PublisherStatsFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -70,7 +70,7 @@ String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
|
|||||||
|
|
||||||
final class PublisherStatsFamily extends $Family
|
final class PublisherStatsFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnPublisherStats?>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherStats?>, String?> {
|
||||||
const PublisherStatsFamily._()
|
PublisherStatsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publisherStatsProvider',
|
name: r'publisherStatsProvider',
|
||||||
@@ -87,7 +87,7 @@ final class PublisherStatsFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(publisherHeatmap)
|
@ProviderFor(publisherHeatmap)
|
||||||
const publisherHeatmapProvider = PublisherHeatmapFamily._();
|
final publisherHeatmapProvider = PublisherHeatmapFamily._();
|
||||||
|
|
||||||
final class PublisherHeatmapProvider
|
final class PublisherHeatmapProvider
|
||||||
extends
|
extends
|
||||||
@@ -97,7 +97,7 @@ final class PublisherHeatmapProvider
|
|||||||
FutureOr<SnHeatmap?>
|
FutureOr<SnHeatmap?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
|
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
|
||||||
const PublisherHeatmapProvider._({
|
PublisherHeatmapProvider._({
|
||||||
required PublisherHeatmapFamily super.from,
|
required PublisherHeatmapFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -144,7 +144,7 @@ String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
|
|||||||
|
|
||||||
final class PublisherHeatmapFamily extends $Family
|
final class PublisherHeatmapFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String?> {
|
||||||
const PublisherHeatmapFamily._()
|
PublisherHeatmapFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publisherHeatmapProvider',
|
name: r'publisherHeatmapProvider',
|
||||||
@@ -161,7 +161,7 @@ final class PublisherHeatmapFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(publisherIdentity)
|
@ProviderFor(publisherIdentity)
|
||||||
const publisherIdentityProvider = PublisherIdentityFamily._();
|
final publisherIdentityProvider = PublisherIdentityFamily._();
|
||||||
|
|
||||||
final class PublisherIdentityProvider
|
final class PublisherIdentityProvider
|
||||||
extends
|
extends
|
||||||
@@ -173,7 +173,7 @@ final class PublisherIdentityProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<SnPublisherMember?>,
|
$FutureModifier<SnPublisherMember?>,
|
||||||
$FutureProvider<SnPublisherMember?> {
|
$FutureProvider<SnPublisherMember?> {
|
||||||
const PublisherIdentityProvider._({
|
PublisherIdentityProvider._({
|
||||||
required PublisherIdentityFamily super.from,
|
required PublisherIdentityFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -221,7 +221,7 @@ String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
|
|||||||
|
|
||||||
final class PublisherIdentityFamily extends $Family
|
final class PublisherIdentityFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnPublisherMember?>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherMember?>, String> {
|
||||||
const PublisherIdentityFamily._()
|
PublisherIdentityFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publisherIdentityProvider',
|
name: r'publisherIdentityProvider',
|
||||||
@@ -238,7 +238,7 @@ final class PublisherIdentityFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(publisherFeatures)
|
@ProviderFor(publisherFeatures)
|
||||||
const publisherFeaturesProvider = PublisherFeaturesFamily._();
|
final publisherFeaturesProvider = PublisherFeaturesFamily._();
|
||||||
|
|
||||||
final class PublisherFeaturesProvider
|
final class PublisherFeaturesProvider
|
||||||
extends
|
extends
|
||||||
@@ -250,7 +250,7 @@ final class PublisherFeaturesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<Map<String, bool>>,
|
$FutureModifier<Map<String, bool>>,
|
||||||
$FutureProvider<Map<String, bool>> {
|
$FutureProvider<Map<String, bool>> {
|
||||||
const PublisherFeaturesProvider._({
|
PublisherFeaturesProvider._({
|
||||||
required PublisherFeaturesFamily super.from,
|
required PublisherFeaturesFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -298,7 +298,7 @@ String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
|
|||||||
|
|
||||||
final class PublisherFeaturesFamily extends $Family
|
final class PublisherFeaturesFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<Map<String, bool>>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<Map<String, bool>>, String?> {
|
||||||
const PublisherFeaturesFamily._()
|
PublisherFeaturesFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publisherFeaturesProvider',
|
name: r'publisherFeaturesProvider',
|
||||||
@@ -315,7 +315,7 @@ final class PublisherFeaturesFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(publisherInvites)
|
@ProviderFor(publisherInvites)
|
||||||
const publisherInvitesProvider = PublisherInvitesProvider._();
|
final publisherInvitesProvider = PublisherInvitesProvider._();
|
||||||
|
|
||||||
final class PublisherInvitesProvider
|
final class PublisherInvitesProvider
|
||||||
extends
|
extends
|
||||||
@@ -327,7 +327,7 @@ final class PublisherInvitesProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnPublisherMember>>,
|
$FutureModifier<List<SnPublisherMember>>,
|
||||||
$FutureProvider<List<SnPublisherMember>> {
|
$FutureProvider<List<SnPublisherMember>> {
|
||||||
const PublisherInvitesProvider._()
|
PublisherInvitesProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -354,3 +354,81 @@ final class PublisherInvitesProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
||||||
|
|
||||||
|
@ProviderFor(publisherActorStatus)
|
||||||
|
final publisherActorStatusProvider = PublisherActorStatusFamily._();
|
||||||
|
|
||||||
|
final class PublisherActorStatusProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnActorStatusResponse>,
|
||||||
|
SnActorStatusResponse,
|
||||||
|
FutureOr<SnActorStatusResponse>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<SnActorStatusResponse>,
|
||||||
|
$FutureProvider<SnActorStatusResponse> {
|
||||||
|
PublisherActorStatusProvider._({
|
||||||
|
required PublisherActorStatusFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherActorStatusProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$publisherActorStatusHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'publisherActorStatusProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnActorStatusResponse> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnActorStatusResponse> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherActorStatus(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is PublisherActorStatusProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$publisherActorStatusHash() =>
|
||||||
|
r'406117cb99b2aef236945ef0ef59e857d8835029';
|
||||||
|
|
||||||
|
final class PublisherActorStatusFamily extends $Family
|
||||||
|
with $FunctionalFamilyOverride<FutureOr<SnActorStatusResponse>, String?> {
|
||||||
|
PublisherActorStatusFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherActorStatusProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PublisherActorStatusProvider call(String? publisherName) =>
|
||||||
|
PublisherActorStatusProvider._(argument: publisherName, from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'publisherActorStatusProvider';
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
|||||||
PollListNotifier.new,
|
PollListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
|
class PollListNotifier extends AsyncNotifier<PaginationState<SnPollWithStats>>
|
||||||
with AsyncPaginationController<SnPollWithStats> {
|
with AsyncPaginationController<SnPollWithStats> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'poll_list.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(pollWithStats)
|
@ProviderFor(pollWithStats)
|
||||||
const pollWithStatsProvider = PollWithStatsFamily._();
|
final pollWithStatsProvider = PollWithStatsFamily._();
|
||||||
|
|
||||||
final class PollWithStatsProvider
|
final class PollWithStatsProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class PollWithStatsProvider
|
|||||||
FutureOr<SnPollWithStats>
|
FutureOr<SnPollWithStats>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnPollWithStats>, $FutureProvider<SnPollWithStats> {
|
with $FutureModifier<SnPollWithStats>, $FutureProvider<SnPollWithStats> {
|
||||||
const PollWithStatsProvider._({
|
PollWithStatsProvider._({
|
||||||
required PollWithStatsFamily super.from,
|
required PollWithStatsFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
|
|||||||
|
|
||||||
final class PollWithStatsFamily extends $Family
|
final class PollWithStatsFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnPollWithStats>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnPollWithStats>, String> {
|
||||||
const PollWithStatsFamily._()
|
PollWithStatsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'pollWithStatsProvider',
|
name: r'pollWithStatsProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'publishers_form.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(publishersManaged)
|
@ProviderFor(publishersManaged)
|
||||||
const publishersManagedProvider = PublishersManagedProvider._();
|
final publishersManagedProvider = PublishersManagedProvider._();
|
||||||
|
|
||||||
final class PublishersManagedProvider
|
final class PublishersManagedProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class PublishersManagedProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnPublisher>>,
|
$FutureModifier<List<SnPublisher>>,
|
||||||
$FutureProvider<List<SnPublisher>> {
|
$FutureProvider<List<SnPublisher>> {
|
||||||
const PublishersManagedProvider._()
|
PublishersManagedProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -51,7 +51,7 @@ final class PublishersManagedProvider
|
|||||||
String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3';
|
String _$publishersManagedHash() => r'ea83759fed9bd5119738b4d09f12b4476959e0a3';
|
||||||
|
|
||||||
@ProviderFor(publisherNullable)
|
@ProviderFor(publisherNullable)
|
||||||
const publisherNullableProvider = PublisherNullableFamily._();
|
final publisherNullableProvider = PublisherNullableFamily._();
|
||||||
|
|
||||||
final class PublisherNullableProvider
|
final class PublisherNullableProvider
|
||||||
extends
|
extends
|
||||||
@@ -61,7 +61,7 @@ final class PublisherNullableProvider
|
|||||||
FutureOr<SnPublisher?>
|
FutureOr<SnPublisher?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnPublisher?>, $FutureProvider<SnPublisher?> {
|
with $FutureModifier<SnPublisher?>, $FutureProvider<SnPublisher?> {
|
||||||
const PublisherNullableProvider._({
|
PublisherNullableProvider._({
|
||||||
required PublisherNullableFamily super.from,
|
required PublisherNullableFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -109,7 +109,7 @@ String _$publisherNullableHash() => r'49b28083a2f351c5e5cde0b1a97f6c7503969041';
|
|||||||
|
|
||||||
final class PublisherNullableFamily extends $Family
|
final class PublisherNullableFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnPublisher?>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<SnPublisher?>, String?> {
|
||||||
const PublisherNullableFamily._()
|
PublisherNullableFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publisherNullableProvider',
|
name: r'publisherNullableProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'site_detail.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(publicationSiteDetail)
|
@ProviderFor(publicationSiteDetail)
|
||||||
const publicationSiteDetailProvider = PublicationSiteDetailFamily._();
|
final publicationSiteDetailProvider = PublicationSiteDetailFamily._();
|
||||||
|
|
||||||
final class PublicationSiteDetailProvider
|
final class PublicationSiteDetailProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class PublicationSiteDetailProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<SnPublicationSite>,
|
$FutureModifier<SnPublicationSite>,
|
||||||
$FutureProvider<SnPublicationSite> {
|
$FutureProvider<SnPublicationSite> {
|
||||||
const PublicationSiteDetailProvider._({
|
PublicationSiteDetailProvider._({
|
||||||
required PublicationSiteDetailFamily super.from,
|
required PublicationSiteDetailFamily super.from,
|
||||||
required (String, String) super.argument,
|
required (String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -75,7 +75,7 @@ final class PublicationSiteDetailFamily extends $Family
|
|||||||
FutureOr<SnPublicationSite>,
|
FutureOr<SnPublicationSite>,
|
||||||
(String, String)
|
(String, String)
|
||||||
> {
|
> {
|
||||||
const PublicationSiteDetailFamily._()
|
PublicationSiteDetailFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'publicationSiteDetailProvider',
|
name: r'publicationSiteDetailProvider',
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
|||||||
SiteListNotifier.new,
|
SiteListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class SiteListNotifier extends AsyncNotifier<List<SnPublicationSite>>
|
class SiteListNotifier extends AsyncNotifier<PaginationState<SnPublicationSite>>
|
||||||
with AsyncPaginationController<SnPublicationSite> {
|
with AsyncPaginationController<SnPublicationSite> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -69,157 +69,141 @@ class StickerPackDetailContent extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return pack.when(
|
return pack.when(
|
||||||
data:
|
data: (pack) => Column(
|
||||||
(pack) => Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Text(pack!.description),
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
Row(
|
||||||
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
Text(pack!.description),
|
const Icon(Symbols.folder, size: 16),
|
||||||
Row(
|
Text(
|
||||||
spacing: 4,
|
'${packContent.value?.length ?? 0}/24',
|
||||||
children: [
|
style: GoogleFonts.robotoMono(),
|
||||||
const Icon(Symbols.folder, size: 16),
|
),
|
||||||
Text(
|
|
||||||
'${packContent.value?.length ?? 0}/24',
|
|
||||||
style: GoogleFonts.robotoMono(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).opacity(0.85),
|
|
||||||
Row(
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.sell, size: 16),
|
|
||||||
Text(pack.prefix, style: GoogleFonts.robotoMono()),
|
|
||||||
],
|
|
||||||
).opacity(0.85),
|
|
||||||
Row(
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.tag, size: 16),
|
|
||||||
Flexible(
|
|
||||||
child: SelectableText(
|
|
||||||
pack.id,
|
|
||||||
maxLines: 1,
|
|
||||||
style: GoogleFonts.robotoMono(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).opacity(0.85),
|
|
||||||
],
|
],
|
||||||
).padding(horizontal: 24, vertical: 24),
|
).opacity(0.85),
|
||||||
const Divider(height: 1),
|
Row(
|
||||||
Expanded(
|
spacing: 4,
|
||||||
child: packContent.when(
|
children: [
|
||||||
data:
|
const Icon(Symbols.sell, size: 16),
|
||||||
(stickers) => RefreshIndicator(
|
Text(pack.prefix, style: GoogleFonts.robotoMono()),
|
||||||
onRefresh:
|
],
|
||||||
() => ref.refresh(
|
).opacity(0.85),
|
||||||
stickerPackContentProvider(id).future,
|
Row(
|
||||||
),
|
spacing: 4,
|
||||||
child: GridView.builder(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
const Icon(Symbols.tag, size: 16),
|
||||||
horizontal: 24,
|
Flexible(
|
||||||
vertical: 20,
|
child: SelectableText(
|
||||||
),
|
pack.id,
|
||||||
gridDelegate:
|
maxLines: 1,
|
||||||
const SliverGridDelegateWithMaxCrossAxisExtent(
|
style: GoogleFonts.robotoMono(),
|
||||||
maxCrossAxisExtent: 80,
|
),
|
||||||
mainAxisSpacing: 8,
|
),
|
||||||
crossAxisSpacing: 8,
|
],
|
||||||
),
|
).opacity(0.85),
|
||||||
itemCount: stickers.length,
|
],
|
||||||
itemBuilder: (context, index) {
|
).padding(horizontal: 24, vertical: 24),
|
||||||
final sticker = stickers[index];
|
const Divider(height: 1),
|
||||||
return ContextMenuWidget(
|
Expanded(
|
||||||
menuProvider: (_) {
|
child: packContent.when(
|
||||||
return Menu(
|
data: (stickers) => RefreshIndicator(
|
||||||
children: [
|
onRefresh: () =>
|
||||||
MenuAction(
|
ref.refresh(stickerPackContentProvider(id).future),
|
||||||
title: 'stickerCopyPlaceholder'.tr(),
|
child: GridView.builder(
|
||||||
image: MenuImage.icon(Symbols.copy_all),
|
padding: const EdgeInsets.symmetric(
|
||||||
callback: () {
|
horizontal: 24,
|
||||||
Clipboard.setData(
|
vertical: 20,
|
||||||
ClipboardData(
|
),
|
||||||
text:
|
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
':${pack.prefix}+${sticker.slug}:',
|
maxCrossAxisExtent: 80,
|
||||||
),
|
mainAxisSpacing: 8,
|
||||||
);
|
crossAxisSpacing: 8,
|
||||||
},
|
),
|
||||||
),
|
itemCount: stickers.length,
|
||||||
MenuSeparator(),
|
itemBuilder: (context, index) {
|
||||||
MenuAction(
|
final sticker = stickers[index];
|
||||||
title: 'edit'.tr(),
|
return ContextMenuWidget(
|
||||||
image: MenuImage.icon(Symbols.edit),
|
menuProvider: (_) {
|
||||||
callback: () {
|
return Menu(
|
||||||
showModalBottomSheet(
|
children: [
|
||||||
context: context,
|
MenuAction(
|
||||||
isScrollControlled: true,
|
title: 'stickerCopyPlaceholder'.tr(),
|
||||||
builder:
|
image: MenuImage.icon(Symbols.copy_all),
|
||||||
(context) => SheetScaffold(
|
callback: () {
|
||||||
titleText: 'editSticker'.tr(),
|
Clipboard.setData(
|
||||||
child: StickerForm(
|
ClipboardData(
|
||||||
packId: id,
|
text: ':${pack.prefix}+${sticker.slug}:',
|
||||||
id: sticker.id,
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
).then((value) {
|
|
||||||
if (value != null) {
|
|
||||||
ref.invalidate(
|
|
||||||
stickerPackContentProvider(id),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
MenuAction(
|
|
||||||
title: 'delete'.tr(),
|
|
||||||
image: MenuImage.icon(Symbols.delete),
|
|
||||||
callback: () {
|
|
||||||
deleteSticker(sticker);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: ClipRRect(
|
),
|
||||||
borderRadius: BorderRadius.all(
|
MenuSeparator(),
|
||||||
Radius.circular(8),
|
MenuAction(
|
||||||
),
|
title: 'edit'.tr(),
|
||||||
child: Container(
|
image: MenuImage.icon(Symbols.edit),
|
||||||
decoration: BoxDecoration(
|
callback: () {
|
||||||
color:
|
showModalBottomSheet(
|
||||||
Theme.of(
|
context: context,
|
||||||
context,
|
isScrollControlled: true,
|
||||||
).colorScheme.surfaceContainer,
|
builder: (context) => SheetScaffold(
|
||||||
borderRadius: BorderRadius.all(
|
titleText: 'editSticker'.tr(),
|
||||||
Radius.circular(8),
|
child: StickerForm(
|
||||||
|
packId: id,
|
||||||
|
id: sticker.id,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: CloudImageWidget(
|
).then((value) {
|
||||||
fileId: sticker.image.id,
|
if (value != null) {
|
||||||
fit: BoxFit.contain,
|
ref.invalidate(
|
||||||
),
|
stickerPackContentProvider(id),
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
);
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
MenuAction(
|
||||||
|
title: 'delete'.tr(),
|
||||||
|
image: MenuImage.icon(Symbols.delete),
|
||||||
|
callback: () {
|
||||||
|
deleteSticker(sticker);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.surfaceContainer,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
|
),
|
||||||
|
child: CloudImageWidget(
|
||||||
|
file: sticker.image,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
error:
|
);
|
||||||
(err, _) =>
|
},
|
||||||
Text(
|
|
||||||
'Error: $err',
|
|
||||||
).textAlignment(TextAlign.center).center(),
|
|
||||||
loading: () => const CircularProgressIndicator().center(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
error: (err, _) =>
|
||||||
|
Text('Error: $err').textAlignment(TextAlign.center).center(),
|
||||||
|
loading: () => const CircularProgressIndicator().center(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
error:
|
],
|
||||||
(err, _) =>
|
),
|
||||||
Text('Error: $err').textAlignment(TextAlign.center).center(),
|
error: (err, _) =>
|
||||||
|
Text('Error: $err').textAlignment(TextAlign.center).center(),
|
||||||
loading: () => const CircularProgressIndicator().center(),
|
loading: () => const CircularProgressIndicator().center(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -241,65 +225,60 @@ class StickerPackActionMenu extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return PopupMenuButton(
|
return PopupMenuButton(
|
||||||
icon: Icon(Icons.more_vert, shadows: [iconShadow]),
|
icon: Icon(Icons.more_vert, shadows: [iconShadow]),
|
||||||
itemBuilder:
|
itemBuilder: (context) => [
|
||||||
(context) => [
|
PopupMenuItem(
|
||||||
PopupMenuItem(
|
onTap: () {
|
||||||
onTap: () {
|
showModalBottomSheet(
|
||||||
showModalBottomSheet(
|
context: context,
|
||||||
context: context,
|
isScrollControlled: true,
|
||||||
isScrollControlled: true,
|
builder: (context) => SheetScaffold(
|
||||||
builder:
|
titleText: 'editStickerPack'.tr(),
|
||||||
(context) => SheetScaffold(
|
child: StickerPackForm(pubName: pubName, packId: packId),
|
||||||
titleText: 'editStickerPack'.tr(),
|
|
||||||
child: StickerPackForm(
|
|
||||||
pubName: pubName,
|
|
||||||
packId: packId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
).then((value) {
|
|
||||||
if (value != null) {
|
|
||||||
ref.invalidate(stickerPackProvider(packId));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.edit,
|
|
||||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
|
||||||
),
|
|
||||||
const Gap(12),
|
|
||||||
const Text('editStickerPack').tr(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
).then((value) {
|
||||||
PopupMenuItem(
|
if (value != null) {
|
||||||
child: Row(
|
ref.invalidate(stickerPackProvider(packId));
|
||||||
children: [
|
}
|
||||||
const Icon(Icons.delete, color: Colors.red),
|
});
|
||||||
const Gap(12),
|
},
|
||||||
const Text(
|
child: Row(
|
||||||
'deleteStickerPack',
|
children: [
|
||||||
style: TextStyle(color: Colors.red),
|
Icon(
|
||||||
).tr(),
|
Icons.edit,
|
||||||
],
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
onTap: () {
|
const Gap(12),
|
||||||
showConfirmAlert(
|
const Text('editStickerPack').tr(),
|
||||||
'deleteStickerPackHint'.tr(),
|
],
|
||||||
'deleteStickerPack'.tr(),
|
),
|
||||||
isDanger: true,
|
),
|
||||||
).then((confirm) {
|
PopupMenuItem(
|
||||||
if (confirm) {
|
child: Row(
|
||||||
final client = ref.watch(apiClientProvider);
|
children: [
|
||||||
client.delete('/sphere/stickers/$packId');
|
const Icon(Icons.delete, color: Colors.red),
|
||||||
ref.invalidate(stickerPacksProvider);
|
const Gap(12),
|
||||||
if (context.mounted) context.pop(true);
|
const Text(
|
||||||
}
|
'deleteStickerPack',
|
||||||
});
|
style: TextStyle(color: Colors.red),
|
||||||
},
|
).tr(),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
|
onTap: () {
|
||||||
|
showConfirmAlert(
|
||||||
|
'deleteStickerPackHint'.tr(),
|
||||||
|
'deleteStickerPack'.tr(),
|
||||||
|
isDanger: true,
|
||||||
|
).then((confirm) {
|
||||||
|
if (confirm) {
|
||||||
|
final client = ref.watch(apiClientProvider);
|
||||||
|
client.delete('/sphere/stickers/$packId');
|
||||||
|
ref.invalidate(stickerPacksProvider);
|
||||||
|
if (context.mounted) context.pop(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,10 +351,9 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||||
),
|
),
|
||||||
child:
|
child: (image.value?.isEmpty ?? true)
|
||||||
(image.value?.isEmpty ?? true)
|
? const SizedBox.shrink()
|
||||||
? const SizedBox.shrink()
|
: CloudImageWidget(fileId: image.value!),
|
||||||
: CloudImageWidget(fileId: image.value!),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -383,10 +361,8 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder: (context) =>
|
||||||
(context) => CloudFilePicker(
|
CloudFilePicker(allowedTypes: {UniversalFileType.image}),
|
||||||
allowedTypes: {UniversalFileType.image},
|
|
||||||
),
|
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
image.value = value[0].id;
|
image.value = value[0].id;
|
||||||
@@ -412,8 +388,8 @@ class StickerForm extends HookConsumerWidget {
|
|||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTapOutside:
|
onTapOutside: (_) =>
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'pack_detail.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(stickerPackContent)
|
@ProviderFor(stickerPackContent)
|
||||||
const stickerPackContentProvider = StickerPackContentFamily._();
|
final stickerPackContentProvider = StickerPackContentFamily._();
|
||||||
|
|
||||||
final class StickerPackContentProvider
|
final class StickerPackContentProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class StickerPackContentProvider
|
|||||||
FutureOr<List<SnSticker>>
|
FutureOr<List<SnSticker>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<SnSticker>>, $FutureProvider<List<SnSticker>> {
|
with $FutureModifier<List<SnSticker>>, $FutureProvider<List<SnSticker>> {
|
||||||
const StickerPackContentProvider._({
|
StickerPackContentProvider._({
|
||||||
required StickerPackContentFamily super.from,
|
required StickerPackContentFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -69,7 +69,7 @@ String _$stickerPackContentHash() =>
|
|||||||
|
|
||||||
final class StickerPackContentFamily extends $Family
|
final class StickerPackContentFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<SnSticker>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<SnSticker>>, String> {
|
||||||
const StickerPackContentFamily._()
|
StickerPackContentFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'stickerPackContentProvider',
|
name: r'stickerPackContentProvider',
|
||||||
@@ -86,7 +86,7 @@ final class StickerPackContentFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(stickerPackSticker)
|
@ProviderFor(stickerPackSticker)
|
||||||
const stickerPackStickerProvider = StickerPackStickerFamily._();
|
final stickerPackStickerProvider = StickerPackStickerFamily._();
|
||||||
|
|
||||||
final class StickerPackStickerProvider
|
final class StickerPackStickerProvider
|
||||||
extends
|
extends
|
||||||
@@ -96,7 +96,7 @@ final class StickerPackStickerProvider
|
|||||||
FutureOr<SnSticker?>
|
FutureOr<SnSticker?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnSticker?>, $FutureProvider<SnSticker?> {
|
with $FutureModifier<SnSticker?>, $FutureProvider<SnSticker?> {
|
||||||
const StickerPackStickerProvider._({
|
StickerPackStickerProvider._({
|
||||||
required StickerPackStickerFamily super.from,
|
required StickerPackStickerFamily super.from,
|
||||||
required StickerWithPackQuery? super.argument,
|
required StickerWithPackQuery? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -145,7 +145,7 @@ String _$stickerPackStickerHash() =>
|
|||||||
final class StickerPackStickerFamily extends $Family
|
final class StickerPackStickerFamily extends $Family
|
||||||
with
|
with
|
||||||
$FunctionalFamilyOverride<FutureOr<SnSticker?>, StickerWithPackQuery?> {
|
$FunctionalFamilyOverride<FutureOr<SnSticker?>, StickerWithPackQuery?> {
|
||||||
const StickerPackStickerFamily._()
|
StickerPackStickerFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'stickerPackStickerProvider',
|
name: r'stickerPackStickerProvider',
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ final stickerPacksProvider = AsyncNotifierProvider.family.autoDispose(
|
|||||||
StickerPacksNotifier.new,
|
StickerPacksNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class StickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
class StickerPacksNotifier extends AsyncNotifier<PaginationState<SnStickerPack>>
|
||||||
with AsyncPaginationController<SnStickerPack> {
|
with AsyncPaginationController<SnStickerPack> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'stickers.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(stickerPack)
|
@ProviderFor(stickerPack)
|
||||||
const stickerPackProvider = StickerPackFamily._();
|
final stickerPackProvider = StickerPackFamily._();
|
||||||
|
|
||||||
final class StickerPackProvider
|
final class StickerPackProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class StickerPackProvider
|
|||||||
FutureOr<SnStickerPack?>
|
FutureOr<SnStickerPack?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnStickerPack?>, $FutureProvider<SnStickerPack?> {
|
with $FutureModifier<SnStickerPack?>, $FutureProvider<SnStickerPack?> {
|
||||||
const StickerPackProvider._({
|
StickerPackProvider._({
|
||||||
required StickerPackFamily super.from,
|
required StickerPackFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$stickerPackHash() => r'71ef84471237c8191918095094bdfc87d3920e77';
|
|||||||
|
|
||||||
final class StickerPackFamily extends $Family
|
final class StickerPackFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnStickerPack?>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<SnStickerPack?>, String?> {
|
||||||
const StickerPackFamily._()
|
StickerPackFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'stickerPackProvider',
|
name: r'stickerPackProvider',
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import 'package:island/widgets/app_scaffold.dart';
|
|||||||
import 'package:island/widgets/notification_tile.dart';
|
import 'package:island/widgets/notification_tile.dart';
|
||||||
import 'package:island/widgets/post/post_featured.dart';
|
import 'package:island/widgets/post/post_featured.dart';
|
||||||
import 'package:island/widgets/check_in.dart';
|
import 'package:island/widgets/check_in.dart';
|
||||||
|
import 'package:island/screens/auth/login_modal.dart';
|
||||||
import 'package:island/models/activity.dart';
|
import 'package:island/models/activity.dart';
|
||||||
import 'package:island/screens/notification.dart';
|
import 'package:island/screens/notification.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
@@ -116,7 +117,11 @@ class DashboardGrid extends HookConsumerWidget {
|
|||||||
topRight: isWide ? 0 : 12,
|
topRight: isWide ? 0 : 12,
|
||||||
)
|
)
|
||||||
.padding(horizontal: isWide ? 0 : 16),
|
.padding(horizontal: isWide ? 0 : 16),
|
||||||
),
|
)
|
||||||
|
else
|
||||||
|
Center(
|
||||||
|
child: _UnauthorizedCard(isWide: isWide),
|
||||||
|
).padding(horizontal: isWide ? 24 : 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -303,7 +308,9 @@ class ClockCard extends HookConsumerWidget {
|
|||||||
spacing: 5,
|
spacing: 5,
|
||||||
children: [
|
children: [
|
||||||
notableDay.when(
|
notableDay.when(
|
||||||
data: (day) => _buildNotableDayText(context, day!),
|
data: (day) => day == null
|
||||||
|
? Text('unauthorized').tr()
|
||||||
|
: _buildNotableDayText(context, day),
|
||||||
error: (err, _) =>
|
error: (err, _) =>
|
||||||
Text(err.toString()).fontSize(12),
|
Text(err.toString()).fontSize(12),
|
||||||
loading: () =>
|
loading: () =>
|
||||||
@@ -412,11 +419,11 @@ class NotificationsCard extends HookConsumerWidget {
|
|||||||
loading: () => const SkeletonNotificationTile(),
|
loading: () => const SkeletonNotificationTile(),
|
||||||
error: (error, stack) => Center(child: Text('Error: $error')),
|
error: (error, stack) => Center(child: Text('Error: $error')),
|
||||||
data: (notificationList) {
|
data: (notificationList) {
|
||||||
if (notificationList.isEmpty) {
|
if (notificationList.items.isEmpty) {
|
||||||
return Center(child: Text('noNotificationsYet').tr());
|
return Center(child: Text('noNotificationsYet').tr());
|
||||||
}
|
}
|
||||||
// Get the most recent notification (first in the list)
|
// Get the most recent notification (first in the list)
|
||||||
final recentNotification = notificationList.first;
|
final recentNotification = notificationList.items.first;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -555,3 +562,64 @@ class FortuneCard extends HookConsumerWidget {
|
|||||||
).height(48);
|
).height(48);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _UnauthorizedCard extends HookConsumerWidget {
|
||||||
|
final bool isWide;
|
||||||
|
const _UnauthorizedCard({required this.isWide});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
return Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: isWide ? 48 : 32,
|
||||||
|
vertical: 32,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Gap(16),
|
||||||
|
Icon(
|
||||||
|
Symbols.dashboard_rounded,
|
||||||
|
size: 64,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
fill: 1,
|
||||||
|
),
|
||||||
|
const Gap(16),
|
||||||
|
Text(
|
||||||
|
'Welcome to\nthe Solar Network',
|
||||||
|
style: Theme.of(
|
||||||
|
context,
|
||||||
|
).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const Gap(8),
|
||||||
|
Text(
|
||||||
|
'Login to access your personalized dashboard with friends, notifications, chats, and more!',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const Gap(12),
|
||||||
|
FilledButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) => const LoginModal(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Symbols.login),
|
||||||
|
label: Text('login').tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class _AppOverview extends StatelessWidget {
|
|||||||
left: 20,
|
left: 20,
|
||||||
bottom: -32,
|
bottom: -32,
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
fileId: app.picture?.id,
|
file: app.picture,
|
||||||
radius: 40,
|
radius: 40,
|
||||||
fallbackIcon: Symbols.apps,
|
fallbackIcon: Symbols.apps,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'app_secrets.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(customAppSecrets)
|
@ProviderFor(customAppSecrets)
|
||||||
const customAppSecretsProvider = CustomAppSecretsFamily._();
|
final customAppSecretsProvider = CustomAppSecretsFamily._();
|
||||||
|
|
||||||
final class CustomAppSecretsProvider
|
final class CustomAppSecretsProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class CustomAppSecretsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<CustomAppSecret>>,
|
$FutureModifier<List<CustomAppSecret>>,
|
||||||
$FutureProvider<List<CustomAppSecret>> {
|
$FutureProvider<List<CustomAppSecret>> {
|
||||||
const CustomAppSecretsProvider._({
|
CustomAppSecretsProvider._({
|
||||||
required CustomAppSecretsFamily super.from,
|
required CustomAppSecretsFamily super.from,
|
||||||
required (String, String, String) super.argument,
|
required (String, String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -74,7 +74,7 @@ final class CustomAppSecretsFamily extends $Family
|
|||||||
FutureOr<List<CustomAppSecret>>,
|
FutureOr<List<CustomAppSecret>>,
|
||||||
(String, String, String)
|
(String, String, String)
|
||||||
> {
|
> {
|
||||||
const CustomAppSecretsFamily._()
|
CustomAppSecretsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'customAppSecretsProvider',
|
name: r'customAppSecretsProvider',
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class CustomAppsScreen extends HookConsumerWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text(app.name),
|
title: Text(app.name),
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
fileId: app.picture?.id,
|
file: app.picture,
|
||||||
fallbackIcon: Symbols.apps,
|
fallbackIcon: Symbols.apps,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'apps.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(customApp)
|
@ProviderFor(customApp)
|
||||||
const customAppProvider = CustomAppFamily._();
|
final customAppProvider = CustomAppFamily._();
|
||||||
|
|
||||||
final class CustomAppProvider
|
final class CustomAppProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class CustomAppProvider
|
|||||||
FutureOr<CustomApp>
|
FutureOr<CustomApp>
|
||||||
>
|
>
|
||||||
with $FutureModifier<CustomApp>, $FutureProvider<CustomApp> {
|
with $FutureModifier<CustomApp>, $FutureProvider<CustomApp> {
|
||||||
const CustomAppProvider._({
|
CustomAppProvider._({
|
||||||
required CustomAppFamily super.from,
|
required CustomAppFamily super.from,
|
||||||
required (String, String, String) super.argument,
|
required (String, String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -71,7 +71,7 @@ final class CustomAppFamily extends $Family
|
|||||||
FutureOr<CustomApp>,
|
FutureOr<CustomApp>,
|
||||||
(String, String, String)
|
(String, String, String)
|
||||||
> {
|
> {
|
||||||
const CustomAppFamily._()
|
CustomAppFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'customAppProvider',
|
name: r'customAppProvider',
|
||||||
@@ -94,7 +94,7 @@ final class CustomAppFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(customApps)
|
@ProviderFor(customApps)
|
||||||
const customAppsProvider = CustomAppsFamily._();
|
final customAppsProvider = CustomAppsFamily._();
|
||||||
|
|
||||||
final class CustomAppsProvider
|
final class CustomAppsProvider
|
||||||
extends
|
extends
|
||||||
@@ -104,7 +104,7 @@ final class CustomAppsProvider
|
|||||||
FutureOr<List<CustomApp>>
|
FutureOr<List<CustomApp>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<CustomApp>>, $FutureProvider<List<CustomApp>> {
|
with $FutureModifier<List<CustomApp>>, $FutureProvider<List<CustomApp>> {
|
||||||
const CustomAppsProvider._({
|
CustomAppsProvider._({
|
||||||
required CustomAppsFamily super.from,
|
required CustomAppsFamily super.from,
|
||||||
required (String, String) super.argument,
|
required (String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -153,7 +153,7 @@ String _$customAppsHash() => r'450bedaf4220b8963cb44afeb14d4c0e80f01b11';
|
|||||||
final class CustomAppsFamily extends $Family
|
final class CustomAppsFamily extends $Family
|
||||||
with
|
with
|
||||||
$FunctionalFamilyOverride<FutureOr<List<CustomApp>>, (String, String)> {
|
$FunctionalFamilyOverride<FutureOr<List<CustomApp>>, (String, String)> {
|
||||||
const CustomAppsFamily._()
|
CustomAppsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'customAppsProvider',
|
name: r'customAppsProvider',
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class _BotOverview extends StatelessWidget {
|
|||||||
left: 20,
|
left: 20,
|
||||||
bottom: -32,
|
bottom: -32,
|
||||||
child: ProfilePictureWidget(
|
child: ProfilePictureWidget(
|
||||||
fileId: bot.account.profile.picture?.id,
|
file: bot.account.profile.picture,
|
||||||
radius: 40,
|
radius: 40,
|
||||||
fallbackIcon: Symbols.smart_toy,
|
fallbackIcon: Symbols.smart_toy,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'bot_keys.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(botKeys)
|
@ProviderFor(botKeys)
|
||||||
const botKeysProvider = BotKeysFamily._();
|
final botKeysProvider = BotKeysFamily._();
|
||||||
|
|
||||||
final class BotKeysProvider
|
final class BotKeysProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class BotKeysProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnAccountApiKey>>,
|
$FutureModifier<List<SnAccountApiKey>>,
|
||||||
$FutureProvider<List<SnAccountApiKey>> {
|
$FutureProvider<List<SnAccountApiKey>> {
|
||||||
const BotKeysProvider._({
|
BotKeysProvider._({
|
||||||
required BotKeysFamily super.from,
|
required BotKeysFamily super.from,
|
||||||
required (String, String, String) super.argument,
|
required (String, String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -74,7 +74,7 @@ final class BotKeysFamily extends $Family
|
|||||||
FutureOr<List<SnAccountApiKey>>,
|
FutureOr<List<SnAccountApiKey>>,
|
||||||
(String, String, String)
|
(String, String, String)
|
||||||
> {
|
> {
|
||||||
const BotKeysFamily._()
|
BotKeysFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'botKeysProvider',
|
name: r'botKeysProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'bots.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(bots)
|
@ProviderFor(bots)
|
||||||
const botsProvider = BotsFamily._();
|
final botsProvider = BotsFamily._();
|
||||||
|
|
||||||
final class BotsProvider
|
final class BotsProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class BotsProvider
|
|||||||
FutureOr<List<Bot>>
|
FutureOr<List<Bot>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<Bot>>, $FutureProvider<List<Bot>> {
|
with $FutureModifier<List<Bot>>, $FutureProvider<List<Bot>> {
|
||||||
const BotsProvider._({
|
BotsProvider._({
|
||||||
required BotsFamily super.from,
|
required BotsFamily super.from,
|
||||||
required (String, String) super.argument,
|
required (String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -67,7 +67,7 @@ String _$botsHash() => r'15cefd5781350eb68208a342e85fcb0b9e0e3269';
|
|||||||
|
|
||||||
final class BotsFamily extends $Family
|
final class BotsFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<Bot>>, (String, String)> {
|
with $FunctionalFamilyOverride<FutureOr<List<Bot>>, (String, String)> {
|
||||||
const BotsFamily._()
|
BotsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'botsProvider',
|
name: r'botsProvider',
|
||||||
|
|||||||
@@ -51,10 +51,9 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final isNew = id == null;
|
final isNew = id == null;
|
||||||
final app =
|
final app = isNew
|
||||||
isNew
|
? null
|
||||||
? null
|
: ref.watch(customAppProvider(publisherName, projectId, id!));
|
||||||
: ref.watch(customAppProvider(publisherName, projectId, id!));
|
|
||||||
|
|
||||||
final formKey = useMemoized(() => GlobalKey<FormState>());
|
final formKey = useMemoized(() => GlobalKey<FormState>());
|
||||||
|
|
||||||
@@ -139,14 +138,10 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
try {
|
try {
|
||||||
final cloudFile =
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
await FileUploader.createCloudFile(
|
ref: ref,
|
||||||
ref: ref,
|
fileData: UniversalFile(data: result, type: UniversalFileType.image),
|
||||||
fileData: UniversalFile(
|
).future;
|
||||||
data: result,
|
|
||||||
type: UniversalFileType.image,
|
|
||||||
),
|
|
||||||
).future;
|
|
||||||
if (cloudFile == null) {
|
if (cloudFile == null) {
|
||||||
throw ArgumentError('Failed to upload the file...');
|
throw ArgumentError('Failed to upload the file...');
|
||||||
}
|
}
|
||||||
@@ -169,41 +164,40 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder:
|
builder: (context) => SheetScaffold(
|
||||||
(context) => SheetScaffold(
|
titleText: 'addScope'.tr(),
|
||||||
titleText: 'addScope'.tr(),
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(20),
|
||||||
padding: const EdgeInsets.all(20),
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: [
|
||||||
children: [
|
TextFormField(
|
||||||
TextFormField(
|
controller: scopeController,
|
||||||
controller: scopeController,
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
labelText: 'scopeName'.tr(),
|
||||||
labelText: 'scopeName'.tr(),
|
border: OutlineInputBorder(
|
||||||
border: OutlineInputBorder(
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
FilledButton.tonalIcon(
|
|
||||||
onPressed: () {
|
|
||||||
if (scopeController.text.isNotEmpty) {
|
|
||||||
allowedScopes.value = [
|
|
||||||
...allowedScopes.value,
|
|
||||||
scopeController.text,
|
|
||||||
];
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: const Icon(Symbols.add),
|
|
||||||
label: Text('add').tr(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
|
FilledButton.tonalIcon(
|
||||||
|
onPressed: () {
|
||||||
|
if (scopeController.text.isNotEmpty) {
|
||||||
|
allowedScopes.value = [
|
||||||
|
...allowedScopes.value,
|
||||||
|
scopeController.text,
|
||||||
|
];
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Symbols.add),
|
||||||
|
label: Text('add').tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,57 +206,56 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder:
|
builder: (context) => SheetScaffold(
|
||||||
(context) => SheetScaffold(
|
titleText: 'addRedirectUri'.tr(),
|
||||||
titleText: 'addRedirectUri'.tr(),
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(20),
|
||||||
padding: const EdgeInsets.all(20),
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: [
|
||||||
children: [
|
TextFormField(
|
||||||
TextFormField(
|
controller: uriController,
|
||||||
controller: uriController,
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
labelText: 'redirectUri'.tr(),
|
||||||
labelText: 'redirectUri'.tr(),
|
hintText: 'https://example.com/auth/callback',
|
||||||
hintText: 'https://example.com/auth/callback',
|
helperText: 'redirectUriHint'.tr(),
|
||||||
helperText: 'redirectUriHint'.tr(),
|
helperMaxLines: 3,
|
||||||
helperMaxLines: 3,
|
border: OutlineInputBorder(
|
||||||
border: OutlineInputBorder(
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'uriRequired'.tr();
|
|
||||||
}
|
|
||||||
final uri = Uri.tryParse(value);
|
|
||||||
if (uri == null || !uri.hasAbsolutePath) {
|
|
||||||
return 'invalidUri'.tr();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
onTapOutside:
|
|
||||||
(_) => FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
FilledButton.tonalIcon(
|
keyboardType: TextInputType.url,
|
||||||
onPressed: () {
|
validator: (value) {
|
||||||
if (uriController.text.isNotEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
redirectUris.value = [
|
return 'uriRequired'.tr();
|
||||||
...redirectUris.value,
|
}
|
||||||
uriController.text,
|
final uri = Uri.tryParse(value);
|
||||||
];
|
if (uri == null || !uri.hasAbsolutePath) {
|
||||||
Navigator.pop(context);
|
return 'invalidUri'.tr();
|
||||||
}
|
}
|
||||||
},
|
return null;
|
||||||
icon: const Icon(Symbols.add),
|
},
|
||||||
label: Text('add').tr(),
|
onTapOutside: (_) =>
|
||||||
),
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
|
FilledButton.tonalIcon(
|
||||||
|
onPressed: () {
|
||||||
|
if (uriController.text.isNotEmpty) {
|
||||||
|
redirectUris.value = [
|
||||||
|
...redirectUris.value,
|
||||||
|
uriController.text,
|
||||||
|
];
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Symbols.add),
|
||||||
|
label: Text('add').tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,31 +268,28 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
'picture_id': picture.value?.id,
|
'picture_id': picture.value?.id,
|
||||||
'background_id': background.value?.id,
|
'background_id': background.value?.id,
|
||||||
'links': {
|
'links': {
|
||||||
'home_page':
|
'home_page': homePageController.text.isNotEmpty
|
||||||
homePageController.text.isNotEmpty
|
? homePageController.text
|
||||||
? homePageController.text
|
: null,
|
||||||
: null,
|
'privacy_policy': privacyPolicyController.text.isNotEmpty
|
||||||
'privacy_policy':
|
? privacyPolicyController.text
|
||||||
privacyPolicyController.text.isNotEmpty
|
: null,
|
||||||
? privacyPolicyController.text
|
'terms_of_service': termsController.text.isNotEmpty
|
||||||
: null,
|
? termsController.text
|
||||||
'terms_of_service':
|
: null,
|
||||||
termsController.text.isNotEmpty ? termsController.text : null,
|
|
||||||
},
|
},
|
||||||
'oauth_config':
|
'oauth_config': oauthEnabled.value
|
||||||
oauthEnabled.value
|
? {
|
||||||
? {
|
'redirect_uris': redirectUris.value,
|
||||||
'redirect_uris': redirectUris.value,
|
'post_logout_redirect_uris': postLogoutUris.value.isNotEmpty
|
||||||
'post_logout_redirect_uris':
|
? postLogoutUris.value
|
||||||
postLogoutUris.value.isNotEmpty
|
: null,
|
||||||
? postLogoutUris.value
|
'allowed_scopes': allowedScopes.value,
|
||||||
: null,
|
'allowed_grant_types': allowedGrantTypes.value,
|
||||||
'allowed_scopes': allowedScopes.value,
|
'require_pkce': requirePkce.value,
|
||||||
'allowed_grant_types': allowedGrantTypes.value,
|
'allow_offline_access': allowOfflineAccess.value,
|
||||||
'require_pkce': requirePkce.value,
|
}
|
||||||
'allow_offline_access': allowOfflineAccess.value,
|
: null,
|
||||||
}
|
|
||||||
: null,
|
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
showLoadingModal(context);
|
showLoadingModal(context);
|
||||||
@@ -326,287 +316,269 @@ class EditAppScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final bodyContent =
|
final bodyContent = app == null && !isNew
|
||||||
app == null && !isNew
|
? const Center(child: CircularProgressIndicator())
|
||||||
? const Center(child: CircularProgressIndicator())
|
: app?.hasError == true && !isNew
|
||||||
: app?.hasError == true && !isNew
|
? ResponseErrorWidget(
|
||||||
? ResponseErrorWidget(
|
error: app!.error,
|
||||||
error: app!.error,
|
onRetry: () => ref.invalidate(
|
||||||
onRetry:
|
customAppProvider(publisherName, projectId, id!),
|
||||||
() => ref.invalidate(
|
),
|
||||||
customAppProvider(publisherName, projectId, id!),
|
)
|
||||||
),
|
: SingleChildScrollView(
|
||||||
)
|
child: Column(
|
||||||
: SingleChildScrollView(
|
children: [
|
||||||
child: Column(
|
AspectRatio(
|
||||||
children: [
|
aspectRatio: 16 / 7,
|
||||||
AspectRatio(
|
child: Stack(
|
||||||
aspectRatio: 16 / 7,
|
clipBehavior: Clip.none,
|
||||||
child: Stack(
|
fit: StackFit.expand,
|
||||||
clipBehavior: Clip.none,
|
children: [
|
||||||
fit: StackFit.expand,
|
GestureDetector(
|
||||||
children: [
|
child: Container(
|
||||||
GestureDetector(
|
color: Theme.of(
|
||||||
child: Container(
|
context,
|
||||||
color:
|
).colorScheme.surfaceContainerHigh,
|
||||||
Theme.of(
|
child: background.value != null
|
||||||
context,
|
? CloudFileWidget(
|
||||||
).colorScheme.surfaceContainerHigh,
|
item: background.value!,
|
||||||
child:
|
fit: BoxFit.cover,
|
||||||
background.value != null
|
)
|
||||||
? CloudFileWidget(
|
: const SizedBox.shrink(),
|
||||||
item: background.value!,
|
),
|
||||||
fit: BoxFit.cover,
|
onTap: () {
|
||||||
)
|
setPicture('background');
|
||||||
: const SizedBox.shrink(),
|
},
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 20,
|
||||||
|
bottom: -32,
|
||||||
|
child: GestureDetector(
|
||||||
|
child: ProfilePictureWidget(
|
||||||
|
file: picture.value,
|
||||||
|
radius: 40,
|
||||||
|
fallbackIcon: Symbols.apps,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setPicture('background');
|
setPicture('picture');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
left: 20,
|
],
|
||||||
bottom: -32,
|
|
||||||
child: GestureDetector(
|
|
||||||
child: ProfilePictureWidget(
|
|
||||||
fileId: picture.value?.id,
|
|
||||||
radius: 40,
|
|
||||||
fallbackIcon: Symbols.apps,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
setPicture('picture');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).padding(bottom: 32),
|
|
||||||
Form(
|
|
||||||
key: formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: nameController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'name'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextFormField(
|
|
||||||
controller: slugController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'slug'.tr(),
|
|
||||||
helperText: 'slugHint'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextFormField(
|
|
||||||
controller: descriptionController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'description'.tr(),
|
|
||||||
alignLabelWithHint: true,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
maxLines: 3,
|
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
ExpansionPanelList(
|
|
||||||
expansionCallback: (index, isExpanded) {
|
|
||||||
switch (index) {
|
|
||||||
case 0:
|
|
||||||
enableLinks.value = isExpanded;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
oauthEnabled.value = isExpanded;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
ExpansionPanel(
|
|
||||||
headerBuilder:
|
|
||||||
(context, isExpanded) =>
|
|
||||||
ListTile(title: Text('appLinks').tr()),
|
|
||||||
body: Column(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: homePageController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'homePageUrl'.tr(),
|
|
||||||
hintText: 'https://example.com',
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
controller: privacyPolicyController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'privacyPolicyUrl'.tr(),
|
|
||||||
hintText: 'https://example.com/privacy',
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
controller: termsController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'termsOfServiceUrl'.tr(),
|
|
||||||
hintText: 'https://example.com/terms',
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 16, bottom: 24),
|
|
||||||
isExpanded: enableLinks.value,
|
|
||||||
),
|
|
||||||
ExpansionPanel(
|
|
||||||
headerBuilder:
|
|
||||||
(context, isExpanded) =>
|
|
||||||
ListTile(title: Text('oauthConfig').tr()),
|
|
||||||
body: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('redirectUris'.tr()),
|
|
||||||
Card(
|
|
||||||
margin: const EdgeInsets.symmetric(
|
|
||||||
vertical: 8,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
...redirectUris.value.map(
|
|
||||||
(uri) => ListTile(
|
|
||||||
title: Text(uri),
|
|
||||||
trailing: IconButton(
|
|
||||||
icon: const Icon(Symbols.delete),
|
|
||||||
onPressed: () {
|
|
||||||
redirectUris.value =
|
|
||||||
redirectUris.value
|
|
||||||
.where((u) => u != uri)
|
|
||||||
.toList();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (redirectUris.value.isNotEmpty)
|
|
||||||
const Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Symbols.add),
|
|
||||||
title: Text('addRedirectUri'.tr()),
|
|
||||||
onTap: showAddRedirectUriDialog,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
8,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Text('allowedScopes'.tr()),
|
|
||||||
Card(
|
|
||||||
margin: const EdgeInsets.symmetric(
|
|
||||||
vertical: 8,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
...allowedScopes.value.map(
|
|
||||||
(scope) => ListTile(
|
|
||||||
title: Text(scope),
|
|
||||||
trailing: IconButton(
|
|
||||||
icon: const Icon(Symbols.delete),
|
|
||||||
onPressed: () {
|
|
||||||
allowedScopes.value =
|
|
||||||
allowedScopes.value
|
|
||||||
.where(
|
|
||||||
(s) => s != scope,
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (allowedScopes.value.isNotEmpty)
|
|
||||||
const Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Symbols.add),
|
|
||||||
title: Text('add').tr(),
|
|
||||||
onTap: showAddScopeDialog,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
SwitchListTile(
|
|
||||||
title: Text('requirePkce'.tr()),
|
|
||||||
value: requirePkce.value,
|
|
||||||
onChanged:
|
|
||||||
(value) => requirePkce.value = value,
|
|
||||||
),
|
|
||||||
SwitchListTile(
|
|
||||||
title: Text('allowOfflineAccess'.tr()),
|
|
||||||
value: allowOfflineAccess.value,
|
|
||||||
onChanged:
|
|
||||||
(value) =>
|
|
||||||
allowOfflineAccess.value = value,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 16, bottom: 24),
|
|
||||||
isExpanded: oauthEnabled.value,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: TextButton.icon(
|
|
||||||
onPressed: submitting.value ? null : performAction,
|
|
||||||
label: Text('saveChanges'.tr()),
|
|
||||||
icon: const Icon(Symbols.save),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(all: 24),
|
|
||||||
),
|
),
|
||||||
],
|
).padding(bottom: 32),
|
||||||
),
|
Form(
|
||||||
);
|
key: formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
controller: nameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'name'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
TextFormField(
|
||||||
|
controller: slugController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'slug'.tr(),
|
||||||
|
helperText: 'slugHint'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'description'.tr(),
|
||||||
|
alignLabelWithHint: true,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
maxLines: 3,
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
ExpansionPanelList(
|
||||||
|
expansionCallback: (index, isExpanded) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
enableLinks.value = isExpanded;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
oauthEnabled.value = isExpanded;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
ExpansionPanel(
|
||||||
|
headerBuilder: (context, isExpanded) =>
|
||||||
|
ListTile(title: Text('appLinks').tr()),
|
||||||
|
body: Column(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
controller: homePageController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'homePageUrl'.tr(),
|
||||||
|
hintText: 'https://example.com',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.url,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: privacyPolicyController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'privacyPolicyUrl'.tr(),
|
||||||
|
hintText: 'https://example.com/privacy',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.url,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: termsController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'termsOfServiceUrl'.tr(),
|
||||||
|
hintText: 'https://example.com/terms',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.url,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16, bottom: 24),
|
||||||
|
isExpanded: enableLinks.value,
|
||||||
|
),
|
||||||
|
ExpansionPanel(
|
||||||
|
headerBuilder: (context, isExpanded) =>
|
||||||
|
ListTile(title: Text('oauthConfig').tr()),
|
||||||
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('redirectUris'.tr()),
|
||||||
|
Card(
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
...redirectUris.value.map(
|
||||||
|
(uri) => ListTile(
|
||||||
|
title: Text(uri),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Symbols.delete),
|
||||||
|
onPressed: () {
|
||||||
|
redirectUris.value = redirectUris
|
||||||
|
.value
|
||||||
|
.where((u) => u != uri)
|
||||||
|
.toList();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (redirectUris.value.isNotEmpty)
|
||||||
|
const Divider(height: 1),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Symbols.add),
|
||||||
|
title: Text('addRedirectUri'.tr()),
|
||||||
|
onTap: showAddRedirectUriDialog,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text('allowedScopes'.tr()),
|
||||||
|
Card(
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
...allowedScopes.value.map(
|
||||||
|
(scope) => ListTile(
|
||||||
|
title: Text(scope),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Symbols.delete),
|
||||||
|
onPressed: () {
|
||||||
|
allowedScopes.value =
|
||||||
|
allowedScopes.value
|
||||||
|
.where((s) => s != scope)
|
||||||
|
.toList();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (allowedScopes.value.isNotEmpty)
|
||||||
|
const Divider(height: 1),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Symbols.add),
|
||||||
|
title: Text('add').tr(),
|
||||||
|
onTap: showAddScopeDialog,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
SwitchListTile(
|
||||||
|
title: Text('requirePkce'.tr()),
|
||||||
|
value: requirePkce.value,
|
||||||
|
onChanged: (value) =>
|
||||||
|
requirePkce.value = value,
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
title: Text('allowOfflineAccess'.tr()),
|
||||||
|
value: allowOfflineAccess.value,
|
||||||
|
onChanged: (value) =>
|
||||||
|
allowOfflineAccess.value = value,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16, bottom: 24),
|
||||||
|
isExpanded: oauthEnabled.value,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: submitting.value ? null : performAction,
|
||||||
|
label: Text('saveChanges'.tr()),
|
||||||
|
icon: const Icon(Symbols.save),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(all: 24),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (isModal) {
|
if (isModal) {
|
||||||
return bodyContent;
|
return bodyContent;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'edit_app.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(customApp)
|
@ProviderFor(customApp)
|
||||||
const customAppProvider = CustomAppFamily._();
|
final customAppProvider = CustomAppFamily._();
|
||||||
|
|
||||||
final class CustomAppProvider
|
final class CustomAppProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class CustomAppProvider
|
|||||||
FutureOr<CustomApp?>
|
FutureOr<CustomApp?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<CustomApp?>, $FutureProvider<CustomApp?> {
|
with $FutureModifier<CustomApp?>, $FutureProvider<CustomApp?> {
|
||||||
const CustomAppProvider._({
|
CustomAppProvider._({
|
||||||
required CustomAppFamily super.from,
|
required CustomAppFamily super.from,
|
||||||
required (String, String, String) super.argument,
|
required (String, String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -71,7 +71,7 @@ final class CustomAppFamily extends $Family
|
|||||||
FutureOr<CustomApp?>,
|
FutureOr<CustomApp?>,
|
||||||
(String, String, String)
|
(String, String, String)
|
||||||
> {
|
> {
|
||||||
const CustomAppFamily._()
|
CustomAppFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'customAppProvider',
|
name: r'customAppProvider',
|
||||||
|
|||||||
@@ -50,8 +50,9 @@ class EditBotScreen extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final isNew = id == null;
|
final isNew = id == null;
|
||||||
final botData =
|
final botData = isNew
|
||||||
isNew ? null : ref.watch(botProvider(publisherName, projectId, id!));
|
? null
|
||||||
|
: ref.watch(botProvider(publisherName, projectId, id!));
|
||||||
|
|
||||||
final formKey = useMemoized(() => GlobalKey<FormState>());
|
final formKey = useMemoized(() => GlobalKey<FormState>());
|
||||||
final submitting = useState(false);
|
final submitting = useState(false);
|
||||||
@@ -125,14 +126,10 @@ class EditBotScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
try {
|
try {
|
||||||
final cloudFile =
|
final cloudFile = await FileUploader.createCloudFile(
|
||||||
await FileUploader.createCloudFile(
|
ref: ref,
|
||||||
ref: ref,
|
fileData: UniversalFile(data: result, type: UniversalFileType.image),
|
||||||
fileData: UniversalFile(
|
).future;
|
||||||
data: result,
|
|
||||||
type: UniversalFileType.image,
|
|
||||||
),
|
|
||||||
).future;
|
|
||||||
if (cloudFile == null) {
|
if (cloudFile == null) {
|
||||||
throw ArgumentError('Failed to upload the file...');
|
throw ArgumentError('Failed to upload the file...');
|
||||||
}
|
}
|
||||||
@@ -193,284 +190,267 @@ class EditBotScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final bodyContent =
|
final bodyContent = botData == null && !isNew
|
||||||
botData == null && !isNew
|
? const Center(child: CircularProgressIndicator())
|
||||||
? const Center(child: CircularProgressIndicator())
|
: botData?.hasError == true && !isNew
|
||||||
: botData?.hasError == true && !isNew
|
? ResponseErrorWidget(
|
||||||
? ResponseErrorWidget(
|
error: botData!.error,
|
||||||
error: botData!.error,
|
onRetry: () =>
|
||||||
onRetry:
|
ref.invalidate(botProvider(publisherName, projectId, id!)),
|
||||||
() => ref.invalidate(
|
)
|
||||||
botProvider(publisherName, projectId, id!),
|
: SingleChildScrollView(
|
||||||
),
|
child: Column(
|
||||||
)
|
children: [
|
||||||
: SingleChildScrollView(
|
AspectRatio(
|
||||||
child: Column(
|
aspectRatio: 16 / 7,
|
||||||
children: [
|
child: Stack(
|
||||||
AspectRatio(
|
clipBehavior: Clip.none,
|
||||||
aspectRatio: 16 / 7,
|
fit: StackFit.expand,
|
||||||
child: Stack(
|
children: [
|
||||||
clipBehavior: Clip.none,
|
GestureDetector(
|
||||||
fit: StackFit.expand,
|
child: Container(
|
||||||
children: [
|
color: Theme.of(
|
||||||
GestureDetector(
|
context,
|
||||||
child: Container(
|
).colorScheme.surfaceContainerHigh,
|
||||||
color:
|
child: background.value != null
|
||||||
Theme.of(
|
? CloudFileWidget(
|
||||||
context,
|
item: background.value!,
|
||||||
).colorScheme.surfaceContainerHigh,
|
fit: BoxFit.cover,
|
||||||
child:
|
)
|
||||||
background.value != null
|
: const SizedBox.shrink(),
|
||||||
? CloudFileWidget(
|
),
|
||||||
item: background.value!,
|
onTap: () {
|
||||||
fit: BoxFit.cover,
|
setPicture('background');
|
||||||
)
|
},
|
||||||
: const SizedBox.shrink(),
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 20,
|
||||||
|
bottom: -32,
|
||||||
|
child: GestureDetector(
|
||||||
|
child: ProfilePictureWidget(
|
||||||
|
file: picture.value,
|
||||||
|
radius: 40,
|
||||||
|
fallbackIcon: Symbols.smart_toy,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setPicture('background');
|
setPicture('picture');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
left: 20,
|
],
|
||||||
bottom: -32,
|
|
||||||
child: GestureDetector(
|
|
||||||
child: ProfilePictureWidget(
|
|
||||||
fileId: picture.value?.id,
|
|
||||||
radius: 40,
|
|
||||||
fallbackIcon: Symbols.smart_toy,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
setPicture('picture');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).padding(bottom: 32),
|
|
||||||
Form(
|
|
||||||
key: formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: nameController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'name'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextFormField(
|
|
||||||
controller: nickController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'nickname'.tr(),
|
|
||||||
alignLabelWithHint: true,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextFormField(
|
|
||||||
controller: slugController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'slug'.tr(),
|
|
||||||
helperText: 'slugHint'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
TextFormField(
|
|
||||||
controller: bioController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'bio'.tr(),
|
|
||||||
alignLabelWithHint: true,
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
maxLines: 3,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: firstNameController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'firstName'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: middleNameController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'middleName'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: lastNameController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'lastName'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: genderController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'gender'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: pronounsController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'pronouns'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: locationController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'location'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: timeZoneController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'timeZone'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
final date = await showDatePicker(
|
|
||||||
context: context,
|
|
||||||
initialDate: birthday.value ?? DateTime.now(),
|
|
||||||
firstDate: DateTime(1900),
|
|
||||||
lastDate: DateTime.now(),
|
|
||||||
);
|
|
||||||
if (date != null) {
|
|
||||||
birthday.value = date;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'birthday'.tr(),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).hintColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
birthday.value != null
|
|
||||||
? DateFormat.yMMMd().format(
|
|
||||||
birthday.value!,
|
|
||||||
)
|
|
||||||
: 'Select a date'.tr(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: TextButton.icon(
|
|
||||||
onPressed: submitting.value ? null : performAction,
|
|
||||||
label: Text('saveChanges').tr(),
|
|
||||||
icon: const Icon(Symbols.save),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(all: 24),
|
|
||||||
),
|
),
|
||||||
],
|
).padding(bottom: 32),
|
||||||
),
|
Form(
|
||||||
);
|
key: formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
controller: nameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'name'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
TextFormField(
|
||||||
|
controller: nickController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'nickname'.tr(),
|
||||||
|
alignLabelWithHint: true,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
TextFormField(
|
||||||
|
controller: slugController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'slug'.tr(),
|
||||||
|
helperText: 'slugHint'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
TextFormField(
|
||||||
|
controller: bioController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'bio'.tr(),
|
||||||
|
alignLabelWithHint: true,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
maxLines: 3,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: firstNameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'firstName'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: middleNameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'middleName'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: lastNameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'lastName'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: genderController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'gender'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: pronounsController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'pronouns'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
spacing: 16,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: locationController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'location'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: timeZoneController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'timeZone'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
final date = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: birthday.value ?? DateTime.now(),
|
||||||
|
firstDate: DateTime(1900),
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
);
|
||||||
|
if (date != null) {
|
||||||
|
birthday.value = date;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'birthday'.tr(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).hintColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
birthday.value != null
|
||||||
|
? DateFormat.yMMMd().format(birthday.value!)
|
||||||
|
: 'Select a date'.tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: submitting.value ? null : performAction,
|
||||||
|
label: Text('saveChanges').tr(),
|
||||||
|
icon: const Icon(Symbols.save),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(all: 24),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (isModal) {
|
if (isModal) {
|
||||||
return bodyContent;
|
return bodyContent;
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ part of 'edit_bot.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(bot)
|
@ProviderFor(bot)
|
||||||
const botProvider = BotFamily._();
|
final botProvider = BotFamily._();
|
||||||
|
|
||||||
final class BotProvider
|
final class BotProvider
|
||||||
extends $FunctionalProvider<AsyncValue<Bot?>, Bot?, FutureOr<Bot?>>
|
extends $FunctionalProvider<AsyncValue<Bot?>, Bot?, FutureOr<Bot?>>
|
||||||
with $FutureModifier<Bot?>, $FutureProvider<Bot?> {
|
with $FutureModifier<Bot?>, $FutureProvider<Bot?> {
|
||||||
const BotProvider._({
|
BotProvider._({
|
||||||
required BotFamily super.from,
|
required BotFamily super.from,
|
||||||
required (String, String, String) super.argument,
|
required (String, String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -62,7 +62,7 @@ String _$botHash() => r'7bec47bb2a4061a5babc6d6d19c3d4c320c91188';
|
|||||||
|
|
||||||
final class BotFamily extends $Family
|
final class BotFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<Bot?>, (String, String, String)> {
|
with $FunctionalFamilyOverride<FutureOr<Bot?>, (String, String, String)> {
|
||||||
const BotFamily._()
|
BotFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'botProvider',
|
name: r'botProvider',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'edit_project.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(devProject)
|
@ProviderFor(devProject)
|
||||||
const devProjectProvider = DevProjectFamily._();
|
final devProjectProvider = DevProjectFamily._();
|
||||||
|
|
||||||
final class DevProjectProvider
|
final class DevProjectProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class DevProjectProvider
|
|||||||
FutureOr<DevProject?>
|
FutureOr<DevProject?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<DevProject?>, $FutureProvider<DevProject?> {
|
with $FutureModifier<DevProject?>, $FutureProvider<DevProject?> {
|
||||||
const DevProjectProvider._({
|
DevProjectProvider._({
|
||||||
required DevProjectFamily super.from,
|
required DevProjectFamily super.from,
|
||||||
required (String, String) super.argument,
|
required (String, String) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$devProjectHash() => r'd92be3f5cdc510c2a377615ed5c70622a6842bf2';
|
|||||||
|
|
||||||
final class DevProjectFamily extends $Family
|
final class DevProjectFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<DevProject?>, (String, String)> {
|
with $FunctionalFamilyOverride<FutureOr<DevProject?>, (String, String)> {
|
||||||
const DevProjectFamily._()
|
DevProjectFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'devProjectProvider',
|
name: r'devProjectProvider',
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ class DeveloperSelector extends HookConsumerWidget {
|
|||||||
minTileHeight: 48,
|
minTileHeight: 48,
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
radius: 16,
|
radius: 16,
|
||||||
fileId: item.publisher?.picture?.id,
|
file: item.publisher?.picture,
|
||||||
),
|
),
|
||||||
title: Text(item.publisher!.nick),
|
title: Text(item.publisher!.nick),
|
||||||
subtitle: Text('@${item.publisher!.name}'),
|
subtitle: Text('@${item.publisher!.name}'),
|
||||||
@@ -348,7 +348,7 @@ class DeveloperSelector extends HookConsumerWidget {
|
|||||||
if (isReadOnly || currentDeveloper == null) {
|
if (isReadOnly || currentDeveloper == null) {
|
||||||
return ProfilePictureWidget(
|
return ProfilePictureWidget(
|
||||||
radius: 16,
|
radius: 16,
|
||||||
fileId: currentDeveloper?.publisher?.picture?.id,
|
file: currentDeveloper?.publisher?.picture,
|
||||||
).center().padding(right: 8);
|
).center().padding(right: 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ class DeveloperSelector extends HookConsumerWidget {
|
|||||||
...developersMenu.map(
|
...developersMenu.map(
|
||||||
(e) => ProfilePictureWidget(
|
(e) => ProfilePictureWidget(
|
||||||
radius: 16,
|
radius: 16,
|
||||||
fileId: e.value?.publisher?.picture?.id,
|
file: e.value?.publisher?.picture,
|
||||||
).center().padding(right: 8),
|
).center().padding(right: 8),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -928,7 +928,7 @@ class _DeveloperEnrollmentSheet extends HookConsumerWidget {
|
|||||||
final publisher = items[index];
|
final publisher = items[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
fileId: publisher.picture?.id,
|
file: publisher.picture,
|
||||||
fallbackIcon: Symbols.group,
|
fallbackIcon: Symbols.group,
|
||||||
),
|
),
|
||||||
title: Text(publisher.nick),
|
title: Text(publisher.nick),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'hub.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(developerStats)
|
@ProviderFor(developerStats)
|
||||||
const developerStatsProvider = DeveloperStatsFamily._();
|
final developerStatsProvider = DeveloperStatsFamily._();
|
||||||
|
|
||||||
final class DeveloperStatsProvider
|
final class DeveloperStatsProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class DeveloperStatsProvider
|
|||||||
FutureOr<DeveloperStats?>
|
FutureOr<DeveloperStats?>
|
||||||
>
|
>
|
||||||
with $FutureModifier<DeveloperStats?>, $FutureProvider<DeveloperStats?> {
|
with $FutureModifier<DeveloperStats?>, $FutureProvider<DeveloperStats?> {
|
||||||
const DeveloperStatsProvider._({
|
DeveloperStatsProvider._({
|
||||||
required DeveloperStatsFamily super.from,
|
required DeveloperStatsFamily super.from,
|
||||||
required String? super.argument,
|
required String? super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$developerStatsHash() => r'45546f29ec7cd1a9c3a4e0f4e39275e78bf34755';
|
|||||||
|
|
||||||
final class DeveloperStatsFamily extends $Family
|
final class DeveloperStatsFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<DeveloperStats?>, String?> {
|
with $FunctionalFamilyOverride<FutureOr<DeveloperStats?>, String?> {
|
||||||
const DeveloperStatsFamily._()
|
DeveloperStatsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'developerStatsProvider',
|
name: r'developerStatsProvider',
|
||||||
@@ -85,7 +85,7 @@ final class DeveloperStatsFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(developers)
|
@ProviderFor(developers)
|
||||||
const developersProvider = DevelopersProvider._();
|
final developersProvider = DevelopersProvider._();
|
||||||
|
|
||||||
final class DevelopersProvider
|
final class DevelopersProvider
|
||||||
extends
|
extends
|
||||||
@@ -97,7 +97,7 @@ final class DevelopersProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnDeveloper>>,
|
$FutureModifier<List<SnDeveloper>>,
|
||||||
$FutureProvider<List<SnDeveloper>> {
|
$FutureProvider<List<SnDeveloper>> {
|
||||||
const DevelopersProvider._()
|
DevelopersProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
@@ -126,7 +126,7 @@ final class DevelopersProvider
|
|||||||
String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2';
|
String _$developersHash() => r'252341098617ac398ce133994453f318dd3edbd2';
|
||||||
|
|
||||||
@ProviderFor(devProjects)
|
@ProviderFor(devProjects)
|
||||||
const devProjectsProvider = DevProjectsFamily._();
|
final devProjectsProvider = DevProjectsFamily._();
|
||||||
|
|
||||||
final class DevProjectsProvider
|
final class DevProjectsProvider
|
||||||
extends
|
extends
|
||||||
@@ -136,7 +136,7 @@ final class DevProjectsProvider
|
|||||||
FutureOr<List<DevProject>>
|
FutureOr<List<DevProject>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<DevProject>>, $FutureProvider<List<DevProject>> {
|
with $FutureModifier<List<DevProject>>, $FutureProvider<List<DevProject>> {
|
||||||
const DevProjectsProvider._({
|
DevProjectsProvider._({
|
||||||
required DevProjectsFamily super.from,
|
required DevProjectsFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -184,7 +184,7 @@ String _$devProjectsHash() => r'715b395bebda785d38691ffee3b88e50b498c91a';
|
|||||||
|
|
||||||
final class DevProjectsFamily extends $Family
|
final class DevProjectsFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<List<DevProject>>, String> {
|
with $FunctionalFamilyOverride<FutureOr<List<DevProject>>, String> {
|
||||||
const DevProjectsFamily._()
|
DevProjectsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'devProjectsProvider',
|
name: r'devProjectsProvider',
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ final articlesListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
|||||||
ArticlesListNotifier.new,
|
ArticlesListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
|
class ArticlesListNotifier extends AsyncNotifier<PaginationState<SnWebArticle>>
|
||||||
with AsyncPaginationController<SnWebArticle> {
|
with AsyncPaginationController<SnWebArticle> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/feeds/articles',
|
'/insight/feeds/articles',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ class SliverArticlesList extends ConsumerWidget {
|
|||||||
@riverpod
|
@riverpod
|
||||||
Future<List<SnWebFeed>> subscribedFeeds(Ref ref) async {
|
Future<List<SnWebFeed>> subscribedFeeds(Ref ref) async {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final response = await client.get('/sphere/feeds/subscribed');
|
final response = await client.get('/insight/feeds/subscribed');
|
||||||
final data = response.data as List<dynamic>;
|
final data = response.data as List<dynamic>;
|
||||||
return data.map((json) => SnWebFeed.fromJson(json)).toList();
|
return data.map((json) => SnWebFeed.fromJson(json)).toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'articles.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(subscribedFeeds)
|
@ProviderFor(subscribedFeeds)
|
||||||
const subscribedFeedsProvider = SubscribedFeedsProvider._();
|
final subscribedFeedsProvider = SubscribedFeedsProvider._();
|
||||||
|
|
||||||
final class SubscribedFeedsProvider
|
final class SubscribedFeedsProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class SubscribedFeedsProvider
|
|||||||
FutureOr<List<SnWebFeed>>
|
FutureOr<List<SnWebFeed>>
|
||||||
>
|
>
|
||||||
with $FutureModifier<List<SnWebFeed>>, $FutureProvider<List<SnWebFeed>> {
|
with $FutureModifier<List<SnWebFeed>>, $FutureProvider<List<SnWebFeed>> {
|
||||||
const SubscribedFeedsProvider._()
|
SubscribedFeedsProvider._()
|
||||||
: super(
|
: super(
|
||||||
from: null,
|
from: null,
|
||||||
argument: null,
|
argument: null,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ part 'feed_detail.g.dart';
|
|||||||
@riverpod
|
@riverpod
|
||||||
Future<SnWebFeed> marketplaceWebFeed(Ref ref, String feedId) async {
|
Future<SnWebFeed> marketplaceWebFeed(Ref ref, String feedId) async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
final resp = await apiClient.get('/sphere/feeds/$feedId');
|
final resp = await apiClient.get('/insight/feeds/$feedId');
|
||||||
return SnWebFeed.fromJson(resp.data);
|
return SnWebFeed.fromJson(resp.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ final marketplaceWebFeedContentNotifierProvider = AsyncNotifierProvider.family
|
|||||||
.autoDispose(MarketplaceWebFeedContentNotifier.new);
|
.autoDispose(MarketplaceWebFeedContentNotifier.new);
|
||||||
|
|
||||||
class MarketplaceWebFeedContentNotifier
|
class MarketplaceWebFeedContentNotifier
|
||||||
extends AsyncNotifier<List<SnWebArticle>>
|
extends AsyncNotifier<PaginationState<SnWebArticle>>
|
||||||
with AsyncPaginationController<SnWebArticle> {
|
with AsyncPaginationController<SnWebArticle> {
|
||||||
static const int pageSize = 20;
|
static const int pageSize = 20;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class MarketplaceWebFeedContentNotifier
|
|||||||
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
final queryParams = {'offset': fetchedCount.toString(), 'take': pageSize};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/feeds/$arg/articles',
|
'/insight/feeds/$arg/articles',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
@@ -61,7 +61,7 @@ Future<bool> marketplaceWebFeedSubscription(
|
|||||||
}) async {
|
}) async {
|
||||||
final api = ref.watch(apiClientProvider);
|
final api = ref.watch(apiClientProvider);
|
||||||
try {
|
try {
|
||||||
await api.get('/sphere/feeds/$feedId/subscription');
|
await api.get('/insight/feeds/$feedId/subscription');
|
||||||
// If not 404, consider subscribed
|
// If not 404, consider subscribed
|
||||||
return true;
|
return true;
|
||||||
} on Object catch (e) {
|
} on Object catch (e) {
|
||||||
@@ -86,7 +86,7 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
|||||||
// Subscribe to web feed
|
// Subscribe to web feed
|
||||||
Future<void> subscribeToFeed() async {
|
Future<void> subscribeToFeed() async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
await apiClient.post('/sphere/feeds/$id/subscribe');
|
await apiClient.post('/insight/feeds/$id/subscribe');
|
||||||
HapticFeedback.selectionClick();
|
HapticFeedback.selectionClick();
|
||||||
ref.invalidate(marketplaceWebFeedSubscriptionProvider(feedId: id));
|
ref.invalidate(marketplaceWebFeedSubscriptionProvider(feedId: id));
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
@@ -96,7 +96,7 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
|
|||||||
// Unsubscribe from web feed
|
// Unsubscribe from web feed
|
||||||
Future<void> unsubscribeFromFeed() async {
|
Future<void> unsubscribeFromFeed() async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
await apiClient.delete('/sphere/feeds/$id/subscribe');
|
await apiClient.delete('/insight/feeds/$id/subscribe');
|
||||||
HapticFeedback.selectionClick();
|
HapticFeedback.selectionClick();
|
||||||
ref.invalidate(marketplaceWebFeedSubscriptionProvider(feedId: id));
|
ref.invalidate(marketplaceWebFeedSubscriptionProvider(feedId: id));
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'feed_detail.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(marketplaceWebFeed)
|
@ProviderFor(marketplaceWebFeed)
|
||||||
const marketplaceWebFeedProvider = MarketplaceWebFeedFamily._();
|
final marketplaceWebFeedProvider = MarketplaceWebFeedFamily._();
|
||||||
|
|
||||||
final class MarketplaceWebFeedProvider
|
final class MarketplaceWebFeedProvider
|
||||||
extends
|
extends
|
||||||
@@ -20,7 +20,7 @@ final class MarketplaceWebFeedProvider
|
|||||||
FutureOr<SnWebFeed>
|
FutureOr<SnWebFeed>
|
||||||
>
|
>
|
||||||
with $FutureModifier<SnWebFeed>, $FutureProvider<SnWebFeed> {
|
with $FutureModifier<SnWebFeed>, $FutureProvider<SnWebFeed> {
|
||||||
const MarketplaceWebFeedProvider._({
|
MarketplaceWebFeedProvider._({
|
||||||
required MarketplaceWebFeedFamily super.from,
|
required MarketplaceWebFeedFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -68,7 +68,7 @@ String _$marketplaceWebFeedHash() =>
|
|||||||
|
|
||||||
final class MarketplaceWebFeedFamily extends $Family
|
final class MarketplaceWebFeedFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<SnWebFeed>, String> {
|
with $FunctionalFamilyOverride<FutureOr<SnWebFeed>, String> {
|
||||||
const MarketplaceWebFeedFamily._()
|
MarketplaceWebFeedFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'marketplaceWebFeedProvider',
|
name: r'marketplaceWebFeedProvider',
|
||||||
@@ -87,7 +87,7 @@ final class MarketplaceWebFeedFamily extends $Family
|
|||||||
/// Provider for web feed subscription status
|
/// Provider for web feed subscription status
|
||||||
|
|
||||||
@ProviderFor(marketplaceWebFeedSubscription)
|
@ProviderFor(marketplaceWebFeedSubscription)
|
||||||
const marketplaceWebFeedSubscriptionProvider =
|
final marketplaceWebFeedSubscriptionProvider =
|
||||||
MarketplaceWebFeedSubscriptionFamily._();
|
MarketplaceWebFeedSubscriptionFamily._();
|
||||||
|
|
||||||
/// Provider for web feed subscription status
|
/// Provider for web feed subscription status
|
||||||
@@ -96,7 +96,7 @@ final class MarketplaceWebFeedSubscriptionProvider
|
|||||||
extends $FunctionalProvider<AsyncValue<bool>, bool, FutureOr<bool>>
|
extends $FunctionalProvider<AsyncValue<bool>, bool, FutureOr<bool>>
|
||||||
with $FutureModifier<bool>, $FutureProvider<bool> {
|
with $FutureModifier<bool>, $FutureProvider<bool> {
|
||||||
/// Provider for web feed subscription status
|
/// Provider for web feed subscription status
|
||||||
const MarketplaceWebFeedSubscriptionProvider._({
|
MarketplaceWebFeedSubscriptionProvider._({
|
||||||
required MarketplaceWebFeedSubscriptionFamily super.from,
|
required MarketplaceWebFeedSubscriptionFamily super.from,
|
||||||
required String super.argument,
|
required String super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -147,7 +147,7 @@ String _$marketplaceWebFeedSubscriptionHash() =>
|
|||||||
|
|
||||||
final class MarketplaceWebFeedSubscriptionFamily extends $Family
|
final class MarketplaceWebFeedSubscriptionFamily extends $Family
|
||||||
with $FunctionalFamilyOverride<FutureOr<bool>, String> {
|
with $FunctionalFamilyOverride<FutureOr<bool>, String> {
|
||||||
const MarketplaceWebFeedSubscriptionFamily._()
|
MarketplaceWebFeedSubscriptionFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'marketplaceWebFeedSubscriptionProvider',
|
name: r'marketplaceWebFeedSubscriptionProvider',
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ final marketplaceWebFeedsNotifierProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
MarketplaceWebFeedsNotifier.new,
|
MarketplaceWebFeedsNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class MarketplaceWebFeedsNotifier extends AsyncNotifier<List<SnWebFeed>>
|
class MarketplaceWebFeedsNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnWebFeed>>
|
||||||
with
|
with
|
||||||
AsyncPaginationController<SnWebFeed>,
|
AsyncPaginationController<SnWebFeed>,
|
||||||
AsyncPaginationFilter<String?, SnWebFeed> {
|
AsyncPaginationFilter<String?, SnWebFeed> {
|
||||||
@@ -28,7 +29,7 @@ class MarketplaceWebFeedsNotifier extends AsyncNotifier<List<SnWebFeed>>
|
|||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/feeds/explore',
|
'/insight/feeds/explore',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'offset': fetchedCount.toString(),
|
'offset': fetchedCount.toString(),
|
||||||
'take': 20,
|
'take': 20,
|
||||||
|
|||||||
@@ -138,6 +138,18 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.search),
|
||||||
|
const Gap(12),
|
||||||
|
Text('search').tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
context.pushNamed('universalSearch');
|
||||||
|
},
|
||||||
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -162,18 +174,6 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
context.pushNamed('postShuffle');
|
context.pushNamed('postShuffle');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.search),
|
|
||||||
const Gap(12),
|
|
||||||
Text('search').tr(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
context.pushNamed('postSearch');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
icon: Icon(Symbols.action_key),
|
icon: Icon(Symbols.action_key),
|
||||||
tooltip: 'search'.tr(),
|
tooltip: 'search'.tr(),
|
||||||
@@ -255,7 +255,7 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).padding(bottom: isWideScreen(context) ? null : 56)
|
).padding(bottom: MediaQuery.of(context).padding.bottom)
|
||||||
: null,
|
: null,
|
||||||
body: isWide
|
body: isWide
|
||||||
? _buildWideBody(
|
? _buildWideBody(
|
||||||
@@ -375,6 +375,8 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
? null // Post list handles its own refreshing
|
? null // Post list handles its own refreshing
|
||||||
: ref.watch(activityListProvider.notifier);
|
: ref.watch(activityListProvider.notifier);
|
||||||
|
|
||||||
|
final activityState = ref.watch(activityListProvider);
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
spacing: 12,
|
spacing: 12,
|
||||||
children: [
|
children: [
|
||||||
@@ -387,6 +389,10 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
const SliverGap(12),
|
const SliverGap(12),
|
||||||
|
if (activityState.value?.isLoading ?? false)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: LinearProgressIndicator().padding(bottom: 8),
|
||||||
|
),
|
||||||
SliverToBoxAdapter(child: filterBar),
|
SliverToBoxAdapter(child: filterBar),
|
||||||
const SliverGap(8),
|
const SliverGap(8),
|
||||||
bodyView,
|
bodyView,
|
||||||
@@ -532,6 +538,18 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.search),
|
||||||
|
const Gap(12),
|
||||||
|
Text('search').tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
context.pushNamed('universalSearch');
|
||||||
|
},
|
||||||
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -556,18 +574,6 @@ class ExploreScreen extends HookConsumerWidget {
|
|||||||
context.pushNamed('postShuffle');
|
context.pushNamed('postShuffle');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.search),
|
|
||||||
const Gap(12),
|
|
||||||
Text('search').tr(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
context.pushNamed('postSearch');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
icon: Icon(Symbols.action_key, color: foregroundColor),
|
icon: Icon(Symbols.action_key, color: foregroundColor),
|
||||||
tooltip: 'search'.tr(),
|
tooltip: 'search'.tr(),
|
||||||
|
|||||||
@@ -1,28 +1,19 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:file_saver/file_saver.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:gal/gal.dart';
|
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/file.dart';
|
import 'package:island/models/file.dart';
|
||||||
import 'package:island/pods/config.dart';
|
import 'package:island/pods/config.dart';
|
||||||
import 'package:island/pods/drive/file_references.dart';
|
import 'package:island/pods/drive/file_references.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/services/file_download.dart';
|
||||||
import 'package:island/pods/drive/upload_tasks.dart';
|
|
||||||
import 'package:island/models/drive_task.dart';
|
|
||||||
import 'package:island/services/responsive.dart';
|
import 'package:island/services/responsive.dart';
|
||||||
import 'package:island/services/time.dart';
|
import 'package:island/services/time.dart';
|
||||||
import 'package:island/widgets/alert.dart';
|
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/content/file_info_sheet.dart';
|
import 'package:island/widgets/content/file_info_sheet.dart';
|
||||||
import 'package:island/widgets/content/file_viewer_contents.dart';
|
import 'package:island/widgets/content/file_viewer_contents.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
import 'package:path/path.dart' show extension;
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
class FileDetailScreen extends HookConsumerWidget {
|
class FileDetailScreen extends HookConsumerWidget {
|
||||||
@@ -155,7 +146,7 @@ class FileDetailScreen extends HookConsumerWidget {
|
|||||||
actions.add(
|
actions.add(
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.save_alt),
|
icon: Icon(Icons.save_alt),
|
||||||
onPressed: () async => _saveToGallery(ref),
|
onPressed: () => FileDownloadService(ref).saveToGallery(item),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -166,7 +157,8 @@ class FileDetailScreen extends HookConsumerWidget {
|
|||||||
actions.add(
|
actions.add(
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.save_alt),
|
icon: Icon(Icons.save_alt),
|
||||||
onPressed: () async => _downloadFile(ref),
|
onPressed: () =>
|
||||||
|
FileDownloadService(ref).downloadWithProgress(item),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -199,80 +191,6 @@ class FileDetailScreen extends HookConsumerWidget {
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _saveToGallery(WidgetRef ref) async {
|
|
||||||
try {
|
|
||||||
showSnackBar('Saving image...');
|
|
||||||
|
|
||||||
final client = ref.read(apiClientProvider);
|
|
||||||
final tempDir = await getTemporaryDirectory();
|
|
||||||
var extName = extension(item.name).trim();
|
|
||||||
if (extName.isEmpty) {
|
|
||||||
extName = item.mimeType?.split('/').lastOrNull ?? 'jpeg';
|
|
||||||
}
|
|
||||||
final filePath = '${tempDir.path}/${item.id}.$extName';
|
|
||||||
|
|
||||||
await client.download(
|
|
||||||
'/drive/files/${item.id}',
|
|
||||||
filePath,
|
|
||||||
queryParameters: {'original': true},
|
|
||||||
);
|
|
||||||
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
|
||||||
await Gal.putImage(filePath, album: 'Solar Network');
|
|
||||||
showSnackBar('Image saved to gallery');
|
|
||||||
} else {
|
|
||||||
await FileSaver.instance.saveFile(
|
|
||||||
name: item.name.isEmpty ? '${item.id}.$extName' : item.name,
|
|
||||||
file: File(filePath),
|
|
||||||
);
|
|
||||||
showSnackBar('Image saved to $filePath');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
showErrorAlert(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _downloadFile(WidgetRef ref) async {
|
|
||||||
final taskNotifier = ref.read(uploadTasksProvider.notifier);
|
|
||||||
final taskId = taskNotifier.addLocalDownloadTask(item);
|
|
||||||
try {
|
|
||||||
showSnackBar('Downloading file...');
|
|
||||||
|
|
||||||
final client = ref.read(apiClientProvider);
|
|
||||||
final tempDir = await getTemporaryDirectory();
|
|
||||||
var extName = extension(item.name).trim();
|
|
||||||
if (extName.isEmpty) {
|
|
||||||
extName = item.mimeType?.split('/').lastOrNull ?? 'bin';
|
|
||||||
}
|
|
||||||
final filePath = '${tempDir.path}/${item.id}.$extName';
|
|
||||||
|
|
||||||
await client.download(
|
|
||||||
'/drive/files/${item.id}',
|
|
||||||
filePath,
|
|
||||||
queryParameters: {'original': true},
|
|
||||||
onReceiveProgress: (count, total) {
|
|
||||||
if (total > 0) {
|
|
||||||
taskNotifier.updateDownloadProgress(taskId, count, total);
|
|
||||||
taskNotifier.updateTransmissionProgress(taskId, count / total);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
await FileSaver.instance.saveFile(
|
|
||||||
name: item.name.isEmpty ? '${item.id}.$extName' : item.name,
|
|
||||||
file: File(filePath),
|
|
||||||
);
|
|
||||||
taskNotifier.updateTaskStatus(taskId, DriveTaskStatus.completed);
|
|
||||||
showSnackBar('File saved to downloads');
|
|
||||||
} catch (e) {
|
|
||||||
taskNotifier.updateTaskStatus(
|
|
||||||
taskId,
|
|
||||||
DriveTaskStatus.failed,
|
|
||||||
errorMessage: e.toString(),
|
|
||||||
);
|
|
||||||
showErrorAlert(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildContent(BuildContext context, WidgetRef ref, String serverUrl) {
|
Widget _buildContent(BuildContext context, WidgetRef ref, String serverUrl) {
|
||||||
final uri = '$serverUrl/drive/files/${item.id}';
|
final uri = '$serverUrl/drive/files/${item.id}';
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ part of 'lottery.dart';
|
|||||||
// ignore_for_file: type=lint, type=warning
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
@ProviderFor(lotteryTickets)
|
@ProviderFor(lotteryTickets)
|
||||||
const lotteryTicketsProvider = LotteryTicketsFamily._();
|
final lotteryTicketsProvider = LotteryTicketsFamily._();
|
||||||
|
|
||||||
final class LotteryTicketsProvider
|
final class LotteryTicketsProvider
|
||||||
extends
|
extends
|
||||||
@@ -22,7 +22,7 @@ final class LotteryTicketsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnLotteryTicket>>,
|
$FutureModifier<List<SnLotteryTicket>>,
|
||||||
$FutureProvider<List<SnLotteryTicket>> {
|
$FutureProvider<List<SnLotteryTicket>> {
|
||||||
const LotteryTicketsProvider._({
|
LotteryTicketsProvider._({
|
||||||
required LotteryTicketsFamily super.from,
|
required LotteryTicketsFamily super.from,
|
||||||
required ({int offset, int take}) super.argument,
|
required ({int offset, int take}) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -74,7 +74,7 @@ final class LotteryTicketsFamily extends $Family
|
|||||||
FutureOr<List<SnLotteryTicket>>,
|
FutureOr<List<SnLotteryTicket>>,
|
||||||
({int offset, int take})
|
({int offset, int take})
|
||||||
> {
|
> {
|
||||||
const LotteryTicketsFamily._()
|
LotteryTicketsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'lotteryTicketsProvider',
|
name: r'lotteryTicketsProvider',
|
||||||
@@ -94,7 +94,7 @@ final class LotteryTicketsFamily extends $Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ProviderFor(lotteryRecords)
|
@ProviderFor(lotteryRecords)
|
||||||
const lotteryRecordsProvider = LotteryRecordsFamily._();
|
final lotteryRecordsProvider = LotteryRecordsFamily._();
|
||||||
|
|
||||||
final class LotteryRecordsProvider
|
final class LotteryRecordsProvider
|
||||||
extends
|
extends
|
||||||
@@ -106,7 +106,7 @@ final class LotteryRecordsProvider
|
|||||||
with
|
with
|
||||||
$FutureModifier<List<SnLotteryRecord>>,
|
$FutureModifier<List<SnLotteryRecord>>,
|
||||||
$FutureProvider<List<SnLotteryRecord>> {
|
$FutureProvider<List<SnLotteryRecord>> {
|
||||||
const LotteryRecordsProvider._({
|
LotteryRecordsProvider._({
|
||||||
required LotteryRecordsFamily super.from,
|
required LotteryRecordsFamily super.from,
|
||||||
required ({int offset, int take}) super.argument,
|
required ({int offset, int take}) super.argument,
|
||||||
}) : super(
|
}) : super(
|
||||||
@@ -158,7 +158,7 @@ final class LotteryRecordsFamily extends $Family
|
|||||||
FutureOr<List<SnLotteryRecord>>,
|
FutureOr<List<SnLotteryRecord>>,
|
||||||
({int offset, int take})
|
({int offset, int take})
|
||||||
> {
|
> {
|
||||||
const LotteryRecordsFamily._()
|
LotteryRecordsFamily._()
|
||||||
: super(
|
: super(
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'lotteryRecordsProvider',
|
name: r'lotteryRecordsProvider',
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class SkeletonNotificationTile extends StatelessWidget {
|
|||||||
isThreeLine: true,
|
isThreeLine: true,
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
leading: fakePfp != null
|
leading: fakePfp != null
|
||||||
? ProfilePictureWidget(fileId: fakePfp, radius: 20)
|
? ProfilePictureWidget(file: null, radius: 20)
|
||||||
: CircleAvatar(
|
: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@@ -164,10 +164,24 @@ final notificationListProvider = AsyncNotifierProvider.autoDispose(
|
|||||||
NotificationListNotifier.new,
|
NotificationListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class NotificationListNotifier extends AsyncNotifier<List<SnNotification>>
|
class NotificationListNotifier
|
||||||
|
extends AsyncNotifier<PaginationState<SnNotification>>
|
||||||
with AsyncPaginationController<SnNotification> {
|
with AsyncPaginationController<SnNotification> {
|
||||||
static const int pageSize = 5;
|
static const int pageSize = 5;
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<PaginationState<SnNotification>> build() async {
|
||||||
|
final items = await fetch();
|
||||||
|
return PaginationState(
|
||||||
|
items: items,
|
||||||
|
isLoading: false,
|
||||||
|
isReloading: false,
|
||||||
|
totalCount: totalCount,
|
||||||
|
hasMore: hasMore,
|
||||||
|
cursor: cursor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnNotification>> fetch() async {
|
Future<List<SnNotification>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user