Compare commits
29 Commits
29574ada88
...
3.5.0+151
| Author | SHA1 | Date | |
|---|---|---|---|
|
d7746d14e4
|
|||
|
648d5225f6
|
|||
|
9d4d0f2e48
|
|||
|
fe386163f4
|
|||
|
ac2cee10e5
|
|||
|
9c370647dd
|
|||
|
7516e197fe
|
|||
|
71c372ab6c
|
|||
|
25f23f7f93
|
|||
|
51853698b9
|
|||
|
39ed5393ab
|
|||
|
782b3f1b08
|
|||
|
3ef2f13dd3
|
|||
|
36b0f55a47
|
|||
|
bc7a6e865e
|
|||
|
2ff60fc4ff
|
|||
|
ea93aa144e
|
|||
|
e4cd0c99df
|
|||
|
dff84dde58
|
|||
|
16c7b7e764
|
|||
|
240509ceff
|
|||
|
91da9768c1
|
|||
|
60b8e2bcad
|
|||
|
504e4d55ad
|
|||
|
38a15bb62a
|
|||
|
9d03faf594
|
|||
|
fd79c11d18
|
|||
|
c4ac256896
|
|||
|
c1fc8ea3fe
|
@@ -12,6 +12,8 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
android:maxSdkVersion="29" />
|
android:maxSdkVersion="29" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||||
|
|||||||
@@ -618,6 +618,7 @@
|
|||||||
"tagsHint": "Enter tags, separated by commas",
|
"tagsHint": "Enter tags, separated by commas",
|
||||||
"categories": "Categories",
|
"categories": "Categories",
|
||||||
"categoriesHint": "Enter categories, separated by commas",
|
"categoriesHint": "Enter categories, separated by commas",
|
||||||
|
"categoriesAndTags": "Categories & Tags",
|
||||||
"chatNotJoined": "You have not joined this chat yet.",
|
"chatNotJoined": "You have not joined this chat yet.",
|
||||||
"chatUnableJoin": "You can't join this chat due to it's access control settings.",
|
"chatUnableJoin": "You can't join this chat due to it's access control settings.",
|
||||||
"chatJoin": "Join the Chat",
|
"chatJoin": "Join the Chat",
|
||||||
|
|||||||
@@ -1489,5 +1489,6 @@
|
|||||||
"accountActivationAlert": "请记住激活您的账户",
|
"accountActivationAlert": "请记住激活您的账户",
|
||||||
"accountActivationAlertHint": "未激活的账户可能会导致各种权限问题,请点击我们发送到您邮箱收件箱的链接来激活您的账户。",
|
"accountActivationAlertHint": "未激活的账户可能会导致各种权限问题,请点击我们发送到您邮箱收件箱的链接来激活您的账户。",
|
||||||
"accountActivationResendHint": "没收到?请尝试点击下方按钮重新发送。如果您在账户未激活期间需要更新邮箱,请随时联系我们的客服。",
|
"accountActivationResendHint": "没收到?请尝试点击下方按钮重新发送。如果您在账户未激活期间需要更新邮箱,请随时联系我们的客服。",
|
||||||
"accountActivationResend": "重新发送"
|
"accountActivationResend": "重新发送",
|
||||||
|
"noFurtherData": "已经到底了"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ PODS:
|
|||||||
- path_provider_foundation (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
- permission_handler_apple (9.3.0):
|
||||||
|
- Flutter
|
||||||
- pointer_interceptor_ios (0.0.1):
|
- pointer_interceptor_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- PromisesObjC (2.4.0)
|
- PromisesObjC (2.4.0)
|
||||||
@@ -351,6 +353,7 @@ DEPENDENCIES:
|
|||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
||||||
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
||||||
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
|
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
|
||||||
@@ -458,6 +461,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/pasteboard/ios"
|
:path: ".symlinks/plugins/pasteboard/ios"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
|
permission_handler_apple:
|
||||||
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
pointer_interceptor_ios:
|
pointer_interceptor_ios:
|
||||||
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
||||||
protocol_handler_ios:
|
protocol_handler_ios:
|
||||||
@@ -539,6 +544,7 @@ SPEC CHECKSUMS:
|
|||||||
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
||||||
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
||||||
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
|
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
|
||||||
|
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
|
||||||
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
|
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
||||||
|
|||||||
@@ -264,8 +264,7 @@ class $ChatRoomsTable extends ChatRooms
|
|||||||
ChatRoom map(Map<String, dynamic> data, {String? tablePrefix}) {
|
ChatRoom map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
return ChatRoom(
|
return ChatRoom(
|
||||||
id:
|
id: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}id'],
|
data['${effectivePrefix}id'],
|
||||||
)!,
|
)!,
|
||||||
@@ -277,8 +276,7 @@ class $ChatRoomsTable extends ChatRooms
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}description'],
|
data['${effectivePrefix}description'],
|
||||||
),
|
),
|
||||||
type:
|
type: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.int,
|
DriftSqlType.int,
|
||||||
data['${effectivePrefix}type'],
|
data['${effectivePrefix}type'],
|
||||||
)!,
|
)!,
|
||||||
@@ -310,13 +308,11 @@ class $ChatRoomsTable extends ChatRooms
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}account_id'],
|
data['${effectivePrefix}account_id'],
|
||||||
),
|
),
|
||||||
createdAt:
|
createdAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}created_at'],
|
data['${effectivePrefix}created_at'],
|
||||||
)!,
|
)!,
|
||||||
updatedAt:
|
updatedAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}updated_at'],
|
data['${effectivePrefix}updated_at'],
|
||||||
)!,
|
)!,
|
||||||
@@ -416,39 +412,31 @@ class ChatRoom extends DataClass implements Insertable<ChatRoom> {
|
|||||||
return ChatRoomsCompanion(
|
return ChatRoomsCompanion(
|
||||||
id: Value(id),
|
id: Value(id),
|
||||||
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
|
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
|
||||||
description:
|
description: description == null && nullToAbsent
|
||||||
description == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(description),
|
: Value(description),
|
||||||
type: Value(type),
|
type: Value(type),
|
||||||
isPublic:
|
isPublic: isPublic == null && nullToAbsent
|
||||||
isPublic == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(isPublic),
|
: Value(isPublic),
|
||||||
isCommunity:
|
isCommunity: isCommunity == null && nullToAbsent
|
||||||
isCommunity == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(isCommunity),
|
: Value(isCommunity),
|
||||||
picture:
|
picture: picture == null && nullToAbsent
|
||||||
picture == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(picture),
|
: Value(picture),
|
||||||
background:
|
background: background == null && nullToAbsent
|
||||||
background == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(background),
|
: Value(background),
|
||||||
realmId:
|
realmId: realmId == null && nullToAbsent
|
||||||
realmId == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(realmId),
|
: Value(realmId),
|
||||||
accountId:
|
accountId: accountId == null && nullToAbsent
|
||||||
accountId == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(accountId),
|
: Value(accountId),
|
||||||
createdAt: Value(createdAt),
|
createdAt: Value(createdAt),
|
||||||
updatedAt: Value(updatedAt),
|
updatedAt: Value(updatedAt),
|
||||||
deletedAt:
|
deletedAt: deletedAt == null && nullToAbsent
|
||||||
deletedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(deletedAt),
|
: Value(deletedAt),
|
||||||
);
|
);
|
||||||
@@ -530,15 +518,18 @@ class ChatRoom extends DataClass implements Insertable<ChatRoom> {
|
|||||||
return ChatRoom(
|
return ChatRoom(
|
||||||
id: data.id.present ? data.id.value : this.id,
|
id: data.id.present ? data.id.value : this.id,
|
||||||
name: data.name.present ? data.name.value : this.name,
|
name: data.name.present ? data.name.value : this.name,
|
||||||
description:
|
description: data.description.present
|
||||||
data.description.present ? data.description.value : this.description,
|
? data.description.value
|
||||||
|
: this.description,
|
||||||
type: data.type.present ? data.type.value : this.type,
|
type: data.type.present ? data.type.value : this.type,
|
||||||
isPublic: data.isPublic.present ? data.isPublic.value : this.isPublic,
|
isPublic: data.isPublic.present ? data.isPublic.value : this.isPublic,
|
||||||
isCommunity:
|
isCommunity: data.isCommunity.present
|
||||||
data.isCommunity.present ? data.isCommunity.value : this.isCommunity,
|
? data.isCommunity.value
|
||||||
|
: this.isCommunity,
|
||||||
picture: data.picture.present ? data.picture.value : this.picture,
|
picture: data.picture.present ? data.picture.value : this.picture,
|
||||||
background:
|
background: data.background.present
|
||||||
data.background.present ? data.background.value : this.background,
|
? data.background.value
|
||||||
|
: this.background,
|
||||||
realmId: data.realmId.present ? data.realmId.value : this.realmId,
|
realmId: data.realmId.present ? data.realmId.value : this.realmId,
|
||||||
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
||||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||||
@@ -1044,18 +1035,15 @@ class $ChatMembersTable extends ChatMembers
|
|||||||
ChatMember map(Map<String, dynamic> data, {String? tablePrefix}) {
|
ChatMember map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
return ChatMember(
|
return ChatMember(
|
||||||
id:
|
id: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}id'],
|
data['${effectivePrefix}id'],
|
||||||
)!,
|
)!,
|
||||||
chatRoomId:
|
chatRoomId: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}chat_room_id'],
|
data['${effectivePrefix}chat_room_id'],
|
||||||
)!,
|
)!,
|
||||||
accountId:
|
accountId: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}account_id'],
|
data['${effectivePrefix}account_id'],
|
||||||
)!,
|
)!,
|
||||||
@@ -1069,8 +1057,7 @@ class $ChatMembersTable extends ChatMembers
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}nick'],
|
data['${effectivePrefix}nick'],
|
||||||
),
|
),
|
||||||
notify:
|
notify: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.int,
|
DriftSqlType.int,
|
||||||
data['${effectivePrefix}notify'],
|
data['${effectivePrefix}notify'],
|
||||||
)!,
|
)!,
|
||||||
@@ -1086,13 +1073,11 @@ class $ChatMembersTable extends ChatMembers
|
|||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}timeout_until'],
|
data['${effectivePrefix}timeout_until'],
|
||||||
),
|
),
|
||||||
createdAt:
|
createdAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}created_at'],
|
data['${effectivePrefix}created_at'],
|
||||||
)!,
|
)!,
|
||||||
updatedAt:
|
updatedAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}updated_at'],
|
data['${effectivePrefix}updated_at'],
|
||||||
)!,
|
)!,
|
||||||
@@ -1179,22 +1164,18 @@ class ChatMember extends DataClass implements Insertable<ChatMember> {
|
|||||||
account: Value(account),
|
account: Value(account),
|
||||||
nick: nick == null && nullToAbsent ? const Value.absent() : Value(nick),
|
nick: nick == null && nullToAbsent ? const Value.absent() : Value(nick),
|
||||||
notify: Value(notify),
|
notify: Value(notify),
|
||||||
joinedAt:
|
joinedAt: joinedAt == null && nullToAbsent
|
||||||
joinedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(joinedAt),
|
: Value(joinedAt),
|
||||||
breakUntil:
|
breakUntil: breakUntil == null && nullToAbsent
|
||||||
breakUntil == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(breakUntil),
|
: Value(breakUntil),
|
||||||
timeoutUntil:
|
timeoutUntil: timeoutUntil == null && nullToAbsent
|
||||||
timeoutUntil == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(timeoutUntil),
|
: Value(timeoutUntil),
|
||||||
createdAt: Value(createdAt),
|
createdAt: Value(createdAt),
|
||||||
updatedAt: Value(updatedAt),
|
updatedAt: Value(updatedAt),
|
||||||
deletedAt:
|
deletedAt: deletedAt == null && nullToAbsent
|
||||||
deletedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(deletedAt),
|
: Value(deletedAt),
|
||||||
);
|
);
|
||||||
@@ -1269,17 +1250,18 @@ class ChatMember extends DataClass implements Insertable<ChatMember> {
|
|||||||
ChatMember copyWithCompanion(ChatMembersCompanion data) {
|
ChatMember copyWithCompanion(ChatMembersCompanion data) {
|
||||||
return ChatMember(
|
return ChatMember(
|
||||||
id: data.id.present ? data.id.value : this.id,
|
id: data.id.present ? data.id.value : this.id,
|
||||||
chatRoomId:
|
chatRoomId: data.chatRoomId.present
|
||||||
data.chatRoomId.present ? data.chatRoomId.value : this.chatRoomId,
|
? data.chatRoomId.value
|
||||||
|
: this.chatRoomId,
|
||||||
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
||||||
account: data.account.present ? data.account.value : this.account,
|
account: data.account.present ? data.account.value : this.account,
|
||||||
nick: data.nick.present ? data.nick.value : this.nick,
|
nick: data.nick.present ? data.nick.value : this.nick,
|
||||||
notify: data.notify.present ? data.notify.value : this.notify,
|
notify: data.notify.present ? data.notify.value : this.notify,
|
||||||
joinedAt: data.joinedAt.present ? data.joinedAt.value : this.joinedAt,
|
joinedAt: data.joinedAt.present ? data.joinedAt.value : this.joinedAt,
|
||||||
breakUntil:
|
breakUntil: data.breakUntil.present
|
||||||
data.breakUntil.present ? data.breakUntil.value : this.breakUntil,
|
? data.breakUntil.value
|
||||||
timeoutUntil:
|
: this.breakUntil,
|
||||||
data.timeoutUntil.present
|
timeoutUntil: data.timeoutUntil.present
|
||||||
? data.timeoutUntil.value
|
? data.timeoutUntil.value
|
||||||
: this.timeoutUntil,
|
: this.timeoutUntil,
|
||||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||||
@@ -1695,7 +1677,8 @@ class $ChatMessagesTable extends ChatMessages
|
|||||||
List<Map<String, dynamic>>,
|
List<Map<String, dynamic>>,
|
||||||
String
|
String
|
||||||
>
|
>
|
||||||
attachments = GeneratedColumn<String>(
|
attachments =
|
||||||
|
GeneratedColumn<String>(
|
||||||
'attachments',
|
'attachments',
|
||||||
aliasedName,
|
aliasedName,
|
||||||
false,
|
false,
|
||||||
@@ -1710,7 +1693,8 @@ class $ChatMessagesTable extends ChatMessages
|
|||||||
List<Map<String, dynamic>>,
|
List<Map<String, dynamic>>,
|
||||||
String
|
String
|
||||||
>
|
>
|
||||||
reactions = GeneratedColumn<String>(
|
reactions =
|
||||||
|
GeneratedColumn<String>(
|
||||||
'reactions',
|
'reactions',
|
||||||
aliasedName,
|
aliasedName,
|
||||||
false,
|
false,
|
||||||
@@ -1882,18 +1866,15 @@ class $ChatMessagesTable extends ChatMessages
|
|||||||
ChatMessage map(Map<String, dynamic> data, {String? tablePrefix}) {
|
ChatMessage map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
return ChatMessage(
|
return ChatMessage(
|
||||||
id:
|
id: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}id'],
|
data['${effectivePrefix}id'],
|
||||||
)!,
|
)!,
|
||||||
roomId:
|
roomId: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}room_id'],
|
data['${effectivePrefix}room_id'],
|
||||||
)!,
|
)!,
|
||||||
senderId:
|
senderId: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}sender_id'],
|
data['${effectivePrefix}sender_id'],
|
||||||
)!,
|
)!,
|
||||||
@@ -1905,13 +1886,11 @@ class $ChatMessagesTable extends ChatMessages
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}nonce'],
|
data['${effectivePrefix}nonce'],
|
||||||
),
|
),
|
||||||
data:
|
data: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}data'],
|
data['${effectivePrefix}data'],
|
||||||
)!,
|
)!,
|
||||||
createdAt:
|
createdAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}created_at'],
|
data['${effectivePrefix}created_at'],
|
||||||
)!,
|
)!,
|
||||||
@@ -1933,8 +1912,7 @@ class $ChatMessagesTable extends ChatMessages
|
|||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}deleted_at'],
|
data['${effectivePrefix}deleted_at'],
|
||||||
),
|
),
|
||||||
type:
|
type: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}type'],
|
data['${effectivePrefix}type'],
|
||||||
)!,
|
)!,
|
||||||
@@ -2101,42 +2079,36 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
|||||||
id: Value(id),
|
id: Value(id),
|
||||||
roomId: Value(roomId),
|
roomId: Value(roomId),
|
||||||
senderId: Value(senderId),
|
senderId: Value(senderId),
|
||||||
content:
|
content: content == null && nullToAbsent
|
||||||
content == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(content),
|
: Value(content),
|
||||||
nonce:
|
nonce: nonce == null && nullToAbsent
|
||||||
nonce == null && nullToAbsent ? const Value.absent() : Value(nonce),
|
? const Value.absent()
|
||||||
|
: Value(nonce),
|
||||||
data: Value(data),
|
data: Value(data),
|
||||||
createdAt: Value(createdAt),
|
createdAt: Value(createdAt),
|
||||||
status: Value(status),
|
status: Value(status),
|
||||||
isDeleted:
|
isDeleted: isDeleted == null && nullToAbsent
|
||||||
isDeleted == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(isDeleted),
|
: Value(isDeleted),
|
||||||
updatedAt:
|
updatedAt: updatedAt == null && nullToAbsent
|
||||||
updatedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(updatedAt),
|
: Value(updatedAt),
|
||||||
deletedAt:
|
deletedAt: deletedAt == null && nullToAbsent
|
||||||
deletedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(deletedAt),
|
: Value(deletedAt),
|
||||||
type: Value(type),
|
type: Value(type),
|
||||||
meta: Value(meta),
|
meta: Value(meta),
|
||||||
membersMentioned: Value(membersMentioned),
|
membersMentioned: Value(membersMentioned),
|
||||||
editedAt:
|
editedAt: editedAt == null && nullToAbsent
|
||||||
editedAt == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(editedAt),
|
: Value(editedAt),
|
||||||
attachments: Value(attachments),
|
attachments: Value(attachments),
|
||||||
reactions: Value(reactions),
|
reactions: Value(reactions),
|
||||||
repliedMessageId:
|
repliedMessageId: repliedMessageId == null && nullToAbsent
|
||||||
repliedMessageId == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(repliedMessageId),
|
: Value(repliedMessageId),
|
||||||
forwardedMessageId:
|
forwardedMessageId: forwardedMessageId == null && nullToAbsent
|
||||||
forwardedMessageId == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(forwardedMessageId),
|
: Value(forwardedMessageId),
|
||||||
);
|
);
|
||||||
@@ -2245,12 +2217,10 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
|||||||
editedAt: editedAt.present ? editedAt.value : this.editedAt,
|
editedAt: editedAt.present ? editedAt.value : this.editedAt,
|
||||||
attachments: attachments ?? this.attachments,
|
attachments: attachments ?? this.attachments,
|
||||||
reactions: reactions ?? this.reactions,
|
reactions: reactions ?? this.reactions,
|
||||||
repliedMessageId:
|
repliedMessageId: repliedMessageId.present
|
||||||
repliedMessageId.present
|
|
||||||
? repliedMessageId.value
|
? repliedMessageId.value
|
||||||
: this.repliedMessageId,
|
: this.repliedMessageId,
|
||||||
forwardedMessageId:
|
forwardedMessageId: forwardedMessageId.present
|
||||||
forwardedMessageId.present
|
|
||||||
? forwardedMessageId.value
|
? forwardedMessageId.value
|
||||||
: this.forwardedMessageId,
|
: this.forwardedMessageId,
|
||||||
);
|
);
|
||||||
@@ -2269,20 +2239,18 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
|||||||
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
||||||
type: data.type.present ? data.type.value : this.type,
|
type: data.type.present ? data.type.value : this.type,
|
||||||
meta: data.meta.present ? data.meta.value : this.meta,
|
meta: data.meta.present ? data.meta.value : this.meta,
|
||||||
membersMentioned:
|
membersMentioned: data.membersMentioned.present
|
||||||
data.membersMentioned.present
|
|
||||||
? data.membersMentioned.value
|
? data.membersMentioned.value
|
||||||
: this.membersMentioned,
|
: this.membersMentioned,
|
||||||
editedAt: data.editedAt.present ? data.editedAt.value : this.editedAt,
|
editedAt: data.editedAt.present ? data.editedAt.value : this.editedAt,
|
||||||
attachments:
|
attachments: data.attachments.present
|
||||||
data.attachments.present ? data.attachments.value : this.attachments,
|
? data.attachments.value
|
||||||
|
: this.attachments,
|
||||||
reactions: data.reactions.present ? data.reactions.value : this.reactions,
|
reactions: data.reactions.present ? data.reactions.value : this.reactions,
|
||||||
repliedMessageId:
|
repliedMessageId: data.repliedMessageId.present
|
||||||
data.repliedMessageId.present
|
|
||||||
? data.repliedMessageId.value
|
? data.repliedMessageId.value
|
||||||
: this.repliedMessageId,
|
: this.repliedMessageId,
|
||||||
forwardedMessageId:
|
forwardedMessageId: data.forwardedMessageId.present
|
||||||
data.forwardedMessageId.present
|
|
||||||
? data.forwardedMessageId.value
|
? data.forwardedMessageId.value
|
||||||
: this.forwardedMessageId,
|
: this.forwardedMessageId,
|
||||||
);
|
);
|
||||||
@@ -2809,8 +2777,7 @@ class $PostDraftsTable extends PostDrafts
|
|||||||
PostDraft map(Map<String, dynamic> data, {String? tablePrefix}) {
|
PostDraft map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
return PostDraft(
|
return PostDraft(
|
||||||
id:
|
id: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}id'],
|
data['${effectivePrefix}id'],
|
||||||
)!,
|
)!,
|
||||||
@@ -2826,23 +2793,19 @@ class $PostDraftsTable extends PostDrafts
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}content'],
|
data['${effectivePrefix}content'],
|
||||||
),
|
),
|
||||||
visibility:
|
visibility: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.int,
|
DriftSqlType.int,
|
||||||
data['${effectivePrefix}visibility'],
|
data['${effectivePrefix}visibility'],
|
||||||
)!,
|
)!,
|
||||||
type:
|
type: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.int,
|
DriftSqlType.int,
|
||||||
data['${effectivePrefix}type'],
|
data['${effectivePrefix}type'],
|
||||||
)!,
|
)!,
|
||||||
lastModified:
|
lastModified: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.dateTime,
|
DriftSqlType.dateTime,
|
||||||
data['${effectivePrefix}last_modified'],
|
data['${effectivePrefix}last_modified'],
|
||||||
)!,
|
)!,
|
||||||
postData:
|
postData: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
|
||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
data['${effectivePrefix}post_data'],
|
data['${effectivePrefix}post_data'],
|
||||||
)!,
|
)!,
|
||||||
@@ -2897,14 +2860,13 @@ class PostDraft extends DataClass implements Insertable<PostDraft> {
|
|||||||
PostDraftsCompanion toCompanion(bool nullToAbsent) {
|
PostDraftsCompanion toCompanion(bool nullToAbsent) {
|
||||||
return PostDraftsCompanion(
|
return PostDraftsCompanion(
|
||||||
id: Value(id),
|
id: Value(id),
|
||||||
title:
|
title: title == null && nullToAbsent
|
||||||
title == null && nullToAbsent ? const Value.absent() : Value(title),
|
? const Value.absent()
|
||||||
description:
|
: Value(title),
|
||||||
description == null && nullToAbsent
|
description: description == null && nullToAbsent
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(description),
|
: Value(description),
|
||||||
content:
|
content: content == null && nullToAbsent
|
||||||
content == null && nullToAbsent
|
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(content),
|
: Value(content),
|
||||||
visibility: Value(visibility),
|
visibility: Value(visibility),
|
||||||
@@ -2968,14 +2930,15 @@ class PostDraft extends DataClass implements Insertable<PostDraft> {
|
|||||||
return PostDraft(
|
return PostDraft(
|
||||||
id: data.id.present ? data.id.value : this.id,
|
id: data.id.present ? data.id.value : this.id,
|
||||||
title: data.title.present ? data.title.value : this.title,
|
title: data.title.present ? data.title.value : this.title,
|
||||||
description:
|
description: data.description.present
|
||||||
data.description.present ? data.description.value : this.description,
|
? data.description.value
|
||||||
|
: this.description,
|
||||||
content: data.content.present ? data.content.value : this.content,
|
content: data.content.present ? data.content.value : this.content,
|
||||||
visibility:
|
visibility: data.visibility.present
|
||||||
data.visibility.present ? data.visibility.value : this.visibility,
|
? data.visibility.value
|
||||||
|
: this.visibility,
|
||||||
type: data.type.present ? data.type.value : this.type,
|
type: data.type.present ? data.type.value : this.type,
|
||||||
lastModified:
|
lastModified: data.lastModified.present
|
||||||
data.lastModified.present
|
|
||||||
? data.lastModified.value
|
? data.lastModified.value
|
||||||
: this.lastModified,
|
: this.lastModified,
|
||||||
postData: data.postData.present ? data.postData.value : this.postData,
|
postData: data.postData.present ? data.postData.value : this.postData,
|
||||||
@@ -3585,12 +3548,12 @@ class $$ChatRoomsTableTableManager
|
|||||||
TableManagerState(
|
TableManagerState(
|
||||||
db: db,
|
db: db,
|
||||||
table: table,
|
table: table,
|
||||||
createFilteringComposer:
|
createFilteringComposer: () =>
|
||||||
() => $$ChatRoomsTableFilterComposer($db: db, $table: table),
|
$$ChatRoomsTableFilterComposer($db: db, $table: table),
|
||||||
createOrderingComposer:
|
createOrderingComposer: () =>
|
||||||
() => $$ChatRoomsTableOrderingComposer($db: db, $table: table),
|
$$ChatRoomsTableOrderingComposer($db: db, $table: table),
|
||||||
createComputedFieldComposer:
|
createComputedFieldComposer: () =>
|
||||||
() => $$ChatRoomsTableAnnotationComposer($db: db, $table: table),
|
$$ChatRoomsTableAnnotationComposer($db: db, $table: table),
|
||||||
updateCompanionCallback:
|
updateCompanionCallback:
|
||||||
({
|
({
|
||||||
Value<String> id = const Value.absent(),
|
Value<String> id = const Value.absent(),
|
||||||
@@ -3655,9 +3618,7 @@ class $$ChatRoomsTableTableManager
|
|||||||
deletedAt: deletedAt,
|
deletedAt: deletedAt,
|
||||||
rowid: rowid,
|
rowid: rowid,
|
||||||
),
|
),
|
||||||
withReferenceMapper:
|
withReferenceMapper: (p0) => p0
|
||||||
(p0) =>
|
|
||||||
p0
|
|
||||||
.map(
|
.map(
|
||||||
(e) => (
|
(e) => (
|
||||||
e.readTable(table),
|
e.readTable(table),
|
||||||
@@ -3665,10 +3626,8 @@ class $$ChatRoomsTableTableManager
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
prefetchHooksCallback: ({
|
prefetchHooksCallback:
|
||||||
chatMembersRefs = false,
|
({chatMembersRefs = false, chatMessagesRefs = false}) {
|
||||||
chatMessagesRefs = false,
|
|
||||||
}) {
|
|
||||||
return PrefetchHooks(
|
return PrefetchHooks(
|
||||||
db: db,
|
db: db,
|
||||||
explicitlyWatchedTables: [
|
explicitlyWatchedTables: [
|
||||||
@@ -3687,8 +3646,7 @@ class $$ChatRoomsTableTableManager
|
|||||||
currentTable: table,
|
currentTable: table,
|
||||||
referencedTable: $$ChatRoomsTableReferences
|
referencedTable: $$ChatRoomsTableReferences
|
||||||
._chatMembersRefsTable(db),
|
._chatMembersRefsTable(db),
|
||||||
managerFromTypedResult:
|
managerFromTypedResult: (p0) =>
|
||||||
(p0) =>
|
|
||||||
$$ChatRoomsTableReferences(
|
$$ChatRoomsTableReferences(
|
||||||
db,
|
db,
|
||||||
table,
|
table,
|
||||||
@@ -3709,16 +3667,16 @@ class $$ChatRoomsTableTableManager
|
|||||||
currentTable: table,
|
currentTable: table,
|
||||||
referencedTable: $$ChatRoomsTableReferences
|
referencedTable: $$ChatRoomsTableReferences
|
||||||
._chatMessagesRefsTable(db),
|
._chatMessagesRefsTable(db),
|
||||||
managerFromTypedResult:
|
managerFromTypedResult: (p0) =>
|
||||||
(p0) =>
|
|
||||||
$$ChatRoomsTableReferences(
|
$$ChatRoomsTableReferences(
|
||||||
db,
|
db,
|
||||||
table,
|
table,
|
||||||
p0,
|
p0,
|
||||||
).chatMessagesRefs,
|
).chatMessagesRefs,
|
||||||
referencedItemsForCurrentItem:
|
referencedItemsForCurrentItem:
|
||||||
(item, referencedItems) =>
|
(item, referencedItems) => referencedItems.where(
|
||||||
referencedItems.where((e) => e.roomId == item.id),
|
(e) => e.roomId == item.id,
|
||||||
|
),
|
||||||
typedResults: items,
|
typedResults: items,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -4142,12 +4100,11 @@ class $$ChatMembersTableTableManager
|
|||||||
TableManagerState(
|
TableManagerState(
|
||||||
db: db,
|
db: db,
|
||||||
table: table,
|
table: table,
|
||||||
createFilteringComposer:
|
createFilteringComposer: () =>
|
||||||
() => $$ChatMembersTableFilterComposer($db: db, $table: table),
|
$$ChatMembersTableFilterComposer($db: db, $table: table),
|
||||||
createOrderingComposer:
|
createOrderingComposer: () =>
|
||||||
() => $$ChatMembersTableOrderingComposer($db: db, $table: table),
|
$$ChatMembersTableOrderingComposer($db: db, $table: table),
|
||||||
createComputedFieldComposer:
|
createComputedFieldComposer: () =>
|
||||||
() =>
|
|
||||||
$$ChatMembersTableAnnotationComposer($db: db, $table: table),
|
$$ChatMembersTableAnnotationComposer($db: db, $table: table),
|
||||||
updateCompanionCallback:
|
updateCompanionCallback:
|
||||||
({
|
({
|
||||||
@@ -4209,9 +4166,7 @@ class $$ChatMembersTableTableManager
|
|||||||
deletedAt: deletedAt,
|
deletedAt: deletedAt,
|
||||||
rowid: rowid,
|
rowid: rowid,
|
||||||
),
|
),
|
||||||
withReferenceMapper:
|
withReferenceMapper: (p0) => p0
|
||||||
(p0) =>
|
|
||||||
p0
|
|
||||||
.map(
|
.map(
|
||||||
(e) => (
|
(e) => (
|
||||||
e.readTable(table),
|
e.readTable(table),
|
||||||
@@ -4219,14 +4174,15 @@ class $$ChatMembersTableTableManager
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
prefetchHooksCallback: ({
|
prefetchHooksCallback:
|
||||||
chatRoomId = false,
|
({chatRoomId = false, chatMessagesRefs = false}) {
|
||||||
chatMessagesRefs = false,
|
|
||||||
}) {
|
|
||||||
return PrefetchHooks(
|
return PrefetchHooks(
|
||||||
db: db,
|
db: db,
|
||||||
explicitlyWatchedTables: [if (chatMessagesRefs) db.chatMessages],
|
explicitlyWatchedTables: [
|
||||||
addJoins: <
|
if (chatMessagesRefs) db.chatMessages,
|
||||||
|
],
|
||||||
|
addJoins:
|
||||||
|
<
|
||||||
T extends TableManagerState<
|
T extends TableManagerState<
|
||||||
dynamic,
|
dynamic,
|
||||||
dynamic,
|
dynamic,
|
||||||
@@ -4246,7 +4202,8 @@ class $$ChatMembersTableTableManager
|
|||||||
state.withJoin(
|
state.withJoin(
|
||||||
currentTable: table,
|
currentTable: table,
|
||||||
currentColumn: table.chatRoomId,
|
currentColumn: table.chatRoomId,
|
||||||
referencedTable: $$ChatMembersTableReferences
|
referencedTable:
|
||||||
|
$$ChatMembersTableReferences
|
||||||
._chatRoomIdTable(db),
|
._chatRoomIdTable(db),
|
||||||
referencedColumn:
|
referencedColumn:
|
||||||
$$ChatMembersTableReferences
|
$$ChatMembersTableReferences
|
||||||
@@ -4269,8 +4226,7 @@ class $$ChatMembersTableTableManager
|
|||||||
currentTable: table,
|
currentTable: table,
|
||||||
referencedTable: $$ChatMembersTableReferences
|
referencedTable: $$ChatMembersTableReferences
|
||||||
._chatMessagesRefsTable(db),
|
._chatMessagesRefsTable(db),
|
||||||
managerFromTypedResult:
|
managerFromTypedResult: (p0) =>
|
||||||
(p0) =>
|
|
||||||
$$ChatMembersTableReferences(
|
$$ChatMembersTableReferences(
|
||||||
db,
|
db,
|
||||||
table,
|
table,
|
||||||
@@ -4831,12 +4787,11 @@ class $$ChatMessagesTableTableManager
|
|||||||
TableManagerState(
|
TableManagerState(
|
||||||
db: db,
|
db: db,
|
||||||
table: table,
|
table: table,
|
||||||
createFilteringComposer:
|
createFilteringComposer: () =>
|
||||||
() => $$ChatMessagesTableFilterComposer($db: db, $table: table),
|
$$ChatMessagesTableFilterComposer($db: db, $table: table),
|
||||||
createOrderingComposer:
|
createOrderingComposer: () =>
|
||||||
() => $$ChatMessagesTableOrderingComposer($db: db, $table: table),
|
$$ChatMessagesTableOrderingComposer($db: db, $table: table),
|
||||||
createComputedFieldComposer:
|
createComputedFieldComposer: () =>
|
||||||
() =>
|
|
||||||
$$ChatMessagesTableAnnotationComposer($db: db, $table: table),
|
$$ChatMessagesTableAnnotationComposer($db: db, $table: table),
|
||||||
updateCompanionCallback:
|
updateCompanionCallback:
|
||||||
({
|
({
|
||||||
@@ -4930,9 +4885,7 @@ class $$ChatMessagesTableTableManager
|
|||||||
forwardedMessageId: forwardedMessageId,
|
forwardedMessageId: forwardedMessageId,
|
||||||
rowid: rowid,
|
rowid: rowid,
|
||||||
),
|
),
|
||||||
withReferenceMapper:
|
withReferenceMapper: (p0) => p0
|
||||||
(p0) =>
|
|
||||||
p0
|
|
||||||
.map(
|
.map(
|
||||||
(e) => (
|
(e) => (
|
||||||
e.readTable(table),
|
e.readTable(table),
|
||||||
@@ -4944,7 +4897,8 @@ class $$ChatMessagesTableTableManager
|
|||||||
return PrefetchHooks(
|
return PrefetchHooks(
|
||||||
db: db,
|
db: db,
|
||||||
explicitlyWatchedTables: [],
|
explicitlyWatchedTables: [],
|
||||||
addJoins: <
|
addJoins:
|
||||||
|
<
|
||||||
T extends TableManagerState<
|
T extends TableManagerState<
|
||||||
dynamic,
|
dynamic,
|
||||||
dynamic,
|
dynamic,
|
||||||
@@ -4966,8 +4920,7 @@ class $$ChatMessagesTableTableManager
|
|||||||
currentColumn: table.roomId,
|
currentColumn: table.roomId,
|
||||||
referencedTable: $$ChatMessagesTableReferences
|
referencedTable: $$ChatMessagesTableReferences
|
||||||
._roomIdTable(db),
|
._roomIdTable(db),
|
||||||
referencedColumn:
|
referencedColumn: $$ChatMessagesTableReferences
|
||||||
$$ChatMessagesTableReferences
|
|
||||||
._roomIdTable(db)
|
._roomIdTable(db)
|
||||||
.id,
|
.id,
|
||||||
)
|
)
|
||||||
@@ -4980,8 +4933,7 @@ class $$ChatMessagesTableTableManager
|
|||||||
currentColumn: table.senderId,
|
currentColumn: table.senderId,
|
||||||
referencedTable: $$ChatMessagesTableReferences
|
referencedTable: $$ChatMessagesTableReferences
|
||||||
._senderIdTable(db),
|
._senderIdTable(db),
|
||||||
referencedColumn:
|
referencedColumn: $$ChatMessagesTableReferences
|
||||||
$$ChatMessagesTableReferences
|
|
||||||
._senderIdTable(db)
|
._senderIdTable(db)
|
||||||
.id,
|
.id,
|
||||||
)
|
)
|
||||||
@@ -5201,12 +5153,12 @@ class $$PostDraftsTableTableManager
|
|||||||
TableManagerState(
|
TableManagerState(
|
||||||
db: db,
|
db: db,
|
||||||
table: table,
|
table: table,
|
||||||
createFilteringComposer:
|
createFilteringComposer: () =>
|
||||||
() => $$PostDraftsTableFilterComposer($db: db, $table: table),
|
$$PostDraftsTableFilterComposer($db: db, $table: table),
|
||||||
createOrderingComposer:
|
createOrderingComposer: () =>
|
||||||
() => $$PostDraftsTableOrderingComposer($db: db, $table: table),
|
$$PostDraftsTableOrderingComposer($db: db, $table: table),
|
||||||
createComputedFieldComposer:
|
createComputedFieldComposer: () =>
|
||||||
() => $$PostDraftsTableAnnotationComposer($db: db, $table: table),
|
$$PostDraftsTableAnnotationComposer($db: db, $table: table),
|
||||||
updateCompanionCallback:
|
updateCompanionCallback:
|
||||||
({
|
({
|
||||||
Value<String> id = const Value.absent(),
|
Value<String> id = const Value.absent(),
|
||||||
@@ -5251,15 +5203,8 @@ class $$PostDraftsTableTableManager
|
|||||||
postData: postData,
|
postData: postData,
|
||||||
rowid: rowid,
|
rowid: rowid,
|
||||||
),
|
),
|
||||||
withReferenceMapper:
|
withReferenceMapper: (p0) => p0
|
||||||
(p0) =>
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||||
p0
|
|
||||||
.map(
|
|
||||||
(e) => (
|
|
||||||
e.readTable(table),
|
|
||||||
BaseReferences(db, table, e),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
.toList(),
|
||||||
prefetchHooksCallback: null,
|
prefetchHooksCallback: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ class IslandApp extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final theme = ref.watch(themeProvider);
|
final theme = ref.watch(themeProvider);
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
// Convert string theme mode to ThemeMode enum
|
// Convert string theme mode to ThemeMode enum
|
||||||
ThemeMode getThemeMode() {
|
ThemeMode getThemeMode() {
|
||||||
|
|||||||
@@ -12,16 +12,14 @@ _SnAbuseReport _$SnAbuseReportFromJson(Map<String, dynamic> json) =>
|
|||||||
resourceIdentifier: json['resource_identifier'] as String,
|
resourceIdentifier: json['resource_identifier'] as String,
|
||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
reason: json['reason'] as String,
|
reason: json['reason'] as String,
|
||||||
resolvedAt:
|
resolvedAt: json['resolved_at'] == null
|
||||||
json['resolved_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['resolved_at'] as String),
|
: DateTime.parse(json['resolved_at'] as String),
|
||||||
resolution: json['resolution'] as String?,
|
resolution: json['resolution'] as String?,
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ _SnAccount _$SnAccountFromJson(Map<String, dynamic> json) => _SnAccount(
|
|||||||
isSuperuser: json['is_superuser'] as bool,
|
isSuperuser: json['is_superuser'] as bool,
|
||||||
automatedId: json['automated_id'] as String?,
|
automatedId: json['automated_id'] as String?,
|
||||||
profile: SnAccountProfile.fromJson(json['profile'] as Map<String, dynamic>),
|
profile: SnAccountProfile.fromJson(json['profile'] as Map<String, dynamic>),
|
||||||
perkSubscription:
|
perkSubscription: json['perk_subscription'] == null
|
||||||
json['perk_subscription'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnWalletSubscriptionRef.fromJson(
|
: SnWalletSubscriptionRef.fromJson(
|
||||||
json['perk_subscription'] as Map<String, dynamic>,
|
json['perk_subscription'] as Map<String, dynamic>,
|
||||||
@@ -31,14 +30,12 @@ _SnAccount _$SnAccountFromJson(Map<String, dynamic> json) => _SnAccount(
|
|||||||
?.map((e) => SnContactMethod.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SnContactMethod.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
activatedAt:
|
activatedAt: json['activated_at'] == null
|
||||||
json['activated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['activated_at'] as String),
|
: DateTime.parse(json['activated_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -73,8 +70,9 @@ _UsernameColor _$UsernameColorFromJson(Map<String, dynamic> json) =>
|
|||||||
type: json['type'] as String? ?? 'plain',
|
type: json['type'] as String? ?? 'plain',
|
||||||
value: json['value'] as String?,
|
value: json['value'] as String?,
|
||||||
direction: json['direction'] as String?,
|
direction: json['direction'] as String?,
|
||||||
colors:
|
colors: (json['colors'] as List<dynamic>?)
|
||||||
(json['colors'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
?.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$UsernameColorToJson(_UsernameColor instance) =>
|
Map<String, dynamic> _$UsernameColorToJson(_UsernameColor instance) =>
|
||||||
@@ -85,8 +83,9 @@ Map<String, dynamic> _$UsernameColorToJson(_UsernameColor instance) =>
|
|||||||
'colors': instance.colors,
|
'colors': instance.colors,
|
||||||
};
|
};
|
||||||
|
|
||||||
_SnAccountProfile _$SnAccountProfileFromJson(Map<String, dynamic> json) =>
|
_SnAccountProfile _$SnAccountProfileFromJson(
|
||||||
_SnAccountProfile(
|
Map<String, dynamic> json,
|
||||||
|
) => _SnAccountProfile(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
firstName: json['first_name'] as String? ?? '',
|
firstName: json['first_name'] as String? ?? '',
|
||||||
middleName: json['middle_name'] as String? ?? '',
|
middleName: json['middle_name'] as String? ?? '',
|
||||||
@@ -96,58 +95,43 @@ _SnAccountProfile _$SnAccountProfileFromJson(Map<String, dynamic> json) =>
|
|||||||
pronouns: json['pronouns'] as String? ?? '',
|
pronouns: json['pronouns'] as String? ?? '',
|
||||||
location: json['location'] as String? ?? '',
|
location: json['location'] as String? ?? '',
|
||||||
timeZone: json['time_zone'] as String? ?? '',
|
timeZone: json['time_zone'] as String? ?? '',
|
||||||
birthday:
|
birthday: json['birthday'] == null
|
||||||
json['birthday'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['birthday'] as String),
|
: DateTime.parse(json['birthday'] as String),
|
||||||
links:
|
links: json['links'] == null
|
||||||
json['links'] == null
|
|
||||||
? const []
|
? const []
|
||||||
: const ProfileLinkConverter().fromJson(json['links']),
|
: const ProfileLinkConverter().fromJson(json['links']),
|
||||||
lastSeenAt:
|
lastSeenAt: json['last_seen_at'] == null
|
||||||
json['last_seen_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['last_seen_at'] as String),
|
: DateTime.parse(json['last_seen_at'] as String),
|
||||||
activeBadge:
|
activeBadge: json['active_badge'] == null
|
||||||
json['active_badge'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccountBadge.fromJson(
|
: SnAccountBadge.fromJson(json['active_badge'] as Map<String, dynamic>),
|
||||||
json['active_badge'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
experience: (json['experience'] as num).toInt(),
|
experience: (json['experience'] as num).toInt(),
|
||||||
level: (json['level'] as num).toInt(),
|
level: (json['level'] as num).toInt(),
|
||||||
socialCredits: (json['social_credits'] as num?)?.toDouble() ?? 100,
|
socialCredits: (json['social_credits'] as num?)?.toDouble() ?? 100,
|
||||||
socialCreditsLevel: (json['social_credits_level'] as num?)?.toInt() ?? 0,
|
socialCreditsLevel: (json['social_credits_level'] as num?)?.toInt() ?? 0,
|
||||||
levelingProgress: (json['leveling_progress'] as num).toDouble(),
|
levelingProgress: (json['leveling_progress'] as num).toDouble(),
|
||||||
picture:
|
picture: json['picture'] == null
|
||||||
json['picture'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||||
background:
|
background: json['background'] == null
|
||||||
json['background'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(
|
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||||
json['background'] as Map<String, dynamic>,
|
verification: json['verification'] == null
|
||||||
),
|
|
||||||
verification:
|
|
||||||
json['verification'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnVerificationMark.fromJson(
|
: SnVerificationMark.fromJson(
|
||||||
json['verification'] as Map<String, dynamic>,
|
json['verification'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
usernameColor:
|
usernameColor: json['username_color'] == null
|
||||||
json['username_color'] == null
|
|
||||||
? null
|
? null
|
||||||
: UsernameColor.fromJson(
|
: UsernameColor.fromJson(json['username_color'] as Map<String, dynamic>),
|
||||||
json['username_color'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnAccountProfileToJson(_SnAccountProfile instance) =>
|
Map<String, dynamic> _$SnAccountProfileToJson(_SnAccountProfile instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -188,15 +172,13 @@ _SnAccountStatus _$SnAccountStatusFromJson(Map<String, dynamic> json) =>
|
|||||||
isCustomized: json['is_customized'] as bool,
|
isCustomized: json['is_customized'] as bool,
|
||||||
label: json['label'] as String? ?? "",
|
label: json['label'] as String? ?? "",
|
||||||
meta: json['meta'] as Map<String, dynamic>?,
|
meta: json['meta'] as Map<String, dynamic>?,
|
||||||
clearedAt:
|
clearedAt: json['cleared_at'] == null
|
||||||
json['cleared_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['cleared_at'] as String),
|
: DateTime.parse(json['cleared_at'] as String),
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -225,19 +207,16 @@ _SnAccountBadge _$SnAccountBadgeFromJson(Map<String, dynamic> json) =>
|
|||||||
label: json['label'] as String?,
|
label: json['label'] as String?,
|
||||||
caption: json['caption'] as String?,
|
caption: json['caption'] as String?,
|
||||||
meta: json['meta'] as Map<String, dynamic>,
|
meta: json['meta'] as Map<String, dynamic>,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
accountId: json['account_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),
|
||||||
activatedAt:
|
activatedAt: json['activated_at'] == null
|
||||||
json['activated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['activated_at'] as String),
|
: DateTime.parse(json['activated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -261,8 +240,7 @@ _SnContactMethod _$SnContactMethodFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnContactMethod(
|
_SnContactMethod(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
verifiedAt:
|
verifiedAt: json['verified_at'] == null
|
||||||
json['verified_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['verified_at'] as String),
|
: DateTime.parse(json['verified_at'] as String),
|
||||||
isPrimary: json['is_primary'] as bool,
|
isPrimary: json['is_primary'] as bool,
|
||||||
@@ -271,8 +249,7 @@ _SnContactMethod _$SnContactMethodFromJson(Map<String, dynamic> json) =>
|
|||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -295,8 +272,7 @@ _SnNotification _$SnNotificationFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnNotification(
|
_SnNotification(
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
@@ -306,8 +282,7 @@ _SnNotification _$SnNotificationFromJson(Map<String, dynamic> json) =>
|
|||||||
content: json['content'] as String,
|
content: json['content'] as String,
|
||||||
meta: json['meta'] as Map<String, dynamic>? ?? const {},
|
meta: json['meta'] as Map<String, dynamic>? ?? const {},
|
||||||
priority: (json['priority'] as num).toInt(),
|
priority: (json['priority'] as num).toInt(),
|
||||||
viewedAt:
|
viewedAt: json['viewed_at'] == null
|
||||||
json['viewed_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['viewed_at'] as String),
|
: DateTime.parse(json['viewed_at'] as String),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
@@ -376,8 +351,7 @@ _SnAuthDeviceWithSessione _$SnAuthDeviceWithSessioneFromJson(
|
|||||||
deviceLabel: json['device_label'] as String?,
|
deviceLabel: json['device_label'] as String?,
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
platform: (json['platform'] as num).toInt(),
|
platform: (json['platform'] as num).toInt(),
|
||||||
sessions:
|
sessions: (json['sessions'] as List<dynamic>)
|
||||||
(json['sessions'] as List<dynamic>)
|
|
||||||
.map((e) => SnAuthSession.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnAuthSession.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
isCurrent: json['is_current'] as bool? ?? false,
|
isCurrent: json['is_current'] as bool? ?? false,
|
||||||
@@ -405,8 +379,7 @@ _SnExperienceRecord _$SnExperienceRecordFromJson(Map<String, dynamic> json) =>
|
|||||||
bonusMultiplier: (json['bonus_multiplier'] as num?)?.toDouble() ?? 1.0,
|
bonusMultiplier: (json['bonus_multiplier'] as num?)?.toDouble() ?? 1.0,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -430,14 +403,12 @@ _SnSocialCreditRecord _$SnSocialCreditRecordFromJson(
|
|||||||
delta: (json['delta'] as num).toDouble(),
|
delta: (json['delta'] as num).toDouble(),
|
||||||
reasonType: json['reason_type'] as String,
|
reasonType: json['reason_type'] as String,
|
||||||
reason: json['reason'] as String,
|
reason: json['reason'] as String,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -460,8 +431,7 @@ _SnFriendOverviewItem _$SnFriendOverviewItemFromJson(
|
|||||||
) => _SnFriendOverviewItem(
|
) => _SnFriendOverviewItem(
|
||||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
status: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
status: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||||
activities:
|
activities: (json['activities'] as List<dynamic>)
|
||||||
(json['activities'] as List<dynamic>)
|
|
||||||
.map((e) => SnPresenceActivity.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnPresenceActivity.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ _SnNotableDay _$SnNotableDayFromJson(Map<String, dynamic> json) =>
|
|||||||
localName: json['local_name'] as String,
|
localName: json['local_name'] as String,
|
||||||
globalName: json['global_name'] as String,
|
globalName: json['global_name'] as String,
|
||||||
countryCode: json['country_code'] as String,
|
countryCode: json['country_code'] as String,
|
||||||
holidays:
|
holidays: (json['holidays'] as List<dynamic>)
|
||||||
(json['holidays'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
.map((e) => (e as num).toInt())
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
@@ -35,8 +34,7 @@ _SnTimelineEvent _$SnTimelineEventFromJson(Map<String, dynamic> json) =>
|
|||||||
data: json['data'],
|
data: json['data'],
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -56,19 +54,16 @@ _SnCheckInResult _$SnCheckInResultFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnCheckInResult(
|
_SnCheckInResult(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
level: (json['level'] as num).toInt(),
|
level: (json['level'] as num).toInt(),
|
||||||
tips:
|
tips: (json['tips'] as List<dynamic>)
|
||||||
(json['tips'] as List<dynamic>)
|
|
||||||
.map((e) => SnFortuneTip.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnFortuneTip.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -103,14 +98,12 @@ _SnEventCalendarEntry _$SnEventCalendarEntryFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _SnEventCalendarEntry(
|
) => _SnEventCalendarEntry(
|
||||||
date: DateTime.parse(json['date'] as String),
|
date: DateTime.parse(json['date'] as String),
|
||||||
checkInResult:
|
checkInResult: json['check_in_result'] == null
|
||||||
json['check_in_result'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCheckInResult.fromJson(
|
: SnCheckInResult.fromJson(
|
||||||
json['check_in_result'] as Map<String, dynamic>,
|
json['check_in_result'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
statuses:
|
statuses: (json['statuses'] as List<dynamic>)
|
||||||
(json['statuses'] as List<dynamic>)
|
|
||||||
.map((e) => SnAccountStatus.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnAccountStatus.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
@@ -141,8 +134,7 @@ _SnPresenceActivity _$SnPresenceActivityFromJson(Map<String, dynamic> json) =>
|
|||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,15 +34,13 @@ Map<String, dynamic> _$GeoIpLocationToJson(_GeoIpLocation instance) =>
|
|||||||
_SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
|
_SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
|
||||||
_SnAuthChallenge(
|
_SnAuthChallenge(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
stepRemain: (json['step_remain'] as num).toInt(),
|
stepRemain: (json['step_remain'] as num).toInt(),
|
||||||
stepTotal: (json['step_total'] as num).toInt(),
|
stepTotal: (json['step_total'] as num).toInt(),
|
||||||
failedAttempts: (json['failed_attempts'] as num).toInt(),
|
failedAttempts: (json['failed_attempts'] as num).toInt(),
|
||||||
blacklistFactors:
|
blacklistFactors: (json['blacklist_factors'] as List<dynamic>)
|
||||||
(json['blacklist_factors'] as List<dynamic>)
|
|
||||||
.map((e) => e as String)
|
.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
audiences: json['audiences'] as List<dynamic>,
|
audiences: json['audiences'] as List<dynamic>,
|
||||||
@@ -50,17 +48,13 @@ _SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
|
|||||||
ipAddress: json['ip_address'] as String,
|
ipAddress: json['ip_address'] as String,
|
||||||
userAgent: json['user_agent'] as String,
|
userAgent: json['user_agent'] as String,
|
||||||
nonce: json['nonce'] as String?,
|
nonce: json['nonce'] as String?,
|
||||||
location:
|
location: json['location'] == null
|
||||||
json['location'] == null
|
|
||||||
? null
|
? null
|
||||||
: GeoIpLocation.fromJson(
|
: GeoIpLocation.fromJson(json['location'] as Map<String, dynamic>),
|
||||||
json['location'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -90,26 +84,21 @@ _SnAuthSession _$SnAuthSessionFromJson(Map<String, dynamic> json) =>
|
|||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
label: json['label'] as String?,
|
label: json['label'] as String?,
|
||||||
lastGrantedAt: DateTime.parse(json['last_granted_at'] as String),
|
lastGrantedAt: DateTime.parse(json['last_granted_at'] as String),
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
audiences: json['audiences'] as List<dynamic>,
|
audiences: json['audiences'] as List<dynamic>,
|
||||||
scopes: json['scopes'] as List<dynamic>,
|
scopes: json['scopes'] as List<dynamic>,
|
||||||
ipAddress: json['ip_address'] as String?,
|
ipAddress: json['ip_address'] as String?,
|
||||||
userAgent: json['user_agent'] as String?,
|
userAgent: json['user_agent'] as String?,
|
||||||
location:
|
location: json['location'] == null
|
||||||
json['location'] == null
|
|
||||||
? null
|
? null
|
||||||
: GeoIpLocation.fromJson(
|
: GeoIpLocation.fromJson(json['location'] as Map<String, dynamic>),
|
||||||
json['location'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -138,16 +127,13 @@ _SnAuthFactor _$SnAuthFactorFromJson(Map<String, dynamic> json) =>
|
|||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
enabledAt:
|
enabledAt: json['enabled_at'] == null
|
||||||
json['enabled_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['enabled_at'] as String),
|
: DateTime.parse(json['enabled_at'] as String),
|
||||||
trustworthy: (json['trustworthy'] as num).toInt(),
|
trustworthy: (json['trustworthy'] as num).toInt(),
|
||||||
@@ -177,8 +163,7 @@ _SnAccountConnection _$SnAccountConnectionFromJson(Map<String, dynamic> json) =>
|
|||||||
lastUsedAt: DateTime.parse(json['last_used_at'] as String),
|
lastUsedAt: DateTime.parse(json['last_used_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ AutoCompletionAccountResponse _$AutoCompletionAccountResponseFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => AutoCompletionAccountResponse(
|
) => AutoCompletionAccountResponse(
|
||||||
type: json['type'] as String,
|
type: json['type'] as String,
|
||||||
items:
|
items: (json['items'] as List<dynamic>)
|
||||||
(json['items'] as List<dynamic>)
|
|
||||||
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
@@ -29,8 +28,7 @@ AutoCompletionStickerResponse _$AutoCompletionStickerResponseFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => AutoCompletionStickerResponse(
|
) => AutoCompletionStickerResponse(
|
||||||
type: json['type'] as String,
|
type: json['type'] as String,
|
||||||
items:
|
items: (json['items'] as List<dynamic>)
|
||||||
(json['items'] as List<dynamic>)
|
|
||||||
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ _Bot _$BotFromJson(Map<String, dynamic> json) => _Bot(
|
|||||||
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),
|
||||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
developer:
|
developer: json['developer'] == null
|
||||||
json['developer'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnDeveloper.fromJson(json['developer'] as Map<String, dynamic>),
|
: SnDeveloper.fromJson(json['developer'] as Map<String, dynamic>),
|
||||||
);
|
);
|
||||||
@@ -74,8 +73,7 @@ _BotSecret _$BotSecretFromJson(Map<String, dynamic> json) => _BotSecret(
|
|||||||
id: json['id'] as String? ?? '',
|
id: json['id'] as String? ?? '',
|
||||||
secret: json['secret'] as String? ?? '',
|
secret: json['secret'] as String? ?? '',
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
botId: json['bot_id'] as String? ?? '',
|
botId: json['bot_id'] as String? ?? '',
|
||||||
|
|||||||
@@ -13,28 +13,23 @@ _SnChatRoom _$SnChatRoomFromJson(Map<String, dynamic> json) => _SnChatRoom(
|
|||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
isPublic: json['is_public'] as bool? ?? false,
|
isPublic: json['is_public'] as bool? ?? false,
|
||||||
isCommunity: json['is_community'] as bool? ?? false,
|
isCommunity: json['is_community'] as bool? ?? false,
|
||||||
picture:
|
picture: json['picture'] == null
|
||||||
json['picture'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||||
background:
|
background: json['background'] == null
|
||||||
json['background'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||||
realmId: json['realm_id'] as String?,
|
realmId: json['realm_id'] as String?,
|
||||||
accountId: json['account_id'] as String?,
|
accountId: json['account_id'] as String?,
|
||||||
realm:
|
realm: json['realm'] == null
|
||||||
json['realm'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
members:
|
members: (json['members'] as List<dynamic>?)
|
||||||
(json['members'] as List<dynamic>?)
|
|
||||||
?.map((e) => SnChatMember.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SnChatMember.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
@@ -62,8 +57,7 @@ _SnChatMessage _$SnChatMessageFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnChatMessage(
|
_SnChatMessage(
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
@@ -76,8 +70,7 @@ _SnChatMessage _$SnChatMessageFromJson(Map<String, dynamic> json) =>
|
|||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
editedAt:
|
editedAt: json['edited_at'] == null
|
||||||
json['edited_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['edited_at'] as String),
|
: DateTime.parse(json['edited_at'] as String),
|
||||||
attachments:
|
attachments:
|
||||||
@@ -122,8 +115,7 @@ _SnChatReaction _$SnChatReactionFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnChatReaction(
|
_SnChatReaction(
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
@@ -151,40 +143,31 @@ _SnChatMember _$SnChatMemberFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnChatMember(
|
_SnChatMember(
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
chatRoomId: json['chat_room_id'] as String,
|
chatRoomId: json['chat_room_id'] as String,
|
||||||
chatRoom:
|
chatRoom: json['chat_room'] == null
|
||||||
json['chat_room'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnChatRoom.fromJson(json['chat_room'] as Map<String, dynamic>),
|
: SnChatRoom.fromJson(json['chat_room'] as Map<String, dynamic>),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
nick: json['nick'] as String?,
|
nick: json['nick'] as String?,
|
||||||
notify: (json['notify'] as num).toInt(),
|
notify: (json['notify'] as num).toInt(),
|
||||||
joinedAt:
|
joinedAt: json['joined_at'] == null
|
||||||
json['joined_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['joined_at'] as String),
|
: DateTime.parse(json['joined_at'] as String),
|
||||||
breakUntil:
|
breakUntil: json['break_until'] == null
|
||||||
json['break_until'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['break_until'] as String),
|
: DateTime.parse(json['break_until'] as String),
|
||||||
timeoutUntil:
|
timeoutUntil: json['timeout_until'] == null
|
||||||
json['timeout_until'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['timeout_until'] as String),
|
: DateTime.parse(json['timeout_until'] as String),
|
||||||
status:
|
status: json['status'] == null
|
||||||
json['status'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccountStatus.fromJson(
|
: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||||
json['status'] as Map<String, dynamic>,
|
lastTyped: json['last_typed'] == null
|
||||||
),
|
|
||||||
lastTyped:
|
|
||||||
json['last_typed'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['last_typed'] as String),
|
: DateTime.parse(json['last_typed'] as String),
|
||||||
);
|
);
|
||||||
@@ -211,8 +194,7 @@ Map<String, dynamic> _$SnChatMemberToJson(_SnChatMember instance) =>
|
|||||||
_SnChatSummary _$SnChatSummaryFromJson(Map<String, dynamic> json) =>
|
_SnChatSummary _$SnChatSummaryFromJson(Map<String, dynamic> json) =>
|
||||||
_SnChatSummary(
|
_SnChatSummary(
|
||||||
unreadCount: (json['unread_count'] as num).toInt(),
|
unreadCount: (json['unread_count'] as num).toInt(),
|
||||||
lastMessage:
|
lastMessage: json['last_message'] == null
|
||||||
json['last_message'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnChatMessage.fromJson(
|
: SnChatMessage.fromJson(
|
||||||
json['last_message'] as Map<String, dynamic>,
|
json['last_message'] as Map<String, dynamic>,
|
||||||
@@ -251,8 +233,7 @@ _ChatRealtimeJoinResponse _$ChatRealtimeJoinResponseFromJson(
|
|||||||
callId: json['call_id'] as String,
|
callId: json['call_id'] as String,
|
||||||
roomName: json['room_name'] as String,
|
roomName: json['room_name'] as String,
|
||||||
isAdmin: json['is_admin'] as bool,
|
isAdmin: json['is_admin'] as bool,
|
||||||
participants:
|
participants: (json['participants'] as List<dynamic>)
|
||||||
(json['participants'] as List<dynamic>)
|
|
||||||
.map((e) => CallParticipant.fromJson(e as Map<String, dynamic>))
|
.map((e) => CallParticipant.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
@@ -288,12 +269,10 @@ _SnRealtimeCall _$SnRealtimeCallFromJson(Map<String, dynamic> json) =>
|
|||||||
id: json['id'] as String,
|
id: json['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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
endedAt:
|
endedAt: json['ended_at'] == null
|
||||||
json['ended_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['ended_at'] as String),
|
: DateTime.parse(json['ended_at'] as String),
|
||||||
senderId: json['sender_id'] as String,
|
senderId: json['sender_id'] as String,
|
||||||
|
|||||||
@@ -12,28 +12,23 @@ _CustomApp _$CustomAppFromJson(Map<String, dynamic> json) => _CustomApp(
|
|||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
status: (json['status'] as num?)?.toInt() ?? 0,
|
status: (json['status'] as num?)?.toInt() ?? 0,
|
||||||
picture:
|
picture: json['picture'] == null
|
||||||
json['picture'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||||
background:
|
background: json['background'] == null
|
||||||
json['background'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||||
verification:
|
verification: json['verification'] == null
|
||||||
json['verification'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnVerificationMark.fromJson(
|
: SnVerificationMark.fromJson(
|
||||||
json['verification'] as Map<String, dynamic>,
|
json['verification'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
oauthConfig:
|
oauthConfig: json['oauth_config'] == null
|
||||||
json['oauth_config'] == null
|
|
||||||
? null
|
? null
|
||||||
: CustomAppOauthConfig.fromJson(
|
: CustomAppOauthConfig.fromJson(
|
||||||
json['oauth_config'] as Map<String, dynamic>,
|
json['oauth_config'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
links:
|
links: json['links'] == null
|
||||||
json['links'] == null
|
|
||||||
? null
|
? null
|
||||||
: CustomAppLinks.fromJson(json['links'] as Map<String, dynamic>),
|
: CustomAppLinks.fromJson(json['links'] as Map<String, dynamic>),
|
||||||
secrets:
|
secrets:
|
||||||
@@ -83,8 +78,7 @@ _CustomAppOauthConfig _$CustomAppOauthConfigFromJson(
|
|||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
postLogoutRedirectUris:
|
postLogoutRedirectUris: (json['post_logout_redirect_uris'] as List<dynamic>?)
|
||||||
(json['post_logout_redirect_uris'] as List<dynamic>?)
|
|
||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
allowedScopes:
|
allowedScopes:
|
||||||
@@ -118,8 +112,7 @@ _CustomAppSecret _$CustomAppSecretFromJson(Map<String, dynamic> json) =>
|
|||||||
id: json['id'] as String? ?? '',
|
id: json['id'] as String? ?? '',
|
||||||
secret: json['secret'] as String? ?? '',
|
secret: json['secret'] as String? ?? '',
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
isOidc: json['is_oidc'] as bool? ?? false,
|
isOidc: json['is_oidc'] as bool? ?? false,
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ part of 'developer.dart';
|
|||||||
_SnDeveloper _$SnDeveloperFromJson(Map<String, dynamic> json) => _SnDeveloper(
|
_SnDeveloper _$SnDeveloperFromJson(Map<String, dynamic> json) => _SnDeveloper(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
publisher:
|
publisher: json['publisher'] == null
|
||||||
json['publisher'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ _DriveTask _$DriveTaskFromJson(Map<String, dynamic> json) => _DriveTask(
|
|||||||
transmissionProgress: (json['transmission_progress'] as num?)?.toDouble(),
|
transmissionProgress: (json['transmission_progress'] as num?)?.toDouble(),
|
||||||
errorMessage: json['error_message'] as String?,
|
errorMessage: json['error_message'] as String?,
|
||||||
statusMessage: json['status_message'] as String?,
|
statusMessage: json['status_message'] as String?,
|
||||||
result:
|
result: json['result'] == null
|
||||||
json['result'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['result'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['result'] as Map<String, dynamic>),
|
||||||
poolId: json['pool_id'] as String?,
|
poolId: json['pool_id'] as String?,
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ _SnScrappedLink _$SnScrappedLinkFromJson(Map<String, dynamic> json) =>
|
|||||||
siteName: json['site_name'] as String?,
|
siteName: json['site_name'] as String?,
|
||||||
contentType: json['content_type'] as String?,
|
contentType: json['content_type'] as String?,
|
||||||
author: json['author'] as String?,
|
author: json['author'] as String?,
|
||||||
publishedDate:
|
publishedDate: json['published_date'] == null
|
||||||
json['published_date'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['published_date'] as String),
|
: DateTime.parse(json['published_date'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
|||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
fileMeta: json['file_meta'] as Map<String, dynamic>?,
|
fileMeta: json['file_meta'] as Map<String, dynamic>?,
|
||||||
userMeta: json['user_meta'] as Map<String, dynamic>?,
|
userMeta: json['user_meta'] as Map<String, dynamic>?,
|
||||||
pool:
|
pool: json['pool'] == null
|
||||||
json['pool'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnFilePool.fromJson(json['pool'] as Map<String, dynamic>),
|
: SnFilePool.fromJson(json['pool'] as Map<String, dynamic>),
|
||||||
sensitiveMarks:
|
sensitiveMarks:
|
||||||
@@ -47,15 +46,13 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
|||||||
mimeType: json['mime_type'] as String?,
|
mimeType: json['mime_type'] as String?,
|
||||||
hash: json['hash'] as String?,
|
hash: json['hash'] as String?,
|
||||||
size: (json['size'] as num).toInt(),
|
size: (json['size'] as num).toInt(),
|
||||||
uploadedAt:
|
uploadedAt: json['uploaded_at'] == null
|
||||||
json['uploaded_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['uploaded_at'] as String),
|
: DateTime.parse(json['uploaded_at'] as String),
|
||||||
uploadedTo: json['uploaded_to'] as String?,
|
uploadedTo: json['uploaded_to'] as String?,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -87,8 +84,7 @@ _SnCloudFileIndex _$SnCloudFileIndexFromJson(Map<String, dynamic> json) =>
|
|||||||
file: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
file: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,16 +16,13 @@ _SnFilePool _$SnFilePoolFromJson(Map<String, dynamic> json) => _SnFilePool(
|
|||||||
isHidden: json['is_hidden'] as bool?,
|
isHidden: json['is_hidden'] as bool?,
|
||||||
accountId: json['account_id'] as String?,
|
accountId: json['account_id'] as String?,
|
||||||
resourceIdentifier: json['resource_identifier'] as String?,
|
resourceIdentifier: json['resource_identifier'] as String?,
|
||||||
createdAt:
|
createdAt: json['created_at'] == null
|
||||||
json['created_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt:
|
updatedAt: json['updated_at'] == null
|
||||||
json['updated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ _SnHeatmap _$SnHeatmapFromJson(Map<String, dynamic> json) => _SnHeatmap(
|
|||||||
unit: json['unit'] as String,
|
unit: json['unit'] as String,
|
||||||
periodStart: DateTime.parse(json['period_start'] as String),
|
periodStart: DateTime.parse(json['period_start'] as String),
|
||||||
periodEnd: DateTime.parse(json['period_end'] as String),
|
periodEnd: DateTime.parse(json['period_end'] as String),
|
||||||
items:
|
items: (json['items'] as List<dynamic>)
|
||||||
(json['items'] as List<dynamic>)
|
|
||||||
.map((e) => SnHeatmapItem.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnHeatmapItem.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,29 +8,23 @@ part of 'poll.dart';
|
|||||||
|
|
||||||
_SnPollWithStats _$SnPollWithStatsFromJson(Map<String, dynamic> json) =>
|
_SnPollWithStats _$SnPollWithStatsFromJson(Map<String, dynamic> json) =>
|
||||||
_SnPollWithStats(
|
_SnPollWithStats(
|
||||||
userAnswer:
|
userAnswer: json['user_answer'] == null
|
||||||
json['user_answer'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPollAnswer.fromJson(
|
: SnPollAnswer.fromJson(json['user_answer'] as Map<String, dynamic>),
|
||||||
json['user_answer'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
stats: json['stats'] as Map<String, dynamic>? ?? const {},
|
stats: json['stats'] as Map<String, dynamic>? ?? const {},
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
questions:
|
questions: (json['questions'] as List<dynamic>)
|
||||||
(json['questions'] as List<dynamic>)
|
|
||||||
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
endedAt:
|
endedAt: json['ended_at'] == null
|
||||||
json['ended_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['ended_at'] as String),
|
: DateTime.parse(json['ended_at'] as String),
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -52,25 +46,21 @@ Map<String, dynamic> _$SnPollWithStatsToJson(_SnPollWithStats instance) =>
|
|||||||
|
|
||||||
_SnPoll _$SnPollFromJson(Map<String, dynamic> json) => _SnPoll(
|
_SnPoll _$SnPollFromJson(Map<String, dynamic> json) => _SnPoll(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
questions:
|
questions: (json['questions'] as List<dynamic>)
|
||||||
(json['questions'] as List<dynamic>)
|
|
||||||
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
endedAt:
|
endedAt: json['ended_at'] == null
|
||||||
json['ended_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['ended_at'] as String),
|
: DateTime.parse(json['ended_at'] as String),
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
publisher:
|
publisher: json['publisher'] == null
|
||||||
json['publisher'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -92,8 +82,7 @@ _SnPollQuestion _$SnPollQuestionFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnPollQuestion(
|
_SnPollQuestion(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
type: $enumDecode(_$SnPollQuestionTypeEnumMap, json['type']),
|
type: $enumDecode(_$SnPollQuestionTypeEnumMap, json['type']),
|
||||||
options:
|
options: (json['options'] as List<dynamic>?)
|
||||||
(json['options'] as List<dynamic>?)
|
|
||||||
?.map((e) => SnPollOption.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SnPollOption.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
title: json['title'] as String,
|
title: json['title'] as String,
|
||||||
@@ -145,12 +134,10 @@ _SnPollAnswer _$SnPollAnswerFromJson(Map<String, dynamic> json) =>
|
|||||||
pollId: json['poll_id'] as String,
|
pollId: json['poll_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
|||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
language: json['language'] as String?,
|
language: json['language'] as String?,
|
||||||
editedAt:
|
editedAt: json['edited_at'] == null
|
||||||
json['edited_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['edited_at'] as String),
|
: DateTime.parse(json['edited_at'] as String),
|
||||||
publishedAt:
|
publishedAt: json['published_at'] == null
|
||||||
json['published_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['published_at'] as String),
|
: DateTime.parse(json['published_at'] as String),
|
||||||
visibility: (json['visibility'] as num?)?.toInt() ?? 0,
|
visibility: (json['visibility'] as num?)?.toInt() ?? 0,
|
||||||
@@ -24,12 +22,9 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
|||||||
slug: json['slug'] as String?,
|
slug: json['slug'] as String?,
|
||||||
type: (json['type'] as num?)?.toInt() ?? 0,
|
type: (json['type'] as num?)?.toInt() ?? 0,
|
||||||
meta: json['meta'] as Map<String, dynamic>?,
|
meta: json['meta'] as Map<String, dynamic>?,
|
||||||
embedView:
|
embedView: json['embed_view'] == null
|
||||||
json['embed_view'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPostEmbedView.fromJson(
|
: SnPostEmbedView.fromJson(json['embed_view'] as Map<String, dynamic>),
|
||||||
json['embed_view'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
viewsUnique: (json['views_unique'] as num?)?.toInt() ?? 0,
|
viewsUnique: (json['views_unique'] as num?)?.toInt() ?? 0,
|
||||||
viewsTotal: (json['views_total'] as num?)?.toInt() ?? 0,
|
viewsTotal: (json['views_total'] as num?)?.toInt() ?? 0,
|
||||||
upvotes: (json['upvotes'] as num?)?.toInt() ?? 0,
|
upvotes: (json['upvotes'] as num?)?.toInt() ?? 0,
|
||||||
@@ -38,23 +33,19 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
|||||||
awardedScore: (json['awarded_score'] as num?)?.toInt() ?? 0,
|
awardedScore: (json['awarded_score'] as num?)?.toInt() ?? 0,
|
||||||
pinMode: (json['pin_mode'] as num?)?.toInt(),
|
pinMode: (json['pin_mode'] as num?)?.toInt(),
|
||||||
threadedPostId: json['threaded_post_id'] as String?,
|
threadedPostId: json['threaded_post_id'] as String?,
|
||||||
threadedPost:
|
threadedPost: json['threaded_post'] == null
|
||||||
json['threaded_post'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPost.fromJson(json['threaded_post'] as Map<String, dynamic>),
|
: SnPost.fromJson(json['threaded_post'] as Map<String, dynamic>),
|
||||||
repliedPostId: json['replied_post_id'] as String?,
|
repliedPostId: json['replied_post_id'] as String?,
|
||||||
repliedPost:
|
repliedPost: json['replied_post'] == null
|
||||||
json['replied_post'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPost.fromJson(json['replied_post'] as Map<String, dynamic>),
|
: SnPost.fromJson(json['replied_post'] as Map<String, dynamic>),
|
||||||
forwardedPostId: json['forwarded_post_id'] as String?,
|
forwardedPostId: json['forwarded_post_id'] as String?,
|
||||||
forwardedPost:
|
forwardedPost: json['forwarded_post'] == null
|
||||||
json['forwarded_post'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPost.fromJson(json['forwarded_post'] as Map<String, dynamic>),
|
: SnPost.fromJson(json['forwarded_post'] as Map<String, dynamic>),
|
||||||
realmId: json['realm_id'] as String?,
|
realmId: json['realm_id'] as String?,
|
||||||
realm:
|
realm: json['realm'] == null
|
||||||
json['realm'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||||
attachments:
|
attachments:
|
||||||
@@ -90,16 +81,13 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
|||||||
?.map((e) => SnPostFeaturedRecord.fromJson(e as Map<String, dynamic>))
|
?.map((e) => SnPostFeaturedRecord.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
createdAt:
|
createdAt: json['created_at'] == null
|
||||||
json['created_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt:
|
updatedAt: json['updated_at'] == null
|
||||||
json['updated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
repliedGone: json['replied_gone'] as bool? ?? false,
|
repliedGone: json['replied_gone'] as bool? ?? false,
|
||||||
@@ -214,16 +202,13 @@ _SnPostAward _$SnPostAwardFromJson(Map<String, dynamic> json) => _SnPostAward(
|
|||||||
message: json['message'] as String?,
|
message: json['message'] as String?,
|
||||||
postId: json['post_id'] as String,
|
postId: json['post_id'] as String,
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
createdAt:
|
createdAt: json['created_at'] == null
|
||||||
json['created_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt:
|
updatedAt: json['updated_at'] == null
|
||||||
json['updated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -250,12 +235,10 @@ _SnPostReaction _$SnPostReactionFromJson(Map<String, dynamic> json) =>
|
|||||||
accountId: json['account_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),
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -278,15 +261,13 @@ _SnPostFeaturedRecord _$SnPostFeaturedRecordFromJson(
|
|||||||
) => _SnPostFeaturedRecord(
|
) => _SnPostFeaturedRecord(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
postId: json['post_id'] as String,
|
postId: json['post_id'] as String,
|
||||||
featuredAt:
|
featuredAt: json['featured_at'] == null
|
||||||
json['featured_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['featured_at'] as String),
|
: DateTime.parse(json['featured_at'] as String),
|
||||||
socialCredits: (json['social_credits'] as num).toInt(),
|
socialCredits: (json['social_credits'] as num).toInt(),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ _SnPublicationSite _$SnPublicationSiteFromJson(Map<String, dynamic> json) =>
|
|||||||
accountId: json['account_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),
|
||||||
pages:
|
pages: (json['pages'] as List<dynamic>)
|
||||||
(json['pages'] as List<dynamic>)
|
|
||||||
.map((e) => SnPublicationPage.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnPublicationPage.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,34 +12,27 @@ _SnPublisher _$SnPublisherFromJson(Map<String, dynamic> json) => _SnPublisher(
|
|||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
nick: json['nick'] as String? ?? '',
|
nick: json['nick'] as String? ?? '',
|
||||||
bio: json['bio'] as String? ?? '',
|
bio: json['bio'] as String? ?? '',
|
||||||
picture:
|
picture: json['picture'] == null
|
||||||
json['picture'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||||
background:
|
background: json['background'] == null
|
||||||
json['background'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
accountId: json['account_id'] as String?,
|
accountId: json['account_id'] as String?,
|
||||||
createdAt:
|
createdAt: json['created_at'] == null
|
||||||
json['created_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt:
|
updatedAt: json['updated_at'] == null
|
||||||
json['updated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
realmId: json['realm_id'] as String?,
|
realmId: json['realm_id'] as String?,
|
||||||
verification:
|
verification: json['verification'] == null
|
||||||
json['verification'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnVerificationMark.fromJson(
|
: SnVerificationMark.fromJson(
|
||||||
json['verification'] as Map<String, dynamic>,
|
json['verification'] as Map<String, dynamic>,
|
||||||
@@ -67,24 +60,20 @@ Map<String, dynamic> _$SnPublisherToJson(_SnPublisher instance) =>
|
|||||||
_SnPublisherMember _$SnPublisherMemberFromJson(Map<String, dynamic> json) =>
|
_SnPublisherMember _$SnPublisherMemberFromJson(Map<String, dynamic> json) =>
|
||||||
_SnPublisherMember(
|
_SnPublisherMember(
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
publisher:
|
publisher: json['publisher'] == null
|
||||||
json['publisher'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
role: (json['role'] as num).toInt(),
|
role: (json['role'] as num).toInt(),
|
||||||
joinedAt:
|
joinedAt: json['joined_at'] == null
|
||||||
json['joined_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['joined_at'] as String),
|
: DateTime.parse(json['joined_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,25 +12,21 @@ _SnRealm _$SnRealmFromJson(Map<String, dynamic> json) => _SnRealm(
|
|||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
description: json['description'] as String? ?? '',
|
description: json['description'] as String? ?? '',
|
||||||
verifiedAs: json['verified_as'] as String?,
|
verifiedAs: json['verified_as'] as String?,
|
||||||
verifiedAt:
|
verifiedAt: json['verified_at'] == null
|
||||||
json['verified_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['verified_at'] as String),
|
: DateTime.parse(json['verified_at'] as String),
|
||||||
isCommunity: json['is_community'] as bool,
|
isCommunity: json['is_community'] as bool,
|
||||||
isPublic: json['is_public'] as bool,
|
isPublic: json['is_public'] as bool,
|
||||||
picture:
|
picture: json['picture'] == null
|
||||||
json['picture'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||||
background:
|
background: json['background'] == null
|
||||||
json['background'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -55,32 +51,25 @@ Map<String, dynamic> _$SnRealmToJson(_SnRealm instance) => <String, dynamic>{
|
|||||||
_SnRealmMember _$SnRealmMemberFromJson(Map<String, dynamic> json) =>
|
_SnRealmMember _$SnRealmMemberFromJson(Map<String, dynamic> json) =>
|
||||||
_SnRealmMember(
|
_SnRealmMember(
|
||||||
realmId: json['realm_id'] as String,
|
realmId: json['realm_id'] as String,
|
||||||
realm:
|
realm: json['realm'] == null
|
||||||
json['realm'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
role: (json['role'] as num).toInt(),
|
role: (json['role'] as num).toInt(),
|
||||||
joinedAt:
|
joinedAt: json['joined_at'] == null
|
||||||
json['joined_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['joined_at'] as String),
|
: DateTime.parse(json['joined_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
status:
|
status: json['status'] == null
|
||||||
json['status'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccountStatus.fromJson(
|
: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||||
json['status'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnRealmMemberToJson(_SnRealmMember instance) =>
|
Map<String, dynamic> _$SnRealmMemberToJson(_SnRealmMember instance) =>
|
||||||
|
|||||||
@@ -9,20 +9,17 @@ part of 'reference.dart';
|
|||||||
_Reference _$ReferenceFromJson(Map<String, dynamic> json) => _Reference(
|
_Reference _$ReferenceFromJson(Map<String, dynamic> json) => _Reference(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
fileId: json['file_id'] as String,
|
fileId: json['file_id'] as String,
|
||||||
file:
|
file: json['file'] == null
|
||||||
json['file'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
||||||
usage: json['usage'] as String,
|
usage: json['usage'] as String,
|
||||||
resourceId: json['resource_id'] as String,
|
resourceId: json['resource_id'] as String,
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,24 +8,20 @@ part of 'relationship.dart';
|
|||||||
|
|
||||||
_SnRelationship _$SnRelationshipFromJson(Map<String, dynamic> json) =>
|
_SnRelationship _$SnRelationshipFromJson(Map<String, dynamic> json) =>
|
||||||
_SnRelationship(
|
_SnRelationship(
|
||||||
createdAt:
|
createdAt: json['created_at'] == null
|
||||||
json['created_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt:
|
updatedAt: json['updated_at'] == null
|
||||||
json['updated_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
relatedId: json['related_id'] as String,
|
relatedId: json['related_id'] as String,
|
||||||
related: SnAccount.fromJson(json['related'] as Map<String, dynamic>),
|
related: SnAccount.fromJson(json['related'] as Map<String, dynamic>),
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
status: (json['status'] as num).toInt(),
|
status: (json['status'] as num).toInt(),
|
||||||
|
|||||||
@@ -11,14 +11,12 @@ _SnSticker _$SnStickerFromJson(Map<String, dynamic> json) => _SnSticker(
|
|||||||
slug: json['slug'] as String,
|
slug: json['slug'] as String,
|
||||||
image: SnCloudFile.fromJson(json['image'] as Map<String, dynamic>),
|
image: SnCloudFile.fromJson(json['image'] as Map<String, dynamic>),
|
||||||
packId: json['pack_id'] as String,
|
packId: json['pack_id'] as String,
|
||||||
pack:
|
pack: json['pack'] == null
|
||||||
json['pack'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnStickerPack.fromJson(json['pack'] as Map<String, dynamic>),
|
: SnStickerPack.fromJson(json['pack'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -42,18 +40,15 @@ _SnStickerPack _$SnStickerPackFromJson(Map<String, dynamic> json) =>
|
|||||||
description: json['description'] as String,
|
description: json['description'] as String,
|
||||||
prefix: json['prefix'] as String,
|
prefix: json['prefix'] as String,
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
icon:
|
icon: json['icon'] == null
|
||||||
json['icon'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnCloudFile.fromJson(json['icon'] as Map<String, dynamic>),
|
: SnCloudFile.fromJson(json['icon'] as Map<String, dynamic>),
|
||||||
publisher:
|
publisher: json['publisher'] == null
|
||||||
json['publisher'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
stickers:
|
stickers:
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ _StreamThinkingRequest _$StreamThinkingRequestFromJson(
|
|||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList() ??
|
.toList() ??
|
||||||
const [],
|
const [],
|
||||||
attachedPosts:
|
attachedPosts: (json['attached_posts'] as List<dynamic>?)
|
||||||
(json['attached_posts'] as List<dynamic>?)
|
|
||||||
?.map((e) => e as String)
|
?.map((e) => e as String)
|
||||||
.toList(),
|
.toList(),
|
||||||
attachedMessages:
|
attachedMessages: (json['attached_messages'] as List<dynamic>?)
|
||||||
(json['attached_messages'] as List<dynamic>?)
|
|
||||||
?.map((e) => e as Map<String, dynamic>)
|
?.map((e) => e as Map<String, dynamic>)
|
||||||
.toList(),
|
.toList(),
|
||||||
serviceId: json['service_id'] as String?,
|
serviceId: json['service_id'] as String?,
|
||||||
@@ -87,14 +85,10 @@ _SnThinkingMessagePart _$SnThinkingMessagePartFromJson(
|
|||||||
(json['type'] as num).toInt(),
|
(json['type'] as num).toInt(),
|
||||||
),
|
),
|
||||||
text: json['text'] as String?,
|
text: json['text'] as String?,
|
||||||
functionCall:
|
functionCall: json['function_call'] == null
|
||||||
json['function_call'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnFunctionCall.fromJson(
|
: SnFunctionCall.fromJson(json['function_call'] as Map<String, dynamic>),
|
||||||
json['function_call'] as Map<String, dynamic>,
|
functionResult: json['function_result'] == null
|
||||||
),
|
|
||||||
functionResult:
|
|
||||||
json['function_result'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnFunctionResult.fromJson(
|
: SnFunctionResult.fromJson(
|
||||||
json['function_result'] as Map<String, dynamic>,
|
json['function_result'] as Map<String, dynamic>,
|
||||||
@@ -119,8 +113,7 @@ _SnThinkingSequence _$SnThinkingSequenceFromJson(Map<String, dynamic> json) =>
|
|||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -159,16 +152,14 @@ _SnThinkingThought _$SnThinkingThoughtFromJson(Map<String, dynamic> json) =>
|
|||||||
tokenCount: (json['token_count'] as num?)?.toInt(),
|
tokenCount: (json['token_count'] as num?)?.toInt(),
|
||||||
modelName: json['model_name'] as String?,
|
modelName: json['model_name'] as String?,
|
||||||
sequenceId: json['sequence_id'] as String,
|
sequenceId: json['sequence_id'] as String,
|
||||||
sequence:
|
sequence: json['sequence'] == null
|
||||||
json['sequence'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnThinkingSequence.fromJson(
|
: SnThinkingSequence.fromJson(
|
||||||
json['sequence'] as Map<String, dynamic>,
|
json['sequence'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -206,8 +197,7 @@ _ThoughtServicesResponse _$ThoughtServicesResponseFromJson(
|
|||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _ThoughtServicesResponse(
|
) => _ThoughtServicesResponse(
|
||||||
defaultService: json['default_service'] as String,
|
defaultService: json['default_service'] as String,
|
||||||
services:
|
services: (json['services'] as List<dynamic>)
|
||||||
(json['services'] as List<dynamic>)
|
|
||||||
.map((e) => ThoughtService.fromJson(e as Map<String, dynamic>))
|
.map((e) => ThoughtService.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,19 +8,16 @@ part of 'wallet.dart';
|
|||||||
|
|
||||||
_SnWallet _$SnWalletFromJson(Map<String, dynamic> json) => _SnWallet(
|
_SnWallet _$SnWalletFromJson(Map<String, dynamic> json) => _SnWallet(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
pockets:
|
pockets: (json['pockets'] as List<dynamic>)
|
||||||
(json['pockets'] as List<dynamic>)
|
|
||||||
.map((e) => SnWalletPocket.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnWalletPocket.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -77,8 +74,7 @@ _SnWalletPocket _$SnWalletPocketFromJson(Map<String, dynamic> json) =>
|
|||||||
walletId: json['wallet_id'] as String,
|
walletId: json['wallet_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -102,19 +98,16 @@ _SnTransaction _$SnTransactionFromJson(Map<String, dynamic> json) =>
|
|||||||
remarks: json['remarks'] as String?,
|
remarks: json['remarks'] as String?,
|
||||||
type: (json['type'] as num).toInt(),
|
type: (json['type'] as num).toInt(),
|
||||||
payerWalletId: json['payer_wallet_id'] as String?,
|
payerWalletId: json['payer_wallet_id'] as String?,
|
||||||
payerWallet:
|
payerWallet: json['payer_wallet'] == null
|
||||||
json['payer_wallet'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnWallet.fromJson(json['payer_wallet'] as Map<String, dynamic>),
|
: SnWallet.fromJson(json['payer_wallet'] as Map<String, dynamic>),
|
||||||
payeeWalletId: json['payee_wallet_id'] as String?,
|
payeeWalletId: json['payee_wallet_id'] as String?,
|
||||||
payeeWallet:
|
payeeWallet: json['payee_wallet'] == null
|
||||||
json['payee_wallet'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnWallet.fromJson(json['payee_wallet'] as Map<String, dynamic>),
|
: SnWallet.fromJson(json['payee_wallet'] as Map<String, dynamic>),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -140,8 +133,7 @@ _SnWalletSubscription _$SnWalletSubscriptionFromJson(
|
|||||||
) => _SnWalletSubscription(
|
) => _SnWalletSubscription(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
begunAt: DateTime.parse(json['begun_at'] as String),
|
begunAt: DateTime.parse(json['begun_at'] as String),
|
||||||
endedAt:
|
endedAt: json['ended_at'] == null
|
||||||
json['ended_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['ended_at'] as String),
|
: DateTime.parse(json['ended_at'] as String),
|
||||||
identifier: json['identifier'] as String,
|
identifier: json['identifier'] as String,
|
||||||
@@ -153,21 +145,18 @@ _SnWalletSubscription _$SnWalletSubscriptionFromJson(
|
|||||||
basePrice: (json['base_price'] as num?)?.toDouble(),
|
basePrice: (json['base_price'] as num?)?.toDouble(),
|
||||||
couponId: json['coupon_id'] as String?,
|
couponId: json['coupon_id'] as String?,
|
||||||
coupon: json['coupon'],
|
coupon: json['coupon'],
|
||||||
renewalAt:
|
renewalAt: json['renewal_at'] == null
|
||||||
json['renewal_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['renewal_at'] as String),
|
: DateTime.parse(json['renewal_at'] as String),
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
isAvailable: json['is_available'] as bool? ?? true,
|
isAvailable: json['is_available'] as bool? ?? true,
|
||||||
finalPrice: (json['final_price'] as num?)?.toDouble(),
|
finalPrice: (json['final_price'] as num?)?.toDouble(),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -204,8 +193,7 @@ _SnWalletSubscriptionRef _$SnWalletSubscriptionRefFromJson(
|
|||||||
isActive: json['is_active'] as bool,
|
isActive: json['is_active'] as bool,
|
||||||
accountId: json['account_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
@@ -239,8 +227,7 @@ _SnWalletOrder _$SnWalletOrderFromJson(Map<String, dynamic> json) =>
|
|||||||
issuerAppId: json['issuer_app_id'] as String?,
|
issuerAppId: json['issuer_app_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -269,41 +256,34 @@ _SnWalletGift _$SnWalletGiftFromJson(Map<String, dynamic> json) =>
|
|||||||
giftCode: json['gift_code'] as String,
|
giftCode: json['gift_code'] as String,
|
||||||
subscriptionIdentifier: json['subscription_identifier'] as String,
|
subscriptionIdentifier: json['subscription_identifier'] as String,
|
||||||
recipientId: json['recipient_id'] as String?,
|
recipientId: json['recipient_id'] as String?,
|
||||||
recipient:
|
recipient: json['recipient'] == null
|
||||||
json['recipient'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['recipient'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['recipient'] as Map<String, dynamic>),
|
||||||
gifterId: json['gifter_id'] as String,
|
gifterId: json['gifter_id'] as String,
|
||||||
gifter:
|
gifter: json['gifter'] == null
|
||||||
json['gifter'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['gifter'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['gifter'] as Map<String, dynamic>),
|
||||||
redeemerId: json['redeemer_id'] as String?,
|
redeemerId: json['redeemer_id'] as String?,
|
||||||
redeemer:
|
redeemer: json['redeemer'] == null
|
||||||
json['redeemer'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['redeemer'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['redeemer'] as Map<String, dynamic>),
|
||||||
message: json['message'] as String?,
|
message: json['message'] as String?,
|
||||||
status: (json['status'] as num).toInt(),
|
status: (json['status'] as num).toInt(),
|
||||||
redeemedAt:
|
redeemedAt: json['redeemed_at'] == null
|
||||||
json['redeemed_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['redeemed_at'] as String),
|
: DateTime.parse(json['redeemed_at'] as String),
|
||||||
expiredAt:
|
expiredAt: json['expired_at'] == null
|
||||||
json['expired_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['expired_at'] as String),
|
: DateTime.parse(json['expired_at'] as String),
|
||||||
subscriptionId: json['subscription_id'] as String?,
|
subscriptionId: json['subscription_id'] as String?,
|
||||||
subscription:
|
subscription: json['subscription'] == null
|
||||||
json['subscription'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnWalletSubscription.fromJson(
|
: SnWalletSubscription.fromJson(
|
||||||
json['subscription'] as Map<String, dynamic>,
|
json['subscription'] as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -330,9 +310,8 @@ Map<String, dynamic> _$SnWalletGiftToJson(_SnWalletGift instance) =>
|
|||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
};
|
};
|
||||||
|
|
||||||
_SnWalletFund _$SnWalletFundFromJson(
|
_SnWalletFund _$SnWalletFundFromJson(Map<String, dynamic> json) =>
|
||||||
Map<String, dynamic> json,
|
_SnWalletFund(
|
||||||
) => _SnWalletFund(
|
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
currency: json['currency'] as String,
|
currency: json['currency'] as String,
|
||||||
totalAmount: (json['total_amount'] as num).toDouble(),
|
totalAmount: (json['total_amount'] as num).toDouble(),
|
||||||
@@ -342,23 +321,20 @@ _SnWalletFund _$SnWalletFundFromJson(
|
|||||||
status: (json['status'] as num).toInt(),
|
status: (json['status'] as num).toInt(),
|
||||||
message: json['message'] as String?,
|
message: json['message'] as String?,
|
||||||
creatorAccountId: json['creator_account_id'] as String,
|
creatorAccountId: json['creator_account_id'] as String,
|
||||||
creatorAccount:
|
creatorAccount: json['creator_account'] == null
|
||||||
json['creator_account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['creator_account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['creator_account'] as Map<String, dynamic>),
|
||||||
expiredAt: DateTime.parse(json['expired_at'] as String),
|
expiredAt: DateTime.parse(json['expired_at'] as String),
|
||||||
recipients:
|
recipients: (json['recipients'] as List<dynamic>)
|
||||||
(json['recipients'] as List<dynamic>)
|
|
||||||
.map((e) => SnWalletFundRecipient.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnWalletFundRecipient.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
isOpen: json['is_open'] as bool,
|
isOpen: json['is_open'] as bool,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnWalletFundToJson(_SnWalletFund instance) =>
|
Map<String, dynamic> _$SnWalletFundToJson(_SnWalletFund instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -386,22 +362,17 @@ _SnWalletFundRecipient _$SnWalletFundRecipientFromJson(
|
|||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
fundId: json['fund_id'] as String,
|
fundId: json['fund_id'] as String,
|
||||||
recipientAccountId: json['recipient_account_id'] as String,
|
recipientAccountId: json['recipient_account_id'] as String,
|
||||||
recipientAccount:
|
recipientAccount: json['recipient_account'] == null
|
||||||
json['recipient_account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(
|
: SnAccount.fromJson(json['recipient_account'] as Map<String, dynamic>),
|
||||||
json['recipient_account'] as Map<String, dynamic>,
|
|
||||||
),
|
|
||||||
amount: (json['amount'] as num).toDouble(),
|
amount: (json['amount'] as num).toDouble(),
|
||||||
isReceived: json['is_received'] as bool,
|
isReceived: json['is_received'] as bool,
|
||||||
receivedAt:
|
receivedAt: json['received_at'] == null
|
||||||
json['received_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['received_at'] as String),
|
: DateTime.parse(json['received_at'] as String),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -425,31 +396,27 @@ _SnLotteryTicket _$SnLotteryTicketFromJson(Map<String, dynamic> json) =>
|
|||||||
_SnLotteryTicket(
|
_SnLotteryTicket(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
accountId: json['account_id'] as String,
|
accountId: json['account_id'] as String,
|
||||||
account:
|
account: json['account'] == null
|
||||||
json['account'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
regionOneNumbers:
|
regionOneNumbers: (json['region_one_numbers'] as List<dynamic>)
|
||||||
(json['region_one_numbers'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
.map((e) => (e as num).toInt())
|
||||||
.toList(),
|
.toList(),
|
||||||
regionTwoNumber: (json['region_two_number'] as num).toInt(),
|
regionTwoNumber: (json['region_two_number'] as num).toInt(),
|
||||||
multiplier: (json['multiplier'] as num).toInt(),
|
multiplier: (json['multiplier'] as num).toInt(),
|
||||||
drawStatus: (json['draw_status'] as num).toInt(),
|
drawStatus: (json['draw_status'] as num).toInt(),
|
||||||
drawDate:
|
drawDate: json['draw_date'] == null
|
||||||
json['draw_date'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['draw_date'] as String),
|
: DateTime.parse(json['draw_date'] as String),
|
||||||
matchedRegionOneNumbers:
|
matchedRegionOneNumbers:
|
||||||
(json['matched_region_one_numbers'] as List<dynamic>?)
|
(json['matched_region_one_numbers'] as List<dynamic>?)
|
||||||
?.map((e) => (e as num).toInt())
|
?.map((e) => (e as num).toInt())
|
||||||
.toList(),
|
.toList(),
|
||||||
matchedRegionTwoNumber:
|
matchedRegionTwoNumber: (json['matched_region_two_number'] as num?)
|
||||||
(json['matched_region_two_number'] as num?)?.toInt(),
|
?.toInt(),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -471,26 +438,24 @@ Map<String, dynamic> _$SnLotteryTicketToJson(_SnLotteryTicket instance) =>
|
|||||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
};
|
};
|
||||||
|
|
||||||
_SnLotteryRecord _$SnLotteryRecordFromJson(Map<String, dynamic> json) =>
|
_SnLotteryRecord _$SnLotteryRecordFromJson(
|
||||||
_SnLotteryRecord(
|
Map<String, dynamic> json,
|
||||||
|
) => _SnLotteryRecord(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
drawDate: DateTime.parse(json['draw_date'] as String),
|
drawDate: DateTime.parse(json['draw_date'] as String),
|
||||||
winningRegionOneNumbers:
|
winningRegionOneNumbers: (json['winning_region_one_numbers'] as List<dynamic>)
|
||||||
(json['winning_region_one_numbers'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
.map((e) => (e as num).toInt())
|
||||||
.toList(),
|
.toList(),
|
||||||
winningRegionTwoNumber:
|
winningRegionTwoNumber: (json['winning_region_two_number'] as num).toInt(),
|
||||||
(json['winning_region_two_number'] as num).toInt(),
|
|
||||||
totalTickets: (json['total_tickets'] as num).toInt(),
|
totalTickets: (json['total_tickets'] as num).toInt(),
|
||||||
totalPrizesAwarded: (json['total_prizes_awarded'] as num).toInt(),
|
totalPrizesAwarded: (json['total_prizes_awarded'] as num).toInt(),
|
||||||
totalPrizeAmount: (json['total_prize_amount'] as num).toDouble(),
|
totalPrizeAmount: (json['total_prize_amount'] as num).toDouble(),
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SnLotteryRecordToJson(_SnLotteryRecord instance) =>
|
Map<String, dynamic> _$SnLotteryRecordToJson(_SnLotteryRecord instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ _SnWebFeed _$SnWebFeedFromJson(Map<String, dynamic> json) => _SnWebFeed(
|
|||||||
url: json['url'] as String,
|
url: json['url'] as String,
|
||||||
title: json['title'] as String,
|
title: json['title'] as String,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
preview:
|
preview: json['preview'] == null
|
||||||
json['preview'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnScrappedLink.fromJson(json['preview'] as Map<String, dynamic>),
|
: SnScrappedLink.fromJson(json['preview'] as Map<String, dynamic>),
|
||||||
config:
|
config: json['config'] == null
|
||||||
json['config'] == null
|
|
||||||
? const SnWebFeedConfig()
|
? const SnWebFeedConfig()
|
||||||
: SnWebFeedConfig.fromJson(json['config'] as Map<String, dynamic>),
|
: SnWebFeedConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||||
publisherId: json['publisher_id'] as String,
|
publisherId: json['publisher_id'] as String,
|
||||||
@@ -33,8 +31,7 @@ _SnWebFeed _$SnWebFeedFromJson(Map<String, dynamic> json) => _SnWebFeed(
|
|||||||
const [],
|
const [],
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
@@ -61,26 +58,20 @@ _SnWebArticle _$SnWebArticleFromJson(Map<String, dynamic> json) =>
|
|||||||
url: json['url'] as String,
|
url: json['url'] as String,
|
||||||
author: json['author'] as String?,
|
author: json['author'] as String?,
|
||||||
meta: json['meta'] as Map<String, dynamic>?,
|
meta: json['meta'] as Map<String, dynamic>?,
|
||||||
preview:
|
preview: json['preview'] == null
|
||||||
json['preview'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnScrappedLink.fromJson(
|
: SnScrappedLink.fromJson(json['preview'] as Map<String, dynamic>),
|
||||||
json['preview'] as Map<String, dynamic>,
|
feed: json['feed'] == null
|
||||||
),
|
|
||||||
feed:
|
|
||||||
json['feed'] == null
|
|
||||||
? null
|
? null
|
||||||
: SnWebFeed.fromJson(json['feed'] as Map<String, dynamic>),
|
: SnWebFeed.fromJson(json['feed'] as Map<String, dynamic>),
|
||||||
content: json['content'] as String?,
|
content: json['content'] as String?,
|
||||||
publishedAt:
|
publishedAt: json['published_at'] == null
|
||||||
json['published_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['published_at'] as String),
|
: DateTime.parse(json['published_at'] as String),
|
||||||
feedId: json['feed_id'] as String,
|
feedId: json['feed_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),
|
||||||
deletedAt:
|
deletedAt: json['deleted_at'] == null
|
||||||
json['deleted_at'] == null
|
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['deleted_at'] as String),
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -330,13 +330,127 @@ class ServerState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerStateNotifier extends StateNotifier<ServerState> {
|
class ServerStateNotifier extends Notifier<ServerState> {
|
||||||
final ActivityRpcServer server;
|
late final ActivityRpcServer server;
|
||||||
final Dio apiClient;
|
late final Dio apiClient;
|
||||||
Timer? _renewalTimer;
|
Timer? _renewalTimer;
|
||||||
|
|
||||||
ServerStateNotifier(this.apiClient, this.server)
|
@override
|
||||||
: super(ServerState(status: 'Server not started'));
|
ServerState build() {
|
||||||
|
apiClient = ref.watch(apiClientProvider);
|
||||||
|
server = ActivityRpcServer({});
|
||||||
|
_setupHandlers();
|
||||||
|
ref.onDispose(() {
|
||||||
|
_stopRenewal();
|
||||||
|
server.stop();
|
||||||
|
});
|
||||||
|
return ServerState(status: 'Server not started');
|
||||||
|
}
|
||||||
|
|
||||||
|
void _setupHandlers() {
|
||||||
|
server.updateHandlers({
|
||||||
|
'connection': (socket) {
|
||||||
|
final clientId =
|
||||||
|
socket is _WsSocketWrapper
|
||||||
|
? socket.clientId
|
||||||
|
: (socket as IpcSocketWrapper).clientId;
|
||||||
|
updateStatus('Client connected (ID: $clientId)');
|
||||||
|
socket.send({
|
||||||
|
'cmd': 'DISPATCH',
|
||||||
|
'data': {
|
||||||
|
'v': 1,
|
||||||
|
'config': {
|
||||||
|
'cdn_host': 'fake.cdn',
|
||||||
|
'api_endpoint': '//fake.api',
|
||||||
|
'environment': 'dev',
|
||||||
|
},
|
||||||
|
'user': {
|
||||||
|
'id': 'fake_user_id',
|
||||||
|
'username': 'FakeUser',
|
||||||
|
'discriminator': '0001',
|
||||||
|
'avatar': null,
|
||||||
|
'bot': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'evt': 'READY',
|
||||||
|
'nonce': '12345',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'message': (socket, dynamic data) async {
|
||||||
|
if (data['cmd'] == 'SET_ACTIVITY') {
|
||||||
|
final activity = data['args']['activity'];
|
||||||
|
final appId = 'rpc:${socket.clientId}';
|
||||||
|
|
||||||
|
final currentId = currentActivityManualId;
|
||||||
|
if (currentId != null && currentId != appId) {
|
||||||
|
talker.info(
|
||||||
|
'Skipped the new SET_ACTIVITY command due to there is one existing...',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addActivity('Activity: ${activity['details'] ?? 'Untitled'}');
|
||||||
|
// https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure
|
||||||
|
final type = switch (activity['type']) {
|
||||||
|
0 => 1, // Discord Playing -> Playing
|
||||||
|
2 => 2, // Discord Music -> Listening
|
||||||
|
3 => 2, // Discord Watching -> Listening
|
||||||
|
_ => 1, // Discord Competing (or null) -> Playing
|
||||||
|
};
|
||||||
|
final title = activity['name'] ?? activity['assets']?['small_text'];
|
||||||
|
final subtitle =
|
||||||
|
activity['details'] ?? activity['assets']?['large_text'];
|
||||||
|
var imageSmall = activity['assets']?['small_image'];
|
||||||
|
var imageLarge = activity['assets']?['large_image'];
|
||||||
|
if (imageSmall != null && !imageSmall!.contains(':')) {
|
||||||
|
imageSmall = 'discord:$imageSmall';
|
||||||
|
}
|
||||||
|
if (imageLarge != null && !imageLarge!.contains(':')) {
|
||||||
|
imageLarge = 'discord:$imageLarge';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final activityData = {
|
||||||
|
'type': type,
|
||||||
|
'manual_id': appId,
|
||||||
|
'title': title,
|
||||||
|
'subtitle': subtitle,
|
||||||
|
'caption': activity['state'],
|
||||||
|
'title_url': activity['assets']?['small_text_url'],
|
||||||
|
'subtitle_url': activity['assets']?['large_text_url'],
|
||||||
|
'small_image': imageSmall,
|
||||||
|
'large_image': imageLarge,
|
||||||
|
'meta': activity,
|
||||||
|
'lease_minutes': kPresenceActivityLease,
|
||||||
|
};
|
||||||
|
|
||||||
|
await apiClient.post('/pass/activities', data: activityData);
|
||||||
|
setCurrentActivity(appId, activityData);
|
||||||
|
} catch (e) {
|
||||||
|
talker.log('Failed to set remote activity status: $e');
|
||||||
|
}
|
||||||
|
socket.send({
|
||||||
|
'cmd': 'SET_ACTIVITY',
|
||||||
|
'data': data['args']['activity'],
|
||||||
|
'evt': null,
|
||||||
|
'nonce': data['nonce'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'close': (socket) async {
|
||||||
|
updateStatus('Client disconnected');
|
||||||
|
final currentId = currentActivityManualId;
|
||||||
|
try {
|
||||||
|
await apiClient.delete(
|
||||||
|
'/pass/activities',
|
||||||
|
queryParameters: {'manualId': currentId},
|
||||||
|
);
|
||||||
|
setCurrentActivity(null, null);
|
||||||
|
} catch (e) {
|
||||||
|
talker.log('Failed to unset remote activity status: $e');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String? get currentActivityManualId => state.currentActivityManualId;
|
String? get currentActivityManualId => state.currentActivityManualId;
|
||||||
|
|
||||||
@@ -408,119 +522,8 @@ class ServerStateNotifier extends StateNotifier<ServerState> {
|
|||||||
const kPresenceActivityLease = 5;
|
const kPresenceActivityLease = 5;
|
||||||
|
|
||||||
// Providers
|
// Providers
|
||||||
final rpcServerStateProvider = StateNotifierProvider<
|
final rpcServerStateProvider =
|
||||||
ServerStateNotifier,
|
NotifierProvider<ServerStateNotifier, ServerState>(ServerStateNotifier.new);
|
||||||
ServerState
|
|
||||||
>((ref) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
final server = ActivityRpcServer({});
|
|
||||||
final notifier = ServerStateNotifier(apiClient, server);
|
|
||||||
server.updateHandlers({
|
|
||||||
'connection': (socket) {
|
|
||||||
final clientId =
|
|
||||||
socket is _WsSocketWrapper
|
|
||||||
? socket.clientId
|
|
||||||
: (socket as IpcSocketWrapper).clientId;
|
|
||||||
notifier.updateStatus('Client connected (ID: $clientId)');
|
|
||||||
socket.send({
|
|
||||||
'cmd': 'DISPATCH',
|
|
||||||
'data': {
|
|
||||||
'v': 1,
|
|
||||||
'config': {
|
|
||||||
'cdn_host': 'fake.cdn',
|
|
||||||
'api_endpoint': '//fake.api',
|
|
||||||
'environment': 'dev',
|
|
||||||
},
|
|
||||||
'user': {
|
|
||||||
'id': 'fake_user_id',
|
|
||||||
'username': 'FakeUser',
|
|
||||||
'discriminator': '0001',
|
|
||||||
'avatar': null,
|
|
||||||
'bot': false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'evt': 'READY',
|
|
||||||
'nonce': '12345',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'message': (socket, dynamic data) async {
|
|
||||||
if (data['cmd'] == 'SET_ACTIVITY') {
|
|
||||||
final activity = data['args']['activity'];
|
|
||||||
final appId = 'rpc:${socket.clientId}';
|
|
||||||
|
|
||||||
final currentId = notifier.currentActivityManualId;
|
|
||||||
if (currentId != null && currentId != appId) {
|
|
||||||
talker.info(
|
|
||||||
'Skipped the new SET_ACTIVITY command due to there is one existing...',
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
notifier.addActivity('Activity: ${activity['details'] ?? 'Untitled'}');
|
|
||||||
// https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure
|
|
||||||
final type = switch (activity['type']) {
|
|
||||||
0 => 1, // Discord Playing -> Playing
|
|
||||||
2 => 2, // Discord Music -> Listening
|
|
||||||
3 => 2, // Discord Watching -> Listening
|
|
||||||
_ => 1, // Discord Competing (or null) -> Playing
|
|
||||||
};
|
|
||||||
final title = activity['name'] ?? activity['assets']?['small_text'];
|
|
||||||
final subtitle =
|
|
||||||
activity['details'] ?? activity['assets']?['large_text'];
|
|
||||||
var imageSmall = activity['assets']?['small_image'];
|
|
||||||
var imageLarge = activity['assets']?['large_image'];
|
|
||||||
if (imageSmall != null && !imageSmall!.contains(':')) {
|
|
||||||
imageSmall = 'discord:$imageSmall';
|
|
||||||
}
|
|
||||||
if (imageLarge != null && !imageLarge!.contains(':')) {
|
|
||||||
imageLarge = 'discord:$imageLarge';
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
final activityData = {
|
|
||||||
'type': type,
|
|
||||||
'manual_id': appId,
|
|
||||||
'title': title,
|
|
||||||
'subtitle': subtitle,
|
|
||||||
'caption': activity['state'],
|
|
||||||
'title_url': activity['assets']?['small_text_url'],
|
|
||||||
'subtitle_url': activity['assets']?['large_text_url'],
|
|
||||||
'small_image': imageSmall,
|
|
||||||
'large_image': imageLarge,
|
|
||||||
'meta': activity,
|
|
||||||
'lease_minutes': kPresenceActivityLease,
|
|
||||||
};
|
|
||||||
|
|
||||||
await apiClient.post('/pass/activities', data: activityData);
|
|
||||||
notifier.setCurrentActivity(appId, activityData);
|
|
||||||
} catch (e) {
|
|
||||||
talker.log('Failed to set remote activity status: $e');
|
|
||||||
}
|
|
||||||
socket.send({
|
|
||||||
'cmd': 'SET_ACTIVITY',
|
|
||||||
'data': data['args']['activity'],
|
|
||||||
'evt': null,
|
|
||||||
'nonce': data['nonce'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'close': (socket) async {
|
|
||||||
notifier.updateStatus('Client disconnected');
|
|
||||||
final currentId = notifier.currentActivityManualId;
|
|
||||||
try {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
await apiClient.delete(
|
|
||||||
'/pass/activities',
|
|
||||||
queryParameters: {'manualId': currentId},
|
|
||||||
);
|
|
||||||
notifier.setCurrentActivity(null, null);
|
|
||||||
} catch (e) {
|
|
||||||
talker.log('Failed to unset remote activity status: $e');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return notifier;
|
|
||||||
});
|
|
||||||
|
|
||||||
final rpcServerProvider = Provider<ActivityRpcServer>((ref) {
|
final rpcServerProvider = Provider<ActivityRpcServer>((ref) {
|
||||||
final notifier = ref.watch(rpcServerStateProvider.notifier);
|
final notifier = ref.watch(rpcServerStateProvider.notifier);
|
||||||
|
|||||||
@@ -6,152 +6,83 @@ part of 'activity_rpc.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$presenceActivitiesHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
@ProviderFor(presenceActivities)
|
@ProviderFor(presenceActivities)
|
||||||
const presenceActivitiesProvider = PresenceActivitiesFamily();
|
const presenceActivitiesProvider = PresenceActivitiesFamily._();
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
final class PresenceActivitiesProvider
|
||||||
class PresenceActivitiesFamily
|
extends
|
||||||
extends Family<AsyncValue<List<SnPresenceActivity>>> {
|
$FunctionalProvider<
|
||||||
/// See also [presenceActivities].
|
AsyncValue<List<SnPresenceActivity>>,
|
||||||
const PresenceActivitiesFamily();
|
List<SnPresenceActivity>,
|
||||||
|
FutureOr<List<SnPresenceActivity>>
|
||||||
/// See also [presenceActivities].
|
>
|
||||||
PresenceActivitiesProvider call(String uname) {
|
with
|
||||||
return PresenceActivitiesProvider(uname);
|
$FutureModifier<List<SnPresenceActivity>>,
|
||||||
}
|
$FutureProvider<List<SnPresenceActivity>> {
|
||||||
|
const PresenceActivitiesProvider._({
|
||||||
@override
|
required PresenceActivitiesFamily super.from,
|
||||||
PresenceActivitiesProvider getProviderOverride(
|
required String super.argument,
|
||||||
covariant PresenceActivitiesProvider provider,
|
}) : super(
|
||||||
) {
|
retry: null,
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'presenceActivitiesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
class PresenceActivitiesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnPresenceActivity>> {
|
|
||||||
/// See also [presenceActivities].
|
|
||||||
PresenceActivitiesProvider(String uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => presenceActivities(ref as PresenceActivitiesRef, uname),
|
|
||||||
from: presenceActivitiesProvider,
|
|
||||||
name: r'presenceActivitiesProvider',
|
name: r'presenceActivitiesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$presenceActivitiesHash,
|
|
||||||
dependencies: PresenceActivitiesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PresenceActivitiesFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PresenceActivitiesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$presenceActivitiesHash();
|
||||||
FutureOr<List<SnPresenceActivity>> Function(PresenceActivitiesRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'presenceActivitiesProvider'
|
||||||
origin: this,
|
''
|
||||||
override: PresenceActivitiesProvider._internal(
|
'($argument)';
|
||||||
(ref) => create(ref as PresenceActivitiesRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnPresenceActivity>> createElement() {
|
$FutureProviderElement<List<SnPresenceActivity>> $createElement(
|
||||||
return _PresenceActivitiesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPresenceActivity>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return presenceActivities(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PresenceActivitiesProvider && other.uname == uname;
|
return other is PresenceActivitiesProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$presenceActivitiesHash() =>
|
||||||
// ignore: unused_element
|
r'3bfaa638eeb961ecd62a32d6a7760a6a7e7bf6f2';
|
||||||
mixin PresenceActivitiesRef
|
|
||||||
on AutoDisposeFutureProviderRef<List<SnPresenceActivity>> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PresenceActivitiesProviderElement
|
final class PresenceActivitiesFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<List<SnPresenceActivity>>
|
with $FunctionalFamilyOverride<FutureOr<List<SnPresenceActivity>>, String> {
|
||||||
with PresenceActivitiesRef {
|
const PresenceActivitiesFamily._()
|
||||||
_PresenceActivitiesProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'presenceActivitiesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PresenceActivitiesProvider call(String uname) =>
|
||||||
|
PresenceActivitiesProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get uname => (origin as PresenceActivitiesProvider).uname;
|
String toString() => r'presenceActivitiesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -6,19 +6,58 @@ part of 'call.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(CallNotifier)
|
||||||
|
const callProvider = CallNotifierProvider._();
|
||||||
|
|
||||||
|
final class CallNotifierProvider
|
||||||
|
extends $NotifierProvider<CallNotifier, CallState> {
|
||||||
|
const CallNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'callProvider',
|
||||||
|
isAutoDispose: false,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$callNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
CallNotifier create() => CallNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(CallState value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<CallState>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3';
|
String _$callNotifierHash() => r'ef4e3e9c9d411cf9dce1ceb456a3b866b2c87db3';
|
||||||
|
|
||||||
/// See also [CallNotifier].
|
abstract class _$CallNotifier extends $Notifier<CallState> {
|
||||||
@ProviderFor(CallNotifier)
|
CallState build();
|
||||||
final callNotifierProvider = NotifierProvider<CallNotifier, CallState>.internal(
|
@$mustCallSuper
|
||||||
CallNotifier.new,
|
@override
|
||||||
name: r'callNotifierProvider',
|
void runBuild() {
|
||||||
debugGetCreateSourceHash:
|
final created = build();
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$callNotifierHash,
|
final ref = this.ref as $Ref<CallState, CallState>;
|
||||||
dependencies: null,
|
final element =
|
||||||
allTransitiveDependencies: null,
|
ref.element
|
||||||
);
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<CallState, CallState>,
|
||||||
typedef _$CallNotifier = Notifier<CallState>;
|
CallState,
|
||||||
// ignore_for_file: type=lint
|
Object?,
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,163 +6,97 @@ part of 'chat_online_count.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$chatOnlineCountNotifierHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'19af8fd0e9f62c65e12a68215406776085235fa3';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$ChatOnlineCountNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<int> {
|
|
||||||
late final String chatroomId;
|
|
||||||
|
|
||||||
FutureOr<int> build(String chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
@ProviderFor(ChatOnlineCountNotifier)
|
@ProviderFor(ChatOnlineCountNotifier)
|
||||||
const chatOnlineCountNotifierProvider = ChatOnlineCountNotifierFamily();
|
const chatOnlineCountProvider = ChatOnlineCountNotifierFamily._();
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
final class ChatOnlineCountNotifierProvider
|
||||||
class ChatOnlineCountNotifierFamily extends Family<AsyncValue<int>> {
|
extends $AsyncNotifierProvider<ChatOnlineCountNotifier, int> {
|
||||||
/// See also [ChatOnlineCountNotifier].
|
const ChatOnlineCountNotifierProvider._({
|
||||||
const ChatOnlineCountNotifierFamily();
|
required ChatOnlineCountNotifierFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [ChatOnlineCountNotifier].
|
}) : super(
|
||||||
ChatOnlineCountNotifierProvider call(String chatroomId) {
|
retry: null,
|
||||||
return ChatOnlineCountNotifierProvider(chatroomId);
|
name: r'chatOnlineCountProvider',
|
||||||
}
|
isAutoDispose: true,
|
||||||
|
|
||||||
@override
|
|
||||||
ChatOnlineCountNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatOnlineCountNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatOnlineCountNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
class ChatOnlineCountNotifierProvider
|
|
||||||
extends AutoDisposeAsyncNotifierProviderImpl<ChatOnlineCountNotifier, int> {
|
|
||||||
/// See also [ChatOnlineCountNotifier].
|
|
||||||
ChatOnlineCountNotifierProvider(String chatroomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatOnlineCountNotifier()..chatroomId = chatroomId,
|
|
||||||
from: chatOnlineCountNotifierProvider,
|
|
||||||
name: r'chatOnlineCountNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatOnlineCountNotifierHash,
|
|
||||||
dependencies: ChatOnlineCountNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatOnlineCountNotifierFamily._allTransitiveDependencies,
|
|
||||||
chatroomId: chatroomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatOnlineCountNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.chatroomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String chatroomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<int> runNotifierBuild(covariant ChatOnlineCountNotifier notifier) {
|
|
||||||
return notifier.build(chatroomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatOnlineCountNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatOnlineCountNotifierProvider._internal(
|
|
||||||
() => create()..chatroomId = chatroomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
chatroomId: chatroomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int>
|
String debugGetCreateSourceHash() => _$chatOnlineCountNotifierHash();
|
||||||
createElement() {
|
|
||||||
return _ChatOnlineCountNotifierProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatOnlineCountProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatOnlineCountNotifier create() => ChatOnlineCountNotifier();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is ChatOnlineCountNotifierProvider &&
|
return other is ChatOnlineCountNotifierProvider &&
|
||||||
other.chatroomId == chatroomId;
|
other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, chatroomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatOnlineCountNotifierHash() =>
|
||||||
// ignore: unused_element
|
r'19af8fd0e9f62c65e12a68215406776085235fa3';
|
||||||
mixin ChatOnlineCountNotifierRef on AutoDisposeAsyncNotifierProviderRef<int> {
|
|
||||||
/// The parameter `chatroomId` of this provider.
|
|
||||||
String get chatroomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatOnlineCountNotifierProviderElement
|
final class ChatOnlineCountNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatOnlineCountNotifier, int>
|
$ClassFamilyOverride<
|
||||||
with ChatOnlineCountNotifierRef {
|
ChatOnlineCountNotifier,
|
||||||
_ChatOnlineCountNotifierProviderElement(super.provider);
|
AsyncValue<int>,
|
||||||
|
int,
|
||||||
|
FutureOr<int>,
|
||||||
|
String
|
||||||
|
> {
|
||||||
|
const ChatOnlineCountNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatOnlineCountProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatOnlineCountNotifierProvider call(String chatroomId) =>
|
||||||
|
ChatOnlineCountNotifierProvider._(argument: chatroomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get chatroomId =>
|
String toString() => r'chatOnlineCountProvider';
|
||||||
(origin as ChatOnlineCountNotifierProvider).chatroomId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$ChatOnlineCountNotifier extends $AsyncNotifier<int> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get chatroomId => _$args;
|
||||||
|
|
||||||
|
FutureOr<int> build(String chatroomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<int>, int>,
|
||||||
|
AsyncValue<int>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,9 +11,32 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|||||||
|
|
||||||
part 'chat_room.g.dart';
|
part 'chat_room.g.dart';
|
||||||
|
|
||||||
final isSyncingProvider = StateProvider.autoDispose<bool>((ref) => false);
|
final chatSyncingProvider = NotifierProvider<ChatSyncingNotifier, bool>(
|
||||||
|
ChatSyncingNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
final flashingMessagesProvider = StateProvider<Set<String>>((ref) => {});
|
class ChatSyncingNotifier extends Notifier<bool> {
|
||||||
|
@override
|
||||||
|
bool build() => false;
|
||||||
|
|
||||||
|
void set(bool value) => state = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
final flashingMessagesProvider =
|
||||||
|
NotifierProvider<FlashingMessagesNotifier, Set<String>>(
|
||||||
|
FlashingMessagesNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class FlashingMessagesNotifier extends Notifier<Set<String>> {
|
||||||
|
@override
|
||||||
|
Set<String> build() => {};
|
||||||
|
|
||||||
|
void update(Set<String> Function(Set<String>) cb) {
|
||||||
|
state = cb(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() => state = {};
|
||||||
|
}
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {
|
class ChatRoomJoinedNotifier extends _$ChatRoomJoinedNotifier {
|
||||||
|
|||||||
@@ -6,350 +6,277 @@ part of 'chat_room.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [chatroomInvites].
|
@ProviderFor(ChatRoomJoinedNotifier)
|
||||||
@ProviderFor(chatroomInvites)
|
const chatRoomJoinedProvider = ChatRoomJoinedNotifierProvider._();
|
||||||
final chatroomInvitesProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnChatMember>>.internal(
|
final class ChatRoomJoinedNotifierProvider
|
||||||
chatroomInvites,
|
extends $AsyncNotifierProvider<ChatRoomJoinedNotifier, List<SnChatRoom>> {
|
||||||
name: r'chatroomInvitesProvider',
|
const ChatRoomJoinedNotifierProvider._()
|
||||||
debugGetCreateSourceHash:
|
: super(
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
from: null,
|
||||||
? null
|
argument: null,
|
||||||
: _$chatroomInvitesHash,
|
retry: null,
|
||||||
|
name: r'chatRoomJoinedProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$chatRoomJoinedNotifierHash();
|
||||||
typedef ChatroomInvitesRef = AutoDisposeFutureProviderRef<List<SnChatMember>>;
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomJoinedNotifier create() => ChatRoomJoinedNotifier();
|
||||||
|
}
|
||||||
|
|
||||||
String _$chatRoomJoinedNotifierHash() =>
|
String _$chatRoomJoinedNotifierHash() =>
|
||||||
r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff';
|
r'c8092225ba0d9c08b2b5bca6f800f1877303b4ff';
|
||||||
|
|
||||||
/// See also [ChatRoomJoinedNotifier].
|
abstract class _$ChatRoomJoinedNotifier
|
||||||
@ProviderFor(ChatRoomJoinedNotifier)
|
extends $AsyncNotifier<List<SnChatRoom>> {
|
||||||
final chatRoomJoinedNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
FutureOr<List<SnChatRoom>> build();
|
||||||
ChatRoomJoinedNotifier,
|
@$mustCallSuper
|
||||||
List<SnChatRoom>
|
@override
|
||||||
>.internal(
|
void runBuild() {
|
||||||
ChatRoomJoinedNotifier.new,
|
final created = build();
|
||||||
name: r'chatRoomJoinedNotifierProvider',
|
final ref =
|
||||||
debugGetCreateSourceHash:
|
this.ref as $Ref<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>;
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
final element =
|
||||||
? null
|
ref.element
|
||||||
: _$chatRoomJoinedNotifierHash,
|
as $ClassProviderElement<
|
||||||
dependencies: null,
|
AnyNotifier<AsyncValue<List<SnChatRoom>>, List<SnChatRoom>>,
|
||||||
allTransitiveDependencies: null,
|
AsyncValue<List<SnChatRoom>>,
|
||||||
);
|
Object?,
|
||||||
|
Object?
|
||||||
typedef _$ChatRoomJoinedNotifier = AutoDisposeAsyncNotifier<List<SnChatRoom>>;
|
>;
|
||||||
String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38';
|
element.handleValue(ref, created);
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _$ChatRoomNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<SnChatRoom?> {
|
|
||||||
late final String? identifier;
|
|
||||||
|
|
||||||
FutureOr<SnChatRoom?> build(String? identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatRoomNotifier].
|
|
||||||
@ProviderFor(ChatRoomNotifier)
|
@ProviderFor(ChatRoomNotifier)
|
||||||
const chatRoomNotifierProvider = ChatRoomNotifierFamily();
|
const chatRoomProvider = ChatRoomNotifierFamily._();
|
||||||
|
|
||||||
/// See also [ChatRoomNotifier].
|
final class ChatRoomNotifierProvider
|
||||||
class ChatRoomNotifierFamily extends Family<AsyncValue<SnChatRoom?>> {
|
extends $AsyncNotifierProvider<ChatRoomNotifier, SnChatRoom?> {
|
||||||
/// See also [ChatRoomNotifier].
|
const ChatRoomNotifierProvider._({
|
||||||
const ChatRoomNotifierFamily();
|
required ChatRoomNotifierFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
/// See also [ChatRoomNotifier].
|
}) : super(
|
||||||
ChatRoomNotifierProvider call(String? identifier) {
|
retry: null,
|
||||||
return ChatRoomNotifierProvider(identifier);
|
name: r'chatRoomProvider',
|
||||||
}
|
isAutoDispose: true,
|
||||||
|
|
||||||
@override
|
|
||||||
ChatRoomNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatRoomNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatRoomNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatRoomNotifier].
|
|
||||||
class ChatRoomNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<ChatRoomNotifier, SnChatRoom?> {
|
|
||||||
/// See also [ChatRoomNotifier].
|
|
||||||
ChatRoomNotifierProvider(String? identifier)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatRoomNotifier()..identifier = identifier,
|
|
||||||
from: chatRoomNotifierProvider,
|
|
||||||
name: r'chatRoomNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatRoomNotifierHash,
|
|
||||||
dependencies: ChatRoomNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatRoomNotifierFamily._allTransitiveDependencies,
|
|
||||||
identifier: identifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatRoomNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.identifier,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? identifier;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<SnChatRoom?> runNotifierBuild(covariant ChatRoomNotifier notifier) {
|
|
||||||
return notifier.build(identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatRoomNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatRoomNotifierProvider._internal(
|
|
||||||
() => create()..identifier = identifier,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
identifier: identifier,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatRoomNotifier, SnChatRoom?>
|
String debugGetCreateSourceHash() => _$chatRoomNotifierHash();
|
||||||
createElement() {
|
|
||||||
return _ChatRoomNotifierProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatRoomProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomNotifier create() => ChatRoomNotifier();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is ChatRoomNotifierProvider && other.identifier == identifier;
|
return other is ChatRoomNotifierProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, identifier.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatRoomNotifierHash() => r'1e6391e2ab4eeb114fa001aaa6b06ab2bd646f38';
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatRoomNotifierRef on AutoDisposeAsyncNotifierProviderRef<SnChatRoom?> {
|
|
||||||
/// The parameter `identifier` of this provider.
|
|
||||||
String? get identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatRoomNotifierProviderElement
|
final class ChatRoomNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<ChatRoomNotifier, SnChatRoom?>
|
$ClassFamilyOverride<
|
||||||
with ChatRoomNotifierRef {
|
ChatRoomNotifier,
|
||||||
_ChatRoomNotifierProviderElement(super.provider);
|
AsyncValue<SnChatRoom?>,
|
||||||
|
SnChatRoom?,
|
||||||
|
FutureOr<SnChatRoom?>,
|
||||||
|
String?
|
||||||
|
> {
|
||||||
|
const ChatRoomNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatRoomNotifierProvider call(String? identifier) =>
|
||||||
|
ChatRoomNotifierProvider._(argument: identifier, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get identifier => (origin as ChatRoomNotifierProvider).identifier;
|
String toString() => r'chatRoomProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _$ChatRoomNotifier extends $AsyncNotifier<SnChatRoom?> {
|
||||||
|
late final _$args = ref.$arg as String?;
|
||||||
|
String? get identifier => _$args;
|
||||||
|
|
||||||
|
FutureOr<SnChatRoom?> build(String? identifier);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnChatRoom?>, SnChatRoom?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnChatRoom?>, SnChatRoom?>,
|
||||||
|
AsyncValue<SnChatRoom?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(ChatRoomIdentityNotifier)
|
||||||
|
const chatRoomIdentityProvider = ChatRoomIdentityNotifierFamily._();
|
||||||
|
|
||||||
|
final class ChatRoomIdentityNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatRoomIdentityNotifier, SnChatMember?> {
|
||||||
|
const ChatRoomIdentityNotifierProvider._({
|
||||||
|
required ChatRoomIdentityNotifierFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomIdentityProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatRoomIdentityNotifierHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatRoomIdentityProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatRoomIdentityNotifier create() => ChatRoomIdentityNotifier();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is ChatRoomIdentityNotifierProvider &&
|
||||||
|
other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$chatRoomIdentityNotifierHash() =>
|
String _$chatRoomIdentityNotifierHash() =>
|
||||||
r'27c17d55366d39be81d7209837e5c01f80a68a24';
|
r'27c17d55366d39be81d7209837e5c01f80a68a24';
|
||||||
|
|
||||||
|
final class ChatRoomIdentityNotifierFamily extends $Family
|
||||||
|
with
|
||||||
|
$ClassFamilyOverride<
|
||||||
|
ChatRoomIdentityNotifier,
|
||||||
|
AsyncValue<SnChatMember?>,
|
||||||
|
SnChatMember?,
|
||||||
|
FutureOr<SnChatMember?>,
|
||||||
|
String?
|
||||||
|
> {
|
||||||
|
const ChatRoomIdentityNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatRoomIdentityProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatRoomIdentityNotifierProvider call(String? identifier) =>
|
||||||
|
ChatRoomIdentityNotifierProvider._(argument: identifier, from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'chatRoomIdentityProvider';
|
||||||
|
}
|
||||||
|
|
||||||
abstract class _$ChatRoomIdentityNotifier
|
abstract class _$ChatRoomIdentityNotifier
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<SnChatMember?> {
|
extends $AsyncNotifier<SnChatMember?> {
|
||||||
late final String? identifier;
|
late final _$args = ref.$arg as String?;
|
||||||
|
String? get identifier => _$args;
|
||||||
|
|
||||||
FutureOr<SnChatMember?> build(String? identifier);
|
FutureOr<SnChatMember?> build(String? identifier);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnChatMember?>, SnChatMember?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnChatMember?>, SnChatMember?>,
|
||||||
|
AsyncValue<SnChatMember?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
@ProviderFor(chatroomInvites)
|
||||||
@ProviderFor(ChatRoomIdentityNotifier)
|
const chatroomInvitesProvider = ChatroomInvitesProvider._();
|
||||||
const chatRoomIdentityNotifierProvider = ChatRoomIdentityNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
final class ChatroomInvitesProvider
|
||||||
class ChatRoomIdentityNotifierFamily extends Family<AsyncValue<SnChatMember?>> {
|
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
|
||||||
const ChatRoomIdentityNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
|
||||||
ChatRoomIdentityNotifierProvider call(String? identifier) {
|
|
||||||
return ChatRoomIdentityNotifierProvider(identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ChatRoomIdentityNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatRoomIdentityNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatRoomIdentityNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
|
||||||
class ChatRoomIdentityNotifierProvider
|
|
||||||
extends
|
extends
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
$FunctionalProvider<
|
||||||
ChatRoomIdentityNotifier,
|
AsyncValue<List<SnChatMember>>,
|
||||||
SnChatMember?
|
List<SnChatMember>,
|
||||||
> {
|
FutureOr<List<SnChatMember>>
|
||||||
/// See also [ChatRoomIdentityNotifier].
|
>
|
||||||
ChatRoomIdentityNotifierProvider(String? identifier)
|
with
|
||||||
: this._internal(
|
$FutureModifier<List<SnChatMember>>,
|
||||||
() => ChatRoomIdentityNotifier()..identifier = identifier,
|
$FutureProvider<List<SnChatMember>> {
|
||||||
from: chatRoomIdentityNotifierProvider,
|
const ChatroomInvitesProvider._()
|
||||||
name: r'chatRoomIdentityNotifierProvider',
|
: super(
|
||||||
debugGetCreateSourceHash:
|
from: null,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
argument: null,
|
||||||
? null
|
retry: null,
|
||||||
: _$chatRoomIdentityNotifierHash,
|
name: r'chatroomInvitesProvider',
|
||||||
dependencies: ChatRoomIdentityNotifierFamily._dependencies,
|
isAutoDispose: true,
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatRoomIdentityNotifierFamily._allTransitiveDependencies,
|
|
||||||
identifier: identifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatRoomIdentityNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.identifier,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? identifier;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<SnChatMember?> runNotifierBuild(
|
|
||||||
covariant ChatRoomIdentityNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatRoomIdentityNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatRoomIdentityNotifierProvider._internal(
|
|
||||||
() => create()..identifier = identifier,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
identifier: identifier,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
String debugGetCreateSourceHash() => _$chatroomInvitesHash();
|
||||||
ChatRoomIdentityNotifier,
|
|
||||||
SnChatMember?
|
@$internal
|
||||||
>
|
@override
|
||||||
createElement() {
|
$FutureProviderElement<List<SnChatMember>> $createElement(
|
||||||
return _ChatRoomIdentityNotifierProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
}
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
FutureOr<List<SnChatMember>> create(Ref ref) {
|
||||||
return other is ChatRoomIdentityNotifierProvider &&
|
return chatroomInvites(ref);
|
||||||
other.identifier == identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, identifier.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatroomInvitesHash() => r'5cd6391b09c5517ede19bacce43b45c8d71dd087';
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatRoomIdentityNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<SnChatMember?> {
|
|
||||||
/// The parameter `identifier` of this provider.
|
|
||||||
String? get identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatRoomIdentityNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ChatRoomIdentityNotifier,
|
|
||||||
SnChatMember?
|
|
||||||
>
|
|
||||||
with ChatRoomIdentityNotifierRef {
|
|
||||||
_ChatRoomIdentityNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get identifier =>
|
|
||||||
(origin as ChatRoomIdentityNotifierProvider).identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -12,7 +12,17 @@ import "package:riverpod_annotation/riverpod_annotation.dart";
|
|||||||
|
|
||||||
part 'chat_subscribe.g.dart';
|
part 'chat_subscribe.g.dart';
|
||||||
|
|
||||||
final currentSubscribedChatIdProvider = StateProvider<String?>((ref) => null);
|
final currentSubscribedChatIdProvider =
|
||||||
|
NotifierProvider<CurrentSubscribedChatIdNotifier, String?>(
|
||||||
|
CurrentSubscribedChatIdNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class CurrentSubscribedChatIdNotifier extends Notifier<String?> {
|
||||||
|
@override
|
||||||
|
String? build() => null;
|
||||||
|
|
||||||
|
void set(String? value) => state = value;
|
||||||
|
}
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
||||||
@@ -29,11 +39,9 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
@override
|
@override
|
||||||
List<SnChatMember> build(String roomId) {
|
List<SnChatMember> build(String roomId) {
|
||||||
final ws = ref.watch(websocketProvider);
|
final ws = ref.watch(websocketProvider);
|
||||||
final chatRoomAsync = ref.watch(ChatRoomNotifierProvider(roomId));
|
final chatRoomAsync = ref.watch(chatRoomProvider(roomId));
|
||||||
final chatIdentityAsync = ref.watch(
|
final chatIdentityAsync = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
ChatRoomIdentityNotifierProvider(roomId),
|
_messagesNotifier = ref.watch(messagesProvider(roomId).notifier);
|
||||||
);
|
|
||||||
_messagesNotifier = ref.watch(messagesNotifierProvider(roomId).notifier);
|
|
||||||
|
|
||||||
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
if (chatRoomAsync.isLoading || chatIdentityAsync.isLoading) {
|
||||||
return [];
|
return [];
|
||||||
@@ -59,7 +67,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Future.microtask(
|
Future.microtask(
|
||||||
() => ref.read(currentSubscribedChatIdProvider.notifier).state = roomId,
|
() => ref.read(currentSubscribedChatIdProvider.notifier).set(roomId),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send initial read receipt
|
// Send initial read receipt
|
||||||
@@ -130,7 +138,7 @@ class ChatSubscribeNotifier extends _$ChatSubscribeNotifier {
|
|||||||
|
|
||||||
// Cleanup on dispose
|
// Cleanup on dispose
|
||||||
ref.onDispose(() {
|
ref.onDispose(() {
|
||||||
ref.read(currentSubscribedChatIdProvider.notifier).state = null;
|
ref.read(currentSubscribedChatIdProvider.notifier).set(null);
|
||||||
wsState.sendMessage(
|
wsState.sendMessage(
|
||||||
jsonEncode(
|
jsonEncode(
|
||||||
WebSocketPacket(
|
WebSocketPacket(
|
||||||
|
|||||||
@@ -6,171 +6,104 @@ part of 'chat_subscribe.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$chatSubscribeNotifierHash() =>
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
r'beec1ddf2e13f6d5af8a08c2c81eff740ae9b986';
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$ChatSubscribeNotifier
|
|
||||||
extends BuildlessAutoDisposeNotifier<List<SnChatMember>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
List<SnChatMember> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
@ProviderFor(ChatSubscribeNotifier)
|
@ProviderFor(ChatSubscribeNotifier)
|
||||||
const chatSubscribeNotifierProvider = ChatSubscribeNotifierFamily();
|
const chatSubscribeProvider = ChatSubscribeNotifierFamily._();
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
final class ChatSubscribeNotifierProvider
|
||||||
class ChatSubscribeNotifierFamily extends Family<List<SnChatMember>> {
|
extends $NotifierProvider<ChatSubscribeNotifier, List<SnChatMember>> {
|
||||||
/// See also [ChatSubscribeNotifier].
|
const ChatSubscribeNotifierProvider._({
|
||||||
const ChatSubscribeNotifierFamily();
|
required ChatSubscribeNotifierFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [ChatSubscribeNotifier].
|
}) : super(
|
||||||
ChatSubscribeNotifierProvider call(String roomId) {
|
retry: null,
|
||||||
return ChatSubscribeNotifierProvider(roomId);
|
name: r'chatSubscribeProvider',
|
||||||
}
|
isAutoDispose: true,
|
||||||
|
|
||||||
@override
|
|
||||||
ChatSubscribeNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatSubscribeNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatSubscribeNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
class ChatSubscribeNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeNotifierProviderImpl<
|
|
||||||
ChatSubscribeNotifier,
|
|
||||||
List<SnChatMember>
|
|
||||||
> {
|
|
||||||
/// See also [ChatSubscribeNotifier].
|
|
||||||
ChatSubscribeNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatSubscribeNotifier()..roomId = roomId,
|
|
||||||
from: chatSubscribeNotifierProvider,
|
|
||||||
name: r'chatSubscribeNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatSubscribeNotifierHash,
|
|
||||||
dependencies: ChatSubscribeNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatSubscribeNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
ChatSubscribeNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<SnChatMember> runNotifierBuild(
|
|
||||||
covariant ChatSubscribeNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatSubscribeNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatSubscribeNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeNotifierProviderElement<ChatSubscribeNotifier, List<SnChatMember>>
|
String debugGetCreateSourceHash() => _$chatSubscribeNotifierHash();
|
||||||
createElement() {
|
|
||||||
return _ChatSubscribeNotifierProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'chatSubscribeProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatSubscribeNotifier create() => ChatSubscribeNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(List<SnChatMember> value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<List<SnChatMember>>(value),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is ChatSubscribeNotifierProvider && other.roomId == roomId;
|
return other is ChatSubscribeNotifierProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$chatSubscribeNotifierHash() =>
|
||||||
// ignore: unused_element
|
r'2b9fae96eb1f96a514a074985e5efa1c13d10aa4';
|
||||||
mixin ChatSubscribeNotifierRef
|
|
||||||
on AutoDisposeNotifierProviderRef<List<SnChatMember>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatSubscribeNotifierProviderElement
|
final class ChatSubscribeNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeNotifierProviderElement<
|
$ClassFamilyOverride<
|
||||||
ChatSubscribeNotifier,
|
ChatSubscribeNotifier,
|
||||||
List<SnChatMember>
|
List<SnChatMember>,
|
||||||
>
|
List<SnChatMember>,
|
||||||
with ChatSubscribeNotifierRef {
|
List<SnChatMember>,
|
||||||
_ChatSubscribeNotifierProviderElement(super.provider);
|
String
|
||||||
|
> {
|
||||||
|
const ChatSubscribeNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'chatSubscribeProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChatSubscribeNotifierProvider call(String roomId) =>
|
||||||
|
ChatSubscribeNotifierProvider._(argument: roomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get roomId => (origin as ChatSubscribeNotifierProvider).roomId;
|
String toString() => r'chatSubscribeProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$ChatSubscribeNotifier extends $Notifier<List<SnChatMember>> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get roomId => _$args;
|
||||||
|
|
||||||
|
List<SnChatMember> build(String roomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<List<SnChatMember>, List<SnChatMember>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<List<SnChatMember>, List<SnChatMember>>,
|
||||||
|
List<SnChatMember>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class ChatSummary extends _$ChatSummary {
|
|||||||
final unreadToDecrement = summary.unreadCount;
|
final unreadToDecrement = summary.unreadCount;
|
||||||
if (unreadToDecrement > 0) {
|
if (unreadToDecrement > 0) {
|
||||||
ref
|
ref
|
||||||
.read(chatUnreadCountNotifierProvider.notifier)
|
.read(chatUnreadCountProvider.notifier)
|
||||||
.decrement(unreadToDecrement);
|
.decrement(unreadToDecrement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,40 +6,105 @@ part of 'chat_summary.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(ChatUnreadCountNotifier)
|
||||||
|
const chatUnreadCountProvider = ChatUnreadCountNotifierProvider._();
|
||||||
|
|
||||||
|
final class ChatUnreadCountNotifierProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatUnreadCountNotifier, int> {
|
||||||
|
const ChatUnreadCountNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'chatUnreadCountProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$chatUnreadCountNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatUnreadCountNotifier create() => ChatUnreadCountNotifier();
|
||||||
|
}
|
||||||
|
|
||||||
String _$chatUnreadCountNotifierHash() =>
|
String _$chatUnreadCountNotifierHash() =>
|
||||||
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
|
r'b8d93589dc37f772d4c3a07d9afd81c37026e57d';
|
||||||
|
|
||||||
/// See also [ChatUnreadCountNotifier].
|
abstract class _$ChatUnreadCountNotifier extends $AsyncNotifier<int> {
|
||||||
@ProviderFor(ChatUnreadCountNotifier)
|
FutureOr<int> build();
|
||||||
final chatUnreadCountNotifierProvider =
|
@$mustCallSuper
|
||||||
AutoDisposeAsyncNotifierProvider<ChatUnreadCountNotifier, int>.internal(
|
@override
|
||||||
ChatUnreadCountNotifier.new,
|
void runBuild() {
|
||||||
name: r'chatUnreadCountNotifierProvider',
|
final created = build();
|
||||||
debugGetCreateSourceHash:
|
final ref = this.ref as $Ref<AsyncValue<int>, int>;
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
final element =
|
||||||
? null
|
ref.element
|
||||||
: _$chatUnreadCountNotifierHash,
|
as $ClassProviderElement<
|
||||||
dependencies: null,
|
AnyNotifier<AsyncValue<int>, int>,
|
||||||
allTransitiveDependencies: null,
|
AsyncValue<int>,
|
||||||
);
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef _$ChatUnreadCountNotifier = AutoDisposeAsyncNotifier<int>;
|
|
||||||
String _$chatSummaryHash() => r'78d927d40cded9d7adbc20bd6f457fdf3c852632';
|
|
||||||
|
|
||||||
/// See also [ChatSummary].
|
|
||||||
@ProviderFor(ChatSummary)
|
@ProviderFor(ChatSummary)
|
||||||
final chatSummaryProvider =
|
const chatSummaryProvider = ChatSummaryProvider._();
|
||||||
AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>>.internal(
|
|
||||||
ChatSummary.new,
|
final class ChatSummaryProvider
|
||||||
|
extends $AsyncNotifierProvider<ChatSummary, Map<String, SnChatSummary>> {
|
||||||
|
const ChatSummaryProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'chatSummaryProvider',
|
name: r'chatSummaryProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: false,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatSummaryHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef _$ChatSummary = AsyncNotifier<Map<String, SnChatSummary>>;
|
@override
|
||||||
// ignore_for_file: type=lint
|
String debugGetCreateSourceHash() => _$chatSummaryHash();
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
ChatSummary create() => ChatSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$chatSummaryHash() => r'dfa5e487586482ebdafef8d711f74db68ee86f84';
|
||||||
|
|
||||||
|
abstract class _$ChatSummary
|
||||||
|
extends $AsyncNotifier<Map<String, SnChatSummary>> {
|
||||||
|
FutureOr<Map<String, SnChatSummary>> build();
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build();
|
||||||
|
final ref =
|
||||||
|
this.ref
|
||||||
|
as $Ref<
|
||||||
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
|
Map<String, SnChatSummary>
|
||||||
|
>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<
|
||||||
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
|
Map<String, SnChatSummary>
|
||||||
|
>,
|
||||||
|
AsyncValue<Map<String, SnChatSummary>>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,10 +52,8 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
FutureOr<List<LocalChatMessage>> build(String roomId) async {
|
||||||
_apiClient = ref.watch(apiClientProvider);
|
_apiClient = ref.watch(apiClientProvider);
|
||||||
_database = ref.watch(databaseProvider);
|
_database = ref.watch(databaseProvider);
|
||||||
final room = await ref.watch(ChatRoomNotifierProvider(roomId).future);
|
final room = await ref.watch(chatRoomProvider(roomId).future);
|
||||||
final identity = await ref.watch(
|
final identity = await ref.watch(chatRoomIdentityProvider(roomId).future);
|
||||||
ChatRoomIdentityNotifierProvider(roomId).future,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Initialize fetch account method for corrupted data recovery
|
// Initialize fetch account method for corrupted data recovery
|
||||||
_fetchAccount = (String accountId) async {
|
_fetchAccount = (String accountId) async {
|
||||||
@@ -321,7 +319,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
_allRemoteMessagesFetched = false;
|
_allRemoteMessagesFetched = false;
|
||||||
|
|
||||||
talker.log('Starting message sync');
|
talker.log('Starting message sync');
|
||||||
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true);
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
||||||
try {
|
try {
|
||||||
final dbMessages = await _database.getMessagesForRoom(
|
final dbMessages = await _database.getMessagesForRoom(
|
||||||
_room.id,
|
_room.id,
|
||||||
@@ -397,9 +395,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
talker.log('Finished message sync');
|
talker.log('Finished message sync');
|
||||||
Future.microtask(
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
||||||
() => ref.read(isSyncingProvider.notifier).state = false,
|
|
||||||
);
|
|
||||||
_isSyncing = false;
|
_isSyncing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,7 +492,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
if (!_hasMore || state is AsyncLoading) return;
|
if (!_hasMore || state is AsyncLoading) return;
|
||||||
talker.log('Loading more messages');
|
talker.log('Loading more messages');
|
||||||
|
|
||||||
Future.microtask(() => ref.read(isSyncingProvider.notifier).state = true);
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(true));
|
||||||
try {
|
try {
|
||||||
final currentMessages = state.value ?? [];
|
final currentMessages = state.value ?? [];
|
||||||
final offset = currentMessages.length;
|
final offset = currentMessages.length;
|
||||||
@@ -519,9 +515,7 @@ class MessagesNotifier extends _$MessagesNotifier {
|
|||||||
);
|
);
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
Future.microtask(
|
Future.microtask(() => ref.read(chatSyncingProvider.notifier).set(false));
|
||||||
() => ref.read(isSyncingProvider.notifier).state = false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,174 +6,101 @@ part of 'messages_notifier.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$messagesNotifierHash() => r'd76d799494b06fac2adc42d94b7ecd7b8d68c352';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$MessagesNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<List<LocalChatMessage>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
FutureOr<List<LocalChatMessage>> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
@ProviderFor(MessagesNotifier)
|
@ProviderFor(MessagesNotifier)
|
||||||
const messagesNotifierProvider = MessagesNotifierFamily();
|
const messagesProvider = MessagesNotifierFamily._();
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
final class MessagesNotifierProvider
|
||||||
class MessagesNotifierFamily
|
extends $AsyncNotifierProvider<MessagesNotifier, List<LocalChatMessage>> {
|
||||||
extends Family<AsyncValue<List<LocalChatMessage>>> {
|
const MessagesNotifierProvider._({
|
||||||
/// See also [MessagesNotifier].
|
required MessagesNotifierFamily super.from,
|
||||||
const MessagesNotifierFamily();
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
/// See also [MessagesNotifier].
|
retry: null,
|
||||||
MessagesNotifierProvider call(String roomId) {
|
name: r'messagesProvider',
|
||||||
return MessagesNotifierProvider(roomId);
|
isAutoDispose: true,
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
MessagesNotifierProvider getProviderOverride(
|
|
||||||
covariant MessagesNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'messagesNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
class MessagesNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
MessagesNotifier,
|
|
||||||
List<LocalChatMessage>
|
|
||||||
> {
|
|
||||||
/// See also [MessagesNotifier].
|
|
||||||
MessagesNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => MessagesNotifier()..roomId = roomId,
|
|
||||||
from: messagesNotifierProvider,
|
|
||||||
name: r'messagesNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$messagesNotifierHash,
|
|
||||||
dependencies: MessagesNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
MessagesNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
MessagesNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<List<LocalChatMessage>> runNotifierBuild(
|
|
||||||
covariant MessagesNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(MessagesNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: MessagesNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
String debugGetCreateSourceHash() => _$messagesNotifierHash();
|
||||||
MessagesNotifier,
|
|
||||||
List<LocalChatMessage>
|
@override
|
||||||
>
|
String toString() {
|
||||||
createElement() {
|
return r'messagesProvider'
|
||||||
return _MessagesNotifierProviderElement(this);
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
MessagesNotifier create() => MessagesNotifier();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is MessagesNotifierProvider && other.roomId == roomId;
|
return other is MessagesNotifierProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$messagesNotifierHash() => r'2f3f19cb99357184e82d66e74a31863fcfc48856';
|
||||||
// ignore: unused_element
|
|
||||||
mixin MessagesNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<List<LocalChatMessage>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MessagesNotifierProviderElement
|
final class MessagesNotifierFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
$ClassFamilyOverride<
|
||||||
MessagesNotifier,
|
MessagesNotifier,
|
||||||
List<LocalChatMessage>
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
>
|
List<LocalChatMessage>,
|
||||||
with MessagesNotifierRef {
|
FutureOr<List<LocalChatMessage>>,
|
||||||
_MessagesNotifierProviderElement(super.provider);
|
String
|
||||||
|
> {
|
||||||
|
const MessagesNotifierFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'messagesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
MessagesNotifierProvider call(String roomId) =>
|
||||||
|
MessagesNotifierProvider._(argument: roomId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get roomId => (origin as MessagesNotifierProvider).roomId;
|
String toString() => r'messagesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$MessagesNotifier
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
extends $AsyncNotifier<List<LocalChatMessage>> {
|
||||||
|
late final _$args = ref.$arg as String;
|
||||||
|
String get roomId => _$args;
|
||||||
|
|
||||||
|
FutureOr<List<LocalChatMessage>> build(String roomId);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref =
|
||||||
|
this.ref
|
||||||
|
as $Ref<AsyncValue<List<LocalChatMessage>>, List<LocalChatMessage>>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<
|
||||||
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
|
List<LocalChatMessage>
|
||||||
|
>,
|
||||||
|
AsyncValue<List<LocalChatMessage>>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -294,12 +294,15 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final updateInfoProvider =
|
final updateInfoProvider =
|
||||||
StateNotifierProvider<UpdateInfoNotifier, (String?, String?)>((ref) {
|
NotifierProvider<UpdateInfoNotifier, (String?, String?)>(
|
||||||
return UpdateInfoNotifier();
|
UpdateInfoNotifier.new,
|
||||||
});
|
);
|
||||||
|
|
||||||
class UpdateInfoNotifier extends StateNotifier<(String?, String?)> {
|
class UpdateInfoNotifier extends Notifier<(String?, String?)> {
|
||||||
UpdateInfoNotifier() : super((null, null));
|
@override
|
||||||
|
(String?, String?) build() {
|
||||||
|
return (null, null);
|
||||||
|
}
|
||||||
|
|
||||||
void setUpdate(String newVersion, String newChangelog) {
|
void setUpdate(String newVersion, String newChangelog) {
|
||||||
state = (newVersion, newChangelog);
|
state = (newVersion, newChangelog);
|
||||||
|
|||||||
@@ -29,23 +29,59 @@ Map<String, dynamic> _$ThemeColorsToJson(_ThemeColors instance) =>
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(AppSettingsNotifier)
|
||||||
|
const appSettingsProvider = AppSettingsNotifierProvider._();
|
||||||
|
|
||||||
|
final class AppSettingsNotifierProvider
|
||||||
|
extends $NotifierProvider<AppSettingsNotifier, AppSettings> {
|
||||||
|
const AppSettingsNotifierProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'appSettingsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$appSettingsNotifierHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
AppSettingsNotifier create() => AppSettingsNotifier();
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(AppSettings value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<AppSettings>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$appSettingsNotifierHash() =>
|
String _$appSettingsNotifierHash() =>
|
||||||
r'22b695f2023e3251db3296858acd701f7211d757';
|
r'22b695f2023e3251db3296858acd701f7211d757';
|
||||||
|
|
||||||
/// See also [AppSettingsNotifier].
|
abstract class _$AppSettingsNotifier extends $Notifier<AppSettings> {
|
||||||
@ProviderFor(AppSettingsNotifier)
|
AppSettings build();
|
||||||
final appSettingsNotifierProvider =
|
@$mustCallSuper
|
||||||
AutoDisposeNotifierProvider<AppSettingsNotifier, AppSettings>.internal(
|
@override
|
||||||
AppSettingsNotifier.new,
|
void runBuild() {
|
||||||
name: r'appSettingsNotifierProvider',
|
final created = build();
|
||||||
debugGetCreateSourceHash:
|
final ref = this.ref as $Ref<AppSettings, AppSettings>;
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
final element =
|
||||||
? null
|
ref.element
|
||||||
: _$appSettingsNotifierHash,
|
as $ClassProviderElement<
|
||||||
dependencies: null,
|
AnyNotifier<AppSettings, AppSettings>,
|
||||||
allTransitiveDependencies: null,
|
AppSettings,
|
||||||
);
|
Object?,
|
||||||
|
Object?
|
||||||
typedef _$AppSettingsNotifier = AutoDisposeNotifier<AppSettings>;
|
>;
|
||||||
// ignore_for_file: type=lint
|
element.handleValue(ref, created);
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Future<Map<String, dynamic>?> billingUsage(Ref ref) async {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
final indexedCloudFileListNotifierProvider = AsyncNotifierProvider(
|
final indexedCloudFileListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
IndexedCloudFileListNotifier.new,
|
IndexedCloudFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<String> folders =
|
final List<String> folders = (response.data['folders'] as List)
|
||||||
(response.data['folders'] as List).map((e) => e as String).toList();
|
.map((e) => e as String)
|
||||||
final List<SnCloudFileIndex> files =
|
.toList();
|
||||||
(response.data['files'] as List)
|
final List<SnCloudFileIndex> files = (response.data['files'] as List)
|
||||||
.map((e) => SnCloudFileIndex.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnCloudFileIndex.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final unindexedFileListNotifierProvider = AsyncNotifierProvider(
|
final unindexedFileListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
UnindexedFileListNotifier.new,
|
UnindexedFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -165,13 +165,13 @@ class UnindexedFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
|
|
||||||
totalCount = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
totalCount = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
||||||
|
|
||||||
final List<SnCloudFile> files =
|
final List<SnCloudFile> files = (response.data as List)
|
||||||
(response.data as List)
|
|
||||||
.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final List<FileListItem> items =
|
final List<FileListItem> items = files
|
||||||
files.map((file) => FileListItem.unindexedFile(file)).toList();
|
.map((file) => FileListItem.unindexedFile(file))
|
||||||
|
.toList();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
92
lib/pods/drive/file_list.g.dart
Normal file
92
lib/pods/drive/file_list.g.dart
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'file_list.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(billingUsage)
|
||||||
|
const billingUsageProvider = BillingUsageProvider._();
|
||||||
|
|
||||||
|
final class BillingUsageProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<Map<String, dynamic>?>,
|
||||||
|
Map<String, dynamic>?,
|
||||||
|
FutureOr<Map<String, dynamic>?>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
|
const BillingUsageProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'billingUsageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$billingUsageHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<Map<String, dynamic>?> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Map<String, dynamic>?> create(Ref ref) {
|
||||||
|
return billingUsage(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
||||||
|
|
||||||
|
@ProviderFor(billingQuota)
|
||||||
|
const billingQuotaProvider = BillingQuotaProvider._();
|
||||||
|
|
||||||
|
final class BillingQuotaProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<Map<String, dynamic>?>,
|
||||||
|
Map<String, dynamic>?,
|
||||||
|
FutureOr<Map<String, dynamic>?>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<Map<String, dynamic>?>,
|
||||||
|
$FutureProvider<Map<String, dynamic>?> {
|
||||||
|
const BillingQuotaProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'billingQuotaProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$billingQuotaHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<Map<String, dynamic>?> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Map<String, dynamic>?> create(Ref ref) {
|
||||||
|
return billingQuota(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';
|
||||||
@@ -13,7 +13,7 @@ final poolsProvider = FutureProvider<List<SnFilePool>>((ref) async {
|
|||||||
});
|
});
|
||||||
|
|
||||||
String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) {
|
String? resolveDefaultPoolId(WidgetRef ref, List<SnFilePool> pools) {
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
final configuredId = settings.defaultPoolId;
|
final configuredId = settings.defaultPoolId;
|
||||||
if (configuredId != null && pools.any((p) => p.id == configuredId)) {
|
if (configuredId != null && pools.any((p) => p.id == configuredId)) {
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:island/models/reference.dart';
|
import 'package:island/models/reference.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
85
lib/pods/drive/file_references.g.dart
Normal file
85
lib/pods/drive/file_references.g.dart
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'file_references.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(fileReferences)
|
||||||
|
const fileReferencesProvider = FileReferencesFamily._();
|
||||||
|
|
||||||
|
final class FileReferencesProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<Reference>>,
|
||||||
|
List<Reference>,
|
||||||
|
FutureOr<List<Reference>>
|
||||||
|
>
|
||||||
|
with $FutureModifier<List<Reference>>, $FutureProvider<List<Reference>> {
|
||||||
|
const FileReferencesProvider._({
|
||||||
|
required FileReferencesFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'fileReferencesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$fileReferencesHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'fileReferencesProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<Reference>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<Reference>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return fileReferences(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is FileReferencesProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
||||||
|
|
||||||
|
final class FileReferencesFamily extends $Family
|
||||||
|
with $FunctionalFamilyOverride<FutureOr<List<Reference>>, String> {
|
||||||
|
const FileReferencesFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'fileReferencesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
FileReferencesProvider call(String fileId) =>
|
||||||
|
FileReferencesProvider._(argument: fileId, from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'fileReferencesProvider';
|
||||||
|
}
|
||||||
@@ -9,18 +9,16 @@ import 'package:island/pods/websocket.dart';
|
|||||||
import 'package:island/services/file_uploader.dart';
|
import 'package:island/services/file_uploader.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
|
|
||||||
final uploadTasksProvider =
|
final uploadTasksProvider = NotifierProvider(UploadTasksNotifier.new);
|
||||||
StateNotifierProvider<UploadTasksNotifier, List<DriveTask>>(
|
|
||||||
(ref) => UploadTasksNotifier(ref),
|
|
||||||
);
|
|
||||||
|
|
||||||
class UploadTasksNotifier extends StateNotifier<List<DriveTask>> {
|
class UploadTasksNotifier extends Notifier<List<DriveTask>> {
|
||||||
final Ref ref;
|
|
||||||
StreamSubscription? _websocketSubscription;
|
StreamSubscription? _websocketSubscription;
|
||||||
final Map<String, Map<String, dynamic>> _pendingUploads = {};
|
final Map<String, Map<String, dynamic>> _pendingUploads = {};
|
||||||
|
|
||||||
UploadTasksNotifier(this.ref) : super([]) {
|
@override
|
||||||
|
List<DriveTask> build() {
|
||||||
_listenToWebSocket();
|
_listenToWebSocket();
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _listenToWebSocket() {
|
void _listenToWebSocket() {
|
||||||
@@ -334,10 +332,8 @@ class UploadTasksNotifier extends StateNotifier<List<DriveTask>> {
|
|||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_websocketSubscription?.cancel();
|
_websocketSubscription?.cancel();
|
||||||
super.dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/models/activity.dart';
|
import 'package:island/models/activity.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|||||||
@@ -6,169 +6,99 @@ part of 'event_calendar.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
@ProviderFor(eventCalendar)
|
@ProviderFor(eventCalendar)
|
||||||
const eventCalendarProvider = EventCalendarFamily();
|
const 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
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
final class EventCalendarProvider
|
||||||
class EventCalendarFamily
|
extends
|
||||||
extends Family<AsyncValue<List<SnEventCalendarEntry>>> {
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnEventCalendarEntry>>,
|
||||||
|
List<SnEventCalendarEntry>,
|
||||||
|
FutureOr<List<SnEventCalendarEntry>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<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._({
|
||||||
/// Copied from [eventCalendar].
|
required EventCalendarFamily super.from,
|
||||||
const EventCalendarFamily();
|
required EventCalendarQuery super.argument,
|
||||||
|
}) : super(
|
||||||
/// Provider for fetching event calendar data
|
retry: null,
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
EventCalendarProvider call(EventCalendarQuery query) {
|
|
||||||
return EventCalendarProvider(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
EventCalendarProvider getProviderOverride(
|
|
||||||
covariant EventCalendarProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'eventCalendarProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Provider for fetching event calendar data
|
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
class EventCalendarProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnEventCalendarEntry>> {
|
|
||||||
/// Provider for fetching event calendar data
|
|
||||||
/// This can be used anywhere in the app where calendar data is needed
|
|
||||||
///
|
|
||||||
/// Copied from [eventCalendar].
|
|
||||||
EventCalendarProvider(EventCalendarQuery query)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => eventCalendar(ref as EventCalendarRef, query),
|
|
||||||
from: eventCalendarProvider,
|
|
||||||
name: r'eventCalendarProvider',
|
name: r'eventCalendarProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$eventCalendarHash,
|
|
||||||
dependencies: EventCalendarFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
EventCalendarFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
EventCalendarProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final EventCalendarQuery query;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$eventCalendarHash();
|
||||||
FutureOr<List<SnEventCalendarEntry>> Function(EventCalendarRef provider)
|
|
||||||
create,
|
@override
|
||||||
) {
|
String toString() {
|
||||||
return ProviderOverride(
|
return r'eventCalendarProvider'
|
||||||
origin: this,
|
''
|
||||||
override: EventCalendarProvider._internal(
|
'($argument)';
|
||||||
(ref) => create(ref as EventCalendarRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>> createElement() {
|
$FutureProviderElement<List<SnEventCalendarEntry>> $createElement(
|
||||||
return _EventCalendarProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnEventCalendarEntry>> create(Ref ref) {
|
||||||
|
final argument = this.argument as EventCalendarQuery;
|
||||||
|
return eventCalendar(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is EventCalendarProvider && other.query == query;
|
return other is EventCalendarProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$eventCalendarHash() => r'3a33581c28bcd44bc5eb3abdb770171b4d275a5d';
|
||||||
// ignore: unused_element
|
|
||||||
mixin EventCalendarRef
|
|
||||||
on AutoDisposeFutureProviderRef<List<SnEventCalendarEntry>> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
EventCalendarQuery get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _EventCalendarProviderElement
|
/// Provider for fetching event calendar data
|
||||||
extends AutoDisposeFutureProviderElement<List<SnEventCalendarEntry>>
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
with EventCalendarRef {
|
|
||||||
_EventCalendarProviderElement(super.provider);
|
final class EventCalendarFamily extends $Family
|
||||||
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnEventCalendarEntry>>,
|
||||||
|
EventCalendarQuery
|
||||||
|
> {
|
||||||
|
const EventCalendarFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'eventCalendarProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Provider for fetching event calendar data
|
||||||
|
/// This can be used anywhere in the app where calendar data is needed
|
||||||
|
|
||||||
|
EventCalendarProvider call(EventCalendarQuery query) =>
|
||||||
|
EventCalendarProvider._(argument: query, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EventCalendarQuery get query => (origin as EventCalendarProvider).query;
|
String toString() => r'eventCalendarProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'file_list.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$billingUsageHash() => r'58d8bc774868d60781574c85d6b25869a79c57aa';
|
|
||||||
|
|
||||||
/// See also [billingUsage].
|
|
||||||
@ProviderFor(billingUsage)
|
|
||||||
final billingUsageProvider =
|
|
||||||
AutoDisposeFutureProvider<Map<String, dynamic>?>.internal(
|
|
||||||
billingUsage,
|
|
||||||
name: r'billingUsageProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$billingUsageHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef BillingUsageRef = AutoDisposeFutureProviderRef<Map<String, dynamic>?>;
|
|
||||||
String _$billingQuotaHash() => r'4ec5d728e439015800abb2d0d673b5a7329cc654';
|
|
||||||
|
|
||||||
/// See also [billingQuota].
|
|
||||||
@ProviderFor(billingQuota)
|
|
||||||
final billingQuotaProvider =
|
|
||||||
AutoDisposeFutureProvider<Map<String, dynamic>?>.internal(
|
|
||||||
billingQuota,
|
|
||||||
name: r'billingQuotaProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$billingQuotaHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef BillingQuotaRef = AutoDisposeFutureProviderRef<Map<String, dynamic>?>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'file_references.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$fileReferencesHash() => r'd66c678c221f61978bdb242b98e6dbe31d0c204b';
|
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
@ProviderFor(fileReferences)
|
|
||||||
const fileReferencesProvider = FileReferencesFamily();
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
class FileReferencesFamily extends Family<AsyncValue<List<Reference>>> {
|
|
||||||
/// See also [fileReferences].
|
|
||||||
const FileReferencesFamily();
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
FileReferencesProvider call(String fileId) {
|
|
||||||
return FileReferencesProvider(fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
FileReferencesProvider getProviderOverride(
|
|
||||||
covariant FileReferencesProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'fileReferencesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [fileReferences].
|
|
||||||
class FileReferencesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<Reference>> {
|
|
||||||
/// See also [fileReferences].
|
|
||||||
FileReferencesProvider(String fileId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => fileReferences(ref as FileReferencesRef, fileId),
|
|
||||||
from: fileReferencesProvider,
|
|
||||||
name: r'fileReferencesProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$fileReferencesHash,
|
|
||||||
dependencies: FileReferencesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
FileReferencesFamily._allTransitiveDependencies,
|
|
||||||
fileId: fileId,
|
|
||||||
);
|
|
||||||
|
|
||||||
FileReferencesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.fileId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String fileId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<List<Reference>> Function(FileReferencesRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: FileReferencesProvider._internal(
|
|
||||||
(ref) => create(ref as FileReferencesRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
fileId: fileId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<List<Reference>> createElement() {
|
|
||||||
return _FileReferencesProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is FileReferencesProvider && other.fileId == fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, fileId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin FileReferencesRef on AutoDisposeFutureProviderRef<List<Reference>> {
|
|
||||||
/// The parameter `fileId` of this provider.
|
|
||||||
String get fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FileReferencesProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<List<Reference>>
|
|
||||||
with FileReferencesRef {
|
|
||||||
_FileReferencesProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get fileId => (origin as FileReferencesProvider).fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
@@ -6,159 +6,95 @@ part of 'link_preview.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$LinkPreview
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<SnScrappedLink?> {
|
|
||||||
late final String url;
|
|
||||||
|
|
||||||
FutureOr<SnScrappedLink?> build(String url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
@ProviderFor(LinkPreview)
|
@ProviderFor(LinkPreview)
|
||||||
const linkPreviewProvider = LinkPreviewFamily();
|
const linkPreviewProvider = LinkPreviewFamily._();
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
final class LinkPreviewProvider
|
||||||
class LinkPreviewFamily extends Family<AsyncValue<SnScrappedLink?>> {
|
extends $AsyncNotifierProvider<LinkPreview, SnScrappedLink?> {
|
||||||
/// See also [LinkPreview].
|
const LinkPreviewProvider._({
|
||||||
const LinkPreviewFamily();
|
required LinkPreviewFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
/// See also [LinkPreview].
|
}) : super(
|
||||||
LinkPreviewProvider call(String url) {
|
retry: null,
|
||||||
return LinkPreviewProvider(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
LinkPreviewProvider getProviderOverride(
|
|
||||||
covariant LinkPreviewProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.url);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'linkPreviewProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
class LinkPreviewProvider
|
|
||||||
extends AutoDisposeAsyncNotifierProviderImpl<LinkPreview, SnScrappedLink?> {
|
|
||||||
/// See also [LinkPreview].
|
|
||||||
LinkPreviewProvider(String url)
|
|
||||||
: this._internal(
|
|
||||||
() => LinkPreview()..url = url,
|
|
||||||
from: linkPreviewProvider,
|
|
||||||
name: r'linkPreviewProvider',
|
name: r'linkPreviewProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$linkPreviewHash,
|
|
||||||
dependencies: LinkPreviewFamily._dependencies,
|
|
||||||
allTransitiveDependencies: LinkPreviewFamily._allTransitiveDependencies,
|
|
||||||
url: url,
|
|
||||||
);
|
|
||||||
|
|
||||||
LinkPreviewProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.url,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String url;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<SnScrappedLink?> runNotifierBuild(covariant LinkPreview notifier) {
|
|
||||||
return notifier.build(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(LinkPreview Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: LinkPreviewProvider._internal(
|
|
||||||
() => create()..url = url,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
url: url,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?>
|
String debugGetCreateSourceHash() => _$linkPreviewHash();
|
||||||
createElement() {
|
|
||||||
return _LinkPreviewProviderElement(this);
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'linkPreviewProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
LinkPreview create() => LinkPreview();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is LinkPreviewProvider && other.url == url;
|
return other is LinkPreviewProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, url.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$linkPreviewHash() => r'5130593d3066155cb958d20714ee577df1f940d7';
|
||||||
// ignore: unused_element
|
|
||||||
mixin LinkPreviewRef on AutoDisposeAsyncNotifierProviderRef<SnScrappedLink?> {
|
|
||||||
/// The parameter `url` of this provider.
|
|
||||||
String get url;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LinkPreviewProviderElement
|
final class LinkPreviewFamily extends $Family
|
||||||
extends
|
with
|
||||||
AutoDisposeAsyncNotifierProviderElement<LinkPreview, SnScrappedLink?>
|
$ClassFamilyOverride<
|
||||||
with LinkPreviewRef {
|
LinkPreview,
|
||||||
_LinkPreviewProviderElement(super.provider);
|
AsyncValue<SnScrappedLink?>,
|
||||||
|
SnScrappedLink?,
|
||||||
|
FutureOr<SnScrappedLink?>,
|
||||||
|
String
|
||||||
|
> {
|
||||||
|
const LinkPreviewFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'linkPreviewProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
LinkPreviewProvider call(String url) =>
|
||||||
|
LinkPreviewProvider._(argument: url, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get url => (origin as LinkPreviewProvider).url;
|
String toString() => r'linkPreviewProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
abstract class _$LinkPreview extends $AsyncNotifier<SnScrappedLink?> {
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
late final _$args = ref.$arg as String;
|
||||||
|
String get url => _$args;
|
||||||
|
|
||||||
|
FutureOr<SnScrappedLink?> build(String url);
|
||||||
|
@$mustCallSuper
|
||||||
|
@override
|
||||||
|
void runBuild() {
|
||||||
|
final created = build(_$args);
|
||||||
|
final ref = this.ref as $Ref<AsyncValue<SnScrappedLink?>, SnScrappedLink?>;
|
||||||
|
final element =
|
||||||
|
ref.element
|
||||||
|
as $ClassProviderElement<
|
||||||
|
AnyNotifier<AsyncValue<SnScrappedLink?>, SnScrappedLink?>,
|
||||||
|
AsyncValue<SnScrappedLink?>,
|
||||||
|
Object?,
|
||||||
|
Object?
|
||||||
|
>;
|
||||||
|
element.handleValue(ref, created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ abstract class PaginationController<T> {
|
|||||||
int get fetchedCount;
|
int get fetchedCount;
|
||||||
|
|
||||||
bool get fetchedAll;
|
bool get fetchedAll;
|
||||||
|
bool get isLoading;
|
||||||
|
|
||||||
FutureOr<List<T>> fetch();
|
FutureOr<List<T>> fetch();
|
||||||
|
|
||||||
@@ -27,40 +28,44 @@ mixin AsyncPaginationController<T> on AsyncNotifier<List<T>>
|
|||||||
int? totalCount;
|
int? totalCount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int fetchedCount = 0;
|
int get fetchedCount => state.value?.length ?? 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!;
|
bool get fetchedAll => totalCount != null && fetchedCount >= totalCount!;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool isLoading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<T>> build() async => fetch();
|
FutureOr<List<T>> build() async => fetch();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
|
isLoading = true;
|
||||||
totalCount = null;
|
totalCount = null;
|
||||||
fetchedCount = 0;
|
|
||||||
state = AsyncData<List<T>>([]);
|
state = AsyncData<List<T>>([]);
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
return await fetch();
|
return await fetch();
|
||||||
});
|
});
|
||||||
state = newState;
|
state = newState;
|
||||||
fetchedCount = newState.value?.length ?? 0;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> fetchFurther() async {
|
Future<void> fetchFurther() async {
|
||||||
if (fetchedAll) return;
|
if (fetchedAll) return;
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
state = AsyncLoading<List<T>>();
|
state = AsyncLoading<List<T>>();
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
final elements = await fetch();
|
final elements = await fetch();
|
||||||
return [...?state.valueOrNull, ...elements];
|
return [...?state.value, ...elements];
|
||||||
});
|
});
|
||||||
|
|
||||||
state = newState;
|
state = newState;
|
||||||
fetchedCount = newState.value?.length ?? 0;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,15 +75,15 @@ mixin AsyncPaginationFilter<F, T> on AsyncPaginationController<T>
|
|||||||
Future<void> applyFilter(F filter) async {
|
Future<void> applyFilter(F filter) async {
|
||||||
if (currentFilter == filter) return;
|
if (currentFilter == filter) return;
|
||||||
// Reset the data
|
// Reset the data
|
||||||
|
isLoading = true;
|
||||||
totalCount = null;
|
totalCount = null;
|
||||||
fetchedCount = 0;
|
|
||||||
currentFilter = filter;
|
|
||||||
|
|
||||||
state = AsyncData<List<T>>([]);
|
state = AsyncData<List<T>>([]);
|
||||||
|
currentFilter = filter;
|
||||||
|
|
||||||
final newState = await AsyncValue.guard<List<T>>(() async {
|
final newState = await AsyncValue.guard<List<T>>(() async {
|
||||||
return await fetch();
|
return await fetch();
|
||||||
});
|
});
|
||||||
state = newState;
|
state = newState;
|
||||||
|
isLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
lib/pods/post/post_categories.dart
Normal file
52
lib/pods/post/post_categories.dart
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// Post Categories Notifier
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/post_category.dart';
|
||||||
|
import 'package:island/models/post_tag.dart';
|
||||||
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
|
final postCategoriesProvider =
|
||||||
|
AsyncNotifierProvider.autoDispose<
|
||||||
|
PostCategoriesNotifier,
|
||||||
|
List<SnPostCategory>
|
||||||
|
>(PostCategoriesNotifier.new);
|
||||||
|
|
||||||
|
class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
|
||||||
|
with AsyncPaginationController<SnPostCategory> {
|
||||||
|
@override
|
||||||
|
Future<List<SnPostCategory>> fetch() async {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
|
final response = await client.get(
|
||||||
|
'/sphere/posts/categories',
|
||||||
|
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
|
||||||
|
);
|
||||||
|
|
||||||
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
final data = response.data as List;
|
||||||
|
return data.map((json) => SnPostCategory.fromJson(json)).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post Tags Notifier
|
||||||
|
final postTagsProvider =
|
||||||
|
AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>(
|
||||||
|
PostTagsNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class PostTagsNotifier extends AsyncNotifier<List<SnPostTag>>
|
||||||
|
with AsyncPaginationController<SnPostTag> {
|
||||||
|
@override
|
||||||
|
Future<List<SnPostTag>> fetch() async {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
|
final response = await client.get(
|
||||||
|
'/sphere/posts/tags',
|
||||||
|
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
|
||||||
|
);
|
||||||
|
|
||||||
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
final data = response.data as List;
|
||||||
|
return data.map((json) => SnPostTag.fromJson(json)).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
95
lib/pods/post/post_list.dart
Normal file
95
lib/pods/post/post_list.dart
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/models/post.dart';
|
||||||
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
|
part 'post_list.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class PostListQuery with _$PostListQuery {
|
||||||
|
const factory PostListQuery({
|
||||||
|
String? pubName,
|
||||||
|
String? realm,
|
||||||
|
int? type,
|
||||||
|
List<String>? categories,
|
||||||
|
List<String>? tags,
|
||||||
|
bool? pinned,
|
||||||
|
@Default(false) bool shuffle,
|
||||||
|
bool? includeReplies,
|
||||||
|
bool? mediaOnly,
|
||||||
|
String? queryTerm,
|
||||||
|
String? order,
|
||||||
|
int? periodStart,
|
||||||
|
int? periodEnd,
|
||||||
|
@Default(true) bool orderDesc,
|
||||||
|
}) = _PostListQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
sealed class PostListQueryConfig with _$PostListQueryConfig {
|
||||||
|
const factory PostListQueryConfig({
|
||||||
|
String? id,
|
||||||
|
@Default(PostListQuery()) PostListQuery initialFilter,
|
||||||
|
}) = _PostListQueryConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
final postListProvider = AsyncNotifierProvider.autoDispose.family(
|
||||||
|
PostListNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class PostListNotifier extends AsyncNotifier<List<SnPost>>
|
||||||
|
with
|
||||||
|
AsyncPaginationController<SnPost>,
|
||||||
|
AsyncPaginationFilter<PostListQuery, SnPost> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String? id;
|
||||||
|
final PostListQueryConfig config;
|
||||||
|
PostListNotifier(this.config) : id = config.id;
|
||||||
|
|
||||||
|
@override
|
||||||
|
late PostListQuery currentFilter;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<SnPost>> build() async {
|
||||||
|
currentFilter = config.initialFilter;
|
||||||
|
return fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<SnPost>> fetch() async {
|
||||||
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
|
final queryParams = {
|
||||||
|
'offset': fetchedCount,
|
||||||
|
'take': pageSize,
|
||||||
|
'replies': currentFilter.includeReplies,
|
||||||
|
'orderDesc': currentFilter.orderDesc,
|
||||||
|
if (currentFilter.shuffle) 'shuffle': currentFilter.shuffle,
|
||||||
|
if (currentFilter.pubName != null) 'pub': currentFilter.pubName,
|
||||||
|
if (currentFilter.realm != null) 'realm': currentFilter.realm,
|
||||||
|
if (currentFilter.type != null) 'type': currentFilter.type,
|
||||||
|
if (currentFilter.tags != null) 'tags': currentFilter.tags,
|
||||||
|
if (currentFilter.categories != null)
|
||||||
|
'categories': currentFilter.categories,
|
||||||
|
if (currentFilter.pinned != null) 'pinned': currentFilter.pinned,
|
||||||
|
if (currentFilter.order != null) 'order': currentFilter.order,
|
||||||
|
if (currentFilter.periodStart != null)
|
||||||
|
'periodStart': currentFilter.periodStart,
|
||||||
|
if (currentFilter.periodEnd != null) 'periodEnd': currentFilter.periodEnd,
|
||||||
|
if (currentFilter.queryTerm != null) 'query': currentFilter.queryTerm,
|
||||||
|
if (currentFilter.mediaOnly != null) 'media': currentFilter.mediaOnly,
|
||||||
|
};
|
||||||
|
|
||||||
|
final response = await client.get(
|
||||||
|
'/sphere/posts',
|
||||||
|
queryParameters: queryParams,
|
||||||
|
);
|
||||||
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
return response.data
|
||||||
|
.map((json) => SnPost.fromJson(json))
|
||||||
|
.cast<SnPost>()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
592
lib/pods/post/post_list.freezed.dart
Normal file
592
lib/pods/post/post_list.freezed.dart
Normal file
@@ -0,0 +1,592 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'post_list.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$PostListQuery {
|
||||||
|
|
||||||
|
String? get pubName; String? get realm; int? get type; List<String>? get categories; List<String>? get tags; bool? get pinned; bool get shuffle; bool? get includeReplies; bool? get mediaOnly; String? get queryTerm; String? get order; int? get periodStart; int? get periodEnd; bool get orderDesc;
|
||||||
|
/// Create a copy of PostListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$PostListQueryCopyWith<PostListQuery> get copyWith => _$PostListQueryCopyWithImpl<PostListQuery>(this as PostListQuery, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is PostListQuery&&(identical(other.pubName, pubName) || other.pubName == pubName)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.categories, categories)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.pinned, pinned) || other.pinned == pinned)&&(identical(other.shuffle, shuffle) || other.shuffle == shuffle)&&(identical(other.includeReplies, includeReplies) || other.includeReplies == includeReplies)&&(identical(other.mediaOnly, mediaOnly) || other.mediaOnly == mediaOnly)&&(identical(other.queryTerm, queryTerm) || other.queryTerm == queryTerm)&&(identical(other.order, order) || other.order == order)&&(identical(other.periodStart, periodStart) || other.periodStart == periodStart)&&(identical(other.periodEnd, periodEnd) || other.periodEnd == periodEnd)&&(identical(other.orderDesc, orderDesc) || other.orderDesc == orderDesc));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,pubName,realm,type,const DeepCollectionEquality().hash(categories),const DeepCollectionEquality().hash(tags),pinned,shuffle,includeReplies,mediaOnly,queryTerm,order,periodStart,periodEnd,orderDesc);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PostListQuery(pubName: $pubName, realm: $realm, type: $type, categories: $categories, tags: $tags, pinned: $pinned, shuffle: $shuffle, includeReplies: $includeReplies, mediaOnly: $mediaOnly, queryTerm: $queryTerm, order: $order, periodStart: $periodStart, periodEnd: $periodEnd, orderDesc: $orderDesc)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $PostListQueryCopyWith<$Res> {
|
||||||
|
factory $PostListQueryCopyWith(PostListQuery value, $Res Function(PostListQuery) _then) = _$PostListQueryCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? pubName, String? realm, int? type, List<String>? categories, List<String>? tags, bool? pinned, bool shuffle, bool? includeReplies, bool? mediaOnly, String? queryTerm, String? order, int? periodStart, int? periodEnd, bool orderDesc
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$PostListQueryCopyWithImpl<$Res>
|
||||||
|
implements $PostListQueryCopyWith<$Res> {
|
||||||
|
_$PostListQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final PostListQuery _self;
|
||||||
|
final $Res Function(PostListQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? pubName = freezed,Object? realm = freezed,Object? type = freezed,Object? categories = freezed,Object? tags = freezed,Object? pinned = freezed,Object? shuffle = null,Object? includeReplies = freezed,Object? mediaOnly = freezed,Object? queryTerm = freezed,Object? order = freezed,Object? periodStart = freezed,Object? periodEnd = freezed,Object? orderDesc = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
pubName: freezed == pubName ? _self.pubName : pubName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,categories: freezed == categories ? _self.categories : categories // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,pinned: freezed == pinned ? _self.pinned : pinned // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,shuffle: null == shuffle ? _self.shuffle : shuffle // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,includeReplies: freezed == includeReplies ? _self.includeReplies : includeReplies // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,mediaOnly: freezed == mediaOnly ? _self.mediaOnly : mediaOnly // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,queryTerm: freezed == queryTerm ? _self.queryTerm : queryTerm // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,order: freezed == order ? _self.order : order // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,periodStart: freezed == periodStart ? _self.periodStart : periodStart // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,periodEnd: freezed == periodEnd ? _self.periodEnd : periodEnd // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,orderDesc: null == orderDesc ? _self.orderDesc : orderDesc // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [PostListQuery].
|
||||||
|
extension PostListQueryPatterns on PostListQuery {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _PostListQuery value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _PostListQuery value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _PostListQuery value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? pubName, String? realm, int? type, List<String>? categories, List<String>? tags, bool? pinned, bool shuffle, bool? includeReplies, bool? mediaOnly, String? queryTerm, String? order, int? periodStart, int? periodEnd, bool orderDesc)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery() when $default != null:
|
||||||
|
return $default(_that.pubName,_that.realm,_that.type,_that.categories,_that.tags,_that.pinned,_that.shuffle,_that.includeReplies,_that.mediaOnly,_that.queryTerm,_that.order,_that.periodStart,_that.periodEnd,_that.orderDesc);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? pubName, String? realm, int? type, List<String>? categories, List<String>? tags, bool? pinned, bool shuffle, bool? includeReplies, bool? mediaOnly, String? queryTerm, String? order, int? periodStart, int? periodEnd, bool orderDesc) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery():
|
||||||
|
return $default(_that.pubName,_that.realm,_that.type,_that.categories,_that.tags,_that.pinned,_that.shuffle,_that.includeReplies,_that.mediaOnly,_that.queryTerm,_that.order,_that.periodStart,_that.periodEnd,_that.orderDesc);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? pubName, String? realm, int? type, List<String>? categories, List<String>? tags, bool? pinned, bool shuffle, bool? includeReplies, bool? mediaOnly, String? queryTerm, String? order, int? periodStart, int? periodEnd, bool orderDesc)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQuery() when $default != null:
|
||||||
|
return $default(_that.pubName,_that.realm,_that.type,_that.categories,_that.tags,_that.pinned,_that.shuffle,_that.includeReplies,_that.mediaOnly,_that.queryTerm,_that.order,_that.periodStart,_that.periodEnd,_that.orderDesc);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _PostListQuery implements PostListQuery {
|
||||||
|
const _PostListQuery({this.pubName, this.realm, this.type, final List<String>? categories, final List<String>? tags, this.pinned, this.shuffle = false, this.includeReplies, this.mediaOnly, this.queryTerm, this.order, this.periodStart, this.periodEnd, this.orderDesc = true}): _categories = categories,_tags = tags;
|
||||||
|
|
||||||
|
|
||||||
|
@override final String? pubName;
|
||||||
|
@override final String? realm;
|
||||||
|
@override final int? type;
|
||||||
|
final List<String>? _categories;
|
||||||
|
@override List<String>? get categories {
|
||||||
|
final value = _categories;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_categories is EqualUnmodifiableListView) return _categories;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String>? _tags;
|
||||||
|
@override List<String>? get tags {
|
||||||
|
final value = _tags;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_tags is EqualUnmodifiableListView) return _tags;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final bool? pinned;
|
||||||
|
@override@JsonKey() final bool shuffle;
|
||||||
|
@override final bool? includeReplies;
|
||||||
|
@override final bool? mediaOnly;
|
||||||
|
@override final String? queryTerm;
|
||||||
|
@override final String? order;
|
||||||
|
@override final int? periodStart;
|
||||||
|
@override final int? periodEnd;
|
||||||
|
@override@JsonKey() final bool orderDesc;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$PostListQueryCopyWith<_PostListQuery> get copyWith => __$PostListQueryCopyWithImpl<_PostListQuery>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PostListQuery&&(identical(other.pubName, pubName) || other.pubName == pubName)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._categories, _categories)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.pinned, pinned) || other.pinned == pinned)&&(identical(other.shuffle, shuffle) || other.shuffle == shuffle)&&(identical(other.includeReplies, includeReplies) || other.includeReplies == includeReplies)&&(identical(other.mediaOnly, mediaOnly) || other.mediaOnly == mediaOnly)&&(identical(other.queryTerm, queryTerm) || other.queryTerm == queryTerm)&&(identical(other.order, order) || other.order == order)&&(identical(other.periodStart, periodStart) || other.periodStart == periodStart)&&(identical(other.periodEnd, periodEnd) || other.periodEnd == periodEnd)&&(identical(other.orderDesc, orderDesc) || other.orderDesc == orderDesc));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,pubName,realm,type,const DeepCollectionEquality().hash(_categories),const DeepCollectionEquality().hash(_tags),pinned,shuffle,includeReplies,mediaOnly,queryTerm,order,periodStart,periodEnd,orderDesc);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PostListQuery(pubName: $pubName, realm: $realm, type: $type, categories: $categories, tags: $tags, pinned: $pinned, shuffle: $shuffle, includeReplies: $includeReplies, mediaOnly: $mediaOnly, queryTerm: $queryTerm, order: $order, periodStart: $periodStart, periodEnd: $periodEnd, orderDesc: $orderDesc)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$PostListQueryCopyWith<$Res> implements $PostListQueryCopyWith<$Res> {
|
||||||
|
factory _$PostListQueryCopyWith(_PostListQuery value, $Res Function(_PostListQuery) _then) = __$PostListQueryCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? pubName, String? realm, int? type, List<String>? categories, List<String>? tags, bool? pinned, bool shuffle, bool? includeReplies, bool? mediaOnly, String? queryTerm, String? order, int? periodStart, int? periodEnd, bool orderDesc
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$PostListQueryCopyWithImpl<$Res>
|
||||||
|
implements _$PostListQueryCopyWith<$Res> {
|
||||||
|
__$PostListQueryCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _PostListQuery _self;
|
||||||
|
final $Res Function(_PostListQuery) _then;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQuery
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? pubName = freezed,Object? realm = freezed,Object? type = freezed,Object? categories = freezed,Object? tags = freezed,Object? pinned = freezed,Object? shuffle = null,Object? includeReplies = freezed,Object? mediaOnly = freezed,Object? queryTerm = freezed,Object? order = freezed,Object? periodStart = freezed,Object? periodEnd = freezed,Object? orderDesc = null,}) {
|
||||||
|
return _then(_PostListQuery(
|
||||||
|
pubName: freezed == pubName ? _self.pubName : pubName // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,categories: freezed == categories ? _self._categories : categories // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,tags: freezed == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>?,pinned: freezed == pinned ? _self.pinned : pinned // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,shuffle: null == shuffle ? _self.shuffle : shuffle // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,includeReplies: freezed == includeReplies ? _self.includeReplies : includeReplies // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,mediaOnly: freezed == mediaOnly ? _self.mediaOnly : mediaOnly // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,queryTerm: freezed == queryTerm ? _self.queryTerm : queryTerm // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,order: freezed == order ? _self.order : order // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,periodStart: freezed == periodStart ? _self.periodStart : periodStart // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,periodEnd: freezed == periodEnd ? _self.periodEnd : periodEnd // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,orderDesc: null == orderDesc ? _self.orderDesc : orderDesc // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$PostListQueryConfig {
|
||||||
|
|
||||||
|
String? get id; PostListQuery get initialFilter;
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$PostListQueryConfigCopyWith<PostListQueryConfig> get copyWith => _$PostListQueryConfigCopyWithImpl<PostListQueryConfig>(this as PostListQueryConfig, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is PostListQueryConfig&&(identical(other.id, id) || other.id == id)&&(identical(other.initialFilter, initialFilter) || other.initialFilter == initialFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,initialFilter);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PostListQueryConfig(id: $id, initialFilter: $initialFilter)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $PostListQueryConfigCopyWith<$Res> {
|
||||||
|
factory $PostListQueryConfigCopyWith(PostListQueryConfig value, $Res Function(PostListQueryConfig) _then) = _$PostListQueryConfigCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? id, PostListQuery initialFilter
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$PostListQueryCopyWith<$Res> get initialFilter;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$PostListQueryConfigCopyWithImpl<$Res>
|
||||||
|
implements $PostListQueryConfigCopyWith<$Res> {
|
||||||
|
_$PostListQueryConfigCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final PostListQueryConfig _self;
|
||||||
|
final $Res Function(PostListQueryConfig) _then;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? initialFilter = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,initialFilter: null == initialFilter ? _self.initialFilter : initialFilter // ignore: cast_nullable_to_non_nullable
|
||||||
|
as PostListQuery,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$PostListQueryCopyWith<$Res> get initialFilter {
|
||||||
|
|
||||||
|
return $PostListQueryCopyWith<$Res>(_self.initialFilter, (value) {
|
||||||
|
return _then(_self.copyWith(initialFilter: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [PostListQueryConfig].
|
||||||
|
extension PostListQueryConfigPatterns on PostListQueryConfig {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _PostListQueryConfig value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _PostListQueryConfig value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig():
|
||||||
|
return $default(_that);}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _PostListQueryConfig value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? id, PostListQuery initialFilter)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig() when $default != null:
|
||||||
|
return $default(_that.id,_that.initialFilter);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? id, PostListQuery initialFilter) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig():
|
||||||
|
return $default(_that.id,_that.initialFilter);}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? id, PostListQuery initialFilter)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _PostListQueryConfig() when $default != null:
|
||||||
|
return $default(_that.id,_that.initialFilter);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _PostListQueryConfig implements PostListQueryConfig {
|
||||||
|
const _PostListQueryConfig({this.id, this.initialFilter = const PostListQuery()});
|
||||||
|
|
||||||
|
|
||||||
|
@override final String? id;
|
||||||
|
@override@JsonKey() final PostListQuery initialFilter;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$PostListQueryConfigCopyWith<_PostListQueryConfig> get copyWith => __$PostListQueryConfigCopyWithImpl<_PostListQueryConfig>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PostListQueryConfig&&(identical(other.id, id) || other.id == id)&&(identical(other.initialFilter, initialFilter) || other.initialFilter == initialFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,initialFilter);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PostListQueryConfig(id: $id, initialFilter: $initialFilter)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$PostListQueryConfigCopyWith<$Res> implements $PostListQueryConfigCopyWith<$Res> {
|
||||||
|
factory _$PostListQueryConfigCopyWith(_PostListQueryConfig value, $Res Function(_PostListQueryConfig) _then) = __$PostListQueryConfigCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? id, PostListQuery initialFilter
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $PostListQueryCopyWith<$Res> get initialFilter;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$PostListQueryConfigCopyWithImpl<$Res>
|
||||||
|
implements _$PostListQueryConfigCopyWith<$Res> {
|
||||||
|
__$PostListQueryConfigCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _PostListQueryConfig _self;
|
||||||
|
final $Res Function(_PostListQueryConfig) _then;
|
||||||
|
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? initialFilter = null,}) {
|
||||||
|
return _then(_PostListQueryConfig(
|
||||||
|
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,initialFilter: null == initialFilter ? _self.initialFilter : initialFilter // ignore: cast_nullable_to_non_nullable
|
||||||
|
as PostListQuery,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of PostListQueryConfig
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$PostListQueryCopyWith<$Res> get initialFilter {
|
||||||
|
|
||||||
|
return $PostListQueryCopyWith<$Res>(_self.initialFilter, (value) {
|
||||||
|
return _then(_self.copyWith(initialFilter: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -55,16 +55,12 @@ Future<String> siteFileContentRaw(
|
|||||||
return resp.data is String ? resp.data : resp.data['content'] as String;
|
return resp.data is String ? resp.data : resp.data['content'] as String;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SiteFilesNotifier
|
class SiteFilesNotifier extends AsyncNotifier<List<SnSiteFileEntry>> {
|
||||||
extends
|
final ({String siteId, String? path}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SiteFilesNotifier(this.arg);
|
||||||
List<SnSiteFileEntry>,
|
|
||||||
({String siteId, String? path})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnSiteFileEntry>> build(
|
Future<List<SnSiteFileEntry>> build() async {
|
||||||
({String siteId, String? path}) arg,
|
|
||||||
) async {
|
|
||||||
return fetchFiles();
|
return fetchFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +148,6 @@ class SiteFilesNotifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family<
|
final siteFilesNotifierProvider = AsyncNotifierProvider.autoDispose.family(
|
||||||
SiteFilesNotifier,
|
SiteFilesNotifier.new,
|
||||||
List<SnSiteFileEntry>,
|
);
|
||||||
({String siteId, String? path})
|
|
||||||
>(SiteFilesNotifier.new);
|
|
||||||
|
|||||||
@@ -6,446 +6,257 @@ part of 'site_files.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFiles].
|
|
||||||
@ProviderFor(siteFiles)
|
@ProviderFor(siteFiles)
|
||||||
const siteFilesProvider = SiteFilesFamily();
|
const siteFilesProvider = SiteFilesFamily._();
|
||||||
|
|
||||||
/// See also [siteFiles].
|
final class SiteFilesProvider
|
||||||
class SiteFilesFamily extends Family<AsyncValue<List<SnSiteFileEntry>>> {
|
extends
|
||||||
/// See also [siteFiles].
|
$FunctionalProvider<
|
||||||
const SiteFilesFamily();
|
AsyncValue<List<SnSiteFileEntry>>,
|
||||||
|
List<SnSiteFileEntry>,
|
||||||
/// See also [siteFiles].
|
FutureOr<List<SnSiteFileEntry>>
|
||||||
SiteFilesProvider call({required String siteId, String? path}) {
|
>
|
||||||
return SiteFilesProvider(siteId: siteId, path: path);
|
with
|
||||||
}
|
$FutureModifier<List<SnSiteFileEntry>>,
|
||||||
|
$FutureProvider<List<SnSiteFileEntry>> {
|
||||||
@override
|
const SiteFilesProvider._({
|
||||||
SiteFilesProvider getProviderOverride(covariant SiteFilesProvider provider) {
|
required SiteFilesFamily super.from,
|
||||||
return call(siteId: provider.siteId, path: provider.path);
|
required ({String siteId, String? path}) super.argument,
|
||||||
}
|
}) : super(
|
||||||
|
retry: null,
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFilesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFiles].
|
|
||||||
class SiteFilesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnSiteFileEntry>> {
|
|
||||||
/// See also [siteFiles].
|
|
||||||
SiteFilesProvider({required String siteId, String? path})
|
|
||||||
: this._internal(
|
|
||||||
(ref) => siteFiles(ref as SiteFilesRef, siteId: siteId, path: path),
|
|
||||||
from: siteFilesProvider,
|
|
||||||
name: r'siteFilesProvider',
|
name: r'siteFilesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$siteFilesHash,
|
|
||||||
dependencies: SiteFilesFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SiteFilesFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
path: path,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFilesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.path,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String? path;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$siteFilesHash();
|
||||||
FutureOr<List<SnSiteFileEntry>> Function(SiteFilesRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'siteFilesProvider'
|
||||||
override: SiteFilesProvider._internal(
|
''
|
||||||
(ref) => create(ref as SiteFilesRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
path: path,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnSiteFileEntry>> createElement() {
|
$FutureProviderElement<List<SnSiteFileEntry>> $createElement(
|
||||||
return _SiteFilesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnSiteFileEntry>> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String? path});
|
||||||
|
return siteFiles(ref, siteId: argument.siteId, path: argument.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SiteFilesProvider &&
|
return other is SiteFilesProvider && other.argument == argument;
|
||||||
other.siteId == siteId &&
|
|
||||||
other.path == path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, path.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$siteFilesHash() => r'd4029e6c160edcd454eb39ef1c19427b7f95a8d8';
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFilesRef on AutoDisposeFutureProviderRef<List<SnSiteFileEntry>> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `path` of this provider.
|
final class SiteFilesFamily extends $Family
|
||||||
String? get path;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnSiteFileEntry>>,
|
||||||
|
({String siteId, String? path})
|
||||||
|
> {
|
||||||
|
const SiteFilesFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFilesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
SiteFilesProvider call({required String siteId, String? path}) =>
|
||||||
|
SiteFilesProvider._(argument: (siteId: siteId, path: path), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'siteFilesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SiteFilesProviderElement
|
@ProviderFor(siteFileContent)
|
||||||
extends AutoDisposeFutureProviderElement<List<SnSiteFileEntry>>
|
const siteFileContentProvider = SiteFileContentFamily._();
|
||||||
with SiteFilesRef {
|
|
||||||
_SiteFilesProviderElement(super.provider);
|
final class SiteFileContentProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnFileContent>,
|
||||||
|
SnFileContent,
|
||||||
|
FutureOr<SnFileContent>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnFileContent>, $FutureProvider<SnFileContent> {
|
||||||
|
const SiteFileContentProvider._({
|
||||||
|
required SiteFileContentFamily super.from,
|
||||||
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get siteId => (origin as SiteFilesProvider).siteId;
|
String debugGetCreateSourceHash() => _$siteFileContentHash();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get path => (origin as SiteFilesProvider).path;
|
String toString() {
|
||||||
|
return r'siteFileContentProvider'
|
||||||
|
''
|
||||||
|
'$argument';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnFileContent> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnFileContent> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String relativePath});
|
||||||
|
return siteFileContent(
|
||||||
|
ref,
|
||||||
|
siteId: argument.siteId,
|
||||||
|
relativePath: argument.relativePath,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is SiteFileContentProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1';
|
String _$siteFileContentHash() => r'b594ad4f8c54555e742ece94ee001092cb2f83d1';
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
final class SiteFileContentFamily extends $Family
|
||||||
@ProviderFor(siteFileContent)
|
with
|
||||||
const siteFileContentProvider = SiteFileContentFamily();
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<SnFileContent>,
|
||||||
|
({String siteId, String relativePath})
|
||||||
|
> {
|
||||||
|
const SiteFileContentFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
class SiteFileContentFamily extends Family<AsyncValue<SnFileContent>> {
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
const SiteFileContentFamily();
|
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
|
||||||
SiteFileContentProvider call({
|
SiteFileContentProvider call({
|
||||||
required String siteId,
|
required String siteId,
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
}) {
|
}) => SiteFileContentProvider._(
|
||||||
return SiteFileContentProvider(siteId: siteId, relativePath: relativePath);
|
argument: (siteId: siteId, relativePath: relativePath),
|
||||||
}
|
from: this,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
SiteFileContentProvider getProviderOverride(
|
String toString() => r'siteFileContentProvider';
|
||||||
covariant SiteFileContentProvider provider,
|
|
||||||
) {
|
|
||||||
return call(siteId: provider.siteId, relativePath: provider.relativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFileContentProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [siteFileContent].
|
@ProviderFor(siteFileContentRaw)
|
||||||
class SiteFileContentProvider extends AutoDisposeFutureProvider<SnFileContent> {
|
const siteFileContentRawProvider = SiteFileContentRawFamily._();
|
||||||
/// See also [siteFileContent].
|
|
||||||
SiteFileContentProvider({
|
final class SiteFileContentRawProvider
|
||||||
required String siteId,
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
required String relativePath,
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
}) : this._internal(
|
const SiteFileContentRawProvider._({
|
||||||
(ref) => siteFileContent(
|
required SiteFileContentRawFamily super.from,
|
||||||
ref as SiteFileContentRef,
|
required ({String siteId, String relativePath}) super.argument,
|
||||||
siteId: siteId,
|
}) : super(
|
||||||
relativePath: relativePath,
|
retry: null,
|
||||||
),
|
name: r'siteFileContentRawProvider',
|
||||||
from: siteFileContentProvider,
|
isAutoDispose: true,
|
||||||
name: r'siteFileContentProvider',
|
dependencies: null,
|
||||||
debugGetCreateSourceHash:
|
$allTransitiveDependencies: null,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$siteFileContentHash,
|
|
||||||
dependencies: SiteFileContentFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
SiteFileContentFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFileContentProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.relativePath,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String relativePath;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$siteFileContentRawHash();
|
||||||
FutureOr<SnFileContent> Function(SiteFileContentRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'siteFileContentRawProvider'
|
||||||
override: SiteFileContentProvider._internal(
|
''
|
||||||
(ref) => create(ref as SiteFileContentRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnFileContent> createElement() {
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
return _SiteFileContentProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
final argument = this.argument as ({String siteId, String relativePath});
|
||||||
|
return siteFileContentRaw(
|
||||||
|
ref,
|
||||||
|
siteId: argument.siteId,
|
||||||
|
relativePath: argument.relativePath,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SiteFileContentProvider &&
|
return other is SiteFileContentRawProvider && other.argument == argument;
|
||||||
other.siteId == siteId &&
|
|
||||||
other.relativePath == relativePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, relativePath.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFileContentRef on AutoDisposeFutureProviderRef<SnFileContent> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `relativePath` of this provider.
|
|
||||||
String get relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SiteFileContentProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnFileContent>
|
|
||||||
with SiteFileContentRef {
|
|
||||||
_SiteFileContentProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get siteId => (origin as SiteFileContentProvider).siteId;
|
|
||||||
@override
|
|
||||||
String get relativePath => (origin as SiteFileContentProvider).relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$siteFileContentRawHash() =>
|
String _$siteFileContentRawHash() =>
|
||||||
r'd0331c30698a9f4b90fe9b79273ff5914fa46616';
|
r'd0331c30698a9f4b90fe9b79273ff5914fa46616';
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
final class SiteFileContentRawFamily extends $Family
|
||||||
@ProviderFor(siteFileContentRaw)
|
with
|
||||||
const siteFileContentRawProvider = SiteFileContentRawFamily();
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<String>,
|
||||||
|
({String siteId, String relativePath})
|
||||||
|
> {
|
||||||
|
const SiteFileContentRawFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'siteFileContentRawProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
class SiteFileContentRawFamily extends Family<AsyncValue<String>> {
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
const SiteFileContentRawFamily();
|
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
SiteFileContentRawProvider call({
|
SiteFileContentRawProvider call({
|
||||||
required String siteId,
|
required String siteId,
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
}) {
|
}) => SiteFileContentRawProvider._(
|
||||||
return SiteFileContentRawProvider(
|
argument: (siteId: siteId, relativePath: relativePath),
|
||||||
siteId: siteId,
|
from: this,
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SiteFileContentRawProvider getProviderOverride(
|
|
||||||
covariant SiteFileContentRawProvider provider,
|
|
||||||
) {
|
|
||||||
return call(siteId: provider.siteId, relativePath: provider.relativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'siteFileContentRawProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
class SiteFileContentRawProvider extends AutoDisposeFutureProvider<String> {
|
|
||||||
/// See also [siteFileContentRaw].
|
|
||||||
SiteFileContentRawProvider({
|
|
||||||
required String siteId,
|
|
||||||
required String relativePath,
|
|
||||||
}) : this._internal(
|
|
||||||
(ref) => siteFileContentRaw(
|
|
||||||
ref as SiteFileContentRawRef,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
from: siteFileContentRawProvider,
|
|
||||||
name: r'siteFileContentRawProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$siteFileContentRawHash,
|
|
||||||
dependencies: SiteFileContentRawFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
SiteFileContentRawFamily._allTransitiveDependencies,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SiteFileContentRawProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.siteId,
|
|
||||||
required this.relativePath,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String siteId;
|
|
||||||
final String relativePath;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String toString() => r'siteFileContentRawProvider';
|
||||||
FutureOr<String> Function(SiteFileContentRawRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: SiteFileContentRawProvider._internal(
|
|
||||||
(ref) => create(ref as SiteFileContentRawRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
siteId: siteId,
|
|
||||||
relativePath: relativePath,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<String> createElement() {
|
|
||||||
return _SiteFileContentRawProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is SiteFileContentRawProvider &&
|
|
||||||
other.siteId == siteId &&
|
|
||||||
other.relativePath == relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, siteId.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, relativePath.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SiteFileContentRawRef on AutoDisposeFutureProviderRef<String> {
|
|
||||||
/// The parameter `siteId` of this provider.
|
|
||||||
String get siteId;
|
|
||||||
|
|
||||||
/// The parameter `relativePath` of this provider.
|
|
||||||
String get relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SiteFileContentRawProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<String>
|
|
||||||
with SiteFileContentRawRef {
|
|
||||||
_SiteFileContentRawProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get siteId => (origin as SiteFileContentRawProvider).siteId;
|
|
||||||
@override
|
|
||||||
String get relativePath =>
|
|
||||||
(origin as SiteFileContentRawProvider).relativePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -25,16 +25,12 @@ Future<SnPublicationPage> sitePage(Ref ref, String pageId) async {
|
|||||||
return SnPublicationPage.fromJson(resp.data);
|
return SnPublicationPage.fromJson(resp.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SitePagesNotifier
|
class SitePagesNotifier extends AsyncNotifier<List<SnPublicationPage>> {
|
||||||
extends
|
final ({String pubName, String siteSlug}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SitePagesNotifier(this.arg);
|
||||||
List<SnPublicationPage>,
|
|
||||||
({String pubName, String siteSlug})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
Future<List<SnPublicationPage>> build(
|
Future<List<SnPublicationPage>> build() async {
|
||||||
({String pubName, String siteSlug}) arg,
|
|
||||||
) async {
|
|
||||||
return fetchPages();
|
return fetchPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,275 +6,163 @@ part of 'site_pages.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePages].
|
|
||||||
@ProviderFor(sitePages)
|
@ProviderFor(sitePages)
|
||||||
const sitePagesProvider = SitePagesFamily();
|
const sitePagesProvider = SitePagesFamily._();
|
||||||
|
|
||||||
/// See also [sitePages].
|
final class SitePagesProvider
|
||||||
class SitePagesFamily extends Family<AsyncValue<List<SnPublicationPage>>> {
|
extends
|
||||||
/// See also [sitePages].
|
$FunctionalProvider<
|
||||||
const SitePagesFamily();
|
AsyncValue<List<SnPublicationPage>>,
|
||||||
|
List<SnPublicationPage>,
|
||||||
/// See also [sitePages].
|
FutureOr<List<SnPublicationPage>>
|
||||||
SitePagesProvider call(String pubName, String siteSlug) {
|
>
|
||||||
return SitePagesProvider(pubName, siteSlug);
|
with
|
||||||
}
|
$FutureModifier<List<SnPublicationPage>>,
|
||||||
|
$FutureProvider<List<SnPublicationPage>> {
|
||||||
@override
|
const SitePagesProvider._({
|
||||||
SitePagesProvider getProviderOverride(covariant SitePagesProvider provider) {
|
required SitePagesFamily super.from,
|
||||||
return call(provider.pubName, provider.siteSlug);
|
required (String, String) super.argument,
|
||||||
}
|
}) : super(
|
||||||
|
retry: null,
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'sitePagesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePages].
|
|
||||||
class SitePagesProvider
|
|
||||||
extends AutoDisposeFutureProvider<List<SnPublicationPage>> {
|
|
||||||
/// See also [sitePages].
|
|
||||||
SitePagesProvider(String pubName, String siteSlug)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => sitePages(ref as SitePagesRef, pubName, siteSlug),
|
|
||||||
from: sitePagesProvider,
|
|
||||||
name: r'sitePagesProvider',
|
name: r'sitePagesProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$sitePagesHash,
|
|
||||||
dependencies: SitePagesFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SitePagesFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
SitePagesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
required this.siteSlug,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pubName;
|
|
||||||
final String siteSlug;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$sitePagesHash();
|
||||||
FutureOr<List<SnPublicationPage>> Function(SitePagesRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'sitePagesProvider'
|
||||||
override: SitePagesProvider._internal(
|
''
|
||||||
(ref) => create(ref as SitePagesRef),
|
'$argument';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
siteSlug: siteSlug,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<List<SnPublicationPage>> createElement() {
|
$FutureProviderElement<List<SnPublicationPage>> $createElement(
|
||||||
return _SitePagesProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPublicationPage>> create(Ref ref) {
|
||||||
|
final argument = this.argument as (String, String);
|
||||||
|
return sitePages(ref, argument.$1, argument.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is SitePagesProvider &&
|
return other is SitePagesProvider && other.argument == argument;
|
||||||
other.pubName == pubName &&
|
|
||||||
other.siteSlug == siteSlug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, siteSlug.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$sitePagesHash() => r'5e084e9694ad665e9b238c6a747c6c6e99c5eb03';
|
||||||
// ignore: unused_element
|
|
||||||
mixin SitePagesRef on AutoDisposeFutureProviderRef<List<SnPublicationPage>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String get pubName;
|
|
||||||
|
|
||||||
/// The parameter `siteSlug` of this provider.
|
final class SitePagesFamily extends $Family
|
||||||
String get siteSlug;
|
with
|
||||||
|
$FunctionalFamilyOverride<
|
||||||
|
FutureOr<List<SnPublicationPage>>,
|
||||||
|
(String, String)
|
||||||
|
> {
|
||||||
|
const SitePagesFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'sitePagesProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
SitePagesProvider call(String pubName, String siteSlug) =>
|
||||||
|
SitePagesProvider._(argument: (pubName, siteSlug), from: this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => r'sitePagesProvider';
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SitePagesProviderElement
|
@ProviderFor(sitePage)
|
||||||
extends AutoDisposeFutureProviderElement<List<SnPublicationPage>>
|
const sitePageProvider = SitePageFamily._();
|
||||||
with SitePagesRef {
|
|
||||||
_SitePagesProviderElement(super.provider);
|
final class SitePageProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnPublicationPage>,
|
||||||
|
SnPublicationPage,
|
||||||
|
FutureOr<SnPublicationPage>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<SnPublicationPage>,
|
||||||
|
$FutureProvider<SnPublicationPage> {
|
||||||
|
const SitePageProvider._({
|
||||||
|
required SitePageFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'sitePageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get pubName => (origin as SitePagesProvider).pubName;
|
String debugGetCreateSourceHash() => _$sitePageHash();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get siteSlug => (origin as SitePagesProvider).siteSlug;
|
String toString() {
|
||||||
|
return r'sitePageProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnPublicationPage> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublicationPage> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return sitePage(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is SitePageProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
|
String _$sitePageHash() => r'542f70c5b103fe34d7cf7eb0821d52f017022efc';
|
||||||
|
|
||||||
/// See also [sitePage].
|
final class SitePageFamily extends $Family
|
||||||
@ProviderFor(sitePage)
|
with $FunctionalFamilyOverride<FutureOr<SnPublicationPage>, String> {
|
||||||
const sitePageProvider = SitePageFamily();
|
const SitePageFamily._()
|
||||||
|
: super(
|
||||||
/// See also [sitePage].
|
retry: null,
|
||||||
class SitePageFamily extends Family<AsyncValue<SnPublicationPage>> {
|
|
||||||
/// See also [sitePage].
|
|
||||||
const SitePageFamily();
|
|
||||||
|
|
||||||
/// See also [sitePage].
|
|
||||||
SitePageProvider call(String pageId) {
|
|
||||||
return SitePageProvider(pageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
SitePageProvider getProviderOverride(covariant SitePageProvider provider) {
|
|
||||||
return call(provider.pageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'sitePageProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [sitePage].
|
|
||||||
class SitePageProvider extends AutoDisposeFutureProvider<SnPublicationPage> {
|
|
||||||
/// See also [sitePage].
|
|
||||||
SitePageProvider(String pageId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => sitePage(ref as SitePageRef, pageId),
|
|
||||||
from: sitePageProvider,
|
|
||||||
name: r'sitePageProvider',
|
name: r'sitePageProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$sitePageHash,
|
|
||||||
dependencies: SitePageFamily._dependencies,
|
|
||||||
allTransitiveDependencies: SitePageFamily._allTransitiveDependencies,
|
|
||||||
pageId: pageId,
|
|
||||||
);
|
|
||||||
|
|
||||||
SitePageProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pageId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String pageId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnPublicationPage> Function(SitePageRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: SitePageProvider._internal(
|
|
||||||
(ref) => create(ref as SitePageRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
pageId: pageId,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
SitePageProvider call(String pageId) =>
|
||||||
|
SitePageProvider._(argument: pageId, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublicationPage> createElement() {
|
String toString() => r'sitePageProvider';
|
||||||
return _SitePageProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is SitePageProvider && other.pageId == pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pageId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin SitePageRef on AutoDisposeFutureProviderRef<SnPublicationPage> {
|
|
||||||
/// The parameter `pageId` of this provider.
|
|
||||||
String get pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SitePageProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPublicationPage>
|
|
||||||
with SitePageRef {
|
|
||||||
_SitePageProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get pageId => (origin as SitePageProvider).pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -4,16 +4,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:island/models/publication_site.dart';
|
import 'package:island/models/publication_site.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|
||||||
class SiteNotifier
|
class SiteNotifier extends AsyncNotifier<SnPublicationSite> {
|
||||||
extends
|
final ({String pubName, String? siteId}) arg;
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
SiteNotifier(this.arg);
|
||||||
SnPublicationSite,
|
|
||||||
({String pubName, String? siteId})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
FutureOr<SnPublicationSite> build(
|
FutureOr<SnPublicationSite> build() async {
|
||||||
({String pubName, String? siteId}) arg,
|
|
||||||
) async {
|
|
||||||
if (arg.siteId == null || arg.siteId!.isEmpty) {
|
if (arg.siteId == null || arg.siteId!.isEmpty) {
|
||||||
return SnPublicationSite(
|
return SnPublicationSite(
|
||||||
id: '',
|
id: '',
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:island/pods/config.dart';
|
import 'package:island/pods/config.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
part 'theme.g.dart';
|
part 'theme.g.dart';
|
||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
ThemeSet theme(Ref ref) {
|
ThemeSet theme(Ref ref) {
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
return createAppThemeSet(settings);
|
return createAppThemeSet(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,46 @@ part of 'theme.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$themeHash() => r'a12dbf8b83d75713b7ae4c68e9cdd1a1cc3a35f0';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [theme].
|
|
||||||
@ProviderFor(theme)
|
@ProviderFor(theme)
|
||||||
final themeProvider = AutoDisposeProvider<ThemeSet>.internal(
|
const themeProvider = ThemeProvider._();
|
||||||
theme,
|
|
||||||
name: r'themeProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$themeHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
final class ThemeProvider
|
||||||
// ignore: unused_element
|
extends $FunctionalProvider<ThemeSet, ThemeSet, ThemeSet>
|
||||||
typedef ThemeRef = AutoDisposeProviderRef<ThemeSet>;
|
with $Provider<ThemeSet> {
|
||||||
// ignore_for_file: type=lint
|
const ThemeProvider._()
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'themeProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$themeHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<ThemeSet> $createElement($ProviderPointer pointer) =>
|
||||||
|
$ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
ThemeSet create(Ref ref) {
|
||||||
|
return theme(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(ThemeSet value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<ThemeSet>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$themeHash() => r'5b41b68e2fc59431bb195ff75f63383982f7730f';
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
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/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/pods/paging.dart';
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
final activityListNotifierProvider =
|
final activityListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>(
|
|
||||||
ActivityListNotifier.new,
|
ActivityListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||||
with
|
with
|
||||||
@@ -22,15 +20,12 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
|||||||
Future<List<SnTimelineEvent>> fetch() async {
|
Future<List<SnTimelineEvent>> fetch() async {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
|
|
||||||
final cursor =
|
final cursor = state.value?.lastOrNull?.createdAt.toUtc().toIso8601String();
|
||||||
state.valueOrNull?.lastOrNull?.createdAt.toUtc().toIso8601String();
|
|
||||||
|
|
||||||
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,
|
||||||
if (kDebugMode)
|
|
||||||
'debugInclude': 'realms,publishers,articles,shuffledPosts',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
@@ -38,23 +33,20 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
|||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<SnTimelineEvent> items =
|
final List<SnTimelineEvent> items = (response.data as List)
|
||||||
(response.data as List)
|
|
||||||
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
||||||
|
|
||||||
totalCount =
|
totalCount =
|
||||||
(state.valueOrNull?.length ?? 0) +
|
(state.value?.length ?? 0) + items.length + (hasMore ? pageSize : 0);
|
||||||
items.length +
|
|
||||||
(hasMore ? pageSize : 0);
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateOne(int index, SnTimelineEvent activity) {
|
void updateOne(int index, SnTimelineEvent activity) {
|
||||||
final currentState = state.valueOrNull;
|
final currentState = state.value;
|
||||||
if (currentState == null) return;
|
if (currentState == null) return;
|
||||||
|
|
||||||
final updatedItems = [...currentState];
|
final updatedItems = [...currentState];
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -6,269 +6,152 @@ part of 'translate.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [translateString].
|
|
||||||
@ProviderFor(translateString)
|
@ProviderFor(translateString)
|
||||||
const translateStringProvider = TranslateStringFamily();
|
const translateStringProvider = TranslateStringFamily._();
|
||||||
|
|
||||||
/// See also [translateString].
|
final class TranslateStringProvider
|
||||||
class TranslateStringFamily extends Family<AsyncValue<String>> {
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
/// See also [translateString].
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
const TranslateStringFamily();
|
const TranslateStringProvider._({
|
||||||
|
required TranslateStringFamily super.from,
|
||||||
/// See also [translateString].
|
required TranslateQuery super.argument,
|
||||||
TranslateStringProvider call(TranslateQuery query) {
|
}) : super(
|
||||||
return TranslateStringProvider(query);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TranslateStringProvider getProviderOverride(
|
|
||||||
covariant TranslateStringProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.query);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'translateStringProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [translateString].
|
|
||||||
class TranslateStringProvider extends AutoDisposeFutureProvider<String> {
|
|
||||||
/// See also [translateString].
|
|
||||||
TranslateStringProvider(TranslateQuery query)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => translateString(ref as TranslateStringRef, query),
|
|
||||||
from: translateStringProvider,
|
|
||||||
name: r'translateStringProvider',
|
name: r'translateStringProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$translateStringHash,
|
|
||||||
dependencies: TranslateStringFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
TranslateStringFamily._allTransitiveDependencies,
|
|
||||||
query: query,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
TranslateStringProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.query,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final TranslateQuery query;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$translateStringHash();
|
||||||
FutureOr<String> Function(TranslateStringRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'translateStringProvider'
|
||||||
override: TranslateStringProvider._internal(
|
''
|
||||||
(ref) => create(ref as TranslateStringRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
query: query,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<String> createElement() {
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
return _TranslateStringProviderElement(this);
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
final argument = this.argument as TranslateQuery;
|
||||||
|
return translateString(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is TranslateStringProvider && other.query == query;
|
return other is TranslateStringProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, query.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$translateStringHash() => r'51d638cf07cbf3ffa9469298f5bd9c667bc0ccb7';
|
||||||
// ignore: unused_element
|
|
||||||
mixin TranslateStringRef on AutoDisposeFutureProviderRef<String> {
|
|
||||||
/// The parameter `query` of this provider.
|
|
||||||
TranslateQuery get query;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TranslateStringProviderElement
|
final class TranslateStringFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<String>
|
with $FunctionalFamilyOverride<FutureOr<String>, TranslateQuery> {
|
||||||
with TranslateStringRef {
|
const TranslateStringFamily._()
|
||||||
_TranslateStringProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'translateStringProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
TranslateStringProvider call(TranslateQuery query) =>
|
||||||
|
TranslateStringProvider._(argument: query, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TranslateQuery get query => (origin as TranslateStringProvider).query;
|
String toString() => r'translateStringProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(detectStringLanguage)
|
||||||
|
const detectStringLanguageProvider = DetectStringLanguageFamily._();
|
||||||
|
|
||||||
|
final class DetectStringLanguageProvider
|
||||||
|
extends $FunctionalProvider<String?, String?, String?>
|
||||||
|
with $Provider<String?> {
|
||||||
|
const DetectStringLanguageProvider._({
|
||||||
|
required DetectStringLanguageFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'detectStringLanguageProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$detectStringLanguageHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'detectStringLanguageProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$ProviderElement<String?> $createElement($ProviderPointer pointer) =>
|
||||||
|
$ProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return detectStringLanguage(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// {@macro riverpod.override_with_value}
|
||||||
|
Override overrideWithValue(String? value) {
|
||||||
|
return $ProviderOverride(
|
||||||
|
origin: this,
|
||||||
|
providerOverride: $SyncValueProvider<String?>(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is DetectStringLanguageProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$detectStringLanguageHash() =>
|
String _$detectStringLanguageHash() =>
|
||||||
r'24fbf52edbbffcc8dc4f09f7206f82d69728e703';
|
r'24fbf52edbbffcc8dc4f09f7206f82d69728e703';
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
final class DetectStringLanguageFamily extends $Family
|
||||||
@ProviderFor(detectStringLanguage)
|
with $FunctionalFamilyOverride<String?, String> {
|
||||||
const detectStringLanguageProvider = DetectStringLanguageFamily();
|
const DetectStringLanguageFamily._()
|
||||||
|
: super(
|
||||||
/// See also [detectStringLanguage].
|
retry: null,
|
||||||
class DetectStringLanguageFamily extends Family<String?> {
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
const DetectStringLanguageFamily();
|
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
DetectStringLanguageProvider call(String text) {
|
|
||||||
return DetectStringLanguageProvider(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
DetectStringLanguageProvider getProviderOverride(
|
|
||||||
covariant DetectStringLanguageProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'detectStringLanguageProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
class DetectStringLanguageProvider extends AutoDisposeProvider<String?> {
|
|
||||||
/// See also [detectStringLanguage].
|
|
||||||
DetectStringLanguageProvider(String text)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => detectStringLanguage(ref as DetectStringLanguageRef, text),
|
|
||||||
from: detectStringLanguageProvider,
|
|
||||||
name: r'detectStringLanguageProvider',
|
name: r'detectStringLanguageProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$detectStringLanguageHash,
|
|
||||||
dependencies: DetectStringLanguageFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
DetectStringLanguageFamily._allTransitiveDependencies,
|
|
||||||
text: text,
|
|
||||||
);
|
|
||||||
|
|
||||||
DetectStringLanguageProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.text,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String text;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
String? Function(DetectStringLanguageRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: DetectStringLanguageProvider._internal(
|
|
||||||
(ref) => create(ref as DetectStringLanguageRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
text: text,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
DetectStringLanguageProvider call(String text) =>
|
||||||
|
DetectStringLanguageProvider._(argument: text, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeProviderElement<String?> createElement() {
|
String toString() => r'detectStringLanguageProvider';
|
||||||
return _DetectStringLanguageProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is DetectStringLanguageProvider && other.text == text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, text.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin DetectStringLanguageRef on AutoDisposeProviderRef<String?> {
|
|
||||||
/// The parameter `text` of this provider.
|
|
||||||
String get text;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DetectStringLanguageProviderElement
|
|
||||||
extends AutoDisposeProviderElement<String?>
|
|
||||||
with DetectStringLanguageRef {
|
|
||||||
_DetectStringLanguageProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get text => (origin as DetectStringLanguageProvider).text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -14,26 +14,27 @@ import 'package:island/pods/config.dart';
|
|||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/talker.dart';
|
import 'package:island/talker.dart';
|
||||||
|
|
||||||
class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
class UserInfoNotifier extends AsyncNotifier<SnAccount?> {
|
||||||
final Ref _ref;
|
@override
|
||||||
|
Future<SnAccount?> build() async {
|
||||||
UserInfoNotifier(this._ref) : super(const AsyncValue.data(null));
|
final token = ref.watch(tokenProvider);
|
||||||
|
|
||||||
Future<void> fetchUser() async {
|
|
||||||
final token = _ref.watch(tokenProvider);
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
talker.info('[UserInfo] No token found, not going to fetch...');
|
talker.info('[UserInfo] No token found, not going to fetch...');
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
return _fetchUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<SnAccount?> _fetchUser() async {
|
||||||
try {
|
try {
|
||||||
final client = _ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final response = await client.get('/pass/accounts/me');
|
final response = await client.get('/pass/accounts/me');
|
||||||
final user = SnAccount.fromJson(response.data);
|
final user = SnAccount.fromJson(response.data);
|
||||||
state = AsyncValue.data(user);
|
|
||||||
|
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
||||||
FirebaseAnalytics.instance.setUserId(id: user.id);
|
FirebaseAnalytics.instance.setUserId(id: user.id);
|
||||||
}
|
}
|
||||||
|
return user;
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
if (!kIsWeb) {
|
if (!kIsWeb) {
|
||||||
if (error is DioException) {
|
if (error is DioException) {
|
||||||
@@ -69,10 +70,10 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
fetchUser();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
showOverlayDialog<bool>(
|
showOverlayDialog<bool>(
|
||||||
builder:
|
builder:
|
||||||
(context, close) => AlertDialog(
|
(context, close) => AlertDialog(
|
||||||
@@ -96,31 +97,36 @@ class UserInfoNotifier extends StateNotifier<AsyncValue<SnAccount?>> {
|
|||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
fetchUser();
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
talker.error(
|
talker.error(
|
||||||
"[UserInfo] Failed to fetch user info...",
|
"[UserInfo] Failed to fetch user info...",
|
||||||
error,
|
error,
|
||||||
stackTrace,
|
stackTrace,
|
||||||
);
|
);
|
||||||
state = AsyncValue.data(null);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> fetchUser() async {
|
||||||
|
ref.invalidateSelf();
|
||||||
|
await future;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> logOut() async {
|
Future<void> logOut() async {
|
||||||
state = const AsyncValue.data(null);
|
state = const AsyncValue.data(null);
|
||||||
final prefs = _ref.read(sharedPreferencesProvider);
|
final prefs = ref.read(sharedPreferencesProvider);
|
||||||
await prefs.remove(kTokenPairStoreKey);
|
await prefs.remove(kTokenPairStoreKey);
|
||||||
_ref.invalidate(tokenProvider);
|
ref.invalidate(tokenProvider);
|
||||||
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
if (kIsWeb || !(Platform.isLinux || Platform.isWindows)) {
|
||||||
FirebaseAnalytics.instance.setUserId(id: null);
|
FirebaseAnalytics.instance.setUserId(id: null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final userInfoProvider =
|
final userInfoProvider = AsyncNotifierProvider<UserInfoNotifier, SnAccount?>(
|
||||||
StateNotifierProvider<UserInfoNotifier, AsyncValue<SnAccount?>>(
|
UserInfoNotifier.new,
|
||||||
(ref) => UserInfoNotifier(ref),
|
);
|
||||||
);
|
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ class WebAuthServerState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebAuthServerNotifier extends StateNotifier<WebAuthServerState> {
|
class WebAuthServerNotifier extends Notifier<WebAuthServerState> {
|
||||||
final WebAuthServer _server;
|
late final WebAuthServer _server;
|
||||||
|
|
||||||
WebAuthServerNotifier(this._server) : super(WebAuthServerState());
|
@override
|
||||||
|
WebAuthServerState build() {
|
||||||
|
_server = ref.watch(webAuthServerProvider);
|
||||||
|
return WebAuthServerState();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> start() async {
|
Future<void> start() async {
|
||||||
try {
|
try {
|
||||||
@@ -47,7 +51,6 @@ final webAuthServerProvider = Provider<WebAuthServer>((ref) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final webAuthServerStateProvider =
|
final webAuthServerStateProvider =
|
||||||
StateNotifierProvider<WebAuthServerNotifier, WebAuthServerState>((ref) {
|
NotifierProvider<WebAuthServerNotifier, WebAuthServerState>(
|
||||||
final server = ref.watch(webAuthServerProvider);
|
WebAuthServerNotifier.new,
|
||||||
return WebAuthServerNotifier(server);
|
);
|
||||||
});
|
|
||||||
|
|||||||
@@ -5,25 +5,21 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:island/models/webfeed.dart';
|
import 'package:island/models/webfeed.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|
||||||
final webFeedListProvider = FutureProvider.family<List<SnWebFeed>, String>((
|
final webFeedListProvider = FutureProvider.autoDispose
|
||||||
ref,
|
.family<List<SnWebFeed>, String>((ref, pubName) async {
|
||||||
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('/sphere/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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
|
||||||
|
final ({String pubName, String? feedId}) arg;
|
||||||
|
WebFeedNotifier(this.arg);
|
||||||
|
|
||||||
class WebFeedNotifier
|
|
||||||
extends
|
|
||||||
AutoDisposeFamilyAsyncNotifier<
|
|
||||||
SnWebFeed,
|
|
||||||
({String pubName, String? feedId})
|
|
||||||
> {
|
|
||||||
@override
|
@override
|
||||||
FutureOr<SnWebFeed> build(({String pubName, String? feedId}) arg) async {
|
FutureOr<SnWebFeed> build() async {
|
||||||
if (arg.feedId == null || arg.feedId!.isEmpty) {
|
if (arg.feedId == null || arg.feedId!.isEmpty) {
|
||||||
return SnWebFeed(
|
return SnWebFeed(
|
||||||
id: '',
|
id: '',
|
||||||
@@ -53,8 +49,7 @@ class WebFeedNotifier
|
|||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final url = '/sphere/publishers/${feed.publisherId}/feeds';
|
final url = '/sphere/publishers/${feed.publisherId}/feeds';
|
||||||
|
|
||||||
final response =
|
final response = feed.id.isEmpty
|
||||||
feed.id.isEmpty
|
|
||||||
? await client.post(url, data: feed.toJson())
|
? await client.post(url, data: feed.toJson())
|
||||||
: await client.patch('$url/${feed.id}', data: feed.toJson());
|
: await client.patch('$url/${feed.id}', data: feed.toJson());
|
||||||
|
|
||||||
|
|||||||
@@ -100,12 +100,16 @@ class WebSocketService {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDone: () {
|
onDone: () {
|
||||||
talker.info('[WebSocket] Connection closed, attempting to reconnect...');
|
talker.info(
|
||||||
|
'[WebSocket] Connection closed, attempting to reconnect...',
|
||||||
|
);
|
||||||
_scheduleReconnect();
|
_scheduleReconnect();
|
||||||
_statusStreamController.sink.add(WebSocketState.disconnected());
|
_statusStreamController.sink.add(WebSocketState.disconnected());
|
||||||
},
|
},
|
||||||
onError: (error) {
|
onError: (error) {
|
||||||
talker.error('[WebSocket] Error occurred: $error, attempting to reconnect...');
|
talker.error(
|
||||||
|
'[WebSocket] Error occurred: $error, attempting to reconnect...',
|
||||||
|
);
|
||||||
_scheduleReconnect();
|
_scheduleReconnect();
|
||||||
_statusStreamController.sink.add(
|
_statusStreamController.sink.add(
|
||||||
WebSocketState.error(error.toString()),
|
WebSocketState.error(error.toString()),
|
||||||
@@ -152,15 +156,20 @@ class WebSocketService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final websocketStateProvider =
|
final websocketStateProvider =
|
||||||
StateNotifierProvider<WebSocketStateNotifier, WebSocketState>(
|
NotifierProvider<WebSocketStateNotifier, WebSocketState>(
|
||||||
(ref) => WebSocketStateNotifier(ref),
|
WebSocketStateNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class WebSocketStateNotifier extends StateNotifier<WebSocketState> {
|
class WebSocketStateNotifier extends Notifier<WebSocketState> {
|
||||||
final Ref ref;
|
|
||||||
Timer? _reconnectTimer;
|
Timer? _reconnectTimer;
|
||||||
|
|
||||||
WebSocketStateNotifier(this.ref) : super(const WebSocketState.disconnected());
|
@override
|
||||||
|
WebSocketState build() {
|
||||||
|
ref.onDispose(() {
|
||||||
|
_reconnectTimer?.cancel();
|
||||||
|
});
|
||||||
|
return const WebSocketState.disconnected();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> connect() async {
|
Future<void> connect() async {
|
||||||
state = const WebSocketState.connecting();
|
state = const WebSocketState.connecting();
|
||||||
@@ -169,7 +178,7 @@ class WebSocketStateNotifier extends StateNotifier<WebSocketState> {
|
|||||||
await service.connect(ref);
|
await service.connect(ref);
|
||||||
state = const WebSocketState.connected();
|
state = const WebSocketState.connected();
|
||||||
service.statusStream.listen((event) {
|
service.statusStream.listen((event) {
|
||||||
if (mounted) state = event;
|
state = event;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
state = WebSocketState.error('Failed to connect: $err');
|
state = WebSocketState.error('Failed to connect: $err');
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'articleCompose',
|
name: 'articleCompose',
|
||||||
path: '/articles/compose',
|
path: '/articles/compose',
|
||||||
builder:
|
builder: (context, state) => ArticleComposeScreen(
|
||||||
(context, state) => ArticleComposeScreen(
|
|
||||||
initialState: state.extra as PostComposeInitialState?,
|
initialState: state.extra as PostComposeInitialState?,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -190,8 +189,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'explore',
|
name: 'explore',
|
||||||
path: '/',
|
path: '/',
|
||||||
pageBuilder:
|
pageBuilder: (context, state) => CustomTransitionPage(
|
||||||
(context, state) => CustomTransitionPage(
|
|
||||||
key: const ValueKey('explore'),
|
key: const ValueKey('explore'),
|
||||||
child: const ExploreScreen(),
|
child: const ExploreScreen(),
|
||||||
transitionsBuilder: _tabPagesTransitionBuilder,
|
transitionsBuilder: _tabPagesTransitionBuilder,
|
||||||
@@ -220,11 +218,6 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
return PostCategoryDetailScreen(slug: slug, isCategory: true);
|
return PostCategoryDetailScreen(slug: slug, isCategory: true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
|
||||||
name: 'postTags',
|
|
||||||
path: '/posts/tags',
|
|
||||||
builder: (context, state) => const PostTagsListScreen(),
|
|
||||||
),
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'postTagDetail',
|
name: 'postTagDetail',
|
||||||
path: '/posts/tags/:slug',
|
path: '/posts/tags/:slug',
|
||||||
@@ -260,8 +253,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
|
|
||||||
// Chat tab
|
// Chat tab
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
pageBuilder:
|
pageBuilder: (context, state, child) => CustomTransitionPage(
|
||||||
(context, state, child) => CustomTransitionPage(
|
|
||||||
key: const ValueKey('chat'),
|
key: const ValueKey('chat'),
|
||||||
child: ChatShellScreen(child: child),
|
child: ChatShellScreen(child: child),
|
||||||
transitionsBuilder: _tabPagesTransitionBuilder,
|
transitionsBuilder: _tabPagesTransitionBuilder,
|
||||||
@@ -303,8 +295,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'realmList',
|
name: 'realmList',
|
||||||
path: '/realms',
|
path: '/realms',
|
||||||
pageBuilder:
|
pageBuilder: (context, state) => CustomTransitionPage(
|
||||||
(context, state) => CustomTransitionPage(
|
|
||||||
key: const ValueKey('realms'),
|
key: const ValueKey('realms'),
|
||||||
child: const RealmListScreen(),
|
child: const RealmListScreen(),
|
||||||
transitionsBuilder: _tabPagesTransitionBuilder,
|
transitionsBuilder: _tabPagesTransitionBuilder,
|
||||||
@@ -336,8 +327,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
|
|
||||||
// Account tab
|
// Account tab
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
pageBuilder:
|
pageBuilder: (context, state, child) => CustomTransitionPage(
|
||||||
(context, state, child) => CustomTransitionPage(
|
|
||||||
key: const ValueKey('account'),
|
key: const ValueKey('account'),
|
||||||
child: AccountShellScreen(child: child),
|
child: AccountShellScreen(child: child),
|
||||||
transitionsBuilder: _tabPagesTransitionBuilder,
|
transitionsBuilder: _tabPagesTransitionBuilder,
|
||||||
@@ -352,8 +342,8 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'stickerMarketplace',
|
name: 'stickerMarketplace',
|
||||||
path: '/stickers',
|
path: '/stickers',
|
||||||
builder:
|
builder: (context, state) =>
|
||||||
(context, state) => const MarketplaceStickersScreen(),
|
const MarketplaceStickersScreen(),
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'stickerPackDetail',
|
name: 'stickerPackDetail',
|
||||||
@@ -368,8 +358,8 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'webFeedMarketplace',
|
name: 'webFeedMarketplace',
|
||||||
path: '/feeds',
|
path: '/feeds',
|
||||||
builder:
|
builder: (context, state) =>
|
||||||
(context, state) => const MarketplaceWebFeedsScreen(),
|
const MarketplaceWebFeedsScreen(),
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'webFeedDetail',
|
name: 'webFeedDetail',
|
||||||
@@ -516,26 +506,22 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'developerHub',
|
name: 'developerHub',
|
||||||
path: '/developers',
|
path: '/developers',
|
||||||
builder:
|
builder: (context, state) => DeveloperHubScreen(
|
||||||
(context, state) => DeveloperHubScreen(
|
initialPublisherName: state.uri.queryParameters['publisher'],
|
||||||
initialPublisherName:
|
|
||||||
state.uri.queryParameters['publisher'],
|
|
||||||
initialProjectId: state.uri.queryParameters['project'],
|
initialProjectId: state.uri.queryParameters['project'],
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'developerProjectNew',
|
name: 'developerProjectNew',
|
||||||
path: ':name/projects/new',
|
path: ':name/projects/new',
|
||||||
builder:
|
builder: (context, state) => NewProjectScreen(
|
||||||
(context, state) => NewProjectScreen(
|
|
||||||
publisherName: state.pathParameters['name']!,
|
publisherName: state.pathParameters['name']!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'developerProjectEdit',
|
name: 'developerProjectEdit',
|
||||||
path: ':name/projects/:id/edit',
|
path: ':name/projects/:id/edit',
|
||||||
builder:
|
builder: (context, state) => EditProjectScreen(
|
||||||
(context, state) => EditProjectScreen(
|
|
||||||
publisherName: state.pathParameters['name']!,
|
publisherName: state.pathParameters['name']!,
|
||||||
id: state.pathParameters['id']!,
|
id: state.pathParameters['id']!,
|
||||||
),
|
),
|
||||||
@@ -558,8 +544,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'developerAppDetail',
|
name: 'developerAppDetail',
|
||||||
path: 'apps/:appId',
|
path: 'apps/:appId',
|
||||||
builder:
|
builder: (context, state) => AppDetailScreen(
|
||||||
(context, state) => AppDetailScreen(
|
|
||||||
publisherName: state.pathParameters['name']!,
|
publisherName: state.pathParameters['name']!,
|
||||||
projectId: state.pathParameters['projectId']!,
|
projectId: state.pathParameters['projectId']!,
|
||||||
appId: state.pathParameters['appId']!,
|
appId: state.pathParameters['appId']!,
|
||||||
@@ -568,8 +553,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
name: 'developerBotDetail',
|
name: 'developerBotDetail',
|
||||||
path: 'bots/:botId',
|
path: 'bots/:botId',
|
||||||
builder:
|
builder: (context, state) => BotDetailScreen(
|
||||||
(context, state) => BotDetailScreen(
|
|
||||||
publisherName: state.pathParameters['name']!,
|
publisherName: state.pathParameters['name']!,
|
||||||
projectId: state.pathParameters['projectId']!,
|
projectId: state.pathParameters['projectId']!,
|
||||||
botId: state.pathParameters['botId']!,
|
botId: state.pathParameters['botId']!,
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
final notificationUnreadCount = ref.watch(
|
final notificationUnreadCount = ref.watch(notificationUnreadCountProvider);
|
||||||
notificationUnreadCountNotifierProvider,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (user.value == null || user.value == null) {
|
if (user.value == null || user.value == null) {
|
||||||
return _UnauthorizedAccountScreen();
|
return _UnauthorizedAccountScreen();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Future<double> socialCredits(Ref ref) async {
|
|||||||
return response.data?.toDouble() ?? 0.0;
|
return response.data?.toDouble() ?? 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final socialCreditHistoryNotifierProvider = AsyncNotifierProvider(
|
final socialCreditHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
SocialCreditHistoryNotifier.new,
|
SocialCreditHistoryNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -45,8 +45,7 @@ class SocialCreditHistoryNotifier
|
|||||||
|
|
||||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
|
||||||
final records =
|
final records = response.data
|
||||||
response.data
|
|
||||||
.map((json) => SnSocialCreditRecord.fromJson(json))
|
.map((json) => SnSocialCreditRecord.fromJson(json))
|
||||||
.cast<SnSocialCreditRecord>()
|
.cast<SnSocialCreditRecord>()
|
||||||
.toList();
|
.toList();
|
||||||
@@ -68,8 +67,7 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
margin: const EdgeInsets.only(left: 16, right: 16, top: 8),
|
margin: const EdgeInsets.only(left: 16, right: 16, top: 8),
|
||||||
child: socialCredits
|
child: socialCredits
|
||||||
.when(
|
.when(
|
||||||
data:
|
data: (credits) => Stack(
|
||||||
(credits) => Stack(
|
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -83,9 +81,7 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
? 'socialCreditsLevelGood'.tr()
|
? 'socialCreditsLevelGood'.tr()
|
||||||
: 'socialCreditsLevelExcellent'.tr(),
|
: 'socialCreditsLevelExcellent'.tr(),
|
||||||
).tr().bold().fontSize(20),
|
).tr().bold().fontSize(20),
|
||||||
Text(
|
Text('${credits.toStringAsFixed(2)} pts').fontSize(14),
|
||||||
'${credits.toStringAsFixed(2)} pts',
|
|
||||||
).fontSize(14),
|
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
LinearProgressIndicator(value: credits / 200),
|
LinearProgressIndicator(value: credits / 200),
|
||||||
],
|
],
|
||||||
@@ -119,8 +115,7 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
title: Text(
|
title: Text(
|
||||||
record.reason,
|
record.reason,
|
||||||
style:
|
style: isExpired
|
||||||
isExpired
|
|
||||||
? TextStyle(
|
? TextStyle(
|
||||||
decoration: TextDecoration.lineThrough,
|
decoration: TextDecoration.lineThrough,
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
|
|||||||
@@ -6,23 +6,38 @@ part of 'credits.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [socialCredits].
|
|
||||||
@ProviderFor(socialCredits)
|
@ProviderFor(socialCredits)
|
||||||
final socialCreditsProvider = AutoDisposeFutureProvider<double>.internal(
|
const socialCreditsProvider = SocialCreditsProvider._();
|
||||||
socialCredits,
|
|
||||||
name: r'socialCreditsProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$socialCreditsHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
final class SocialCreditsProvider
|
||||||
// ignore: unused_element
|
extends $FunctionalProvider<AsyncValue<double>, double, FutureOr<double>>
|
||||||
typedef SocialCreditsRef = AutoDisposeFutureProviderRef<double>;
|
with $FutureModifier<double>, $FutureProvider<double> {
|
||||||
// ignore_for_file: type=lint
|
const SocialCreditsProvider._()
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'socialCreditsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$socialCreditsHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<double> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<double> create(Ref ref) {
|
||||||
|
return socialCredits(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$socialCreditsHash() => r'a0284583e94bc97285c689ac2bc018536932da69';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ 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(
|
final levelingHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
LevelingHistoryNotifier.new,
|
LevelingHistoryNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -35,8 +35,7 @@ class LevelingHistoryNotifier extends AsyncNotifier<List<SnExperienceRecord>>
|
|||||||
|
|
||||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
|
||||||
final List<SnExperienceRecord> records =
|
final List<SnExperienceRecord> records = response.data
|
||||||
response.data
|
|
||||||
.map((json) => SnExperienceRecord.fromJson(json))
|
.map((json) => SnExperienceRecord.fromJson(json))
|
||||||
.cast<SnExperienceRecord>()
|
.cast<SnExperienceRecord>()
|
||||||
.toList();
|
.toList();
|
||||||
@@ -162,8 +161,9 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
stopIndicatorRadius: 0,
|
stopIndicatorRadius: 0,
|
||||||
trackGap: 0,
|
trackGap: 0,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
backgroundColor:
|
backgroundColor: Theme.of(
|
||||||
Theme.of(context).colorScheme.surfaceContainerHigh,
|
context,
|
||||||
|
).colorScheme.surfaceContainerHigh,
|
||||||
borderRadius: BorderRadius.circular(32),
|
borderRadius: BorderRadius.circular(32),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -186,8 +186,7 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
notifier: levelingHistoryNotifierProvider.notifier,
|
notifier: levelingHistoryNotifierProvider.notifier,
|
||||||
isRefreshable: false,
|
isRefreshable: false,
|
||||||
isSliver: true,
|
isSliver: true,
|
||||||
itemBuilder:
|
itemBuilder: (context, idx, record) => ListTile(
|
||||||
(context, idx, record) => ListTile(
|
|
||||||
title: Column(
|
title: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@@ -208,9 +207,7 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
subtitle: Row(
|
subtitle: Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text('${record.delta > 0 ? '+' : ''}${record.delta} EXP'),
|
||||||
'${record.delta > 0 ? '+' : ''}${record.delta} EXP',
|
|
||||||
),
|
|
||||||
if (record.bonusMultiplier != 1.0)
|
if (record.bonusMultiplier != 1.0)
|
||||||
Text('x${record.bonusMultiplier}'),
|
Text('x${record.bonusMultiplier}'),
|
||||||
],
|
],
|
||||||
@@ -249,8 +246,7 @@ class LevelStairsPainter extends CustomPainter {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
final paint =
|
final paint = Paint()
|
||||||
Paint()
|
|
||||||
..color = surfaceColor.withOpacity(0.2)
|
..color = surfaceColor.withOpacity(0.2)
|
||||||
..strokeWidth = 1.5
|
..strokeWidth = 1.5
|
||||||
..style = PaintingStyle.stroke;
|
..style = PaintingStyle.stroke;
|
||||||
|
|||||||
@@ -6,64 +6,129 @@ part of 'account_settings.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(authFactors)
|
||||||
|
const authFactorsProvider = AuthFactorsProvider._();
|
||||||
|
|
||||||
|
final class AuthFactorsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnAuthFactor>>,
|
||||||
|
List<SnAuthFactor>,
|
||||||
|
FutureOr<List<SnAuthFactor>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnAuthFactor>>,
|
||||||
|
$FutureProvider<List<SnAuthFactor>> {
|
||||||
|
const AuthFactorsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'authFactorsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$authFactorsHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnAuthFactor>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnAuthFactor>> create(Ref ref) {
|
||||||
|
return authFactors(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
String _$authFactorsHash() => r'ed87d7dbd421fef0a5620416727c3dc598c97ef5';
|
||||||
|
|
||||||
/// See also [authFactors].
|
@ProviderFor(contactMethods)
|
||||||
@ProviderFor(authFactors)
|
const contactMethodsProvider = ContactMethodsProvider._();
|
||||||
final authFactorsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnAuthFactor>>.internal(
|
final class ContactMethodsProvider
|
||||||
authFactors,
|
extends
|
||||||
name: r'authFactorsProvider',
|
$FunctionalProvider<
|
||||||
debugGetCreateSourceHash:
|
AsyncValue<List<SnContactMethod>>,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
List<SnContactMethod>,
|
||||||
? null
|
FutureOr<List<SnContactMethod>>
|
||||||
: _$authFactorsHash,
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnContactMethod>>,
|
||||||
|
$FutureProvider<List<SnContactMethod>> {
|
||||||
|
const ContactMethodsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'contactMethodsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$contactMethodsHash();
|
||||||
typedef AuthFactorsRef = AutoDisposeFutureProviderRef<List<SnAuthFactor>>;
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnContactMethod>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnContactMethod>> create(Ref ref) {
|
||||||
|
return contactMethods(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
String _$contactMethodsHash() => r'1d3d03e9ffbf36126236558ead22cb7d88bb9cb2';
|
||||||
|
|
||||||
/// See also [contactMethods].
|
@ProviderFor(accountConnections)
|
||||||
@ProviderFor(contactMethods)
|
const accountConnectionsProvider = AccountConnectionsProvider._();
|
||||||
final contactMethodsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnContactMethod>>.internal(
|
final class AccountConnectionsProvider
|
||||||
contactMethods,
|
extends
|
||||||
name: r'contactMethodsProvider',
|
$FunctionalProvider<
|
||||||
debugGetCreateSourceHash:
|
AsyncValue<List<SnAccountConnection>>,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
List<SnAccountConnection>,
|
||||||
? null
|
FutureOr<List<SnAccountConnection>>
|
||||||
: _$contactMethodsHash,
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnAccountConnection>>,
|
||||||
|
$FutureProvider<List<SnAccountConnection>> {
|
||||||
|
const AccountConnectionsProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'accountConnectionsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$accountConnectionsHash();
|
||||||
typedef ContactMethodsRef = AutoDisposeFutureProviderRef<List<SnContactMethod>>;
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnAccountConnection>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnAccountConnection>> create(Ref ref) {
|
||||||
|
return accountConnections(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$accountConnectionsHash() =>
|
String _$accountConnectionsHash() =>
|
||||||
r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22';
|
r'33c10b98962ede6c428d4028c0d5f2f12ff0eb22';
|
||||||
|
|
||||||
/// See also [accountConnections].
|
|
||||||
@ProviderFor(accountConnections)
|
|
||||||
final accountConnectionsProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnAccountConnection>>.internal(
|
|
||||||
accountConnections,
|
|
||||||
name: r'accountConnectionsProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$accountConnectionsHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef AccountConnectionsRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnAccountConnection>>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,16 +3,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/pods/userinfo.dart';
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/widgets/account/account_pfc.dart';
|
import 'package:island/widgets/account/account_pfc.dart';
|
||||||
import 'package:island/widgets/account/account_picker.dart';
|
import 'package:island/widgets/account/account_picker.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';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:relative_time/relative_time.dart';
|
import 'package:relative_time/relative_time.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:island/models/relationship.dart';
|
import 'package:island/models/relationship.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
|
||||||
@@ -28,39 +29,30 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final relationshipListNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
class RelationshipListNotifier extends _$RelationshipListNotifier
|
RelationshipListNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnRelationship> {
|
);
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnRelationship>> build() => fetch(cursor: null);
|
|
||||||
|
|
||||||
|
class RelationshipListNotifier extends AsyncNotifier<List<SnRelationship>>
|
||||||
|
with AsyncPaginationController<SnRelationship> {
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnRelationship>> fetch({
|
Future<List<SnRelationship>> fetch() async {
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
final take = 20;
|
final take = 20;
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/pass/relationships',
|
'/pass/relationships',
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
queryParameters: {'offset': fetchedCount.toString(), 'take': take},
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<SnRelationship> items =
|
final List<SnRelationship> items = (response.data as List)
|
||||||
(response.data as List)
|
|
||||||
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
||||||
|
.cast<SnRelationship>()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final total = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
totalCount = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
||||||
final hasMore = offset + items.length < total;
|
|
||||||
final nextCursor = hasMore ? (offset + items.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
return items;
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +82,9 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final account =
|
final account = showRelatedAccount
|
||||||
showRelatedAccount ? relationship.related : relationship.account;
|
? relationship.related
|
||||||
|
: relationship.account;
|
||||||
final isPending =
|
final isPending =
|
||||||
relationship.status == 0 && relationship.relatedId == currentUserId;
|
relationship.status == 0 && relationship.relatedId == currentUserId;
|
||||||
final isWaiting =
|
final isWaiting =
|
||||||
@@ -145,8 +138,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text('@${account.name}'),
|
subtitle: Text('@${account.name}'),
|
||||||
trailing:
|
trailing: showActions
|
||||||
showActions
|
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -172,8 +164,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
icon: const Icon(Symbols.more_vert),
|
icon: const Icon(Symbols.more_vert),
|
||||||
itemBuilder:
|
itemBuilder: (context) => [
|
||||||
(context) => [
|
|
||||||
if (relationship.status >= 100) // If friend
|
if (relationship.status >= 100) // If friend
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
@@ -181,11 +172,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
title: Text('blockUser').tr(),
|
title: Text('blockUser').tr(),
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
),
|
),
|
||||||
onTap:
|
onTap: () => onUpdateStatus?.call(relationship, -100),
|
||||||
() => onUpdateStatus?.call(
|
|
||||||
relationship,
|
|
||||||
-100,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
else if (relationship.status <= -100) // If blocked
|
else if (relationship.status <= -100) // If blocked
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
@@ -194,9 +181,7 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
title: Text('unblockUser').tr(),
|
title: Text('unblockUser').tr(),
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
),
|
),
|
||||||
onTap:
|
onTap: () => onUpdateStatus?.call(relationship, 100),
|
||||||
() =>
|
|
||||||
onUpdateStatus?.call(relationship, 100),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -242,7 +227,7 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
await client.post(
|
await client.post(
|
||||||
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
'/pass/relationships/${relationship.accountId}/friends/${isAccept ? 'accept' : 'decline'}',
|
||||||
);
|
);
|
||||||
relationshipNotifier.forceRefresh();
|
relationshipNotifier.refresh();
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
if (isAccept) {
|
if (isAccept) {
|
||||||
showSnackBar(
|
showSnackBar(
|
||||||
@@ -270,7 +255,7 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
'/pass/relationships/${relationship.accountId}',
|
'/pass/relationships/${relationship.accountId}',
|
||||||
data: {'status': newStatus},
|
data: {'status': newStatus},
|
||||||
);
|
);
|
||||||
relationshipNotifier.forceRefresh();
|
relationshipNotifier.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
final user = ref.watch(userInfoProvider);
|
final user = ref.watch(userInfoProvider);
|
||||||
@@ -305,26 +290,16 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: relationshipListNotifierProvider,
|
|
||||||
futureRefreshable: relationshipListNotifierProvider.future,
|
|
||||||
notifierRefreshable: relationshipListNotifierProvider.notifier,
|
|
||||||
contentBuilder:
|
|
||||||
(data, widgetCount, endItemView) => ListView.builder(
|
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: widgetCount,
|
provider: relationshipListNotifierProvider,
|
||||||
itemBuilder: (context, index) {
|
notifier: relationshipListNotifierProvider.notifier,
|
||||||
if (index == widgetCount - 1) {
|
itemBuilder: (context, index, relationship) {
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final relationship = data.items[index];
|
|
||||||
return RelationshipListTile(
|
return RelationshipListTile(
|
||||||
relationship: relationship,
|
relationship: relationship,
|
||||||
submitting: submitting.value,
|
submitting: submitting.value,
|
||||||
onAccept: () => handleFriendRequest(relationship, true),
|
onAccept: () => handleFriendRequest(relationship, true),
|
||||||
onDecline:
|
onDecline: () => handleFriendRequest(relationship, false),
|
||||||
() => handleFriendRequest(relationship, false),
|
|
||||||
currentUserId: user.value?.id,
|
currentUserId: user.value?.id,
|
||||||
showRelatedAccount: false,
|
showRelatedAccount: false,
|
||||||
onUpdateStatus: updateRelationship,
|
onUpdateStatus: updateRelationship,
|
||||||
@@ -332,7 +307,6 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -399,9 +373,7 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: requests.when(
|
child: requests.when(
|
||||||
data:
|
data: (items) => items.isEmpty
|
||||||
(items) =>
|
|
||||||
items.isEmpty
|
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'friendSentRequestEmpty'.tr(),
|
'friendSentRequestEmpty'.tr(),
|
||||||
|
|||||||
@@ -6,46 +6,46 @@ part of 'relationship.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [sentFriendRequest].
|
|
||||||
@ProviderFor(sentFriendRequest)
|
@ProviderFor(sentFriendRequest)
|
||||||
final sentFriendRequestProvider =
|
const sentFriendRequestProvider = SentFriendRequestProvider._();
|
||||||
AutoDisposeFutureProvider<List<SnRelationship>>.internal(
|
|
||||||
sentFriendRequest,
|
final class SentFriendRequestProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<List<SnRelationship>>,
|
||||||
|
List<SnRelationship>,
|
||||||
|
FutureOr<List<SnRelationship>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnRelationship>>,
|
||||||
|
$FutureProvider<List<SnRelationship>> {
|
||||||
|
const SentFriendRequestProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
name: r'sentFriendRequestProvider',
|
name: r'sentFriendRequestProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$sentFriendRequestHash,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@override
|
||||||
// ignore: unused_element
|
String debugGetCreateSourceHash() => _$sentFriendRequestHash();
|
||||||
typedef SentFriendRequestRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnRelationship>>;
|
|
||||||
String _$relationshipListNotifierHash() =>
|
|
||||||
r'fc46920256f7c48445c00652165e879890f2c9a3';
|
|
||||||
|
|
||||||
/// See also [RelationshipListNotifier].
|
@$internal
|
||||||
@ProviderFor(RelationshipListNotifier)
|
@override
|
||||||
final relationshipListNotifierProvider = AutoDisposeAsyncNotifierProvider<
|
$FutureProviderElement<List<SnRelationship>> $createElement(
|
||||||
RelationshipListNotifier,
|
$ProviderPointer pointer,
|
||||||
CursorPagingData<SnRelationship>
|
) => $FutureProviderElement(pointer);
|
||||||
>.internal(
|
|
||||||
RelationshipListNotifier.new,
|
|
||||||
name: r'relationshipListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$relationshipListNotifierHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$RelationshipListNotifier =
|
@override
|
||||||
AutoDisposeAsyncNotifier<CursorPagingData<SnRelationship>>;
|
FutureOr<List<SnRelationship>> create(Ref ref) {
|
||||||
// ignore_for_file: type=lint
|
return sentFriendRequest(ref);
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$sentFriendRequestHash() => r'0c52813eb6f86c05f6e0b1e4e840d0d9c350aa9e';
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,38 @@ part of 'captcha.config.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// See also [captchaUrl].
|
|
||||||
@ProviderFor(captchaUrl)
|
@ProviderFor(captchaUrl)
|
||||||
final captchaUrlProvider = AutoDisposeFutureProvider<String>.internal(
|
const captchaUrlProvider = CaptchaUrlProvider._();
|
||||||
captchaUrl,
|
|
||||||
name: r'captchaUrlProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$captchaUrlHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
final class CaptchaUrlProvider
|
||||||
// ignore: unused_element
|
extends $FunctionalProvider<AsyncValue<String>, String, FutureOr<String>>
|
||||||
typedef CaptchaUrlRef = AutoDisposeFutureProviderRef<String>;
|
with $FutureModifier<String>, $FutureProvider<String> {
|
||||||
// ignore_for_file: type=lint
|
const CaptchaUrlProvider._()
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'captchaUrlProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$captchaUrlHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<String> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<String> create(Ref ref) {
|
||||||
|
return captchaUrl(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _$captchaUrlHash() => r'5d59de4f26a0544bf4fbd5209943f0b111959ce6';
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ class CallScreen extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final ongoingCall = ref.watch(ongoingCallProvider(room.id));
|
final ongoingCall = ref.watch(ongoingCallProvider(room.id));
|
||||||
final callState = ref.watch(callNotifierProvider);
|
final callState = ref.watch(callProvider);
|
||||||
final callNotifier = ref.watch(callNotifierProvider.notifier);
|
final callNotifier = ref.watch(callProvider.notifier);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
talker.info('[Call] Joining the call...');
|
talker.info('[Call] Joining the call...');
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import 'package:island/widgets/navigation/fab_menu.dart';
|
|||||||
import 'package:island/widgets/response.dart';
|
import 'package:island/widgets/response.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:relative_time/relative_time.dart';
|
import 'package:relative_time/relative_time.dart';
|
||||||
|
import 'package:skeletonizer/skeletonizer.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:super_sliver_list/super_sliver_list.dart';
|
import 'package:super_sliver_list/super_sliver_list.dart';
|
||||||
import 'package:island/pods/chat/chat_room.dart';
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
@@ -50,8 +51,7 @@ class ChatRoomListTile extends HookConsumerWidget {
|
|||||||
if (validMembers.isNotEmpty) {
|
if (validMembers.isNotEmpty) {
|
||||||
final userInfo = ref.watch(userInfoProvider);
|
final userInfo = ref.watch(userInfoProvider);
|
||||||
if (userInfo.value != null) {
|
if (userInfo.value != null) {
|
||||||
validMembers =
|
validMembers = validMembers
|
||||||
validMembers
|
|
||||||
.where((e) => e.accountId != userInfo.value!.id)
|
.where((e) => e.accountId != userInfo.value!.id)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
@@ -60,37 +60,60 @@ class ChatRoomListTile extends HookConsumerWidget {
|
|||||||
Widget buildSubtitle() {
|
Widget buildSubtitle() {
|
||||||
if (subtitle != null) return subtitle!;
|
if (subtitle != null) return subtitle!;
|
||||||
|
|
||||||
return summary.when(
|
return AnimatedSwitcher(
|
||||||
data: (data) {
|
duration: const Duration(milliseconds: 300),
|
||||||
if (data == null) {
|
layoutBuilder: (currentChild, previousChildren) => Stack(
|
||||||
return isDirect && room.description == null
|
alignment: Alignment.centerLeft,
|
||||||
|
children: [
|
||||||
|
...previousChildren,
|
||||||
|
if (currentChild != null) currentChild,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: summary.when(
|
||||||
|
data: (data) => Container(
|
||||||
|
key: const ValueKey('data'),
|
||||||
|
child: data == null
|
||||||
|
? isDirect && room.description == null
|
||||||
? Text(
|
? Text(
|
||||||
validMembers.map((e) => '@${e.account.name}').join(', '),
|
validMembers
|
||||||
|
.map((e) => '@${e.account.name}')
|
||||||
|
.join(', '),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
)
|
)
|
||||||
: Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1);
|
: Text(
|
||||||
}
|
room.description ?? 'descriptionNone'.tr(),
|
||||||
|
maxLines: 1,
|
||||||
return Column(
|
)
|
||||||
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
if (data.unreadCount > 0)
|
if (data.unreadCount > 0)
|
||||||
Text(
|
Text(
|
||||||
'unreadMessages'.plural(data.unreadCount),
|
'unreadMessages'.plural(data.unreadCount),
|
||||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
style: Theme.of(context).textTheme.bodySmall
|
||||||
|
?.copyWith(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (data.lastMessage == null)
|
if (data.lastMessage == null)
|
||||||
Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1)
|
Text(
|
||||||
|
room.description ?? 'descriptionNone'.tr(),
|
||||||
|
maxLines: 1,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
Row(
|
Row(
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
Badge(
|
Badge(
|
||||||
label: Text(data.lastMessage!.sender.account.nick),
|
label: Text(
|
||||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
data.lastMessage!.sender.account.nick,
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
),
|
||||||
|
textColor: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.onPrimary,
|
||||||
|
backgroundColor: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.primary,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -114,19 +137,37 @@ class ChatRoomListTile extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
loading: () => Container(
|
||||||
|
key: const ValueKey('loading'),
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
|
final seed = DateTime.now().microsecondsSinceEpoch;
|
||||||
|
final len = 4 + (seed % 17); // 4..20 inclusive
|
||||||
|
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
var s = seed;
|
||||||
|
final buffer = StringBuffer();
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
s = (s * 1103515245 + 12345) & 0x7fffffff;
|
||||||
|
buffer.write(chars[s % chars.length]);
|
||||||
|
}
|
||||||
|
return Skeletonizer(
|
||||||
|
enabled: true,
|
||||||
|
child: Text(buffer.toString()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
loading: () => const SizedBox.shrink(),
|
),
|
||||||
error:
|
),
|
||||||
(_, _) =>
|
error: (_, _) => Container(
|
||||||
isDirect && room.description == null
|
key: const ValueKey('error'),
|
||||||
|
child: isDirect && room.description == null
|
||||||
? Text(
|
? Text(
|
||||||
validMembers.map((e) => '@${e.account.name}').join(', '),
|
validMembers.map((e) => '@${e.account.name}').join(', '),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1),
|
||||||
room.description ?? 'descriptionNone'.tr(),
|
),
|
||||||
maxLines: 1,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -149,11 +190,9 @@ class ChatRoomListTile extends HookConsumerWidget {
|
|||||||
loading: () => false,
|
loading: () => false,
|
||||||
error: (_, _) => false,
|
error: (_, _) => false,
|
||||||
),
|
),
|
||||||
child:
|
child: (isDirect && room.picture?.id == null)
|
||||||
(isDirect && room.picture?.id == null)
|
|
||||||
? SplitAvatarWidget(
|
? SplitAvatarWidget(
|
||||||
filesId:
|
filesId: validMembers
|
||||||
validMembers
|
|
||||||
.map((e) => e.account.profile.picture?.id)
|
.map((e) => e.account.profile.picture?.id)
|
||||||
.toList(),
|
.toList(),
|
||||||
)
|
)
|
||||||
@@ -191,7 +230,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chats = ref.watch(chatRoomJoinedNotifierProvider);
|
final chats = ref.watch(chatRoomJoinedProvider);
|
||||||
|
|
||||||
Widget bodyWidget = Column(
|
Widget bodyWidget = Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -199,8 +238,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
builder: (context, ref, _) {
|
builder: (context, ref, _) {
|
||||||
final summaryState = ref.watch(chatSummaryProvider);
|
final summaryState = ref.watch(chatSummaryProvider);
|
||||||
return summaryState.maybeWhen(
|
return summaryState.maybeWhen(
|
||||||
loading:
|
loading: () => const LinearProgressIndicator(
|
||||||
() => const LinearProgressIndicator(
|
|
||||||
minHeight: 2,
|
minHeight: 2,
|
||||||
borderRadius: BorderRadius.zero,
|
borderRadius: BorderRadius.zero,
|
||||||
),
|
),
|
||||||
@@ -210,16 +248,13 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: chats.when(
|
child: chats.when(
|
||||||
data:
|
data: (items) => RefreshIndicator(
|
||||||
(items) => RefreshIndicator(
|
onRefresh: () => Future.sync(() {
|
||||||
onRefresh:
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
() => Future.sync(() {
|
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
|
||||||
}),
|
}),
|
||||||
child: SuperListView.builder(
|
child: SuperListView.builder(
|
||||||
padding: EdgeInsets.only(bottom: 96),
|
padding: EdgeInsets.only(bottom: 96),
|
||||||
itemCount:
|
itemCount: items
|
||||||
items
|
|
||||||
.where(
|
.where(
|
||||||
(item) =>
|
(item) =>
|
||||||
selectedTab.value == 0 ||
|
selectedTab.value == 0 ||
|
||||||
@@ -228,13 +263,11 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
)
|
)
|
||||||
.length,
|
.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final filteredItems =
|
final filteredItems = items
|
||||||
items
|
|
||||||
.where(
|
.where(
|
||||||
(item) =>
|
(item) =>
|
||||||
selectedTab.value == 0 ||
|
selectedTab.value == 0 ||
|
||||||
(selectedTab.value == 1 &&
|
(selectedTab.value == 1 && item.type == 1) ||
|
||||||
item.type == 1) ||
|
|
||||||
(selectedTab.value == 2 && item.type != 1),
|
(selectedTab.value == 2 && item.type != 1),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
@@ -260,11 +293,10 @@ class ChatListBodyWidget extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error:
|
error: (error, stack) => ResponseErrorWidget(
|
||||||
(error, stack) => ResponseErrorWidget(
|
|
||||||
error: error,
|
error: error,
|
||||||
onRetry: () {
|
onRetry: () {
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -341,7 +373,7 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Listen for chat rooms refresh events
|
// Listen for chat rooms refresh events
|
||||||
final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) {
|
final subscription = eventBus.on<ChatRoomsRefreshEvent>().listen((event) {
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
});
|
});
|
||||||
|
|
||||||
return () {
|
return () {
|
||||||
@@ -353,13 +385,14 @@ class ChatListScreen extends HookConsumerWidget {
|
|||||||
// Set FAB type to chat
|
// Set FAB type to chat
|
||||||
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
|
final fabMenuNotifier = ref.read(fabMenuTypeProvider.notifier);
|
||||||
Future(() {
|
Future(() {
|
||||||
fabMenuNotifier.state = FabMenuType.chat;
|
fabMenuNotifier.setMenuType(FabMenuType.chat);
|
||||||
});
|
});
|
||||||
return () {
|
return () {
|
||||||
// Clean up: reset FAB type to main
|
// Clean up: reset FAB type to main
|
||||||
|
final fabMenu = ref.read(fabMenuTypeProvider);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (fabMenuNotifier.state == FabMenuType.chat) {
|
if (fabMenu == FabMenuType.chat) {
|
||||||
fabMenuNotifier.state = FabMenuType.main;
|
fabMenuNotifier.setMenuType(FabMenuType.main);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -521,7 +554,7 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
|
await client.post('/sphere/chat/invites/${invite.chatRoom!.id}/accept');
|
||||||
ref.invalidate(chatroomInvitesProvider);
|
ref.invalidate(chatroomInvitesProvider);
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -551,15 +584,9 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: invites.when(
|
child: invites.when(
|
||||||
data:
|
data: (items) => items.isEmpty
|
||||||
(items) =>
|
|
||||||
items.isEmpty
|
|
||||||
? Center(
|
? Center(
|
||||||
child:
|
child: Text('invitesEmpty', textAlign: TextAlign.center).tr(),
|
||||||
Text(
|
|
||||||
'invitesEmpty',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
).tr(),
|
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
@@ -575,10 +602,10 @@ class _ChatInvitesSheet extends HookConsumerWidget {
|
|||||||
if (invite.chatRoom!.type == 1)
|
if (invite.chatRoom!.type == 1)
|
||||||
Badge(
|
Badge(
|
||||||
label: const Text('directMessage').tr(),
|
label: const Text('directMessage').tr(),
|
||||||
backgroundColor:
|
backgroundColor: Theme.of(
|
||||||
Theme.of(context).colorScheme.primary,
|
context,
|
||||||
textColor:
|
).colorScheme.primary,
|
||||||
Theme.of(context).colorScheme.onPrimary,
|
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class EditChatScreen extends HookConsumerWidget {
|
|||||||
final isPublic = useState(true);
|
final isPublic = useState(true);
|
||||||
final isCommunity = useState(false);
|
final isCommunity = useState(false);
|
||||||
|
|
||||||
final chat = ref.watch(ChatRoomNotifierProvider(id));
|
final chat = ref.watch(chatRoomProvider(id));
|
||||||
|
|
||||||
final joinedRealms = ref.watch(realmsJoinedProvider);
|
final joinedRealms = ref.watch(realmsJoinedProvider);
|
||||||
final currentRealm = useState<SnRealm?>(null);
|
final currentRealm = useState<SnRealm?>(null);
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final messages = ref.watch(messagesNotifierProvider(id));
|
final messages = ref.watch(messagesProvider(id));
|
||||||
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier);
|
final messagesNotifier = ref.read(messagesProvider(id).notifier);
|
||||||
final scrollController = useScrollController();
|
final scrollController = useScrollController();
|
||||||
|
|
||||||
final listController = useMemoized(() => ListController(), []);
|
final listController = useMemoized(() => ListController(), []);
|
||||||
@@ -203,7 +203,7 @@ class PublicRoomPreview extends HookConsumerWidget {
|
|||||||
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('/sphere/chat/${room.id}/members/me');
|
||||||
ref.invalidate(ChatRoomIdentityNotifierProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chatRoom = ref.watch(ChatRoomNotifierProvider(id));
|
final chatRoom = ref.watch(chatRoomProvider(id));
|
||||||
final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id));
|
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final isSyncing = ref.watch(isSyncingProvider);
|
final isSyncing = ref.watch(chatSyncingProvider);
|
||||||
final onlineCount = ref.watch(chatOnlineCountNotifierProvider(id));
|
final onlineCount = ref.watch(chatOnlineCountProvider(id));
|
||||||
final settings = ref.watch(appSettingsNotifierProvider);
|
final settings = ref.watch(appSettingsProvider);
|
||||||
|
|
||||||
if (chatIdentity.isLoading || chatRoom.isLoading) {
|
if (chatIdentity.isLoading || chatRoom.isLoading) {
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
@@ -100,9 +100,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
await apiClient.post(
|
await apiClient.post(
|
||||||
'/sphere/chat/${room.id}/members/me',
|
'/sphere/chat/${room.id}/members/me',
|
||||||
);
|
);
|
||||||
ref.invalidate(
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
ChatRoomIdentityNotifierProvider(id),
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -131,17 +129,15 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
appBar: AppBar(leading: const PageBackButton()),
|
appBar: AppBar(leading: const PageBackButton()),
|
||||||
body: ResponseErrorWidget(
|
body: ResponseErrorWidget(
|
||||||
error: error,
|
error: error,
|
||||||
onRetry: () => ref.refresh(ChatRoomNotifierProvider(id)),
|
onRetry: () => ref.refresh(chatRoomProvider(id)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final messages = ref.watch(messagesNotifierProvider(id));
|
final messages = ref.watch(messagesProvider(id));
|
||||||
final messagesNotifier = ref.read(messagesNotifierProvider(id).notifier);
|
final messagesNotifier = ref.read(messagesProvider(id).notifier);
|
||||||
final chatSubscribeNotifier = ref.read(
|
final chatSubscribeNotifier = ref.read(chatSubscribeProvider(id).notifier);
|
||||||
chatSubscribeNotifierProvider(id).notifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
final messageController = useTextEditingController();
|
final messageController = useTextEditingController();
|
||||||
final scrollController = useScrollController();
|
final scrollController = useScrollController();
|
||||||
@@ -384,7 +380,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Convert selected message IDs to message data
|
// Convert selected message IDs to message data
|
||||||
final selectedMessageData =
|
final selectedMessageData =
|
||||||
messages.valueOrNull
|
messages.value
|
||||||
?.where((msg) => selectedMessages.value.contains(msg.id))
|
?.where((msg) => selectedMessages.value.contains(msg.id))
|
||||||
.map(
|
.map(
|
||||||
(msg) => {
|
(msg) => {
|
||||||
@@ -773,8 +769,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
|||||||
'chatDetail',
|
'chatDetail',
|
||||||
pathParameters: {'id': id},
|
pathParameters: {'id': id},
|
||||||
);
|
);
|
||||||
if (result is SearchMessagesResult &&
|
if (result is SearchMessagesResult && messages.value != null) {
|
||||||
messages.valueOrNull != null) {
|
|
||||||
final messageId = result.messageId;
|
final messageId = result.messageId;
|
||||||
|
|
||||||
// Jump to the message and trigger flash effect
|
// Jump to the message and trigger flash effect
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.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/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/pods/chat/chat_room.dart';
|
import 'package:island/pods/chat/chat_room.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/widgets/account/account_pfc.dart';
|
import 'package:island/widgets/account/account_pfc.dart';
|
||||||
import 'package:island/widgets/account/account_picker.dart';
|
import 'package:island/widgets/account/account_picker.dart';
|
||||||
import 'package:island/widgets/account/status.dart';
|
import 'package:island/widgets/account/status.dart';
|
||||||
@@ -17,9 +16,9 @@ import 'package:island/widgets/app_scaffold.dart';
|
|||||||
import 'package:island/widgets/content/cloud_files.dart';
|
import 'package:island/widgets/content/cloud_files.dart';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
import 'package:island/screens/chat/chat_form.dart';
|
import 'package:island/screens/chat/chat_form.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:island/pods/database.dart';
|
import 'package:island/pods/database.dart';
|
||||||
import 'package:island/screens/chat/search_messages.dart';
|
import 'package:island/screens/chat/search_messages.dart';
|
||||||
@@ -39,8 +38,8 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final roomState = ref.watch(ChatRoomNotifierProvider(id));
|
final roomState = ref.watch(chatRoomProvider(id));
|
||||||
final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id));
|
final roomIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final totalMessages = ref.watch(totalMessagesCountProvider(id));
|
final totalMessages = ref.watch(totalMessagesCountProvider(id));
|
||||||
|
|
||||||
const kNotifyLevelText = [
|
const kNotifyLevelText = [
|
||||||
@@ -56,7 +55,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
'/sphere/chat/$id/members/me/notify',
|
'/sphere/chat/$id/members/me/notify',
|
||||||
data: {'notify_level': level},
|
data: {'notify_level': level},
|
||||||
);
|
);
|
||||||
ref.invalidate(ChatRoomIdentityNotifierProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
showSnackBar(
|
showSnackBar(
|
||||||
'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]),
|
'chatNotifyLevelUpdated'.tr(args: [kNotifyLevelText[level].tr()]),
|
||||||
@@ -74,7 +73,7 @@ class ChatDetailScreen extends HookConsumerWidget {
|
|||||||
'/sphere/chat/$id/members/me/notify',
|
'/sphere/chat/$id/members/me/notify',
|
||||||
data: {'break_until': until.toUtc().toIso8601String()},
|
data: {'break_until': until.toUtc().toIso8601String()},
|
||||||
);
|
);
|
||||||
ref.invalidate(ChatRoomNotifierProvider(id));
|
ref.invalidate(chatRoomIdentityProvider(id));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -439,8 +438,8 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final chatIdentity = ref.watch(ChatRoomIdentityNotifierProvider(id));
|
final chatIdentity = ref.watch(chatRoomIdentityProvider(id));
|
||||||
final chatRoom = ref.watch(ChatRoomNotifierProvider(id));
|
final chatRoom = ref.watch(chatRoomProvider(id));
|
||||||
|
|
||||||
final isManagable =
|
final isManagable =
|
||||||
chatIdentity.value?.accountId == chatRoom.value?.accountId ||
|
chatIdentity.value?.accountId == chatRoom.value?.accountId ||
|
||||||
@@ -461,7 +460,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// Invalidate to refresh room data after edit
|
// Invalidate to refresh room data after edit
|
||||||
ref.invalidate(ChatRoomNotifierProvider(id));
|
ref.invalidate(chatMemberListProvider(id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -497,7 +496,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
if (confirm) {
|
if (confirm) {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
await client.delete('/sphere/chat/$id');
|
await client.delete('/sphere/chat/$id');
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
@@ -530,7 +529,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
|||||||
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('/sphere/chat/$id/members/me');
|
||||||
ref.invalidate(chatRoomJoinedNotifierProvider);
|
ref.invalidate(chatRoomJoinedProvider);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
@@ -553,86 +552,37 @@ sealed class ChatRoomMemberState with _$ChatRoomMemberState {
|
|||||||
}) = _ChatRoomMemberState;
|
}) = _ChatRoomMemberState;
|
||||||
}
|
}
|
||||||
|
|
||||||
final chatMemberStateProvider = StateNotifierProvider.family<
|
final chatMemberListProvider = AsyncNotifierProvider.autoDispose.family(
|
||||||
ChatMemberNotifier,
|
ChatMemberListNotifier.new,
|
||||||
ChatRoomMemberState,
|
);
|
||||||
String
|
|
||||||
>((ref, roomId) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
return ChatMemberNotifier(apiClient, roomId);
|
|
||||||
});
|
|
||||||
|
|
||||||
class ChatMemberNotifier extends StateNotifier<ChatRoomMemberState> {
|
class ChatMemberListNotifier extends AsyncNotifier<List<SnChatMember>>
|
||||||
final String roomId;
|
with AsyncPaginationController<SnChatMember> {
|
||||||
final Dio _apiClient;
|
static const pageSize = 20;
|
||||||
|
|
||||||
ChatMemberNotifier(this._apiClient, this.roomId)
|
final String arg;
|
||||||
: super(const ChatRoomMemberState(members: [], isLoading: false, total: 0));
|
ChatMemberListNotifier(this.arg);
|
||||||
|
|
||||||
Future<void> loadMore({int offset = 0, int take = 20}) async {
|
|
||||||
if (state.isLoading) return;
|
|
||||||
if (state.total > 0 && state.members.length >= state.total) return;
|
|
||||||
|
|
||||||
state = state.copyWith(isLoading: true, error: null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
'/sphere/chat/$roomId/members',
|
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
|
||||||
);
|
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final members = data.map((e) => SnChatMember.fromJson(e)).toList();
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
members: [...state.members, ...members],
|
|
||||||
total: total,
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
state = state.copyWith(error: e.toString(), isLoading: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
state = const ChatRoomMemberState(members: [], isLoading: false, total: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@riverpod
|
|
||||||
class ChatMemberListNotifier extends _$ChatMemberListNotifier
|
|
||||||
with CursorPagingNotifierMixin<SnChatMember> {
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnChatMember>> build(String roomId) {
|
|
||||||
return fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnChatMember>> fetch({String? cursor}) async {
|
Future<List<SnChatMember>> fetch() async {
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
final take = 20;
|
|
||||||
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/chat/$roomId/members',
|
'/sphere/chat/$arg/members',
|
||||||
queryParameters: {'offset': offset, 'take': take, 'withStatus': true},
|
queryParameters: {
|
||||||
|
'offset': fetchedCount.toString(),
|
||||||
|
'take': pageSize,
|
||||||
|
'withStatus': true,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final members =
|
||||||
final members = data.map((e) => SnChatMember.fromJson(e)).toList();
|
response.data
|
||||||
|
.map((e) => SnChatMember.fromJson(e))
|
||||||
|
.cast<SnChatMember>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Calculate next cursor based on total count
|
return members;
|
||||||
final nextOffset = offset + members.length;
|
|
||||||
final String? nextCursor =
|
|
||||||
nextOffset < total ? nextOffset.toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: members,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
hasMore: members.length < total,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,26 +592,15 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final memberListProvider = chatMemberListNotifierProvider(roomId);
|
final memberNotifier = ref.read(chatMemberListProvider(roomId).notifier);
|
||||||
|
|
||||||
// For backward compatibility and to show total count in the header
|
final roomIdentity = ref.watch(chatRoomIdentityProvider(roomId));
|
||||||
final memberState = ref.watch(chatMemberStateProvider(roomId));
|
final chatRoom = ref.watch(chatRoomProvider(roomId));
|
||||||
final memberNotifier = ref.read(chatMemberStateProvider(roomId).notifier);
|
|
||||||
|
|
||||||
final roomIdentity = ref.watch(ChatRoomIdentityNotifierProvider(roomId));
|
|
||||||
final chatRoom = ref.watch(ChatRoomNotifierProvider(roomId));
|
|
||||||
|
|
||||||
final isManagable =
|
final isManagable =
|
||||||
chatRoom.value?.accountId == roomIdentity.value?.accountId ||
|
chatRoom.value?.accountId == roomIdentity.value?.accountId ||
|
||||||
chatRoom.value?.type == 1;
|
chatRoom.value?.type == 1;
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
Future(() {
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
Future<void> invitePerson() async {
|
Future<void> invitePerson() async {
|
||||||
final result = await showModalBottomSheet(
|
final result = await showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -676,10 +615,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
'/sphere/chat/invites/$roomId',
|
'/sphere/chat/invites/$roomId',
|
||||||
data: {'related_user_id': result.id, 'role': 0},
|
data: {'related_user_id': result.id, 'role': 0},
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
await memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -696,7 +632,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'members'.plural(memberState.total),
|
'members'.plural(memberNotifier.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,
|
||||||
@@ -711,10 +647,7 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.refresh),
|
icon: const Icon(Symbols.refresh),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -727,19 +660,10 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: memberListProvider,
|
provider: chatMemberListProvider(roomId),
|
||||||
futureRefreshable: memberListProvider.future,
|
notifier: chatMemberListProvider(roomId).notifier,
|
||||||
notifierRefreshable: memberListProvider.notifier,
|
itemBuilder: (context, idx, member) {
|
||||||
contentBuilder: (data, widgetCount, endItemView) {
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == data.items.length) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final member = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: AccountPfcGestureDetector(
|
leading: AccountPfcGestureDetector(
|
||||||
@@ -776,16 +700,12 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm != true) return;
|
if (confirm != true) return;
|
||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
apiClientProvider,
|
|
||||||
);
|
|
||||||
await apiClient.delete(
|
await apiClient.delete(
|
||||||
'/sphere/chat/$roomId/members/${member.accountId}',
|
'/sphere/chat/$roomId/members/${member.accountId}',
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
// Refresh both providers
|
||||||
memberNotifier.reset();
|
memberNotifier.refresh();
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -796,8 +716,6 @@ class _ChatMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -6,297 +6,75 @@ part of 'room_detail.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(totalMessagesCount)
|
||||||
|
const totalMessagesCountProvider = TotalMessagesCountFamily._();
|
||||||
|
|
||||||
|
final class TotalMessagesCountProvider
|
||||||
|
extends $FunctionalProvider<AsyncValue<int>, int, FutureOr<int>>
|
||||||
|
with $FutureModifier<int>, $FutureProvider<int> {
|
||||||
|
const TotalMessagesCountProvider._({
|
||||||
|
required TotalMessagesCountFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'totalMessagesCountProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$totalMessagesCountHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'totalMessagesCountProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<int> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<int> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return totalMessagesCount(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is TotalMessagesCountProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$totalMessagesCountHash() =>
|
String _$totalMessagesCountHash() =>
|
||||||
r'd55f1507aba2acdce5e468c1c2e15dba7640c571';
|
r'd55f1507aba2acdce5e468c1c2e15dba7640c571';
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
final class TotalMessagesCountFamily extends $Family
|
||||||
class _SystemHash {
|
with $FunctionalFamilyOverride<FutureOr<int>, String> {
|
||||||
_SystemHash._();
|
const TotalMessagesCountFamily._()
|
||||||
|
: super(
|
||||||
static int combine(int hash, int value) {
|
retry: null,
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
@ProviderFor(totalMessagesCount)
|
|
||||||
const totalMessagesCountProvider = TotalMessagesCountFamily();
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
class TotalMessagesCountFamily extends Family<AsyncValue<int>> {
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
const TotalMessagesCountFamily();
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
TotalMessagesCountProvider call(String roomId) {
|
|
||||||
return TotalMessagesCountProvider(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TotalMessagesCountProvider getProviderOverride(
|
|
||||||
covariant TotalMessagesCountProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'totalMessagesCountProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
class TotalMessagesCountProvider extends AutoDisposeFutureProvider<int> {
|
|
||||||
/// See also [totalMessagesCount].
|
|
||||||
TotalMessagesCountProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => totalMessagesCount(ref as TotalMessagesCountRef, roomId),
|
|
||||||
from: totalMessagesCountProvider,
|
|
||||||
name: r'totalMessagesCountProvider',
|
name: r'totalMessagesCountProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$totalMessagesCountHash,
|
|
||||||
dependencies: TotalMessagesCountFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
TotalMessagesCountFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
|
||||||
|
|
||||||
TotalMessagesCountProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<int> Function(TotalMessagesCountRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: TotalMessagesCountProvider._internal(
|
|
||||||
(ref) => create(ref as TotalMessagesCountRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<int> createElement() {
|
|
||||||
return _TotalMessagesCountProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is TotalMessagesCountProvider && other.roomId == roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin TotalMessagesCountRef on AutoDisposeFutureProviderRef<int> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TotalMessagesCountProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<int>
|
|
||||||
with TotalMessagesCountRef {
|
|
||||||
_TotalMessagesCountProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get roomId => (origin as TotalMessagesCountProvider).roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$chatMemberListNotifierHash() =>
|
|
||||||
r'3ea30150278523e9f6b23f9200ea9a9fbae9c973';
|
|
||||||
|
|
||||||
abstract class _$ChatMemberListNotifier
|
|
||||||
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnChatMember>> {
|
|
||||||
late final String roomId;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnChatMember>> build(String roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
@ProviderFor(ChatMemberListNotifier)
|
|
||||||
const chatMemberListNotifierProvider = ChatMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
class ChatMemberListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnChatMember>>> {
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
const ChatMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
ChatMemberListNotifierProvider call(String roomId) {
|
|
||||||
return ChatMemberListNotifierProvider(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
ChatMemberListNotifierProvider getProviderOverride(
|
|
||||||
covariant ChatMemberListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'chatMemberListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
class ChatMemberListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
> {
|
|
||||||
/// See also [ChatMemberListNotifier].
|
|
||||||
ChatMemberListNotifierProvider(String roomId)
|
|
||||||
: this._internal(
|
|
||||||
() => ChatMemberListNotifier()..roomId = roomId,
|
|
||||||
from: chatMemberListNotifierProvider,
|
|
||||||
name: r'chatMemberListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$chatMemberListNotifierHash,
|
|
||||||
dependencies: ChatMemberListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
ChatMemberListNotifierFamily._allTransitiveDependencies,
|
|
||||||
roomId: roomId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ChatMemberListNotifierProvider._internal(
|
TotalMessagesCountProvider call(String roomId) =>
|
||||||
super._createNotifier, {
|
TotalMessagesCountProvider._(argument: roomId, from: this);
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.roomId,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String roomId;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnChatMember>> runNotifierBuild(
|
String toString() => r'totalMessagesCountProvider';
|
||||||
covariant ChatMemberListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(roomId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(ChatMemberListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: ChatMemberListNotifierProvider._internal(
|
|
||||||
() => create()..roomId = roomId,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
roomId: roomId,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _ChatMemberListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is ChatMemberListNotifierProvider && other.roomId == roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, roomId.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin ChatMemberListNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnChatMember>> {
|
|
||||||
/// The parameter `roomId` of this provider.
|
|
||||||
String get roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChatMemberListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
ChatMemberListNotifier,
|
|
||||||
CursorPagingData<SnChatMember>
|
|
||||||
>
|
|
||||||
with ChatMemberListNotifierRef {
|
|
||||||
_ChatMemberListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get roomId => (origin as ChatMemberListNotifierProvider).roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -124,9 +124,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
|
|||||||
// Debounce timer for search optimization
|
// Debounce timer for search optimization
|
||||||
final debounceTimer = useRef<Timer?>(null);
|
final debounceTimer = useRef<Timer?>(null);
|
||||||
|
|
||||||
final messagesNotifier = ref.read(
|
final messagesNotifier = ref.read(messagesProvider(roomId).notifier);
|
||||||
messagesNotifierProvider(roomId).notifier,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Optimized search function with debouncing
|
// Optimized search function with debouncing
|
||||||
void performSearch(String query) async {
|
void performSearch(String query) async {
|
||||||
@@ -180,7 +178,7 @@ class SearchMessagesScreen extends HookConsumerWidget {
|
|||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// Clear flashing messages when entering search screen
|
// Clear flashing messages when entering search screen
|
||||||
ref.read(flashingMessagesProvider.notifier).state = {};
|
ref.read(flashingMessagesProvider.notifier).clear();
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -1,14 +1,28 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import 'package:island/database/message.dart';
|
import 'package:island/database/message.dart';
|
||||||
import 'package:island/models/chat.dart';
|
import 'package:island/models/chat.dart';
|
||||||
import 'package:island/widgets/chat/message_item.dart';
|
import 'package:island/widgets/chat/message_item.dart';
|
||||||
|
|
||||||
// Provider to track animated messages to prevent replay
|
// Provider to track animated messages to prevent replay
|
||||||
final animatedMessagesProvider = StateProvider<Set<String>>((ref) => {});
|
final animatedMessagesProvider =
|
||||||
|
NotifierProvider<AnimatedMessagesNotifier, Set<String>>(
|
||||||
|
AnimatedMessagesNotifier.new,
|
||||||
|
);
|
||||||
|
|
||||||
class MessageItemWrapper extends HookConsumerWidget {
|
class AnimatedMessagesNotifier extends Notifier<Set<String>> {
|
||||||
|
@override
|
||||||
|
Set<String> build() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void addMessage(String messageId) {
|
||||||
|
state = {...state, messageId};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MessageItemWrapper extends ConsumerWidget {
|
||||||
final LocalChatMessage message;
|
final LocalChatMessage message;
|
||||||
final int index;
|
final int index;
|
||||||
final bool isLastInGroup;
|
final bool isLastInGroup;
|
||||||
@@ -78,9 +92,7 @@ class MessageItemWrapper extends HookConsumerWidget {
|
|||||||
onEnd: () {
|
onEnd: () {
|
||||||
// Mark as animated
|
// Mark as animated
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
ref
|
ref.read(animatedMessagesProvider.notifier).addMessage(message.id);
|
||||||
.read(animatedMessagesProvider.notifier)
|
|
||||||
.update((state) => {...state, message.id});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/screens/creators/publishers_form.dart';
|
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';
|
||||||
@@ -18,11 +19,11 @@ 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';
|
||||||
import 'package:island/widgets/content/sheet.dart';
|
import 'package:island/widgets/content/sheet.dart';
|
||||||
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/response.dart';
|
import 'package:island/widgets/response.dart';
|
||||||
import 'package:island/widgets/activity_heatmap.dart';
|
import 'package:island/widgets/activity_heatmap.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'hub.g.dart';
|
part 'hub.g.dart';
|
||||||
@@ -77,38 +78,32 @@ Future<List<SnPublisherMember>> publisherInvites(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
|
||||||
class PublisherMemberListNotifier extends _$PublisherMemberListNotifier
|
.autoDispose(PublisherMemberListNotifier.new);
|
||||||
with CursorPagingNotifierMixin<SnPublisherMember> {
|
|
||||||
static const int _pageSize = 20;
|
class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
|
||||||
|
with AsyncPaginationController<SnPublisherMember> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String arg;
|
||||||
|
PublisherMemberListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnPublisherMember>> build(String uname) async {
|
Future<List<SnPublisherMember>> fetch() async {
|
||||||
return fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnPublisherMember>> fetch({String? cursor}) async {
|
|
||||||
final apiClient = ref.read(apiClientProvider);
|
final apiClient = ref.read(apiClientProvider);
|
||||||
final offset = cursor != null ? int.parse(cursor) : 0;
|
|
||||||
|
|
||||||
final response = await apiClient.get(
|
final response = await apiClient.get(
|
||||||
'/sphere/publishers/$uname/members',
|
'/sphere/publishers/$arg/members',
|
||||||
queryParameters: {'offset': offset, 'take': _pageSize},
|
queryParameters: {'offset': fetchedCount.toString(), 'take': pageSize},
|
||||||
);
|
);
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final members = response.data
|
||||||
final members = data.map((e) => SnPublisherMember.fromJson(e)).toList();
|
.map((e) => SnPublisherMember.fromJson(e))
|
||||||
|
.cast<SnPublisherMember>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + members.length < total;
|
return members;
|
||||||
final nextCursor = hasMore ? (offset + members.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: members,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,12 +172,10 @@ class PublisherSelector extends StatelessWidget {
|
|||||||
iconStyleData: IconStyleData(
|
iconStyleData: IconStyleData(
|
||||||
icon: Icon(Icons.arrow_drop_down),
|
icon: Icon(Icons.arrow_drop_down),
|
||||||
iconSize: 19,
|
iconSize: 19,
|
||||||
iconEnabledColor:
|
iconEnabledColor: isWideScreen(context)
|
||||||
isWideScreen(context)
|
|
||||||
? null
|
? null
|
||||||
: Theme.of(context).appBarTheme.foregroundColor!,
|
: Theme.of(context).appBarTheme.foregroundColor!,
|
||||||
iconDisabledColor:
|
iconDisabledColor: isWideScreen(context)
|
||||||
isWideScreen(context)
|
|
||||||
? null
|
? null
|
||||||
: Theme.of(context).appBarTheme.foregroundColor!,
|
: Theme.of(context).appBarTheme.foregroundColor!,
|
||||||
),
|
),
|
||||||
@@ -208,6 +201,13 @@ class _PublisherUnselectedWidget extends HookConsumerWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (!hasPublishers) ...[
|
if (!hasPublishers) ...[
|
||||||
|
if (publishers.isLoading)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
...([
|
||||||
const Icon(
|
const Icon(
|
||||||
Symbols.info,
|
Symbols.info,
|
||||||
fill: 1,
|
fill: 1,
|
||||||
@@ -218,6 +218,7 @@ class _PublisherUnselectedWidget extends HookConsumerWidget {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
).tr(),
|
).tr(),
|
||||||
|
]),
|
||||||
const Gap(24),
|
const Gap(24),
|
||||||
],
|
],
|
||||||
if (hasPublishers)
|
if (hasPublishers)
|
||||||
@@ -292,14 +293,14 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder:
|
builder: (context) =>
|
||||||
(context) =>
|
|
||||||
EditPublisherScreen(name: currentPublisher.value!.name),
|
EditPublisherScreen(name: currentPublisher.value!.name),
|
||||||
).then((value) async {
|
).then((value) async {
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
final data = await ref.refresh(publishersManagedProvider.future);
|
final data = await ref.refresh(publishersManagedProvider.future);
|
||||||
currentPublisher.value =
|
currentPublisher.value = data
|
||||||
data.where((e) => e.id == currentPublisher.value!.id).firstOrNull;
|
.where((e) => e.id == currentPublisher.value!.id)
|
||||||
|
.firstOrNull;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,9 +320,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<DropdownMenuItem<SnPublisher>> publishersMenu = publishers.when(
|
final List<DropdownMenuItem<SnPublisher>> publishersMenu = publishers.when(
|
||||||
data:
|
data: (data) => data
|
||||||
(data) =>
|
|
||||||
data
|
|
||||||
.map(
|
.map(
|
||||||
(item) => DropdownMenuItem<SnPublisher>(
|
(item) => DropdownMenuItem<SnPublisher>(
|
||||||
value: item,
|
value: item,
|
||||||
@@ -333,8 +332,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
title: Text(item.nick),
|
title: Text(item.nick),
|
||||||
subtitle: Text('@${item.name}'),
|
subtitle: Text('@${item.name}'),
|
||||||
trailing:
|
trailing: currentPublisher.value?.id == item.id
|
||||||
currentPublisher.value?.id == item.id
|
|
||||||
? const Icon(Icons.check)
|
? const Icon(Icons.check)
|
||||||
: null,
|
: null,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 8),
|
contentPadding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
@@ -447,8 +445,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder: (context) => _PublisherMemberListSheet(
|
||||||
(context) => _PublisherMemberListSheet(
|
|
||||||
publisherUname: currentPublisher.value!.name,
|
publisherUname: currentPublisher.value!.name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -571,11 +568,9 @@ class CreatorHubScreen extends HookConsumerWidget {
|
|||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
constraints: BoxConstraints(maxWidth: maxWidth),
|
||||||
child: publisherStats.when(
|
child: publisherStats.when(
|
||||||
data:
|
data: (stats) => SingleChildScrollView(
|
||||||
(stats) => SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||||
child:
|
child: currentPublisher.value == null
|
||||||
currentPublisher.value == null
|
|
||||||
? ConstrainedBox(
|
? ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 640),
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
child: _PublisherUnselectedWidget(
|
child: _PublisherUnselectedWidget(
|
||||||
@@ -765,55 +760,6 @@ class PublisherMemberState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final publisherMemberStateProvider = StateNotifierProvider.family<
|
|
||||||
PublisherMemberNotifier,
|
|
||||||
PublisherMemberState,
|
|
||||||
String
|
|
||||||
>((ref, publisherUname) {
|
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
|
||||||
return PublisherMemberNotifier(apiClient, publisherUname);
|
|
||||||
});
|
|
||||||
|
|
||||||
class PublisherMemberNotifier extends StateNotifier<PublisherMemberState> {
|
|
||||||
final String publisherUname;
|
|
||||||
final Dio _apiClient;
|
|
||||||
|
|
||||||
PublisherMemberNotifier(this._apiClient, this.publisherUname)
|
|
||||||
: super(
|
|
||||||
const PublisherMemberState(members: [], isLoading: false, total: 0),
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<void> loadMore({int offset = 0, int take = 20}) async {
|
|
||||||
if (state.isLoading) return;
|
|
||||||
if (state.total > 0 && state.members.length >= state.total) return;
|
|
||||||
|
|
||||||
state = state.copyWith(isLoading: true, error: null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final response = await _apiClient.get(
|
|
||||||
'/sphere/publishers/$publisherUname/members',
|
|
||||||
queryParameters: {'offset': offset, 'take': take},
|
|
||||||
);
|
|
||||||
|
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
|
||||||
final List<dynamic> data = response.data;
|
|
||||||
final members = data.map((e) => SnPublisherMember.fromJson(e)).toList();
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
members: [...state.members, ...members],
|
|
||||||
total: total,
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
state = state.copyWith(error: e.toString(), isLoading: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
state = const PublisherMemberState(members: [], isLoading: false, total: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherMemberListSheet extends HookConsumerWidget {
|
class _PublisherMemberListSheet extends HookConsumerWidget {
|
||||||
final String publisherUname;
|
final String publisherUname;
|
||||||
const _PublisherMemberListSheet({required this.publisherUname});
|
const _PublisherMemberListSheet({required this.publisherUname});
|
||||||
@@ -826,18 +772,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
final memberListProvider = publisherMemberListNotifierProvider(
|
final memberListProvider = publisherMemberListNotifierProvider(
|
||||||
publisherUname,
|
publisherUname,
|
||||||
);
|
);
|
||||||
final memberState = ref.watch(publisherMemberStateProvider(publisherUname));
|
|
||||||
final memberNotifier = ref.read(
|
final memberNotifier = ref.read(
|
||||||
publisherMemberStateProvider(publisherUname).notifier,
|
publisherMemberListNotifierProvider(publisherUname).notifier,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
Future(() {
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
Future<void> invitePerson() async {
|
Future<void> invitePerson() async {
|
||||||
final result = await showModalBottomSheet(
|
final result = await showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@@ -852,10 +790,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
'/sphere/publishers/invites/$publisherUname',
|
'/sphere/publishers/invites/$publisherUname',
|
||||||
data: {'related_user_id': result.id, 'role': 0},
|
data: {'related_user_id': result.id, 'role': 0},
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
await memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -872,7 +807,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'members'.plural(memberState.total),
|
'members'.plural(memberNotifier.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,
|
||||||
@@ -887,9 +822,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.refresh),
|
icon: const Icon(Symbols.refresh),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
memberNotifier.reset();
|
memberNotifier.refresh();
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -902,19 +835,10 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PagingHelperView(
|
child: PaginationList(
|
||||||
provider: memberListProvider,
|
provider: memberListProvider,
|
||||||
futureRefreshable: memberListProvider.future,
|
notifier: memberListProvider.notifier,
|
||||||
notifierRefreshable: memberListProvider.notifier,
|
itemBuilder: (context, index, member) {
|
||||||
contentBuilder: (data, widgetCount, endItemView) {
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == data.items.length) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
|
|
||||||
final member = data.items[index];
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
contentPadding: EdgeInsets.only(left: 16, right: 12),
|
||||||
leading: ProfilePictureWidget(
|
leading: ProfilePictureWidget(
|
||||||
@@ -951,17 +875,13 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder: (context) => _PublisherMemberRoleSheet(
|
||||||
(context) => _PublisherMemberRoleSheet(
|
|
||||||
publisherUname: publisherUname,
|
publisherUname: publisherUname,
|
||||||
member: member,
|
member: member,
|
||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -976,16 +896,11 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
).then((confirm) async {
|
).then((confirm) async {
|
||||||
if (confirm != true) return;
|
if (confirm != true) return;
|
||||||
try {
|
try {
|
||||||
final apiClient = ref.watch(
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
apiClientProvider,
|
|
||||||
);
|
|
||||||
await apiClient.delete(
|
await apiClient.delete(
|
||||||
'/sphere/publishers/$publisherUname/members/${member.accountId}',
|
'/sphere/publishers/$publisherUname/members/${member.accountId}',
|
||||||
);
|
);
|
||||||
// Refresh both providers
|
memberNotifier.refresh();
|
||||||
memberNotifier.reset();
|
|
||||||
memberNotifier.loadMore();
|
|
||||||
ref.invalidate(memberListProvider);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
}
|
}
|
||||||
@@ -996,8 +911,6 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -1076,12 +989,8 @@ class _PublisherMemberRoleSheet extends HookConsumerWidget {
|
|||||||
onSelected: (int selection) {
|
onSelected: (int selection) {
|
||||||
roleController.text = selection.toString();
|
roleController.text = selection.toString();
|
||||||
},
|
},
|
||||||
fieldViewBuilder: (
|
fieldViewBuilder:
|
||||||
context,
|
(context, controller, focusNode, onFieldSubmitted) {
|
||||||
controller,
|
|
||||||
focusNode,
|
|
||||||
onFieldSubmitted,
|
|
||||||
) {
|
|
||||||
return TextField(
|
return TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@@ -1170,15 +1079,9 @@ class _PublisherInviteSheet extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: invites.when(
|
child: invites.when(
|
||||||
data:
|
data: (items) => items.isEmpty
|
||||||
(items) =>
|
|
||||||
items.isEmpty
|
|
||||||
? Center(
|
? Center(
|
||||||
child:
|
child: Text('invitesEmpty', textAlign: TextAlign.center).tr(),
|
||||||
Text(
|
|
||||||
'invitesEmpty',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
).tr(),
|
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
@@ -1191,8 +1094,7 @@ class _PublisherInviteSheet extends HookConsumerWidget {
|
|||||||
fallbackIcon: Symbols.group,
|
fallbackIcon: Symbols.group,
|
||||||
),
|
),
|
||||||
title: Text(invite.publisher!.nick),
|
title: Text(invite.publisher!.nick),
|
||||||
subtitle:
|
subtitle: Text(
|
||||||
Text(
|
|
||||||
invite.role >= 100
|
invite.role >= 100
|
||||||
? 'permissionOwner'
|
? 'permissionOwner'
|
||||||
: invite.role >= 50
|
: invite.role >= 50
|
||||||
@@ -1216,8 +1118,7 @@ class _PublisherInviteSheet extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error:
|
error: (error, _) => ResponseErrorWidget(
|
||||||
(error, _) => ResponseErrorWidget(
|
|
||||||
error: error,
|
error: error,
|
||||||
onRetry: () => ref.invalidate(publisherInvitesProvider),
|
onRetry: () => ref.invalidate(publisherInvitesProvider),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,686 +6,351 @@ part of 'hub.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
|
||||||
class _SystemHash {
|
|
||||||
_SystemHash._();
|
|
||||||
|
|
||||||
static int combine(int hash, int value) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherStats].
|
|
||||||
@ProviderFor(publisherStats)
|
@ProviderFor(publisherStats)
|
||||||
const publisherStatsProvider = PublisherStatsFamily();
|
const publisherStatsProvider = PublisherStatsFamily._();
|
||||||
|
|
||||||
/// See also [publisherStats].
|
final class PublisherStatsProvider
|
||||||
class PublisherStatsFamily extends Family<AsyncValue<SnPublisherStats?>> {
|
extends
|
||||||
/// See also [publisherStats].
|
$FunctionalProvider<
|
||||||
const PublisherStatsFamily();
|
AsyncValue<SnPublisherStats?>,
|
||||||
|
SnPublisherStats?,
|
||||||
/// See also [publisherStats].
|
FutureOr<SnPublisherStats?>
|
||||||
PublisherStatsProvider call(String? uname) {
|
>
|
||||||
return PublisherStatsProvider(uname);
|
with
|
||||||
}
|
$FutureModifier<SnPublisherStats?>,
|
||||||
|
$FutureProvider<SnPublisherStats?> {
|
||||||
@override
|
const PublisherStatsProvider._({
|
||||||
PublisherStatsProvider getProviderOverride(
|
required PublisherStatsFamily super.from,
|
||||||
covariant PublisherStatsProvider provider,
|
required String? super.argument,
|
||||||
) {
|
}) : super(
|
||||||
return call(provider.uname);
|
retry: null,
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherStatsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherStats].
|
|
||||||
class PublisherStatsProvider
|
|
||||||
extends AutoDisposeFutureProvider<SnPublisherStats?> {
|
|
||||||
/// See also [publisherStats].
|
|
||||||
PublisherStatsProvider(String? uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publisherStats(ref as PublisherStatsRef, uname),
|
|
||||||
from: publisherStatsProvider,
|
|
||||||
name: r'publisherStatsProvider',
|
name: r'publisherStatsProvider',
|
||||||
debugGetCreateSourceHash:
|
isAutoDispose: true,
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
dependencies: null,
|
||||||
? null
|
$allTransitiveDependencies: null,
|
||||||
: _$publisherStatsHash,
|
|
||||||
dependencies: PublisherStatsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherStatsFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherStatsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherStatsHash();
|
||||||
FutureOr<SnPublisherStats?> Function(PublisherStatsRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherStatsProvider'
|
||||||
override: PublisherStatsProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherStatsRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublisherStats?> createElement() {
|
$FutureProviderElement<SnPublisherStats?> $createElement(
|
||||||
return _PublisherStatsProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublisherStats?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherStats(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherStatsProvider && other.uname == uname;
|
return other is PublisherStatsProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
String _$publisherStatsHash() => r'eea4ed98bf165cc785874f83b912bb7e23d1f7bc';
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherStatsRef on AutoDisposeFutureProviderRef<SnPublisherStats?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherStatsProviderElement
|
final class PublisherStatsFamily extends $Family
|
||||||
extends AutoDisposeFutureProviderElement<SnPublisherStats?>
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherStats?>, String?> {
|
||||||
with PublisherStatsRef {
|
const PublisherStatsFamily._()
|
||||||
_PublisherStatsProviderElement(super.provider);
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherStatsProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
PublisherStatsProvider call(String? uname) =>
|
||||||
|
PublisherStatsProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get uname => (origin as PublisherStatsProvider).uname;
|
String toString() => r'publisherStatsProvider';
|
||||||
|
}
|
||||||
|
|
||||||
|
@ProviderFor(publisherHeatmap)
|
||||||
|
const publisherHeatmapProvider = PublisherHeatmapFamily._();
|
||||||
|
|
||||||
|
final class PublisherHeatmapProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnHeatmap?>,
|
||||||
|
SnHeatmap?,
|
||||||
|
FutureOr<SnHeatmap?>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnHeatmap?>, $FutureProvider<SnHeatmap?> {
|
||||||
|
const PublisherHeatmapProvider._({
|
||||||
|
required PublisherHeatmapFamily super.from,
|
||||||
|
required String? super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherHeatmapProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$publisherHeatmapHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'publisherHeatmapProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnHeatmap?> $createElement($ProviderPointer pointer) =>
|
||||||
|
$FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnHeatmap?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherHeatmap(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is PublisherHeatmapProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
|
String _$publisherHeatmapHash() => r'5f70c55e14629ec8628445a317888e02fccd9af2';
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
final class PublisherHeatmapFamily extends $Family
|
||||||
@ProviderFor(publisherHeatmap)
|
with $FunctionalFamilyOverride<FutureOr<SnHeatmap?>, String?> {
|
||||||
const publisherHeatmapProvider = PublisherHeatmapFamily();
|
const PublisherHeatmapFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherHeatmapProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
PublisherHeatmapProvider call(String? uname) =>
|
||||||
class PublisherHeatmapFamily extends Family<AsyncValue<SnHeatmap?>> {
|
PublisherHeatmapProvider._(argument: uname, from: this);
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
const PublisherHeatmapFamily();
|
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
PublisherHeatmapProvider call(String? uname) {
|
|
||||||
return PublisherHeatmapProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PublisherHeatmapProvider getProviderOverride(
|
String toString() => r'publisherHeatmapProvider';
|
||||||
covariant PublisherHeatmapProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherHeatmapProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [publisherHeatmap].
|
@ProviderFor(publisherIdentity)
|
||||||
class PublisherHeatmapProvider extends AutoDisposeFutureProvider<SnHeatmap?> {
|
const publisherIdentityProvider = PublisherIdentityFamily._();
|
||||||
/// See also [publisherHeatmap].
|
|
||||||
PublisherHeatmapProvider(String? uname)
|
final class PublisherIdentityProvider
|
||||||
: this._internal(
|
extends
|
||||||
(ref) => publisherHeatmap(ref as PublisherHeatmapRef, uname),
|
$FunctionalProvider<
|
||||||
from: publisherHeatmapProvider,
|
AsyncValue<SnPublisherMember?>,
|
||||||
name: r'publisherHeatmapProvider',
|
SnPublisherMember?,
|
||||||
debugGetCreateSourceHash:
|
FutureOr<SnPublisherMember?>
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
>
|
||||||
? null
|
with
|
||||||
: _$publisherHeatmapHash,
|
$FutureModifier<SnPublisherMember?>,
|
||||||
dependencies: PublisherHeatmapFamily._dependencies,
|
$FutureProvider<SnPublisherMember?> {
|
||||||
allTransitiveDependencies:
|
const PublisherIdentityProvider._({
|
||||||
PublisherHeatmapFamily._allTransitiveDependencies,
|
required PublisherIdentityFamily super.from,
|
||||||
uname: uname,
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherIdentityProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherHeatmapProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherIdentityHash();
|
||||||
FutureOr<SnHeatmap?> Function(PublisherHeatmapRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherIdentityProvider'
|
||||||
override: PublisherHeatmapProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherHeatmapRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnHeatmap?> createElement() {
|
$FutureProviderElement<SnPublisherMember?> $createElement(
|
||||||
return _PublisherHeatmapProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPublisherMember?> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return publisherIdentity(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherHeatmapProvider && other.uname == uname;
|
return other is PublisherIdentityProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherHeatmapRef on AutoDisposeFutureProviderRef<SnHeatmap?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherHeatmapProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnHeatmap?>
|
|
||||||
with PublisherHeatmapRef {
|
|
||||||
_PublisherHeatmapProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get uname => (origin as PublisherHeatmapProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
|
String _$publisherIdentityHash() => r'299372f25fa4b2bf8e11a8ba2d645100fc38e76f';
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
final class PublisherIdentityFamily extends $Family
|
||||||
@ProviderFor(publisherIdentity)
|
with $FunctionalFamilyOverride<FutureOr<SnPublisherMember?>, String> {
|
||||||
const publisherIdentityProvider = PublisherIdentityFamily();
|
const PublisherIdentityFamily._()
|
||||||
|
: super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherIdentityProvider',
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
isAutoDispose: true,
|
||||||
|
);
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
PublisherIdentityProvider call(String uname) =>
|
||||||
class PublisherIdentityFamily extends Family<AsyncValue<SnPublisherMember?>> {
|
PublisherIdentityProvider._(argument: uname, from: this);
|
||||||
/// See also [publisherIdentity].
|
|
||||||
const PublisherIdentityFamily();
|
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
|
||||||
PublisherIdentityProvider call(String uname) {
|
|
||||||
return PublisherIdentityProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PublisherIdentityProvider getProviderOverride(
|
String toString() => r'publisherIdentityProvider';
|
||||||
covariant PublisherIdentityProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherIdentityProvider';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See also [publisherIdentity].
|
@ProviderFor(publisherFeatures)
|
||||||
class PublisherIdentityProvider
|
const publisherFeaturesProvider = PublisherFeaturesFamily._();
|
||||||
extends AutoDisposeFutureProvider<SnPublisherMember?> {
|
|
||||||
/// See also [publisherIdentity].
|
final class PublisherFeaturesProvider
|
||||||
PublisherIdentityProvider(String uname)
|
extends
|
||||||
: this._internal(
|
$FunctionalProvider<
|
||||||
(ref) => publisherIdentity(ref as PublisherIdentityRef, uname),
|
AsyncValue<Map<String, bool>>,
|
||||||
from: publisherIdentityProvider,
|
Map<String, bool>,
|
||||||
name: r'publisherIdentityProvider',
|
FutureOr<Map<String, bool>>
|
||||||
debugGetCreateSourceHash:
|
>
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
with
|
||||||
? null
|
$FutureModifier<Map<String, bool>>,
|
||||||
: _$publisherIdentityHash,
|
$FutureProvider<Map<String, bool>> {
|
||||||
dependencies: PublisherIdentityFamily._dependencies,
|
const PublisherFeaturesProvider._({
|
||||||
allTransitiveDependencies:
|
required PublisherFeaturesFamily super.from,
|
||||||
PublisherIdentityFamily._allTransitiveDependencies,
|
required String? super.argument,
|
||||||
uname: uname,
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherFeaturesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
PublisherIdentityProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Override overrideWith(
|
String debugGetCreateSourceHash() => _$publisherFeaturesHash();
|
||||||
FutureOr<SnPublisherMember?> Function(PublisherIdentityRef provider) create,
|
|
||||||
) {
|
@override
|
||||||
return ProviderOverride(
|
String toString() {
|
||||||
origin: this,
|
return r'publisherFeaturesProvider'
|
||||||
override: PublisherIdentityProvider._internal(
|
''
|
||||||
(ref) => create(ref as PublisherIdentityRef),
|
'($argument)';
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<SnPublisherMember?> createElement() {
|
$FutureProviderElement<Map<String, bool>> $createElement(
|
||||||
return _PublisherIdentityProviderElement(this);
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<Map<String, bool>> create(Ref ref) {
|
||||||
|
final argument = this.argument as String?;
|
||||||
|
return publisherFeatures(ref, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return other is PublisherIdentityProvider && other.uname == uname;
|
return other is PublisherFeaturesProvider && other.argument == argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
return argument.hashCode;
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherIdentityRef on AutoDisposeFutureProviderRef<SnPublisherMember?> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherIdentityProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPublisherMember?>
|
|
||||||
with PublisherIdentityRef {
|
|
||||||
_PublisherIdentityProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get uname => (origin as PublisherIdentityProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
|
String _$publisherFeaturesHash() => r'08bace2d9a3da227ecec0cbf8709e55ee0646ca2';
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
final class PublisherFeaturesFamily extends $Family
|
||||||
@ProviderFor(publisherFeatures)
|
with $FunctionalFamilyOverride<FutureOr<Map<String, bool>>, String?> {
|
||||||
const publisherFeaturesProvider = PublisherFeaturesFamily();
|
const PublisherFeaturesFamily._()
|
||||||
|
: super(
|
||||||
/// See also [publisherFeatures].
|
retry: null,
|
||||||
class PublisherFeaturesFamily extends Family<AsyncValue<Map<String, bool>>> {
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
const PublisherFeaturesFamily();
|
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
PublisherFeaturesProvider call(String? uname) {
|
|
||||||
return PublisherFeaturesProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PublisherFeaturesProvider getProviderOverride(
|
|
||||||
covariant PublisherFeaturesProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherFeaturesProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
class PublisherFeaturesProvider
|
|
||||||
extends AutoDisposeFutureProvider<Map<String, bool>> {
|
|
||||||
/// See also [publisherFeatures].
|
|
||||||
PublisherFeaturesProvider(String? uname)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => publisherFeatures(ref as PublisherFeaturesRef, uname),
|
|
||||||
from: publisherFeaturesProvider,
|
|
||||||
name: r'publisherFeaturesProvider',
|
name: r'publisherFeaturesProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherFeaturesHash,
|
|
||||||
dependencies: PublisherFeaturesFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherFeaturesFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
|
||||||
|
|
||||||
PublisherFeaturesProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? uname;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<Map<String, bool>> Function(PublisherFeaturesRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PublisherFeaturesProvider._internal(
|
|
||||||
(ref) => create(ref as PublisherFeaturesRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
PublisherFeaturesProvider call(String? uname) =>
|
||||||
|
PublisherFeaturesProvider._(argument: uname, from: this);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AutoDisposeFutureProviderElement<Map<String, bool>> createElement() {
|
String toString() => r'publisherFeaturesProvider';
|
||||||
return _PublisherFeaturesProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PublisherFeaturesProvider && other.uname == uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@ProviderFor(publisherInvites)
|
||||||
// ignore: unused_element
|
const publisherInvitesProvider = PublisherInvitesProvider._();
|
||||||
mixin PublisherFeaturesRef on AutoDisposeFutureProviderRef<Map<String, bool>> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String? get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherFeaturesProviderElement
|
final class PublisherInvitesProvider
|
||||||
extends AutoDisposeFutureProviderElement<Map<String, bool>>
|
extends
|
||||||
with PublisherFeaturesRef {
|
$FunctionalProvider<
|
||||||
_PublisherFeaturesProviderElement(super.provider);
|
AsyncValue<List<SnPublisherMember>>,
|
||||||
|
List<SnPublisherMember>,
|
||||||
|
FutureOr<List<SnPublisherMember>>
|
||||||
|
>
|
||||||
|
with
|
||||||
|
$FutureModifier<List<SnPublisherMember>>,
|
||||||
|
$FutureProvider<List<SnPublisherMember>> {
|
||||||
|
const PublisherInvitesProvider._()
|
||||||
|
: super(
|
||||||
|
from: null,
|
||||||
|
argument: null,
|
||||||
|
retry: null,
|
||||||
|
name: r'publisherInvitesProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get uname => (origin as PublisherFeaturesProvider).uname;
|
String debugGetCreateSourceHash() => _$publisherInvitesHash();
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<List<SnPublisherMember>> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<List<SnPublisherMember>> create(Ref ref) {
|
||||||
|
return publisherInvites(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
String _$publisherInvitesHash() => r'93aafc2f02af0a7a055ec1770b3999363dfaabdc';
|
||||||
|
|
||||||
/// See also [publisherInvites].
|
|
||||||
@ProviderFor(publisherInvites)
|
|
||||||
final publisherInvitesProvider =
|
|
||||||
AutoDisposeFutureProvider<List<SnPublisherMember>>.internal(
|
|
||||||
publisherInvites,
|
|
||||||
name: r'publisherInvitesProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherInvitesHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
typedef PublisherInvitesRef =
|
|
||||||
AutoDisposeFutureProviderRef<List<SnPublisherMember>>;
|
|
||||||
String _$publisherMemberListNotifierHash() =>
|
|
||||||
r'b4afd5d591a6f3d29f1b45fb1b6d17cb34f3f11b';
|
|
||||||
|
|
||||||
abstract class _$PublisherMemberListNotifier
|
|
||||||
extends
|
|
||||||
BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnPublisherMember>> {
|
|
||||||
late final String uname;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnPublisherMember>> build(String uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
@ProviderFor(PublisherMemberListNotifier)
|
|
||||||
const publisherMemberListNotifierProvider = PublisherMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
class PublisherMemberListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnPublisherMember>>> {
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
const PublisherMemberListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
PublisherMemberListNotifierProvider call(String uname) {
|
|
||||||
return PublisherMemberListNotifierProvider(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PublisherMemberListNotifierProvider getProviderOverride(
|
|
||||||
covariant PublisherMemberListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'publisherMemberListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
class PublisherMemberListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
> {
|
|
||||||
/// See also [PublisherMemberListNotifier].
|
|
||||||
PublisherMemberListNotifierProvider(String uname)
|
|
||||||
: this._internal(
|
|
||||||
() => PublisherMemberListNotifier()..uname = uname,
|
|
||||||
from: publisherMemberListNotifierProvider,
|
|
||||||
name: r'publisherMemberListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$publisherMemberListNotifierHash,
|
|
||||||
dependencies: PublisherMemberListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PublisherMemberListNotifierFamily._allTransitiveDependencies,
|
|
||||||
uname: uname,
|
|
||||||
);
|
|
||||||
|
|
||||||
PublisherMemberListNotifierProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.uname,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String uname;
|
|
||||||
|
|
||||||
@override
|
|
||||||
FutureOr<CursorPagingData<SnPublisherMember>> runNotifierBuild(
|
|
||||||
covariant PublisherMemberListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(PublisherMemberListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PublisherMemberListNotifierProvider._internal(
|
|
||||||
() => create()..uname = uname,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
uname: uname,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _PublisherMemberListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PublisherMemberListNotifierProvider && other.uname == uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, uname.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PublisherMemberListNotifierRef
|
|
||||||
on
|
|
||||||
AutoDisposeAsyncNotifierProviderRef<
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
> {
|
|
||||||
/// The parameter `uname` of this provider.
|
|
||||||
String get uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PublisherMemberListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PublisherMemberListNotifier,
|
|
||||||
CursorPagingData<SnPublisherMember>
|
|
||||||
>
|
|
||||||
with PublisherMemberListNotifierRef {
|
|
||||||
_PublisherMemberListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get uname => (origin as PublisherMemberListNotifierProvider).uname;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -4,60 +4,52 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/poll.dart';
|
import 'package:island/models/poll.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/paging.dart';
|
||||||
import 'package:island/screens/poll/poll_editor.dart';
|
import 'package:island/screens/poll/poll_editor.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/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/poll/poll_feedback.dart';
|
import 'package:island/widgets/poll/poll_feedback.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
|
||||||
import 'package:island/widgets/extended_refresh_indicator.dart';
|
import 'package:island/widgets/extended_refresh_indicator.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
part 'poll_list.g.dart';
|
part 'poll_list.g.dart';
|
||||||
|
|
||||||
@riverpod
|
final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||||
class PollListNotifier extends _$PollListNotifier
|
PollListNotifier.new,
|
||||||
with CursorPagingNotifierMixin<SnPollWithStats> {
|
);
|
||||||
static const int _pageSize = 20;
|
|
||||||
|
class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
|
||||||
|
with AsyncPaginationController<SnPollWithStats> {
|
||||||
|
static const int pageSize = 20;
|
||||||
|
|
||||||
|
final String? arg;
|
||||||
|
PollListNotifier(this.arg);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<CursorPagingData<SnPollWithStats>> build(String? pubName) {
|
Future<List<SnPollWithStats>> fetch() async {
|
||||||
// immediately load first page
|
|
||||||
return fetch(cursor: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<CursorPagingData<SnPollWithStats>> fetch({
|
|
||||||
required String? cursor,
|
|
||||||
}) async {
|
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
final offset = cursor == null ? 0 : int.parse(cursor);
|
|
||||||
|
|
||||||
// read the current family argument passed to provider
|
// read the current family argument passed to provider
|
||||||
final currentPub = pubName;
|
|
||||||
final queryParams = {
|
final queryParams = {
|
||||||
'offset': offset,
|
'offset': fetchedCount.toString(),
|
||||||
'take': _pageSize,
|
'take': pageSize,
|
||||||
if (currentPub != null) 'pub': currentPub,
|
if (arg != null) 'pub': arg,
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
'/sphere/polls/me',
|
'/sphere/polls/me',
|
||||||
queryParameters: queryParams,
|
queryParameters: queryParams,
|
||||||
);
|
);
|
||||||
final total = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
final List<dynamic> data = response.data;
|
final items = response.data
|
||||||
final items = data.map((json) => SnPollWithStats.fromJson(json)).toList();
|
.map((json) => SnPollWithStats.fromJson(json))
|
||||||
|
.cast<SnPollWithStats>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
final hasMore = offset + items.length < total;
|
return items;
|
||||||
final nextCursor = hasMore ? (offset + items.length).toString() : null;
|
|
||||||
|
|
||||||
return CursorPagingData(
|
|
||||||
items: items,
|
|
||||||
hasMore: hasMore,
|
|
||||||
nextCursor: nextCursor,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,20 +89,12 @@ class CreatorPollListScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: ExtendedRefreshIndicator(
|
body: ExtendedRefreshIndicator(
|
||||||
onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future),
|
onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future),
|
||||||
child: CustomScrollView(
|
child: PaginationList(
|
||||||
slivers: [
|
footerSkeletonMaxWidth: 640,
|
||||||
PagingHelperSliverView(
|
|
||||||
provider: pollListNotifierProvider(pubName),
|
provider: pollListNotifierProvider(pubName),
|
||||||
futureRefreshable: pollListNotifierProvider(pubName).future,
|
notifier: pollListNotifierProvider(pubName).notifier,
|
||||||
notifierRefreshable: pollListNotifierProvider(pubName).notifier,
|
padding: const EdgeInsets.only(top: 12),
|
||||||
contentBuilder:
|
itemBuilder: (context, index, pollWithStats) {
|
||||||
(data, widgetCount, endItemView) => SliverList.builder(
|
|
||||||
itemCount: widgetCount,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == widgetCount - 1) {
|
|
||||||
return endItemView;
|
|
||||||
}
|
|
||||||
final pollWithStats = data.items[index];
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 640),
|
constraints: BoxConstraints(maxWidth: 640),
|
||||||
child: _CreatorPollItem(
|
child: _CreatorPollItem(
|
||||||
@@ -121,9 +105,6 @@ class CreatorPollListScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,8 +119,7 @@ class _CreatorPollItem extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final ended = pollWithStats.endedAt;
|
final ended = pollWithStats.endedAt;
|
||||||
final endedText =
|
final endedText = ended == null
|
||||||
ended == null
|
|
||||||
? 'No end'
|
? 'No end'
|
||||||
: MaterialLocalizations.of(context).formatFullDate(ended);
|
: MaterialLocalizations.of(context).formatFullDate(ended);
|
||||||
|
|
||||||
@@ -171,8 +151,7 @@ class _CreatorPollItem extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton<String>(
|
trailing: PopupMenuButton<String>(
|
||||||
itemBuilder:
|
itemBuilder: (context) => [
|
||||||
(context) => [
|
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -186,8 +165,7 @@ class _CreatorPollItem extends HookConsumerWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
isDismissible: false,
|
isDismissible: false,
|
||||||
builder:
|
builder: (context) => PollEditorScreen(
|
||||||
(context) => PollEditorScreen(
|
|
||||||
initialPublisher: pubName,
|
initialPublisher: pubName,
|
||||||
initialPollId: pollWithStats.id,
|
initialPollId: pollWithStats.id,
|
||||||
),
|
),
|
||||||
@@ -208,21 +186,16 @@ class _CreatorPollItem extends HookConsumerWidget {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
final confirmed = await showDialog<bool>(
|
final confirmed = await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder: (context) => AlertDialog(
|
||||||
(context) => AlertDialog(
|
|
||||||
title: Text('Delete Poll'),
|
title: Text('Delete Poll'),
|
||||||
content: Text(
|
content: Text('Are you sure you want to delete this poll?'),
|
||||||
'Are you sure you want to delete this poll?',
|
|
||||||
),
|
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed:
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
() => Navigator.of(context).pop(false),
|
|
||||||
child: Text('Cancel'),
|
child: Text('Cancel'),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed:
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
() => Navigator.of(context).pop(true),
|
|
||||||
child: Text('Delete'),
|
child: Text('Delete'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -231,9 +204,7 @@ class _CreatorPollItem extends HookConsumerWidget {
|
|||||||
if (confirmed == true) {
|
if (confirmed == true) {
|
||||||
try {
|
try {
|
||||||
final client = ref.read(apiClientProvider);
|
final client = ref.read(apiClientProvider);
|
||||||
await client.delete(
|
await client.delete('/sphere/polls/${pollWithStats.id}');
|
||||||
'/sphere/polls/${pollWithStats.id}',
|
|
||||||
);
|
|
||||||
ref.invalidate(pollListNotifierProvider(pubName));
|
ref.invalidate(pollListNotifierProvider(pubName));
|
||||||
showSnackBar('Poll deleted successfully');
|
showSnackBar('Poll deleted successfully');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -6,296 +6,80 @@ part of 'poll_list.dart';
|
|||||||
// RiverpodGenerator
|
// RiverpodGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint, type=warning
|
||||||
|
|
||||||
|
@ProviderFor(pollWithStats)
|
||||||
|
const pollWithStatsProvider = PollWithStatsFamily._();
|
||||||
|
|
||||||
|
final class PollWithStatsProvider
|
||||||
|
extends
|
||||||
|
$FunctionalProvider<
|
||||||
|
AsyncValue<SnPollWithStats>,
|
||||||
|
SnPollWithStats,
|
||||||
|
FutureOr<SnPollWithStats>
|
||||||
|
>
|
||||||
|
with $FutureModifier<SnPollWithStats>, $FutureProvider<SnPollWithStats> {
|
||||||
|
const PollWithStatsProvider._({
|
||||||
|
required PollWithStatsFamily super.from,
|
||||||
|
required String super.argument,
|
||||||
|
}) : super(
|
||||||
|
retry: null,
|
||||||
|
name: r'pollWithStatsProvider',
|
||||||
|
isAutoDispose: true,
|
||||||
|
dependencies: null,
|
||||||
|
$allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String debugGetCreateSourceHash() => _$pollWithStatsHash();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return r'pollWithStatsProvider'
|
||||||
|
''
|
||||||
|
'($argument)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@$internal
|
||||||
|
@override
|
||||||
|
$FutureProviderElement<SnPollWithStats> $createElement(
|
||||||
|
$ProviderPointer pointer,
|
||||||
|
) => $FutureProviderElement(pointer);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<SnPollWithStats> create(Ref ref) {
|
||||||
|
final argument = this.argument as String;
|
||||||
|
return pollWithStats(ref, argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return other is PollWithStatsProvider && other.argument == argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return argument.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
|
String _$pollWithStatsHash() => r'6bb910046ce1e09368f9922dbec52fdc2cc86740';
|
||||||
|
|
||||||
/// Copied from Dart SDK
|
final class PollWithStatsFamily extends $Family
|
||||||
class _SystemHash {
|
with $FunctionalFamilyOverride<FutureOr<SnPollWithStats>, String> {
|
||||||
_SystemHash._();
|
const PollWithStatsFamily._()
|
||||||
|
: super(
|
||||||
static int combine(int hash, int value) {
|
retry: null,
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + value);
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
|
||||||
return hash ^ (hash >> 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int finish(int hash) {
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
|
||||||
// ignore: parameter_assignments
|
|
||||||
hash = hash ^ (hash >> 11);
|
|
||||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
@ProviderFor(pollWithStats)
|
|
||||||
const pollWithStatsProvider = PollWithStatsFamily();
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
class PollWithStatsFamily extends Family<AsyncValue<SnPollWithStats>> {
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
const PollWithStatsFamily();
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
PollWithStatsProvider call(String id) {
|
|
||||||
return PollWithStatsProvider(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PollWithStatsProvider getProviderOverride(
|
|
||||||
covariant PollWithStatsProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'pollWithStatsProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
class PollWithStatsProvider extends AutoDisposeFutureProvider<SnPollWithStats> {
|
|
||||||
/// See also [pollWithStats].
|
|
||||||
PollWithStatsProvider(String id)
|
|
||||||
: this._internal(
|
|
||||||
(ref) => pollWithStats(ref as PollWithStatsRef, id),
|
|
||||||
from: pollWithStatsProvider,
|
|
||||||
name: r'pollWithStatsProvider',
|
name: r'pollWithStatsProvider',
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$pollWithStatsHash,
|
|
||||||
dependencies: PollWithStatsFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PollWithStatsFamily._allTransitiveDependencies,
|
|
||||||
id: id,
|
|
||||||
);
|
|
||||||
|
|
||||||
PollWithStatsProvider._internal(
|
|
||||||
super._createNotifier, {
|
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.id,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(
|
|
||||||
FutureOr<SnPollWithStats> Function(PollWithStatsRef provider) create,
|
|
||||||
) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PollWithStatsProvider._internal(
|
|
||||||
(ref) => create(ref as PollWithStatsRef),
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
debugGetCreateSourceHash: null,
|
isAutoDispose: true,
|
||||||
id: id,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeFutureProviderElement<SnPollWithStats> createElement() {
|
|
||||||
return _PollWithStatsProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PollWithStatsProvider && other.id == id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, id.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PollWithStatsRef on AutoDisposeFutureProviderRef<SnPollWithStats> {
|
|
||||||
/// The parameter `id` of this provider.
|
|
||||||
String get id;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PollWithStatsProviderElement
|
|
||||||
extends AutoDisposeFutureProviderElement<SnPollWithStats>
|
|
||||||
with PollWithStatsRef {
|
|
||||||
_PollWithStatsProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get id => (origin as PollWithStatsProvider).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _$pollListNotifierHash() => r'd5b822e737788be8982f5cb3b501d460441930c1';
|
|
||||||
|
|
||||||
abstract class _$PollListNotifier
|
|
||||||
extends
|
|
||||||
BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnPollWithStats>> {
|
|
||||||
late final String? pubName;
|
|
||||||
|
|
||||||
FutureOr<CursorPagingData<SnPollWithStats>> build(String? pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
@ProviderFor(PollListNotifier)
|
|
||||||
const pollListNotifierProvider = PollListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
class PollListNotifierFamily
|
|
||||||
extends Family<AsyncValue<CursorPagingData<SnPollWithStats>>> {
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
const PollListNotifierFamily();
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
PollListNotifierProvider call(String? pubName) {
|
|
||||||
return PollListNotifierProvider(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
PollListNotifierProvider getProviderOverride(
|
|
||||||
covariant PollListNotifierProvider provider,
|
|
||||||
) {
|
|
||||||
return call(provider.pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
|
||||||
|
|
||||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
|
||||||
_allTransitiveDependencies;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get name => r'pollListNotifierProvider';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
class PollListNotifierProvider
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderImpl<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
> {
|
|
||||||
/// See also [PollListNotifier].
|
|
||||||
PollListNotifierProvider(String? pubName)
|
|
||||||
: this._internal(
|
|
||||||
() => PollListNotifier()..pubName = pubName,
|
|
||||||
from: pollListNotifierProvider,
|
|
||||||
name: r'pollListNotifierProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product')
|
|
||||||
? null
|
|
||||||
: _$pollListNotifierHash,
|
|
||||||
dependencies: PollListNotifierFamily._dependencies,
|
|
||||||
allTransitiveDependencies:
|
|
||||||
PollListNotifierFamily._allTransitiveDependencies,
|
|
||||||
pubName: pubName,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
PollListNotifierProvider._internal(
|
PollWithStatsProvider call(String id) =>
|
||||||
super._createNotifier, {
|
PollWithStatsProvider._(argument: id, from: this);
|
||||||
required super.name,
|
|
||||||
required super.dependencies,
|
|
||||||
required super.allTransitiveDependencies,
|
|
||||||
required super.debugGetCreateSourceHash,
|
|
||||||
required super.from,
|
|
||||||
required this.pubName,
|
|
||||||
}) : super.internal();
|
|
||||||
|
|
||||||
final String? pubName;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<CursorPagingData<SnPollWithStats>> runNotifierBuild(
|
String toString() => r'pollWithStatsProvider';
|
||||||
covariant PollListNotifier notifier,
|
|
||||||
) {
|
|
||||||
return notifier.build(pubName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Override overrideWith(PollListNotifier Function() create) {
|
|
||||||
return ProviderOverride(
|
|
||||||
origin: this,
|
|
||||||
override: PollListNotifierProvider._internal(
|
|
||||||
() => create()..pubName = pubName,
|
|
||||||
from: from,
|
|
||||||
name: null,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
debugGetCreateSourceHash: null,
|
|
||||||
pubName: pubName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
>
|
|
||||||
createElement() {
|
|
||||||
return _PollListNotifierProviderElement(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return other is PollListNotifierProvider && other.pubName == pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
|
||||||
hash = _SystemHash.combine(hash, pubName.hashCode);
|
|
||||||
|
|
||||||
return _SystemHash.finish(hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
|
||||||
// ignore: unused_element
|
|
||||||
mixin PollListNotifierRef
|
|
||||||
on AutoDisposeAsyncNotifierProviderRef<CursorPagingData<SnPollWithStats>> {
|
|
||||||
/// The parameter `pubName` of this provider.
|
|
||||||
String? get pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PollListNotifierProviderElement
|
|
||||||
extends
|
|
||||||
AutoDisposeAsyncNotifierProviderElement<
|
|
||||||
PollListNotifier,
|
|
||||||
CursorPagingData<SnPollWithStats>
|
|
||||||
>
|
|
||||||
with PollListNotifierRef {
|
|
||||||
_PollListNotifierProviderElement(super.provider);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String? get pubName => (origin as PollListNotifierProvider).pubName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:island/pods/post/post_list.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/post/post_list.dart';
|
import 'package:island/widgets/post/post_list.dart';
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ class CreatorPostListScreen extends HookConsumerWidget {
|
|||||||
key: ValueKey(refreshKey.value),
|
key: ValueKey(refreshKey.value),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverPostList(
|
SliverPostList(
|
||||||
pubName: pubName,
|
query: PostListQuery(pubName: pubName),
|
||||||
itemType: PostItemType.creator,
|
itemType: PostItemType.creator,
|
||||||
maxWidth: 640,
|
maxWidth: 640,
|
||||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user