🚚 Update files layout of pods
This commit is contained in:
@@ -264,8 +264,7 @@ class $ChatRoomsTable extends ChatRooms
|
||||
ChatRoom map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return ChatRoom(
|
||||
id:
|
||||
attachedDatabase.typeMapping.read(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
@@ -277,8 +276,7 @@ class $ChatRoomsTable extends ChatRooms
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}description'],
|
||||
),
|
||||
type:
|
||||
attachedDatabase.typeMapping.read(
|
||||
type: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}type'],
|
||||
)!,
|
||||
@@ -310,13 +308,11 @@ class $ChatRoomsTable extends ChatRooms
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}account_id'],
|
||||
),
|
||||
createdAt:
|
||||
attachedDatabase.typeMapping.read(
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}created_at'],
|
||||
)!,
|
||||
updatedAt:
|
||||
attachedDatabase.typeMapping.read(
|
||||
updatedAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}updated_at'],
|
||||
)!,
|
||||
@@ -416,39 +412,31 @@ class ChatRoom extends DataClass implements Insertable<ChatRoom> {
|
||||
return ChatRoomsCompanion(
|
||||
id: Value(id),
|
||||
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
|
||||
description:
|
||||
description == null && nullToAbsent
|
||||
description: description == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(description),
|
||||
type: Value(type),
|
||||
isPublic:
|
||||
isPublic == null && nullToAbsent
|
||||
isPublic: isPublic == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(isPublic),
|
||||
isCommunity:
|
||||
isCommunity == null && nullToAbsent
|
||||
isCommunity: isCommunity == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(isCommunity),
|
||||
picture:
|
||||
picture == null && nullToAbsent
|
||||
picture: picture == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(picture),
|
||||
background:
|
||||
background == null && nullToAbsent
|
||||
background: background == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(background),
|
||||
realmId:
|
||||
realmId == null && nullToAbsent
|
||||
realmId: realmId == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(realmId),
|
||||
accountId:
|
||||
accountId == null && nullToAbsent
|
||||
accountId: accountId == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(accountId),
|
||||
createdAt: Value(createdAt),
|
||||
updatedAt: Value(updatedAt),
|
||||
deletedAt:
|
||||
deletedAt == null && nullToAbsent
|
||||
deletedAt: deletedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(deletedAt),
|
||||
);
|
||||
@@ -530,15 +518,18 @@ class ChatRoom extends DataClass implements Insertable<ChatRoom> {
|
||||
return ChatRoom(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
name: data.name.present ? data.name.value : this.name,
|
||||
description:
|
||||
data.description.present ? data.description.value : this.description,
|
||||
description: data.description.present
|
||||
? data.description.value
|
||||
: this.description,
|
||||
type: data.type.present ? data.type.value : this.type,
|
||||
isPublic: data.isPublic.present ? data.isPublic.value : this.isPublic,
|
||||
isCommunity:
|
||||
data.isCommunity.present ? data.isCommunity.value : this.isCommunity,
|
||||
isCommunity: data.isCommunity.present
|
||||
? data.isCommunity.value
|
||||
: this.isCommunity,
|
||||
picture: data.picture.present ? data.picture.value : this.picture,
|
||||
background:
|
||||
data.background.present ? data.background.value : this.background,
|
||||
background: data.background.present
|
||||
? data.background.value
|
||||
: this.background,
|
||||
realmId: data.realmId.present ? data.realmId.value : this.realmId,
|
||||
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
||||
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}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return ChatMember(
|
||||
id:
|
||||
attachedDatabase.typeMapping.read(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
chatRoomId:
|
||||
attachedDatabase.typeMapping.read(
|
||||
chatRoomId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}chat_room_id'],
|
||||
)!,
|
||||
accountId:
|
||||
attachedDatabase.typeMapping.read(
|
||||
accountId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}account_id'],
|
||||
)!,
|
||||
@@ -1069,8 +1057,7 @@ class $ChatMembersTable extends ChatMembers
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}nick'],
|
||||
),
|
||||
notify:
|
||||
attachedDatabase.typeMapping.read(
|
||||
notify: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}notify'],
|
||||
)!,
|
||||
@@ -1086,13 +1073,11 @@ class $ChatMembersTable extends ChatMembers
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}timeout_until'],
|
||||
),
|
||||
createdAt:
|
||||
attachedDatabase.typeMapping.read(
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}created_at'],
|
||||
)!,
|
||||
updatedAt:
|
||||
attachedDatabase.typeMapping.read(
|
||||
updatedAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}updated_at'],
|
||||
)!,
|
||||
@@ -1179,22 +1164,18 @@ class ChatMember extends DataClass implements Insertable<ChatMember> {
|
||||
account: Value(account),
|
||||
nick: nick == null && nullToAbsent ? const Value.absent() : Value(nick),
|
||||
notify: Value(notify),
|
||||
joinedAt:
|
||||
joinedAt == null && nullToAbsent
|
||||
joinedAt: joinedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(joinedAt),
|
||||
breakUntil:
|
||||
breakUntil == null && nullToAbsent
|
||||
breakUntil: breakUntil == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(breakUntil),
|
||||
timeoutUntil:
|
||||
timeoutUntil == null && nullToAbsent
|
||||
timeoutUntil: timeoutUntil == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(timeoutUntil),
|
||||
createdAt: Value(createdAt),
|
||||
updatedAt: Value(updatedAt),
|
||||
deletedAt:
|
||||
deletedAt == null && nullToAbsent
|
||||
deletedAt: deletedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(deletedAt),
|
||||
);
|
||||
@@ -1269,17 +1250,18 @@ class ChatMember extends DataClass implements Insertable<ChatMember> {
|
||||
ChatMember copyWithCompanion(ChatMembersCompanion data) {
|
||||
return ChatMember(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
chatRoomId:
|
||||
data.chatRoomId.present ? data.chatRoomId.value : this.chatRoomId,
|
||||
chatRoomId: data.chatRoomId.present
|
||||
? data.chatRoomId.value
|
||||
: this.chatRoomId,
|
||||
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
||||
account: data.account.present ? data.account.value : this.account,
|
||||
nick: data.nick.present ? data.nick.value : this.nick,
|
||||
notify: data.notify.present ? data.notify.value : this.notify,
|
||||
joinedAt: data.joinedAt.present ? data.joinedAt.value : this.joinedAt,
|
||||
breakUntil:
|
||||
data.breakUntil.present ? data.breakUntil.value : this.breakUntil,
|
||||
timeoutUntil:
|
||||
data.timeoutUntil.present
|
||||
breakUntil: data.breakUntil.present
|
||||
? data.breakUntil.value
|
||||
: this.breakUntil,
|
||||
timeoutUntil: data.timeoutUntil.present
|
||||
? data.timeoutUntil.value
|
||||
: this.timeoutUntil,
|
||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||
@@ -1695,7 +1677,8 @@ class $ChatMessagesTable extends ChatMessages
|
||||
List<Map<String, dynamic>>,
|
||||
String
|
||||
>
|
||||
attachments = GeneratedColumn<String>(
|
||||
attachments =
|
||||
GeneratedColumn<String>(
|
||||
'attachments',
|
||||
aliasedName,
|
||||
false,
|
||||
@@ -1710,7 +1693,8 @@ class $ChatMessagesTable extends ChatMessages
|
||||
List<Map<String, dynamic>>,
|
||||
String
|
||||
>
|
||||
reactions = GeneratedColumn<String>(
|
||||
reactions =
|
||||
GeneratedColumn<String>(
|
||||
'reactions',
|
||||
aliasedName,
|
||||
false,
|
||||
@@ -1882,18 +1866,15 @@ class $ChatMessagesTable extends ChatMessages
|
||||
ChatMessage map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return ChatMessage(
|
||||
id:
|
||||
attachedDatabase.typeMapping.read(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
roomId:
|
||||
attachedDatabase.typeMapping.read(
|
||||
roomId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}room_id'],
|
||||
)!,
|
||||
senderId:
|
||||
attachedDatabase.typeMapping.read(
|
||||
senderId: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}sender_id'],
|
||||
)!,
|
||||
@@ -1905,13 +1886,11 @@ class $ChatMessagesTable extends ChatMessages
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}nonce'],
|
||||
),
|
||||
data:
|
||||
attachedDatabase.typeMapping.read(
|
||||
data: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}data'],
|
||||
)!,
|
||||
createdAt:
|
||||
attachedDatabase.typeMapping.read(
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}created_at'],
|
||||
)!,
|
||||
@@ -1933,8 +1912,7 @@ class $ChatMessagesTable extends ChatMessages
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}deleted_at'],
|
||||
),
|
||||
type:
|
||||
attachedDatabase.typeMapping.read(
|
||||
type: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}type'],
|
||||
)!,
|
||||
@@ -2101,42 +2079,36 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
||||
id: Value(id),
|
||||
roomId: Value(roomId),
|
||||
senderId: Value(senderId),
|
||||
content:
|
||||
content == null && nullToAbsent
|
||||
content: content == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(content),
|
||||
nonce:
|
||||
nonce == null && nullToAbsent ? const Value.absent() : Value(nonce),
|
||||
nonce: nonce == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(nonce),
|
||||
data: Value(data),
|
||||
createdAt: Value(createdAt),
|
||||
status: Value(status),
|
||||
isDeleted:
|
||||
isDeleted == null && nullToAbsent
|
||||
isDeleted: isDeleted == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(isDeleted),
|
||||
updatedAt:
|
||||
updatedAt == null && nullToAbsent
|
||||
updatedAt: updatedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(updatedAt),
|
||||
deletedAt:
|
||||
deletedAt == null && nullToAbsent
|
||||
deletedAt: deletedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(deletedAt),
|
||||
type: Value(type),
|
||||
meta: Value(meta),
|
||||
membersMentioned: Value(membersMentioned),
|
||||
editedAt:
|
||||
editedAt == null && nullToAbsent
|
||||
editedAt: editedAt == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(editedAt),
|
||||
attachments: Value(attachments),
|
||||
reactions: Value(reactions),
|
||||
repliedMessageId:
|
||||
repliedMessageId == null && nullToAbsent
|
||||
repliedMessageId: repliedMessageId == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(repliedMessageId),
|
||||
forwardedMessageId:
|
||||
forwardedMessageId == null && nullToAbsent
|
||||
forwardedMessageId: forwardedMessageId == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(forwardedMessageId),
|
||||
);
|
||||
@@ -2245,12 +2217,10 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
||||
editedAt: editedAt.present ? editedAt.value : this.editedAt,
|
||||
attachments: attachments ?? this.attachments,
|
||||
reactions: reactions ?? this.reactions,
|
||||
repliedMessageId:
|
||||
repliedMessageId.present
|
||||
repliedMessageId: repliedMessageId.present
|
||||
? repliedMessageId.value
|
||||
: this.repliedMessageId,
|
||||
forwardedMessageId:
|
||||
forwardedMessageId.present
|
||||
forwardedMessageId: forwardedMessageId.present
|
||||
? forwardedMessageId.value
|
||||
: this.forwardedMessageId,
|
||||
);
|
||||
@@ -2269,20 +2239,18 @@ class ChatMessage extends DataClass implements Insertable<ChatMessage> {
|
||||
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
||||
type: data.type.present ? data.type.value : this.type,
|
||||
meta: data.meta.present ? data.meta.value : this.meta,
|
||||
membersMentioned:
|
||||
data.membersMentioned.present
|
||||
membersMentioned: data.membersMentioned.present
|
||||
? data.membersMentioned.value
|
||||
: this.membersMentioned,
|
||||
editedAt: data.editedAt.present ? data.editedAt.value : this.editedAt,
|
||||
attachments:
|
||||
data.attachments.present ? data.attachments.value : this.attachments,
|
||||
attachments: data.attachments.present
|
||||
? data.attachments.value
|
||||
: this.attachments,
|
||||
reactions: data.reactions.present ? data.reactions.value : this.reactions,
|
||||
repliedMessageId:
|
||||
data.repliedMessageId.present
|
||||
repliedMessageId: data.repliedMessageId.present
|
||||
? data.repliedMessageId.value
|
||||
: this.repliedMessageId,
|
||||
forwardedMessageId:
|
||||
data.forwardedMessageId.present
|
||||
forwardedMessageId: data.forwardedMessageId.present
|
||||
? data.forwardedMessageId.value
|
||||
: this.forwardedMessageId,
|
||||
);
|
||||
@@ -2809,8 +2777,7 @@ class $PostDraftsTable extends PostDrafts
|
||||
PostDraft map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return PostDraft(
|
||||
id:
|
||||
attachedDatabase.typeMapping.read(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
@@ -2826,23 +2793,19 @@ class $PostDraftsTable extends PostDrafts
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}content'],
|
||||
),
|
||||
visibility:
|
||||
attachedDatabase.typeMapping.read(
|
||||
visibility: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}visibility'],
|
||||
)!,
|
||||
type:
|
||||
attachedDatabase.typeMapping.read(
|
||||
type: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}type'],
|
||||
)!,
|
||||
lastModified:
|
||||
attachedDatabase.typeMapping.read(
|
||||
lastModified: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}last_modified'],
|
||||
)!,
|
||||
postData:
|
||||
attachedDatabase.typeMapping.read(
|
||||
postData: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}post_data'],
|
||||
)!,
|
||||
@@ -2897,14 +2860,13 @@ class PostDraft extends DataClass implements Insertable<PostDraft> {
|
||||
PostDraftsCompanion toCompanion(bool nullToAbsent) {
|
||||
return PostDraftsCompanion(
|
||||
id: Value(id),
|
||||
title:
|
||||
title == null && nullToAbsent ? const Value.absent() : Value(title),
|
||||
description:
|
||||
description == null && nullToAbsent
|
||||
title: title == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(title),
|
||||
description: description == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(description),
|
||||
content:
|
||||
content == null && nullToAbsent
|
||||
content: content == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(content),
|
||||
visibility: Value(visibility),
|
||||
@@ -2968,14 +2930,15 @@ class PostDraft extends DataClass implements Insertable<PostDraft> {
|
||||
return PostDraft(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
title: data.title.present ? data.title.value : this.title,
|
||||
description:
|
||||
data.description.present ? data.description.value : this.description,
|
||||
description: data.description.present
|
||||
? data.description.value
|
||||
: this.description,
|
||||
content: data.content.present ? data.content.value : this.content,
|
||||
visibility:
|
||||
data.visibility.present ? data.visibility.value : this.visibility,
|
||||
visibility: data.visibility.present
|
||||
? data.visibility.value
|
||||
: this.visibility,
|
||||
type: data.type.present ? data.type.value : this.type,
|
||||
lastModified:
|
||||
data.lastModified.present
|
||||
lastModified: data.lastModified.present
|
||||
? data.lastModified.value
|
||||
: this.lastModified,
|
||||
postData: data.postData.present ? data.postData.value : this.postData,
|
||||
@@ -3585,12 +3548,12 @@ class $$ChatRoomsTableTableManager
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer:
|
||||
() => $$ChatRoomsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $$ChatRoomsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() => $$ChatRoomsTableAnnotationComposer($db: db, $table: table),
|
||||
createFilteringComposer: () =>
|
||||
$$ChatRoomsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$ChatRoomsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$ChatRoomsTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<String> id = const Value.absent(),
|
||||
@@ -3655,9 +3618,7 @@ class $$ChatRoomsTableTableManager
|
||||
deletedAt: deletedAt,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
@@ -3665,10 +3626,8 @@ class $$ChatRoomsTableTableManager
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
prefetchHooksCallback: ({
|
||||
chatMembersRefs = false,
|
||||
chatMessagesRefs = false,
|
||||
}) {
|
||||
prefetchHooksCallback:
|
||||
({chatMembersRefs = false, chatMessagesRefs = false}) {
|
||||
return PrefetchHooks(
|
||||
db: db,
|
||||
explicitlyWatchedTables: [
|
||||
@@ -3687,8 +3646,7 @@ class $$ChatRoomsTableTableManager
|
||||
currentTable: table,
|
||||
referencedTable: $$ChatRoomsTableReferences
|
||||
._chatMembersRefsTable(db),
|
||||
managerFromTypedResult:
|
||||
(p0) =>
|
||||
managerFromTypedResult: (p0) =>
|
||||
$$ChatRoomsTableReferences(
|
||||
db,
|
||||
table,
|
||||
@@ -3709,16 +3667,16 @@ class $$ChatRoomsTableTableManager
|
||||
currentTable: table,
|
||||
referencedTable: $$ChatRoomsTableReferences
|
||||
._chatMessagesRefsTable(db),
|
||||
managerFromTypedResult:
|
||||
(p0) =>
|
||||
managerFromTypedResult: (p0) =>
|
||||
$$ChatRoomsTableReferences(
|
||||
db,
|
||||
table,
|
||||
p0,
|
||||
).chatMessagesRefs,
|
||||
referencedItemsForCurrentItem:
|
||||
(item, referencedItems) =>
|
||||
referencedItems.where((e) => e.roomId == item.id),
|
||||
(item, referencedItems) => referencedItems.where(
|
||||
(e) => e.roomId == item.id,
|
||||
),
|
||||
typedResults: items,
|
||||
),
|
||||
];
|
||||
@@ -4142,12 +4100,11 @@ class $$ChatMembersTableTableManager
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer:
|
||||
() => $$ChatMembersTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $$ChatMembersTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() =>
|
||||
createFilteringComposer: () =>
|
||||
$$ChatMembersTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$ChatMembersTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$ChatMembersTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
@@ -4209,9 +4166,7 @@ class $$ChatMembersTableTableManager
|
||||
deletedAt: deletedAt,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
@@ -4219,14 +4174,15 @@ class $$ChatMembersTableTableManager
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
prefetchHooksCallback: ({
|
||||
chatRoomId = false,
|
||||
chatMessagesRefs = false,
|
||||
}) {
|
||||
prefetchHooksCallback:
|
||||
({chatRoomId = false, chatMessagesRefs = false}) {
|
||||
return PrefetchHooks(
|
||||
db: db,
|
||||
explicitlyWatchedTables: [if (chatMessagesRefs) db.chatMessages],
|
||||
addJoins: <
|
||||
explicitlyWatchedTables: [
|
||||
if (chatMessagesRefs) db.chatMessages,
|
||||
],
|
||||
addJoins:
|
||||
<
|
||||
T extends TableManagerState<
|
||||
dynamic,
|
||||
dynamic,
|
||||
@@ -4246,7 +4202,8 @@ class $$ChatMembersTableTableManager
|
||||
state.withJoin(
|
||||
currentTable: table,
|
||||
currentColumn: table.chatRoomId,
|
||||
referencedTable: $$ChatMembersTableReferences
|
||||
referencedTable:
|
||||
$$ChatMembersTableReferences
|
||||
._chatRoomIdTable(db),
|
||||
referencedColumn:
|
||||
$$ChatMembersTableReferences
|
||||
@@ -4269,8 +4226,7 @@ class $$ChatMembersTableTableManager
|
||||
currentTable: table,
|
||||
referencedTable: $$ChatMembersTableReferences
|
||||
._chatMessagesRefsTable(db),
|
||||
managerFromTypedResult:
|
||||
(p0) =>
|
||||
managerFromTypedResult: (p0) =>
|
||||
$$ChatMembersTableReferences(
|
||||
db,
|
||||
table,
|
||||
@@ -4831,12 +4787,11 @@ class $$ChatMessagesTableTableManager
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer:
|
||||
() => $$ChatMessagesTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $$ChatMessagesTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() =>
|
||||
createFilteringComposer: () =>
|
||||
$$ChatMessagesTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$ChatMessagesTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$ChatMessagesTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
@@ -4930,9 +4885,7 @@ class $$ChatMessagesTableTableManager
|
||||
forwardedMessageId: forwardedMessageId,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
@@ -4944,7 +4897,8 @@ class $$ChatMessagesTableTableManager
|
||||
return PrefetchHooks(
|
||||
db: db,
|
||||
explicitlyWatchedTables: [],
|
||||
addJoins: <
|
||||
addJoins:
|
||||
<
|
||||
T extends TableManagerState<
|
||||
dynamic,
|
||||
dynamic,
|
||||
@@ -4966,8 +4920,7 @@ class $$ChatMessagesTableTableManager
|
||||
currentColumn: table.roomId,
|
||||
referencedTable: $$ChatMessagesTableReferences
|
||||
._roomIdTable(db),
|
||||
referencedColumn:
|
||||
$$ChatMessagesTableReferences
|
||||
referencedColumn: $$ChatMessagesTableReferences
|
||||
._roomIdTable(db)
|
||||
.id,
|
||||
)
|
||||
@@ -4980,8 +4933,7 @@ class $$ChatMessagesTableTableManager
|
||||
currentColumn: table.senderId,
|
||||
referencedTable: $$ChatMessagesTableReferences
|
||||
._senderIdTable(db),
|
||||
referencedColumn:
|
||||
$$ChatMessagesTableReferences
|
||||
referencedColumn: $$ChatMessagesTableReferences
|
||||
._senderIdTable(db)
|
||||
.id,
|
||||
)
|
||||
@@ -5201,12 +5153,12 @@ class $$PostDraftsTableTableManager
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer:
|
||||
() => $$PostDraftsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $$PostDraftsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() => $$PostDraftsTableAnnotationComposer($db: db, $table: table),
|
||||
createFilteringComposer: () =>
|
||||
$$PostDraftsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$PostDraftsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$PostDraftsTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<String> id = const Value.absent(),
|
||||
@@ -5251,15 +5203,8 @@ class $$PostDraftsTableTableManager
|
||||
postData: postData,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
BaseReferences(db, table, e),
|
||||
),
|
||||
)
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
),
|
||||
|
||||
@@ -12,16 +12,14 @@ _SnAbuseReport _$SnAbuseReportFromJson(Map<String, dynamic> json) =>
|
||||
resourceIdentifier: json['resource_identifier'] as String,
|
||||
type: (json['type'] as num).toInt(),
|
||||
reason: json['reason'] as String,
|
||||
resolvedAt:
|
||||
json['resolved_at'] == null
|
||||
resolvedAt: json['resolved_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['resolved_at'] as String),
|
||||
resolution: json['resolution'] as String?,
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -15,8 +15,7 @@ _SnAccount _$SnAccountFromJson(Map<String, dynamic> json) => _SnAccount(
|
||||
isSuperuser: json['is_superuser'] as bool,
|
||||
automatedId: json['automated_id'] as String?,
|
||||
profile: SnAccountProfile.fromJson(json['profile'] as Map<String, dynamic>),
|
||||
perkSubscription:
|
||||
json['perk_subscription'] == null
|
||||
perkSubscription: json['perk_subscription'] == null
|
||||
? null
|
||||
: SnWalletSubscriptionRef.fromJson(
|
||||
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>))
|
||||
.toList() ??
|
||||
const [],
|
||||
activatedAt:
|
||||
json['activated_at'] == null
|
||||
activatedAt: json['activated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['activated_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -73,8 +70,9 @@ _UsernameColor _$UsernameColorFromJson(Map<String, dynamic> json) =>
|
||||
type: json['type'] as String? ?? 'plain',
|
||||
value: json['value'] as String?,
|
||||
direction: json['direction'] as String?,
|
||||
colors:
|
||||
(json['colors'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
colors: (json['colors'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UsernameColorToJson(_UsernameColor instance) =>
|
||||
@@ -85,8 +83,9 @@ Map<String, dynamic> _$UsernameColorToJson(_UsernameColor instance) =>
|
||||
'colors': instance.colors,
|
||||
};
|
||||
|
||||
_SnAccountProfile _$SnAccountProfileFromJson(Map<String, dynamic> json) =>
|
||||
_SnAccountProfile(
|
||||
_SnAccountProfile _$SnAccountProfileFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnAccountProfile(
|
||||
id: json['id'] as String,
|
||||
firstName: json['first_name'] as String? ?? '',
|
||||
middleName: json['middle_name'] as String? ?? '',
|
||||
@@ -96,58 +95,43 @@ _SnAccountProfile _$SnAccountProfileFromJson(Map<String, dynamic> json) =>
|
||||
pronouns: json['pronouns'] as String? ?? '',
|
||||
location: json['location'] as String? ?? '',
|
||||
timeZone: json['time_zone'] as String? ?? '',
|
||||
birthday:
|
||||
json['birthday'] == null
|
||||
birthday: json['birthday'] == null
|
||||
? null
|
||||
: DateTime.parse(json['birthday'] as String),
|
||||
links:
|
||||
json['links'] == null
|
||||
links: json['links'] == null
|
||||
? const []
|
||||
: const ProfileLinkConverter().fromJson(json['links']),
|
||||
lastSeenAt:
|
||||
json['last_seen_at'] == null
|
||||
lastSeenAt: json['last_seen_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_seen_at'] as String),
|
||||
activeBadge:
|
||||
json['active_badge'] == null
|
||||
activeBadge: json['active_badge'] == null
|
||||
? null
|
||||
: SnAccountBadge.fromJson(
|
||||
json['active_badge'] as Map<String, dynamic>,
|
||||
),
|
||||
: SnAccountBadge.fromJson(json['active_badge'] as Map<String, dynamic>),
|
||||
experience: (json['experience'] as num).toInt(),
|
||||
level: (json['level'] as num).toInt(),
|
||||
socialCredits: (json['social_credits'] as num?)?.toDouble() ?? 100,
|
||||
socialCreditsLevel: (json['social_credits_level'] as num?)?.toInt() ?? 0,
|
||||
levelingProgress: (json['leveling_progress'] as num).toDouble(),
|
||||
picture:
|
||||
json['picture'] == null
|
||||
picture: json['picture'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||
background:
|
||||
json['background'] == null
|
||||
background: json['background'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(
|
||||
json['background'] as Map<String, dynamic>,
|
||||
),
|
||||
verification:
|
||||
json['verification'] == null
|
||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||
verification: json['verification'] == null
|
||||
? null
|
||||
: SnVerificationMark.fromJson(
|
||||
json['verification'] as Map<String, dynamic>,
|
||||
),
|
||||
usernameColor:
|
||||
json['username_color'] == null
|
||||
usernameColor: json['username_color'] == null
|
||||
? null
|
||||
: UsernameColor.fromJson(
|
||||
json['username_color'] as Map<String, dynamic>,
|
||||
),
|
||||
: UsernameColor.fromJson(json['username_color'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnAccountProfileToJson(_SnAccountProfile instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -188,15 +172,13 @@ _SnAccountStatus _$SnAccountStatusFromJson(Map<String, dynamic> json) =>
|
||||
isCustomized: json['is_customized'] as bool,
|
||||
label: json['label'] as String? ?? "",
|
||||
meta: json['meta'] as Map<String, dynamic>?,
|
||||
clearedAt:
|
||||
json['cleared_at'] == null
|
||||
clearedAt: json['cleared_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['cleared_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -225,19 +207,16 @@ _SnAccountBadge _$SnAccountBadgeFromJson(Map<String, dynamic> json) =>
|
||||
label: json['label'] as String?,
|
||||
caption: json['caption'] as String?,
|
||||
meta: json['meta'] as Map<String, dynamic>,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
activatedAt:
|
||||
json['activated_at'] == null
|
||||
activatedAt: json['activated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['activated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -261,8 +240,7 @@ _SnContactMethod _$SnContactMethodFromJson(Map<String, dynamic> json) =>
|
||||
_SnContactMethod(
|
||||
id: json['id'] as String,
|
||||
type: (json['type'] as num).toInt(),
|
||||
verifiedAt:
|
||||
json['verified_at'] == null
|
||||
verifiedAt: json['verified_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['verified_at'] as String),
|
||||
isPrimary: json['is_primary'] as bool,
|
||||
@@ -271,8 +249,7 @@ _SnContactMethod _$SnContactMethodFromJson(Map<String, dynamic> json) =>
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -295,8 +272,7 @@ _SnNotification _$SnNotificationFromJson(Map<String, dynamic> json) =>
|
||||
_SnNotification(
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
id: json['id'] as String,
|
||||
@@ -306,8 +282,7 @@ _SnNotification _$SnNotificationFromJson(Map<String, dynamic> json) =>
|
||||
content: json['content'] as String,
|
||||
meta: json['meta'] as Map<String, dynamic>? ?? const {},
|
||||
priority: (json['priority'] as num).toInt(),
|
||||
viewedAt:
|
||||
json['viewed_at'] == null
|
||||
viewedAt: json['viewed_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['viewed_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
@@ -376,8 +351,7 @@ _SnAuthDeviceWithSessione _$SnAuthDeviceWithSessioneFromJson(
|
||||
deviceLabel: json['device_label'] as String?,
|
||||
accountId: json['account_id'] as String,
|
||||
platform: (json['platform'] as num).toInt(),
|
||||
sessions:
|
||||
(json['sessions'] as List<dynamic>)
|
||||
sessions: (json['sessions'] as List<dynamic>)
|
||||
.map((e) => SnAuthSession.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
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,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -430,14 +403,12 @@ _SnSocialCreditRecord _$SnSocialCreditRecordFromJson(
|
||||
delta: (json['delta'] as num).toDouble(),
|
||||
reasonType: json['reason_type'] as String,
|
||||
reason: json['reason'] as String,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -460,8 +431,7 @@ _SnFriendOverviewItem _$SnFriendOverviewItemFromJson(
|
||||
) => _SnFriendOverviewItem(
|
||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
status: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||
activities:
|
||||
(json['activities'] as List<dynamic>)
|
||||
activities: (json['activities'] as List<dynamic>)
|
||||
.map((e) => SnPresenceActivity.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
@@ -12,8 +12,7 @@ _SnNotableDay _$SnNotableDayFromJson(Map<String, dynamic> json) =>
|
||||
localName: json['local_name'] as String,
|
||||
globalName: json['global_name'] as String,
|
||||
countryCode: json['country_code'] as String,
|
||||
holidays:
|
||||
(json['holidays'] as List<dynamic>)
|
||||
holidays: (json['holidays'] as List<dynamic>)
|
||||
.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
);
|
||||
@@ -35,8 +34,7 @@ _SnTimelineEvent _$SnTimelineEventFromJson(Map<String, dynamic> json) =>
|
||||
data: json['data'],
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -56,19 +54,16 @@ _SnCheckInResult _$SnCheckInResultFromJson(Map<String, dynamic> json) =>
|
||||
_SnCheckInResult(
|
||||
id: json['id'] as String,
|
||||
level: (json['level'] as num).toInt(),
|
||||
tips:
|
||||
(json['tips'] as List<dynamic>)
|
||||
tips: (json['tips'] as List<dynamic>)
|
||||
.map((e) => SnFortuneTip.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -103,14 +98,12 @@ _SnEventCalendarEntry _$SnEventCalendarEntryFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnEventCalendarEntry(
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
checkInResult:
|
||||
json['check_in_result'] == null
|
||||
checkInResult: json['check_in_result'] == null
|
||||
? null
|
||||
: SnCheckInResult.fromJson(
|
||||
json['check_in_result'] as Map<String, dynamic>,
|
||||
),
|
||||
statuses:
|
||||
(json['statuses'] as List<dynamic>)
|
||||
statuses: (json['statuses'] as List<dynamic>)
|
||||
.map((e) => SnAccountStatus.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
@@ -141,8 +134,7 @@ _SnPresenceActivity _$SnPresenceActivityFromJson(Map<String, dynamic> json) =>
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -34,15 +34,13 @@ Map<String, dynamic> _$GeoIpLocationToJson(_GeoIpLocation instance) =>
|
||||
_SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
|
||||
_SnAuthChallenge(
|
||||
id: json['id'] as String,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
stepRemain: (json['step_remain'] as num).toInt(),
|
||||
stepTotal: (json['step_total'] as num).toInt(),
|
||||
failedAttempts: (json['failed_attempts'] as num).toInt(),
|
||||
blacklistFactors:
|
||||
(json['blacklist_factors'] as List<dynamic>)
|
||||
blacklistFactors: (json['blacklist_factors'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
audiences: json['audiences'] as List<dynamic>,
|
||||
@@ -50,17 +48,13 @@ _SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
|
||||
ipAddress: json['ip_address'] as String,
|
||||
userAgent: json['user_agent'] as String,
|
||||
nonce: json['nonce'] as String?,
|
||||
location:
|
||||
json['location'] == null
|
||||
location: json['location'] == null
|
||||
? null
|
||||
: GeoIpLocation.fromJson(
|
||||
json['location'] as Map<String, dynamic>,
|
||||
),
|
||||
: GeoIpLocation.fromJson(json['location'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -90,26 +84,21 @@ _SnAuthSession _$SnAuthSessionFromJson(Map<String, dynamic> json) =>
|
||||
id: json['id'] as String,
|
||||
label: json['label'] as String?,
|
||||
lastGrantedAt: DateTime.parse(json['last_granted_at'] as String),
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
audiences: json['audiences'] as List<dynamic>,
|
||||
scopes: json['scopes'] as List<dynamic>,
|
||||
ipAddress: json['ip_address'] as String?,
|
||||
userAgent: json['user_agent'] as String?,
|
||||
location:
|
||||
json['location'] == null
|
||||
location: json['location'] == null
|
||||
? null
|
||||
: GeoIpLocation.fromJson(
|
||||
json['location'] as Map<String, dynamic>,
|
||||
),
|
||||
: GeoIpLocation.fromJson(json['location'] as Map<String, dynamic>),
|
||||
type: (json['type'] as num).toInt(),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -138,16 +127,13 @@ _SnAuthFactor _$SnAuthFactorFromJson(Map<String, dynamic> json) =>
|
||||
type: (json['type'] as num).toInt(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
enabledAt:
|
||||
json['enabled_at'] == null
|
||||
enabledAt: json['enabled_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['enabled_at'] as String),
|
||||
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),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -10,8 +10,7 @@ AutoCompletionAccountResponse _$AutoCompletionAccountResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => AutoCompletionAccountResponse(
|
||||
type: json['type'] as String,
|
||||
items:
|
||||
(json['items'] as List<dynamic>)
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
$type: json['runtimeType'] as String?,
|
||||
@@ -29,8 +28,7 @@ AutoCompletionStickerResponse _$AutoCompletionStickerResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => AutoCompletionStickerResponse(
|
||||
type: json['type'] as String,
|
||||
items:
|
||||
(json['items'] as List<dynamic>)
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map((e) => AutoCompletionItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
$type: json['runtimeType'] as String?,
|
||||
|
||||
@@ -14,8 +14,7 @@ _Bot _$BotFromJson(Map<String, dynamic> json) => _Bot(
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
developer:
|
||||
json['developer'] == null
|
||||
developer: json['developer'] == null
|
||||
? null
|
||||
: SnDeveloper.fromJson(json['developer'] as Map<String, dynamic>),
|
||||
);
|
||||
@@ -74,8 +73,7 @@ _BotSecret _$BotSecretFromJson(Map<String, dynamic> json) => _BotSecret(
|
||||
id: json['id'] as String? ?? '',
|
||||
secret: json['secret'] as String? ?? '',
|
||||
description: json['description'] as String?,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] 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(),
|
||||
isPublic: json['is_public'] as bool? ?? false,
|
||||
isCommunity: json['is_community'] as bool? ?? false,
|
||||
picture:
|
||||
json['picture'] == null
|
||||
picture: json['picture'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||
background:
|
||||
json['background'] == null
|
||||
background: json['background'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||
realmId: json['realm_id'] as String?,
|
||||
accountId: json['account_id'] as String?,
|
||||
realm:
|
||||
json['realm'] == null
|
||||
realm: json['realm'] == null
|
||||
? null
|
||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
members:
|
||||
(json['members'] as List<dynamic>?)
|
||||
members: (json['members'] as List<dynamic>?)
|
||||
?.map((e) => SnChatMember.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
@@ -62,8 +57,7 @@ _SnChatMessage _$SnChatMessageFromJson(Map<String, dynamic> json) =>
|
||||
_SnChatMessage(
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
id: json['id'] as String,
|
||||
@@ -76,8 +70,7 @@ _SnChatMessage _$SnChatMessageFromJson(Map<String, dynamic> json) =>
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const [],
|
||||
editedAt:
|
||||
json['edited_at'] == null
|
||||
editedAt: json['edited_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['edited_at'] as String),
|
||||
attachments:
|
||||
@@ -122,8 +115,7 @@ _SnChatReaction _$SnChatReactionFromJson(Map<String, dynamic> json) =>
|
||||
_SnChatReaction(
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
id: json['id'] as String,
|
||||
@@ -151,40 +143,31 @@ _SnChatMember _$SnChatMemberFromJson(Map<String, dynamic> json) =>
|
||||
_SnChatMember(
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
id: json['id'] as String,
|
||||
chatRoomId: json['chat_room_id'] as String,
|
||||
chatRoom:
|
||||
json['chat_room'] == null
|
||||
chatRoom: json['chat_room'] == null
|
||||
? null
|
||||
: SnChatRoom.fromJson(json['chat_room'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String,
|
||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
nick: json['nick'] as String?,
|
||||
notify: (json['notify'] as num).toInt(),
|
||||
joinedAt:
|
||||
json['joined_at'] == null
|
||||
joinedAt: json['joined_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['joined_at'] as String),
|
||||
breakUntil:
|
||||
json['break_until'] == null
|
||||
breakUntil: json['break_until'] == null
|
||||
? null
|
||||
: DateTime.parse(json['break_until'] as String),
|
||||
timeoutUntil:
|
||||
json['timeout_until'] == null
|
||||
timeoutUntil: json['timeout_until'] == null
|
||||
? null
|
||||
: DateTime.parse(json['timeout_until'] as String),
|
||||
status:
|
||||
json['status'] == null
|
||||
status: json['status'] == null
|
||||
? null
|
||||
: SnAccountStatus.fromJson(
|
||||
json['status'] as Map<String, dynamic>,
|
||||
),
|
||||
lastTyped:
|
||||
json['last_typed'] == null
|
||||
: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||
lastTyped: json['last_typed'] == null
|
||||
? null
|
||||
: DateTime.parse(json['last_typed'] as String),
|
||||
);
|
||||
@@ -211,8 +194,7 @@ Map<String, dynamic> _$SnChatMemberToJson(_SnChatMember instance) =>
|
||||
_SnChatSummary _$SnChatSummaryFromJson(Map<String, dynamic> json) =>
|
||||
_SnChatSummary(
|
||||
unreadCount: (json['unread_count'] as num).toInt(),
|
||||
lastMessage:
|
||||
json['last_message'] == null
|
||||
lastMessage: json['last_message'] == null
|
||||
? null
|
||||
: SnChatMessage.fromJson(
|
||||
json['last_message'] as Map<String, dynamic>,
|
||||
@@ -251,8 +233,7 @@ _ChatRealtimeJoinResponse _$ChatRealtimeJoinResponseFromJson(
|
||||
callId: json['call_id'] as String,
|
||||
roomName: json['room_name'] as String,
|
||||
isAdmin: json['is_admin'] as bool,
|
||||
participants:
|
||||
(json['participants'] as List<dynamic>)
|
||||
participants: (json['participants'] as List<dynamic>)
|
||||
.map((e) => CallParticipant.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
@@ -288,12 +269,10 @@ _SnRealtimeCall _$SnRealtimeCallFromJson(Map<String, dynamic> json) =>
|
||||
id: json['id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
endedAt:
|
||||
json['ended_at'] == null
|
||||
endedAt: json['ended_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['ended_at'] as String),
|
||||
senderId: json['sender_id'] as String,
|
||||
|
||||
@@ -12,28 +12,23 @@ _CustomApp _$CustomAppFromJson(Map<String, dynamic> json) => _CustomApp(
|
||||
name: json['name'] as String? ?? '',
|
||||
description: json['description'] as String?,
|
||||
status: (json['status'] as num?)?.toInt() ?? 0,
|
||||
picture:
|
||||
json['picture'] == null
|
||||
picture: json['picture'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||
background:
|
||||
json['background'] == null
|
||||
background: json['background'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||
verification:
|
||||
json['verification'] == null
|
||||
verification: json['verification'] == null
|
||||
? null
|
||||
: SnVerificationMark.fromJson(
|
||||
json['verification'] as Map<String, dynamic>,
|
||||
),
|
||||
oauthConfig:
|
||||
json['oauth_config'] == null
|
||||
oauthConfig: json['oauth_config'] == null
|
||||
? null
|
||||
: CustomAppOauthConfig.fromJson(
|
||||
json['oauth_config'] as Map<String, dynamic>,
|
||||
),
|
||||
links:
|
||||
json['links'] == null
|
||||
links: json['links'] == null
|
||||
? null
|
||||
: CustomAppLinks.fromJson(json['links'] as Map<String, dynamic>),
|
||||
secrets:
|
||||
@@ -83,8 +78,7 @@ _CustomAppOauthConfig _$CustomAppOauthConfigFromJson(
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const [],
|
||||
postLogoutRedirectUris:
|
||||
(json['post_logout_redirect_uris'] as List<dynamic>?)
|
||||
postLogoutRedirectUris: (json['post_logout_redirect_uris'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
allowedScopes:
|
||||
@@ -118,8 +112,7 @@ _CustomAppSecret _$CustomAppSecretFromJson(Map<String, dynamic> json) =>
|
||||
id: json['id'] as String? ?? '',
|
||||
secret: json['secret'] as String? ?? '',
|
||||
description: json['description'] as String?,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
isOidc: json['is_oidc'] as bool? ?? false,
|
||||
|
||||
@@ -9,8 +9,7 @@ part of 'developer.dart';
|
||||
_SnDeveloper _$SnDeveloperFromJson(Map<String, dynamic> json) => _SnDeveloper(
|
||||
id: json['id'] as String,
|
||||
publisherId: json['publisher_id'] as String,
|
||||
publisher:
|
||||
json['publisher'] == null
|
||||
publisher: json['publisher'] == null
|
||||
? null
|
||||
: 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(),
|
||||
errorMessage: json['error_message'] as String?,
|
||||
statusMessage: json['status_message'] as String?,
|
||||
result:
|
||||
json['result'] == null
|
||||
result: json['result'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['result'] as Map<String, dynamic>),
|
||||
poolId: json['pool_id'] as String?,
|
||||
|
||||
@@ -17,8 +17,7 @@ _SnScrappedLink _$SnScrappedLinkFromJson(Map<String, dynamic> json) =>
|
||||
siteName: json['site_name'] as String?,
|
||||
contentType: json['content_type'] as String?,
|
||||
author: json['author'] as String?,
|
||||
publishedDate:
|
||||
json['published_date'] == null
|
||||
publishedDate: json['published_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json['published_date'] as String),
|
||||
);
|
||||
|
||||
@@ -35,8 +35,7 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
||||
description: json['description'] as String?,
|
||||
fileMeta: json['file_meta'] as Map<String, dynamic>?,
|
||||
userMeta: json['user_meta'] as Map<String, dynamic>?,
|
||||
pool:
|
||||
json['pool'] == null
|
||||
pool: json['pool'] == null
|
||||
? null
|
||||
: SnFilePool.fromJson(json['pool'] as Map<String, dynamic>),
|
||||
sensitiveMarks:
|
||||
@@ -47,15 +46,13 @@ _SnCloudFile _$SnCloudFileFromJson(Map<String, dynamic> json) => _SnCloudFile(
|
||||
mimeType: json['mime_type'] as String?,
|
||||
hash: json['hash'] as String?,
|
||||
size: (json['size'] as num).toInt(),
|
||||
uploadedAt:
|
||||
json['uploaded_at'] == null
|
||||
uploadedAt: json['uploaded_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['uploaded_at'] as String),
|
||||
uploadedTo: json['uploaded_to'] as String?,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: 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>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -16,16 +16,13 @@ _SnFilePool _$SnFilePoolFromJson(Map<String, dynamic> json) => _SnFilePool(
|
||||
isHidden: json['is_hidden'] as bool?,
|
||||
accountId: json['account_id'] as String?,
|
||||
resourceIdentifier: json['resource_identifier'] as String?,
|
||||
createdAt:
|
||||
json['created_at'] == null
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt:
|
||||
json['updated_at'] == null
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -10,8 +10,7 @@ _SnHeatmap _$SnHeatmapFromJson(Map<String, dynamic> json) => _SnHeatmap(
|
||||
unit: json['unit'] as String,
|
||||
periodStart: DateTime.parse(json['period_start'] as String),
|
||||
periodEnd: DateTime.parse(json['period_end'] as String),
|
||||
items:
|
||||
(json['items'] as List<dynamic>)
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map((e) => SnHeatmapItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
@@ -8,29 +8,23 @@ part of 'poll.dart';
|
||||
|
||||
_SnPollWithStats _$SnPollWithStatsFromJson(Map<String, dynamic> json) =>
|
||||
_SnPollWithStats(
|
||||
userAnswer:
|
||||
json['user_answer'] == null
|
||||
userAnswer: json['user_answer'] == null
|
||||
? null
|
||||
: SnPollAnswer.fromJson(
|
||||
json['user_answer'] as Map<String, dynamic>,
|
||||
),
|
||||
: SnPollAnswer.fromJson(json['user_answer'] as Map<String, dynamic>),
|
||||
stats: json['stats'] as Map<String, dynamic>? ?? const {},
|
||||
id: json['id'] as String,
|
||||
questions:
|
||||
(json['questions'] as List<dynamic>)
|
||||
questions: (json['questions'] as List<dynamic>)
|
||||
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
title: json['title'] as String?,
|
||||
description: json['description'] as String?,
|
||||
endedAt:
|
||||
json['ended_at'] == null
|
||||
endedAt: json['ended_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['ended_at'] as String),
|
||||
publisherId: json['publisher_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -52,25 +46,21 @@ Map<String, dynamic> _$SnPollWithStatsToJson(_SnPollWithStats instance) =>
|
||||
|
||||
_SnPoll _$SnPollFromJson(Map<String, dynamic> json) => _SnPoll(
|
||||
id: json['id'] as String,
|
||||
questions:
|
||||
(json['questions'] as List<dynamic>)
|
||||
questions: (json['questions'] as List<dynamic>)
|
||||
.map((e) => SnPollQuestion.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
title: json['title'] as String?,
|
||||
description: json['description'] as String?,
|
||||
endedAt:
|
||||
json['ended_at'] == null
|
||||
endedAt: json['ended_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['ended_at'] as String),
|
||||
publisherId: json['publisher_id'] as String,
|
||||
publisher:
|
||||
json['publisher'] == null
|
||||
publisher: json['publisher'] == null
|
||||
? null
|
||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -92,8 +82,7 @@ _SnPollQuestion _$SnPollQuestionFromJson(Map<String, dynamic> json) =>
|
||||
_SnPollQuestion(
|
||||
id: json['id'] as String,
|
||||
type: $enumDecode(_$SnPollQuestionTypeEnumMap, json['type']),
|
||||
options:
|
||||
(json['options'] as List<dynamic>?)
|
||||
options: (json['options'] as List<dynamic>?)
|
||||
?.map((e) => SnPollOption.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
title: json['title'] as String,
|
||||
@@ -145,12 +134,10 @@ _SnPollAnswer _$SnPollAnswerFromJson(Map<String, dynamic> json) =>
|
||||
pollId: json['poll_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
@@ -11,12 +11,10 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
||||
title: json['title'] as String?,
|
||||
description: json['description'] as String?,
|
||||
language: json['language'] as String?,
|
||||
editedAt:
|
||||
json['edited_at'] == null
|
||||
editedAt: json['edited_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['edited_at'] as String),
|
||||
publishedAt:
|
||||
json['published_at'] == null
|
||||
publishedAt: json['published_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['published_at'] as String),
|
||||
visibility: (json['visibility'] as num?)?.toInt() ?? 0,
|
||||
@@ -24,12 +22,9 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
||||
slug: json['slug'] as String?,
|
||||
type: (json['type'] as num?)?.toInt() ?? 0,
|
||||
meta: json['meta'] as Map<String, dynamic>?,
|
||||
embedView:
|
||||
json['embed_view'] == null
|
||||
embedView: json['embed_view'] == null
|
||||
? null
|
||||
: SnPostEmbedView.fromJson(
|
||||
json['embed_view'] as Map<String, dynamic>,
|
||||
),
|
||||
: SnPostEmbedView.fromJson(json['embed_view'] as Map<String, dynamic>),
|
||||
viewsUnique: (json['views_unique'] as num?)?.toInt() ?? 0,
|
||||
viewsTotal: (json['views_total'] 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,
|
||||
pinMode: (json['pin_mode'] as num?)?.toInt(),
|
||||
threadedPostId: json['threaded_post_id'] as String?,
|
||||
threadedPost:
|
||||
json['threaded_post'] == null
|
||||
threadedPost: json['threaded_post'] == null
|
||||
? null
|
||||
: SnPost.fromJson(json['threaded_post'] as Map<String, dynamic>),
|
||||
repliedPostId: json['replied_post_id'] as String?,
|
||||
repliedPost:
|
||||
json['replied_post'] == null
|
||||
repliedPost: json['replied_post'] == null
|
||||
? null
|
||||
: SnPost.fromJson(json['replied_post'] as Map<String, dynamic>),
|
||||
forwardedPostId: json['forwarded_post_id'] as String?,
|
||||
forwardedPost:
|
||||
json['forwarded_post'] == null
|
||||
forwardedPost: json['forwarded_post'] == null
|
||||
? null
|
||||
: SnPost.fromJson(json['forwarded_post'] as Map<String, dynamic>),
|
||||
realmId: json['realm_id'] as String?,
|
||||
realm:
|
||||
json['realm'] == null
|
||||
realm: json['realm'] == null
|
||||
? null
|
||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||
attachments:
|
||||
@@ -90,16 +81,13 @@ _SnPost _$SnPostFromJson(Map<String, dynamic> json) => _SnPost(
|
||||
?.map((e) => SnPostFeaturedRecord.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
createdAt:
|
||||
json['created_at'] == null
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt:
|
||||
json['updated_at'] == null
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
repliedGone: json['replied_gone'] as bool? ?? false,
|
||||
@@ -214,16 +202,13 @@ _SnPostAward _$SnPostAwardFromJson(Map<String, dynamic> json) => _SnPostAward(
|
||||
message: json['message'] as String?,
|
||||
postId: json['post_id'] as String,
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt:
|
||||
json['created_at'] == null
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt:
|
||||
json['updated_at'] == null
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -250,12 +235,10 @@ _SnPostReaction _$SnPostReactionFromJson(Map<String, dynamic> json) =>
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -278,15 +261,13 @@ _SnPostFeaturedRecord _$SnPostFeaturedRecordFromJson(
|
||||
) => _SnPostFeaturedRecord(
|
||||
id: json['id'] as String,
|
||||
postId: json['post_id'] as String,
|
||||
featuredAt:
|
||||
json['featured_at'] == null
|
||||
featuredAt: json['featured_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['featured_at'] as String),
|
||||
socialCredits: (json['social_credits'] as num).toInt(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -17,8 +17,7 @@ _SnPublicationSite _$SnPublicationSiteFromJson(Map<String, dynamic> json) =>
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
pages:
|
||||
(json['pages'] as List<dynamic>)
|
||||
pages: (json['pages'] as List<dynamic>)
|
||||
.map((e) => SnPublicationPage.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
@@ -12,34 +12,27 @@ _SnPublisher _$SnPublisherFromJson(Map<String, dynamic> json) => _SnPublisher(
|
||||
name: json['name'] as String? ?? '',
|
||||
nick: json['nick'] as String? ?? '',
|
||||
bio: json['bio'] as String? ?? '',
|
||||
picture:
|
||||
json['picture'] == null
|
||||
picture: json['picture'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||
background:
|
||||
json['background'] == null
|
||||
background: json['background'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String?,
|
||||
createdAt:
|
||||
json['created_at'] == null
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt:
|
||||
json['updated_at'] == null
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
realmId: json['realm_id'] as String?,
|
||||
verification:
|
||||
json['verification'] == null
|
||||
verification: json['verification'] == null
|
||||
? null
|
||||
: SnVerificationMark.fromJson(
|
||||
json['verification'] as Map<String, dynamic>,
|
||||
@@ -67,24 +60,20 @@ Map<String, dynamic> _$SnPublisherToJson(_SnPublisher instance) =>
|
||||
_SnPublisherMember _$SnPublisherMemberFromJson(Map<String, dynamic> json) =>
|
||||
_SnPublisherMember(
|
||||
publisherId: json['publisher_id'] as String,
|
||||
publisher:
|
||||
json['publisher'] == null
|
||||
publisher: json['publisher'] == null
|
||||
? null
|
||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
role: (json['role'] as num).toInt(),
|
||||
joinedAt:
|
||||
json['joined_at'] == null
|
||||
joinedAt: json['joined_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['joined_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -12,25 +12,21 @@ _SnRealm _$SnRealmFromJson(Map<String, dynamic> json) => _SnRealm(
|
||||
name: json['name'] as String? ?? '',
|
||||
description: json['description'] as String? ?? '',
|
||||
verifiedAs: json['verified_as'] as String?,
|
||||
verifiedAt:
|
||||
json['verified_at'] == null
|
||||
verifiedAt: json['verified_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['verified_at'] as String),
|
||||
isCommunity: json['is_community'] as bool,
|
||||
isPublic: json['is_public'] as bool,
|
||||
picture:
|
||||
json['picture'] == null
|
||||
picture: json['picture'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['picture'] as Map<String, dynamic>),
|
||||
background:
|
||||
json['background'] == null
|
||||
background: json['background'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['background'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: 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(
|
||||
realmId: json['realm_id'] as String,
|
||||
realm:
|
||||
json['realm'] == null
|
||||
realm: json['realm'] == null
|
||||
? null
|
||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
role: (json['role'] as num).toInt(),
|
||||
joinedAt:
|
||||
json['joined_at'] == null
|
||||
joinedAt: json['joined_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['joined_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
status:
|
||||
json['status'] == null
|
||||
status: json['status'] == null
|
||||
? null
|
||||
: SnAccountStatus.fromJson(
|
||||
json['status'] as Map<String, dynamic>,
|
||||
),
|
||||
: SnAccountStatus.fromJson(json['status'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnRealmMemberToJson(_SnRealmMember instance) =>
|
||||
|
||||
@@ -9,20 +9,17 @@ part of 'reference.dart';
|
||||
_Reference _$ReferenceFromJson(Map<String, dynamic> json) => _Reference(
|
||||
id: json['id'] as String,
|
||||
fileId: json['file_id'] as String,
|
||||
file:
|
||||
json['file'] == null
|
||||
file: json['file'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['file'] as Map<String, dynamic>),
|
||||
usage: json['usage'] as String,
|
||||
resourceId: json['resource_id'] as String,
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
@@ -8,24 +8,20 @@ part of 'relationship.dart';
|
||||
|
||||
_SnRelationship _$SnRelationshipFromJson(Map<String, dynamic> json) =>
|
||||
_SnRelationship(
|
||||
createdAt:
|
||||
json['created_at'] == null
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt:
|
||||
json['updated_at'] == null
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
account: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
relatedId: json['related_id'] as String,
|
||||
related: SnAccount.fromJson(json['related'] as Map<String, dynamic>),
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
status: (json['status'] as num).toInt(),
|
||||
|
||||
@@ -11,14 +11,12 @@ _SnSticker _$SnStickerFromJson(Map<String, dynamic> json) => _SnSticker(
|
||||
slug: json['slug'] as String,
|
||||
image: SnCloudFile.fromJson(json['image'] as Map<String, dynamic>),
|
||||
packId: json['pack_id'] as String,
|
||||
pack:
|
||||
json['pack'] == null
|
||||
pack: json['pack'] == null
|
||||
? null
|
||||
: SnStickerPack.fromJson(json['pack'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -42,18 +40,15 @@ _SnStickerPack _$SnStickerPackFromJson(Map<String, dynamic> json) =>
|
||||
description: json['description'] as String,
|
||||
prefix: json['prefix'] as String,
|
||||
publisherId: json['publisher_id'] as String,
|
||||
icon:
|
||||
json['icon'] == null
|
||||
icon: json['icon'] == null
|
||||
? null
|
||||
: SnCloudFile.fromJson(json['icon'] as Map<String, dynamic>),
|
||||
publisher:
|
||||
json['publisher'] == null
|
||||
publisher: json['publisher'] == null
|
||||
? null
|
||||
: SnPublisher.fromJson(json['publisher'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
stickers:
|
||||
|
||||
@@ -16,12 +16,10 @@ _StreamThinkingRequest _$StreamThinkingRequestFromJson(
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const [],
|
||||
attachedPosts:
|
||||
(json['attached_posts'] as List<dynamic>?)
|
||||
attachedPosts: (json['attached_posts'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
attachedMessages:
|
||||
(json['attached_messages'] as List<dynamic>?)
|
||||
attachedMessages: (json['attached_messages'] as List<dynamic>?)
|
||||
?.map((e) => e as Map<String, dynamic>)
|
||||
.toList(),
|
||||
serviceId: json['service_id'] as String?,
|
||||
@@ -87,14 +85,10 @@ _SnThinkingMessagePart _$SnThinkingMessagePartFromJson(
|
||||
(json['type'] as num).toInt(),
|
||||
),
|
||||
text: json['text'] as String?,
|
||||
functionCall:
|
||||
json['function_call'] == null
|
||||
functionCall: json['function_call'] == null
|
||||
? null
|
||||
: SnFunctionCall.fromJson(
|
||||
json['function_call'] as Map<String, dynamic>,
|
||||
),
|
||||
functionResult:
|
||||
json['function_result'] == null
|
||||
: SnFunctionCall.fromJson(json['function_call'] as Map<String, dynamic>),
|
||||
functionResult: json['function_result'] == null
|
||||
? null
|
||||
: SnFunctionResult.fromJson(
|
||||
json['function_result'] as Map<String, dynamic>,
|
||||
@@ -119,8 +113,7 @@ _SnThinkingSequence _$SnThinkingSequenceFromJson(Map<String, dynamic> json) =>
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -159,16 +152,14 @@ _SnThinkingThought _$SnThinkingThoughtFromJson(Map<String, dynamic> json) =>
|
||||
tokenCount: (json['token_count'] as num?)?.toInt(),
|
||||
modelName: json['model_name'] as String?,
|
||||
sequenceId: json['sequence_id'] as String,
|
||||
sequence:
|
||||
json['sequence'] == null
|
||||
sequence: json['sequence'] == null
|
||||
? null
|
||||
: SnThinkingSequence.fromJson(
|
||||
json['sequence'] as Map<String, dynamic>,
|
||||
),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -206,8 +197,7 @@ _ThoughtServicesResponse _$ThoughtServicesResponseFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _ThoughtServicesResponse(
|
||||
defaultService: json['default_service'] as String,
|
||||
services:
|
||||
(json['services'] as List<dynamic>)
|
||||
services: (json['services'] as List<dynamic>)
|
||||
.map((e) => ThoughtService.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
@@ -8,19 +8,16 @@ part of 'wallet.dart';
|
||||
|
||||
_SnWallet _$SnWalletFromJson(Map<String, dynamic> json) => _SnWallet(
|
||||
id: json['id'] as String,
|
||||
pockets:
|
||||
(json['pockets'] as List<dynamic>)
|
||||
pockets: (json['pockets'] as List<dynamic>)
|
||||
.map((e) => SnWalletPocket.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -77,8 +74,7 @@ _SnWalletPocket _$SnWalletPocketFromJson(Map<String, dynamic> json) =>
|
||||
walletId: json['wallet_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -102,19 +98,16 @@ _SnTransaction _$SnTransactionFromJson(Map<String, dynamic> json) =>
|
||||
remarks: json['remarks'] as String?,
|
||||
type: (json['type'] as num).toInt(),
|
||||
payerWalletId: json['payer_wallet_id'] as String?,
|
||||
payerWallet:
|
||||
json['payer_wallet'] == null
|
||||
payerWallet: json['payer_wallet'] == null
|
||||
? null
|
||||
: SnWallet.fromJson(json['payer_wallet'] as Map<String, dynamic>),
|
||||
payeeWalletId: json['payee_wallet_id'] as String?,
|
||||
payeeWallet:
|
||||
json['payee_wallet'] == null
|
||||
payeeWallet: json['payee_wallet'] == null
|
||||
? null
|
||||
: SnWallet.fromJson(json['payee_wallet'] as Map<String, dynamic>),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -140,8 +133,7 @@ _SnWalletSubscription _$SnWalletSubscriptionFromJson(
|
||||
) => _SnWalletSubscription(
|
||||
id: json['id'] as String,
|
||||
begunAt: DateTime.parse(json['begun_at'] as String),
|
||||
endedAt:
|
||||
json['ended_at'] == null
|
||||
endedAt: json['ended_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['ended_at'] as String),
|
||||
identifier: json['identifier'] as String,
|
||||
@@ -153,21 +145,18 @@ _SnWalletSubscription _$SnWalletSubscriptionFromJson(
|
||||
basePrice: (json['base_price'] as num?)?.toDouble(),
|
||||
couponId: json['coupon_id'] as String?,
|
||||
coupon: json['coupon'],
|
||||
renewalAt:
|
||||
json['renewal_at'] == null
|
||||
renewalAt: json['renewal_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['renewal_at'] as String),
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
isAvailable: json['is_available'] as bool? ?? true,
|
||||
finalPrice: (json['final_price'] as num?)?.toDouble(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -204,8 +193,7 @@ _SnWalletSubscriptionRef _$SnWalletSubscriptionRefFromJson(
|
||||
isActive: json['is_active'] as bool,
|
||||
accountId: json['account_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_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?,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -269,41 +256,34 @@ _SnWalletGift _$SnWalletGiftFromJson(Map<String, dynamic> json) =>
|
||||
giftCode: json['gift_code'] as String,
|
||||
subscriptionIdentifier: json['subscription_identifier'] as String,
|
||||
recipientId: json['recipient_id'] as String?,
|
||||
recipient:
|
||||
json['recipient'] == null
|
||||
recipient: json['recipient'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['recipient'] as Map<String, dynamic>),
|
||||
gifterId: json['gifter_id'] as String,
|
||||
gifter:
|
||||
json['gifter'] == null
|
||||
gifter: json['gifter'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['gifter'] as Map<String, dynamic>),
|
||||
redeemerId: json['redeemer_id'] as String?,
|
||||
redeemer:
|
||||
json['redeemer'] == null
|
||||
redeemer: json['redeemer'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['redeemer'] as Map<String, dynamic>),
|
||||
message: json['message'] as String?,
|
||||
status: (json['status'] as num).toInt(),
|
||||
redeemedAt:
|
||||
json['redeemed_at'] == null
|
||||
redeemedAt: json['redeemed_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['redeemed_at'] as String),
|
||||
expiredAt:
|
||||
json['expired_at'] == null
|
||||
expiredAt: json['expired_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['expired_at'] as String),
|
||||
subscriptionId: json['subscription_id'] as String?,
|
||||
subscription:
|
||||
json['subscription'] == null
|
||||
subscription: json['subscription'] == null
|
||||
? null
|
||||
: SnWalletSubscription.fromJson(
|
||||
json['subscription'] as Map<String, dynamic>,
|
||||
),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -330,9 +310,8 @@ Map<String, dynamic> _$SnWalletGiftToJson(_SnWalletGift instance) =>
|
||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_SnWalletFund _$SnWalletFundFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnWalletFund(
|
||||
_SnWalletFund _$SnWalletFundFromJson(Map<String, dynamic> json) =>
|
||||
_SnWalletFund(
|
||||
id: json['id'] as String,
|
||||
currency: json['currency'] as String,
|
||||
totalAmount: (json['total_amount'] as num).toDouble(),
|
||||
@@ -342,23 +321,20 @@ _SnWalletFund _$SnWalletFundFromJson(
|
||||
status: (json['status'] as num).toInt(),
|
||||
message: json['message'] as String?,
|
||||
creatorAccountId: json['creator_account_id'] as String,
|
||||
creatorAccount:
|
||||
json['creator_account'] == null
|
||||
creatorAccount: json['creator_account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['creator_account'] as Map<String, dynamic>),
|
||||
expiredAt: DateTime.parse(json['expired_at'] as String),
|
||||
recipients:
|
||||
(json['recipients'] as List<dynamic>)
|
||||
recipients: (json['recipients'] as List<dynamic>)
|
||||
.map((e) => SnWalletFundRecipient.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
isOpen: json['is_open'] as bool,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnWalletFundToJson(_SnWalletFund instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -386,22 +362,17 @@ _SnWalletFundRecipient _$SnWalletFundRecipientFromJson(
|
||||
id: json['id'] as String,
|
||||
fundId: json['fund_id'] as String,
|
||||
recipientAccountId: json['recipient_account_id'] as String,
|
||||
recipientAccount:
|
||||
json['recipient_account'] == null
|
||||
recipientAccount: json['recipient_account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(
|
||||
json['recipient_account'] as Map<String, dynamic>,
|
||||
),
|
||||
: SnAccount.fromJson(json['recipient_account'] as Map<String, dynamic>),
|
||||
amount: (json['amount'] as num).toDouble(),
|
||||
isReceived: json['is_received'] as bool,
|
||||
receivedAt:
|
||||
json['received_at'] == null
|
||||
receivedAt: json['received_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['received_at'] as String),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -425,31 +396,27 @@ _SnLotteryTicket _$SnLotteryTicketFromJson(Map<String, dynamic> json) =>
|
||||
_SnLotteryTicket(
|
||||
id: json['id'] as String,
|
||||
accountId: json['account_id'] as String,
|
||||
account:
|
||||
json['account'] == null
|
||||
account: json['account'] == null
|
||||
? null
|
||||
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
|
||||
regionOneNumbers:
|
||||
(json['region_one_numbers'] as List<dynamic>)
|
||||
regionOneNumbers: (json['region_one_numbers'] as List<dynamic>)
|
||||
.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
regionTwoNumber: (json['region_two_number'] as num).toInt(),
|
||||
multiplier: (json['multiplier'] as num).toInt(),
|
||||
drawStatus: (json['draw_status'] as num).toInt(),
|
||||
drawDate:
|
||||
json['draw_date'] == null
|
||||
drawDate: json['draw_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json['draw_date'] as String),
|
||||
matchedRegionOneNumbers:
|
||||
(json['matched_region_one_numbers'] as List<dynamic>?)
|
||||
?.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
matchedRegionTwoNumber:
|
||||
(json['matched_region_two_number'] as num?)?.toInt(),
|
||||
matchedRegionTwoNumber: (json['matched_region_two_number'] as num?)
|
||||
?.toInt(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -471,26 +438,24 @@ Map<String, dynamic> _$SnLotteryTicketToJson(_SnLotteryTicket instance) =>
|
||||
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
_SnLotteryRecord _$SnLotteryRecordFromJson(Map<String, dynamic> json) =>
|
||||
_SnLotteryRecord(
|
||||
_SnLotteryRecord _$SnLotteryRecordFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _SnLotteryRecord(
|
||||
id: json['id'] as String,
|
||||
drawDate: DateTime.parse(json['draw_date'] as String),
|
||||
winningRegionOneNumbers:
|
||||
(json['winning_region_one_numbers'] as List<dynamic>)
|
||||
winningRegionOneNumbers: (json['winning_region_one_numbers'] as List<dynamic>)
|
||||
.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
winningRegionTwoNumber:
|
||||
(json['winning_region_two_number'] as num).toInt(),
|
||||
winningRegionTwoNumber: (json['winning_region_two_number'] as num).toInt(),
|
||||
totalTickets: (json['total_tickets'] as num).toInt(),
|
||||
totalPrizesAwarded: (json['total_prizes_awarded'] as num).toInt(),
|
||||
totalPrizeAmount: (json['total_prize_amount'] as num).toDouble(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnLotteryRecordToJson(_SnLotteryRecord instance) =>
|
||||
<String, dynamic>{
|
||||
|
||||
@@ -17,12 +17,10 @@ _SnWebFeed _$SnWebFeedFromJson(Map<String, dynamic> json) => _SnWebFeed(
|
||||
url: json['url'] as String,
|
||||
title: json['title'] as String,
|
||||
description: json['description'] as String?,
|
||||
preview:
|
||||
json['preview'] == null
|
||||
preview: json['preview'] == null
|
||||
? null
|
||||
: SnScrappedLink.fromJson(json['preview'] as Map<String, dynamic>),
|
||||
config:
|
||||
json['config'] == null
|
||||
config: json['config'] == null
|
||||
? const SnWebFeedConfig()
|
||||
: SnWebFeedConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||
publisherId: json['publisher_id'] as String,
|
||||
@@ -33,8 +31,7 @@ _SnWebFeed _$SnWebFeedFromJson(Map<String, dynamic> json) => _SnWebFeed(
|
||||
const [],
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
@@ -61,26 +58,20 @@ _SnWebArticle _$SnWebArticleFromJson(Map<String, dynamic> json) =>
|
||||
url: json['url'] as String,
|
||||
author: json['author'] as String?,
|
||||
meta: json['meta'] as Map<String, dynamic>?,
|
||||
preview:
|
||||
json['preview'] == null
|
||||
preview: json['preview'] == null
|
||||
? null
|
||||
: SnScrappedLink.fromJson(
|
||||
json['preview'] as Map<String, dynamic>,
|
||||
),
|
||||
feed:
|
||||
json['feed'] == null
|
||||
: SnScrappedLink.fromJson(json['preview'] as Map<String, dynamic>),
|
||||
feed: json['feed'] == null
|
||||
? null
|
||||
: SnWebFeed.fromJson(json['feed'] as Map<String, dynamic>),
|
||||
content: json['content'] as String?,
|
||||
publishedAt:
|
||||
json['published_at'] == null
|
||||
publishedAt: json['published_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['published_at'] as String),
|
||||
feedId: json['feed_id'] as String,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
deletedAt:
|
||||
json['deleted_at'] == null
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
);
|
||||
|
||||
72
lib/pods/post/post_list.dart
Normal file
72
lib/pods/post/post_list.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
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;
|
||||
}
|
||||
|
||||
final postListNotifierProvider = AsyncNotifierProvider.autoDispose
|
||||
.family<PostListNotifier, List<SnPost>, PostListQuery>(
|
||||
PostListNotifier.new,
|
||||
);
|
||||
|
||||
class PostListNotifier extends AsyncNotifier<List<SnPost>>
|
||||
with AsyncPaginationController<SnPost> {
|
||||
final PostListQuery arg;
|
||||
PostListNotifier(this.arg);
|
||||
|
||||
static const int pageSize = 20;
|
||||
|
||||
@override
|
||||
Future<List<SnPost>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
|
||||
final queryParams = {
|
||||
'offset': fetchedCount,
|
||||
'take': pageSize,
|
||||
'replies': arg.includeReplies,
|
||||
'orderDesc': arg.orderDesc,
|
||||
if (arg.shuffle) 'shuffle': arg.shuffle,
|
||||
if (arg.pubName != null) 'pub': arg.pubName,
|
||||
if (arg.realm != null) 'realm': arg.realm,
|
||||
if (arg.type != null) 'type': arg.type,
|
||||
if (arg.tags != null) 'tags': arg.tags,
|
||||
if (arg.categories != null) 'categories': arg.categories,
|
||||
if (arg.pinned != null) 'pinned': arg.pinned,
|
||||
if (arg.order != null) 'order': arg.order,
|
||||
if (arg.periodStart != null) 'periodStart': arg.periodStart,
|
||||
if (arg.periodEnd != null) 'periodEnd': arg.periodEnd,
|
||||
if (arg.queryTerm != null) 'query': arg.queryTerm,
|
||||
if (arg.mediaOnly != null) 'media': arg.mediaOnly,
|
||||
};
|
||||
|
||||
final response = await client.get(
|
||||
'/sphere/posts',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final List<dynamic> data = response.data;
|
||||
return data.map((json) => SnPost.fromJson(json)).toList();
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/pods/config.dart';
|
||||
import 'package:island/pods/file_references.dart';
|
||||
import 'package:island/pods/drive/file_references.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/upload_tasks.dart';
|
||||
import 'package:island/pods/drive/upload_tasks.dart';
|
||||
import 'package:island/models/drive_task.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/services/time.dart';
|
||||
@@ -120,8 +120,9 @@ class FileDetailScreen extends HookConsumerWidget {
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
child: Material(
|
||||
color:
|
||||
Theme.of(context).colorScheme.surfaceContainer,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainer,
|
||||
elevation: 8,
|
||||
child: FileInfoSheet(
|
||||
item: item,
|
||||
@@ -176,13 +177,11 @@ class FileDetailScreen extends HookConsumerWidget {
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: Icon(Icons.link),
|
||||
onPressed:
|
||||
() => showModalBottomSheet(
|
||||
onPressed: () => showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder:
|
||||
(context) => SheetScaffold(
|
||||
builder: (context) => SheetScaffold(
|
||||
titleText: 'File References',
|
||||
child: ReferencesList(fileId: item.id),
|
||||
),
|
||||
@@ -300,8 +299,7 @@ class ReferencesList extends ConsumerWidget {
|
||||
final asyncReferences = ref.watch(fileReferencesProvider(fileId));
|
||||
|
||||
return asyncReferences.when(
|
||||
data:
|
||||
(references) => ListView.builder(
|
||||
data: (references) => ListView.builder(
|
||||
itemCount: references.length,
|
||||
itemBuilder: (context, index) {
|
||||
final reference = references[index];
|
||||
@@ -317,10 +315,7 @@ class ReferencesList extends ConsumerWidget {
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
reference.id,
|
||||
style: GoogleFonts.robotoMono(fontSize: 13),
|
||||
),
|
||||
Text(reference.id, style: GoogleFonts.robotoMono(fontSize: 13)),
|
||||
],
|
||||
),
|
||||
subtitle: Row(
|
||||
@@ -335,8 +330,8 @@ class ReferencesList extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error:
|
||||
(error, _) => Center(child: Text('Error loading references: $error')),
|
||||
error: (error, _) =>
|
||||
Center(child: Text('Error loading references: $error')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/models/file_pool.dart';
|
||||
import 'package:island/pods/file_list.dart';
|
||||
import 'package:island/pods/drive/file_list.dart';
|
||||
import 'package:island/services/file_uploader.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
@@ -40,27 +40,20 @@ class FileListScreen extends HookConsumerWidget {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Symbols.bar_chart),
|
||||
onPressed:
|
||||
() => _showUsageSheet(
|
||||
context,
|
||||
usageAsync.value,
|
||||
quotaAsync.value,
|
||||
),
|
||||
onPressed: () =>
|
||||
_showUsageSheet(context, usageAsync.value, quotaAsync.value),
|
||||
),
|
||||
const Gap(8),
|
||||
],
|
||||
),
|
||||
body: usageAsync.when(
|
||||
data:
|
||||
(usage) => quotaAsync.when(
|
||||
data:
|
||||
(quota) => FileListView(
|
||||
data: (usage) => quotaAsync.when(
|
||||
data: (quota) => FileListView(
|
||||
usage: usage,
|
||||
quota: quota,
|
||||
currentPath: currentPath,
|
||||
selectedPool: selectedPool,
|
||||
onPickAndUpload:
|
||||
() => _pickAndUploadFile(
|
||||
onPickAndUpload: () => _pickAndUploadFile(
|
||||
ref,
|
||||
currentPath.value,
|
||||
selectedPool.value?.id,
|
||||
@@ -158,8 +151,7 @@ class FileListScreen extends HookConsumerWidget {
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Navigate to Directory'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -207,8 +199,7 @@ class FileListScreen extends HookConsumerWidget {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder:
|
||||
(context) => SheetScaffold(
|
||||
builder: (context) => SheetScaffold(
|
||||
titleText: 'Usage Overview',
|
||||
child: UsageOverviewWidget(
|
||||
usage: usage,
|
||||
|
||||
@@ -18,12 +18,10 @@ _PostComposeInitialState _$PostComposeInitialStateFromJson(
|
||||
.toList() ??
|
||||
const [],
|
||||
visibility: (json['visibility'] as num?)?.toInt(),
|
||||
replyingTo:
|
||||
json['replying_to'] == null
|
||||
replyingTo: json['replying_to'] == null
|
||||
? null
|
||||
: SnPost.fromJson(json['replying_to'] as Map<String, dynamic>),
|
||||
forwardingTo:
|
||||
json['forwarding_to'] == null
|
||||
forwardingTo: json['forwarding_to'] == null
|
||||
? null
|
||||
: SnPost.fromJson(json['forwarding_to'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
@@ -7,9 +7,12 @@ import 'package:island/models/post.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:island/widgets/post/post_item.dart';
|
||||
|
||||
import 'package:island/widgets/posts/post_filter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:island/pods/paging.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/paging/pagination_list.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
final postSearchProvider = AsyncNotifierProvider.autoDispose(
|
||||
@@ -36,6 +39,14 @@ class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
|
||||
return [];
|
||||
}
|
||||
|
||||
bool? _includeReplies;
|
||||
bool _mediaOnly = false;
|
||||
String? _queryTerm;
|
||||
String? _order;
|
||||
bool _orderDesc = true;
|
||||
int? _periodStart;
|
||||
int? _periodEnd;
|
||||
|
||||
Future<void> search(
|
||||
String query, {
|
||||
String? pubName,
|
||||
@@ -45,6 +56,13 @@ class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
|
||||
List<String>? tags,
|
||||
bool shuffle = false,
|
||||
bool? pinned,
|
||||
bool? includeReplies,
|
||||
bool mediaOnly = false,
|
||||
String? queryTerm,
|
||||
String? order,
|
||||
bool orderDesc = true,
|
||||
int? periodStart,
|
||||
int? periodEnd,
|
||||
}) async {
|
||||
_currentQuery = query.trim();
|
||||
_pubName = pubName;
|
||||
@@ -54,6 +72,13 @@ class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
|
||||
_tags = tags;
|
||||
_shuffle = shuffle;
|
||||
_pinned = pinned;
|
||||
_includeReplies = includeReplies;
|
||||
_mediaOnly = mediaOnly;
|
||||
_queryTerm = queryTerm;
|
||||
_order = order;
|
||||
_orderDesc = orderDesc;
|
||||
_periodStart = periodStart;
|
||||
_periodEnd = periodEnd;
|
||||
|
||||
final hasFilters =
|
||||
pubName != null ||
|
||||
@@ -62,7 +87,13 @@ class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
|
||||
categories != null ||
|
||||
tags != null ||
|
||||
shuffle ||
|
||||
pinned != null;
|
||||
pinned != null ||
|
||||
includeReplies != null ||
|
||||
mediaOnly ||
|
||||
queryTerm != null ||
|
||||
order != null ||
|
||||
periodStart != null ||
|
||||
periodEnd != null;
|
||||
|
||||
if (_currentQuery.isEmpty && !hasFilters) {
|
||||
state = const AsyncData([]);
|
||||
@@ -91,6 +122,13 @@ class PostSearchNotifier extends AsyncNotifier<List<SnPost>>
|
||||
if (_categories != null) 'categories': _categories,
|
||||
if (_shuffle) 'shuffle': true,
|
||||
if (_pinned != null) 'pinned': _pinned,
|
||||
if (_includeReplies != null) 'includeReplies': _includeReplies,
|
||||
if (_mediaOnly) 'mediaOnly': true,
|
||||
if (_queryTerm != null) 'queryTerm': _queryTerm,
|
||||
if (_order != null) 'order': _order,
|
||||
if (_orderDesc) 'orderDesc': true,
|
||||
if (_periodStart != null) 'periodStart': _periodStart,
|
||||
if (_periodEnd != null) 'periodEnd': _periodEnd,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -117,6 +155,17 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
final shuffleValue = useState(false);
|
||||
final pinnedValue = useState<bool?>(null);
|
||||
|
||||
// State variables for PostFilterWidget
|
||||
final categoryTabController = useTabController(initialLength: 3);
|
||||
final includeReplies = useState<bool?>(null);
|
||||
final mediaOnly = useState(false);
|
||||
final queryTerm = useState<String?>(null);
|
||||
final order = useState<String?>('date');
|
||||
final orderDesc = useState(true);
|
||||
final periodStart = useState<int?>(null);
|
||||
final periodEnd = useState<int?>(null);
|
||||
final showAdvancedFilters = useState(false);
|
||||
|
||||
useEffect(() {
|
||||
return () {
|
||||
searchController.dispose();
|
||||
@@ -130,7 +179,21 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
if (debounceTimer.value?.isActive ?? false) debounceTimer.value!.cancel();
|
||||
|
||||
debounceTimer.value = Timer(debounce, () {
|
||||
ref.read(postSearchProvider.notifier).search(query);
|
||||
ref
|
||||
.read(postSearchProvider.notifier)
|
||||
.search(
|
||||
query,
|
||||
type: categoryTabController.index == 1
|
||||
? 0
|
||||
: (categoryTabController.index == 2 ? 1 : null),
|
||||
includeReplies: includeReplies.value,
|
||||
mediaOnly: mediaOnly.value,
|
||||
queryTerm: queryTerm.value,
|
||||
order: order.value,
|
||||
orderDesc: orderDesc.value,
|
||||
periodStart: periodStart.value,
|
||||
periodEnd: periodEnd.value,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -142,20 +205,28 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
.read(postSearchProvider.notifier)
|
||||
.search(
|
||||
query,
|
||||
pubName:
|
||||
pubNameController.text.isNotEmpty
|
||||
pubName: pubNameController.text.isNotEmpty
|
||||
? pubNameController.text
|
||||
: null,
|
||||
realm:
|
||||
realmController.text.isNotEmpty ? realmController.text : null,
|
||||
type: typeValue.value,
|
||||
categories:
|
||||
selectedCategories.value.isNotEmpty
|
||||
realm: realmController.text.isNotEmpty
|
||||
? realmController.text
|
||||
: null,
|
||||
type: categoryTabController.index == 1
|
||||
? 0
|
||||
: (categoryTabController.index == 2 ? 1 : null),
|
||||
categories: selectedCategories.value.isNotEmpty
|
||||
? selectedCategories.value
|
||||
: null,
|
||||
tags: selectedTags.value.isNotEmpty ? selectedTags.value : null,
|
||||
shuffle: shuffleValue.value,
|
||||
pinned: pinnedValue.value,
|
||||
includeReplies: includeReplies.value,
|
||||
mediaOnly: mediaOnly.value,
|
||||
queryTerm: queryTerm.value,
|
||||
order: order.value,
|
||||
orderDesc: orderDesc.value,
|
||||
periodStart: periodStart.value,
|
||||
periodEnd: periodEnd.value,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -164,108 +235,26 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
showFilters.value = !showFilters.value;
|
||||
}
|
||||
|
||||
void applyFilters() {
|
||||
onSearchWithFilters(searchController.text);
|
||||
}
|
||||
|
||||
void clearFilters() {
|
||||
pubNameController.clear();
|
||||
realmController.clear();
|
||||
typeValue.value = null;
|
||||
selectedCategories.value = [];
|
||||
selectedTags.value = [];
|
||||
shuffleValue.value = false;
|
||||
pinnedValue.value = null;
|
||||
onSearchChanged(searchController.text);
|
||||
}
|
||||
|
||||
Widget buildFilterPanel() {
|
||||
return Card(
|
||||
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'filters'.tr(),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
).padding(left: 4),
|
||||
Row(
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: applyFilters,
|
||||
child: Text('apply'.tr()),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: clearFilters,
|
||||
child: Text('clear'.tr()),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: pubNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'pubName'.tr(),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
),
|
||||
onChanged:
|
||||
(value) => onSearchWithFilters(searchController.text),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: realmController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'realm'.tr(),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
),
|
||||
onChanged:
|
||||
(value) => onSearchWithFilters(searchController.text),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: shuffleValue.value,
|
||||
onChanged: (value) {
|
||||
shuffleValue.value = value ?? false;
|
||||
onSearchWithFilters(searchController.text);
|
||||
},
|
||||
),
|
||||
Text('shuffle'.tr()),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: pinnedValue.value ?? false,
|
||||
onChanged: (value) {
|
||||
pinnedValue.value = value;
|
||||
onSearchWithFilters(searchController.text);
|
||||
},
|
||||
),
|
||||
Text('pinned'.tr()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
return PostFilterWidget(
|
||||
categoryTabController: categoryTabController,
|
||||
includeReplies: includeReplies,
|
||||
mediaOnly: mediaOnly,
|
||||
queryTerm: queryTerm,
|
||||
order: order,
|
||||
orderDesc: orderDesc,
|
||||
periodStart: periodStart,
|
||||
periodEnd: periodEnd,
|
||||
showAdvancedFilters: showAdvancedFilters,
|
||||
hideSearch: true,
|
||||
);
|
||||
}
|
||||
|
||||
return AppScaffold(
|
||||
isNoBackground: false,
|
||||
appBar: AppBar(
|
||||
appBar: isWideScreen(context)
|
||||
? null
|
||||
: AppBar(
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -304,7 +293,113 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
builder: (context, ref, child) {
|
||||
final searchState = ref.watch(postSearchProvider);
|
||||
|
||||
return CustomScrollView(
|
||||
return isWideScreen(context)
|
||||
? Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 4,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverGap(16),
|
||||
SliverToBoxAdapter(
|
||||
child: SearchBar(
|
||||
elevation: WidgetStateProperty.all(4),
|
||||
controller: searchController,
|
||||
hintText: 'search'.tr(),
|
||||
leading: const Icon(Icons.search),
|
||||
padding: WidgetStateProperty.all(
|
||||
const EdgeInsets.symmetric(horizontal: 24),
|
||||
),
|
||||
onChanged: onSearchChanged,
|
||||
onSubmitted: (value) {
|
||||
onSearchWithFilters(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SliverGap(16),
|
||||
if (showFilters.value && !isWideScreen(context))
|
||||
SliverToBoxAdapter(child: buildFilterPanel()),
|
||||
// Use PaginationList with isSliver=true
|
||||
PaginationList(
|
||||
provider: postSearchProvider,
|
||||
notifier: postSearchProvider.notifier,
|
||||
isSliver: true,
|
||||
isRefreshable: false,
|
||||
itemBuilder: (context, index, post) {
|
||||
return Card(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
child: PostActionableItem(
|
||||
item: post,
|
||||
borderRadius: 8,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (searchState.value?.isEmpty == true &&
|
||||
searchController.text.isNotEmpty &&
|
||||
!searchState.isLoading)
|
||||
SliverFillRemaining(
|
||||
child: Center(child: Text('noResultsFound'.tr())),
|
||||
),
|
||||
SliverGap(MediaQuery.of(context).padding.bottom + 16),
|
||||
],
|
||||
).padding(left: 8),
|
||||
),
|
||||
Flexible(
|
||||
flex: 3,
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Gap(16),
|
||||
Card(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Symbols.tune,
|
||||
).padding(horizontal: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'filters'.tr(),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyLarge,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Symbols.filter_alt,
|
||||
fill: showFilters.value ? 1 : null,
|
||||
),
|
||||
onPressed: toggleFilters,
|
||||
tooltip: 'toggleFilters'.tr(),
|
||||
),
|
||||
const Gap(4),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
if (showFilters.value) buildFilterPanel(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: CustomScrollView(
|
||||
slivers: [
|
||||
if (showFilters.value)
|
||||
SliverToBoxAdapter(
|
||||
@@ -320,8 +415,7 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
provider: postSearchProvider,
|
||||
notifier: postSearchProvider.notifier,
|
||||
isSliver: true,
|
||||
isRefreshable:
|
||||
false, // CustomScrollView handles refreshing usually, but here we don't have PullToRefresh
|
||||
isRefreshable: false,
|
||||
itemBuilder: (context, index, post) {
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
@@ -331,7 +425,10 @@ class PostSearchScreen extends HookConsumerWidget {
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
child: PostActionableItem(item: post, borderRadius: 8),
|
||||
child: PostActionableItem(
|
||||
item: post,
|
||||
borderRadius: 8,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'package:island/widgets/content/cloud_files.dart';
|
||||
import 'package:island/widgets/content/markdown.dart';
|
||||
import 'package:island/widgets/post/post_list.dart';
|
||||
import 'package:island/widgets/activity_heatmap.dart';
|
||||
import 'package:island/widgets/posts/post_filter.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:island/services/color_extraction.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
@@ -82,8 +83,9 @@ class _PublisherBasisWidget extends StatelessWidget {
|
||||
size: 12,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
backgroundColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
offset: Offset(0, 48),
|
||||
child: ProfilePictureWidget(
|
||||
file: data.picture,
|
||||
@@ -121,8 +123,9 @@ class _PublisherBasisWidget extends StatelessWidget {
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
backgroundColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
offset: Offset(0, 48),
|
||||
child: ProfilePictureWidget(
|
||||
file: data.picture,
|
||||
@@ -201,10 +204,8 @@ class _PublisherBasisWidget extends StatelessWidget {
|
||||
),
|
||||
subStatus
|
||||
.when(
|
||||
data:
|
||||
(status) => FilledButton.icon(
|
||||
onPressed:
|
||||
subscribing.value
|
||||
data: (status) => FilledButton.icon(
|
||||
onPressed: subscribing.value
|
||||
? null
|
||||
: (status.isSubscribed
|
||||
? unsubscribe
|
||||
@@ -214,8 +215,7 @@ class _PublisherBasisWidget extends StatelessWidget {
|
||||
? Symbols.remove_circle
|
||||
: Symbols.add_circle,
|
||||
),
|
||||
label:
|
||||
Text(
|
||||
label: Text(
|
||||
status.isSubscribed
|
||||
? 'unsubscribe'
|
||||
: 'subscribe',
|
||||
@@ -227,8 +227,7 @@ class _PublisherBasisWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
error: (_, _) => const SizedBox(),
|
||||
loading:
|
||||
() => const SizedBox(
|
||||
loading: () => const SizedBox(
|
||||
height: 36,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
@@ -333,9 +332,7 @@ class _PublisherHeatmapWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return heatmap.when(
|
||||
data:
|
||||
(data) =>
|
||||
data != null
|
||||
data: (data) => data != null
|
||||
? ActivityHeatmapWidget(
|
||||
heatmap: data,
|
||||
forceDense: forceDense,
|
||||
@@ -372,242 +369,16 @@ class _PublisherCategoryTabWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
controller: categoryTabController,
|
||||
dividerColor: Colors.transparent,
|
||||
splashBorderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
tabs: [
|
||||
Tab(text: 'all'.tr()),
|
||||
Tab(text: 'postTypePost'.tr()),
|
||||
Tab(text: 'postArticle'.tr()),
|
||||
],
|
||||
),
|
||||
const Divider(height: 1),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CheckboxListTile(
|
||||
title: Text('reply'.tr()),
|
||||
value: includeReplies.value,
|
||||
tristate: true,
|
||||
onChanged: (value) {
|
||||
// Cycle through: null -> false -> true -> null
|
||||
if (includeReplies.value == null) {
|
||||
includeReplies.value = false;
|
||||
} else if (includeReplies.value == false) {
|
||||
includeReplies.value = true;
|
||||
} else {
|
||||
includeReplies.value = null;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.reply),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CheckboxListTile(
|
||||
title: Text('attachments'.tr()),
|
||||
value: mediaOnly.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
mediaOnly.value = value;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.attachment),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
CheckboxListTile(
|
||||
title: Text('descendingOrder'.tr()),
|
||||
value: orderDesc.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
orderDesc.value = value;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.sort),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
title: Text('advancedFilters'.tr()),
|
||||
leading: const Icon(Symbols.filter_list),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(const Radius.circular(8)),
|
||||
),
|
||||
trailing: Icon(
|
||||
showAdvancedFilters.value
|
||||
? Symbols.expand_less
|
||||
: Symbols.expand_more,
|
||||
),
|
||||
onTap: () {
|
||||
showAdvancedFilters.value = !showAdvancedFilters.value;
|
||||
},
|
||||
),
|
||||
if (showAdvancedFilters.value) ...[
|
||||
const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'search'.tr(),
|
||||
hintText: 'searchPosts'.tr(),
|
||||
prefixIcon: const Icon(Symbols.search),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
queryTerm.value = value.isEmpty ? null : value;
|
||||
},
|
||||
),
|
||||
const Gap(12),
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'sortBy'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
),
|
||||
value: order.value,
|
||||
items: [
|
||||
DropdownMenuItem(value: 'date', child: Text('date'.tr())),
|
||||
DropdownMenuItem(
|
||||
value: 'popularity',
|
||||
child: Text('popularity'.tr()),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
order.value = value;
|
||||
},
|
||||
),
|
||||
const Gap(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate:
|
||||
periodStart.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodStart.value! * 1000,
|
||||
)
|
||||
: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now().add(
|
||||
const Duration(days: 365),
|
||||
),
|
||||
);
|
||||
if (pickedDate != null) {
|
||||
periodStart.value =
|
||||
pickedDate.millisecondsSinceEpoch ~/ 1000;
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'fromDate'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
suffixIcon: const Icon(Symbols.calendar_today),
|
||||
),
|
||||
child: Text(
|
||||
periodStart.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodStart.value! * 1000,
|
||||
).toString().split(' ')[0]
|
||||
: 'selectDate'.tr(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate:
|
||||
periodEnd.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodEnd.value! * 1000,
|
||||
)
|
||||
: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now().add(
|
||||
const Duration(days: 365),
|
||||
),
|
||||
);
|
||||
if (pickedDate != null) {
|
||||
periodEnd.value =
|
||||
pickedDate.millisecondsSinceEpoch ~/ 1000;
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'toDate'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
suffixIcon: const Icon(Symbols.calendar_today),
|
||||
),
|
||||
child: Text(
|
||||
periodEnd.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodEnd.value! * 1000,
|
||||
).toString().split(' ')[0]
|
||||
: 'selectDate'.tr(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
return PostFilterWidget(
|
||||
categoryTabController: categoryTabController,
|
||||
includeReplies: includeReplies,
|
||||
mediaOnly: mediaOnly,
|
||||
queryTerm: queryTerm,
|
||||
order: order,
|
||||
orderDesc: orderDesc,
|
||||
periodStart: periodStart,
|
||||
periodEnd: periodEnd,
|
||||
showAdvancedFilters: showAdvancedFilters,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -739,11 +510,9 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
return publisher.when(
|
||||
data:
|
||||
(data) => AppScaffold(
|
||||
data: (data) => AppScaffold(
|
||||
isNoBackground: false,
|
||||
appBar:
|
||||
isWideScreen(context)
|
||||
appBar: isWideScreen(context)
|
||||
? AppBar(
|
||||
foregroundColor: appbarColor.value,
|
||||
leading: PageBackButton(
|
||||
@@ -761,8 +530,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
),
|
||||
)
|
||||
: null,
|
||||
body:
|
||||
isWideScreen(context)
|
||||
body: isWideScreen(context)
|
||||
? Row(
|
||||
children: [
|
||||
Flexible(
|
||||
@@ -789,9 +557,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
? Symbols.expand_less
|
||||
: Symbols.expand_more,
|
||||
),
|
||||
onTap:
|
||||
() =>
|
||||
isPinnedExpanded.value =
|
||||
onTap: () => isPinnedExpanded.value =
|
||||
!isPinnedExpanded.value,
|
||||
),
|
||||
),
|
||||
@@ -819,8 +585,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
),
|
||||
pubName: name,
|
||||
pinned: false,
|
||||
type:
|
||||
categoryTab.value == 1
|
||||
type: categoryTab.value == 1
|
||||
? 0
|
||||
: (categoryTab.value == 2 ? 1 : null),
|
||||
includeReplies: includeReplies.value,
|
||||
@@ -831,9 +596,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
periodStart: periodStart.value,
|
||||
periodEnd: periodEnd.value,
|
||||
),
|
||||
SliverGap(
|
||||
MediaQuery.of(context).padding.bottom + 16,
|
||||
),
|
||||
SliverGap(MediaQuery.of(context).padding.bottom + 16),
|
||||
],
|
||||
).padding(left: 8),
|
||||
),
|
||||
@@ -852,10 +615,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
subscribe: subscribe,
|
||||
unsubscribe: unsubscribe,
|
||||
).padding(horizontal: 4, top: 20),
|
||||
_PublisherBadgesWidget(
|
||||
data: data,
|
||||
badges: badges,
|
||||
),
|
||||
_PublisherBadgesWidget(data: data, badges: badges),
|
||||
_PublisherVerificationWidget(data: data),
|
||||
_PublisherBioWidget(data: data),
|
||||
_PublisherHeatmapWidget(
|
||||
@@ -882,14 +642,10 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
flexibleSpace: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child:
|
||||
data.background?.id != null
|
||||
? CloudImageWidget(
|
||||
file: data.background,
|
||||
)
|
||||
child: data.background?.id != null
|
||||
? CloudImageWidget(file: data.background)
|
||||
: Container(
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).appBarTheme.backgroundColor,
|
||||
),
|
||||
@@ -900,9 +656,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
style: TextStyle(
|
||||
color:
|
||||
appbarColor.value ??
|
||||
Theme.of(
|
||||
context,
|
||||
).appBarTheme.foregroundColor,
|
||||
Theme.of(context).appBarTheme.foregroundColor,
|
||||
shadows: [appbarShadow],
|
||||
),
|
||||
),
|
||||
@@ -922,17 +676,12 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
).padding(horizontal: 4, top: 8),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: _PublisherBadgesWidget(
|
||||
data: data,
|
||||
badges: badges,
|
||||
),
|
||||
child: _PublisherBadgesWidget(data: data, badges: badges),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: _PublisherVerificationWidget(data: data),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: _PublisherBioWidget(data: data),
|
||||
),
|
||||
SliverToBoxAdapter(child: _PublisherBioWidget(data: data)),
|
||||
SliverToBoxAdapter(
|
||||
child: _PublisherHeatmapWidget(
|
||||
heatmap: heatmap,
|
||||
@@ -940,10 +689,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Card(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: ListTile(
|
||||
title: Text('pinnedPosts'.tr()),
|
||||
trailing: Icon(
|
||||
@@ -951,10 +697,8 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
? Symbols.expand_less
|
||||
: Symbols.expand_more,
|
||||
),
|
||||
onTap:
|
||||
() =>
|
||||
isPinnedExpanded.value =
|
||||
!isPinnedExpanded.value,
|
||||
onTap: () =>
|
||||
isPinnedExpanded.value = !isPinnedExpanded.value,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -981,8 +725,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
),
|
||||
pubName: name,
|
||||
pinned: false,
|
||||
type:
|
||||
categoryTab.value == 1
|
||||
type: categoryTab.value == 1
|
||||
? 0
|
||||
: (categoryTab.value == 2 ? 1 : null),
|
||||
includeReplies: includeReplies.value,
|
||||
@@ -997,14 +740,12 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
error:
|
||||
(error, stackTrace) => AppScaffold(
|
||||
error: (error, stackTrace) => AppScaffold(
|
||||
isNoBackground: false,
|
||||
appBar: AppBar(leading: const PageBackButton()),
|
||||
body: Center(child: Text(error.toString())),
|
||||
),
|
||||
loading:
|
||||
() => AppScaffold(
|
||||
loading: () => AppScaffold(
|
||||
isNoBackground: false,
|
||||
appBar: AppBar(leading: const PageBackButton()),
|
||||
body: Center(child: CircularProgressIndicator()),
|
||||
|
||||
@@ -21,7 +21,7 @@ import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:island/pods/config.dart';
|
||||
import 'package:island/pods/file_pool.dart';
|
||||
import 'package:island/pods/drive/file_pool.dart';
|
||||
|
||||
class SettingsScreen extends HookConsumerWidget {
|
||||
const SettingsScreen({super.key});
|
||||
@@ -249,8 +249,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
Color selectedColor =
|
||||
settings.appColorScheme != null
|
||||
Color selectedColor = settings.appColorScheme != null
|
||||
? Color(settings.appColorScheme!)
|
||||
: Colors.indigo;
|
||||
|
||||
@@ -292,8 +291,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
height: 24,
|
||||
margin: EdgeInsets.symmetric(horizontal: 2, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
settings.appColorScheme != null
|
||||
color: settings.appColorScheme != null
|
||||
? Color(settings.appColorScheme!)
|
||||
: Colors.indigo,
|
||||
shape: BoxShape.circle,
|
||||
@@ -310,8 +308,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Custom colors section
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
||||
child:
|
||||
Text(
|
||||
child: Text(
|
||||
'Custom Colors',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
).bold(),
|
||||
@@ -319,8 +316,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Primary color
|
||||
_ColorPickerTile(
|
||||
title: 'Primary',
|
||||
color:
|
||||
settings.customColors?.primary != null
|
||||
color: settings.customColors?.primary != null
|
||||
? Color(settings.customColors!.primary!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -333,8 +329,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Secondary
|
||||
_ColorPickerTile(
|
||||
title: 'Secondary',
|
||||
color:
|
||||
settings.customColors?.secondary != null
|
||||
color: settings.customColors?.secondary != null
|
||||
? Color(settings.customColors!.secondary!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -347,8 +342,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Tertiary
|
||||
_ColorPickerTile(
|
||||
title: 'Tertiary',
|
||||
color:
|
||||
settings.customColors?.tertiary != null
|
||||
color: settings.customColors?.tertiary != null
|
||||
? Color(settings.customColors!.tertiary!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -361,8 +355,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Surface
|
||||
_ColorPickerTile(
|
||||
title: 'Surface',
|
||||
color:
|
||||
settings.customColors?.surface != null
|
||||
color: settings.customColors?.surface != null
|
||||
? Color(settings.customColors!.surface!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -375,8 +368,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Background
|
||||
_ColorPickerTile(
|
||||
title: 'Background',
|
||||
color:
|
||||
settings.customColors?.background != null
|
||||
color: settings.customColors?.background != null
|
||||
? Color(settings.customColors!.background!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -391,8 +383,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Error
|
||||
_ColorPickerTile(
|
||||
title: 'Error',
|
||||
color:
|
||||
settings.customColors?.error != null
|
||||
color: settings.customColors?.error != null
|
||||
? Color(settings.customColors!.error!)
|
||||
: null,
|
||||
onColorChanged: (color) {
|
||||
@@ -509,8 +500,9 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Background image enabled
|
||||
if (!kIsWeb && docBasepath.value != null)
|
||||
FutureBuilder<bool>(
|
||||
future:
|
||||
File('${docBasepath.value}/$kAppBackgroundImagePath').exists(),
|
||||
future: File(
|
||||
'${docBasepath.value}/$kAppBackgroundImagePath',
|
||||
).exists(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData || !snapshot.data!) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -536,8 +528,9 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
// Clear background image option
|
||||
if (!kIsWeb && docBasepath.value != null)
|
||||
FutureBuilder<bool>(
|
||||
future:
|
||||
File('${docBasepath.value}/$kAppBackgroundImagePath').exists(),
|
||||
future: File(
|
||||
'${docBasepath.value}/$kAppBackgroundImagePath',
|
||||
).exists(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData || !snapshot.data!) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -565,8 +558,9 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
|
||||
if (!kIsWeb && docBasepath.value != null)
|
||||
FutureBuilder(
|
||||
future:
|
||||
File('${docBasepath.value}/$kAppBackgroundImagePath').exists(),
|
||||
future: File(
|
||||
'${docBasepath.value}/$kAppBackgroundImagePath',
|
||||
).exists(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData || !snapshot.data!) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -674,8 +668,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
trailing: DropdownButtonHideUnderline(
|
||||
child: DropdownButton2<String>(
|
||||
isExpanded: true,
|
||||
items:
|
||||
validPools.map((p) {
|
||||
items: validPools.map((p) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: p.id,
|
||||
child: Tooltip(
|
||||
@@ -705,14 +698,12 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
loading:
|
||||
() => const ListTile(
|
||||
loading: () => const ListTile(
|
||||
minLeadingWidth: 48,
|
||||
title: Text('Loading pools...'),
|
||||
leading: CircularProgressIndicator(),
|
||||
),
|
||||
error:
|
||||
(err, st) => ListTile(
|
||||
error: (err, st) => ListTile(
|
||||
minLeadingWidth: 48,
|
||||
title: Text('settingsDefaultPool').tr(),
|
||||
subtitle: Text('Error: $err'),
|
||||
@@ -767,8 +758,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
ListTile(
|
||||
minLeadingWidth: 48,
|
||||
title: Text('settingsEnterToSend').tr(),
|
||||
subtitle:
|
||||
isDesktop
|
||||
subtitle: isDesktop
|
||||
? Text('settingsEnterToSendDesktopHint').tr().fontSize(12)
|
||||
: null,
|
||||
contentPadding: const EdgeInsets.only(left: 24, right: 17),
|
||||
@@ -823,8 +813,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
];
|
||||
|
||||
// Desktop-specific settings
|
||||
final desktopSettings =
|
||||
!isDesktop
|
||||
final desktopSettings = !isDesktop
|
||||
? <Widget>[]
|
||||
: [
|
||||
ListTile(
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/upload_tasks.dart';
|
||||
import 'package:island/pods/drive/upload_tasks.dart';
|
||||
import 'package:mime/mime.dart';
|
||||
import 'package:native_exif/native_exif.dart';
|
||||
import 'package:path/path.dart' show extension;
|
||||
@@ -211,8 +211,9 @@ class FileUploader {
|
||||
// Use old way for Uint8List
|
||||
final chunks = <Uint8List>[];
|
||||
for (int i = 0; i < fileData.length; i += chunkSize) {
|
||||
final end =
|
||||
i + chunkSize > fileData.length ? fileData.length : i + chunkSize;
|
||||
final end = i + chunkSize > fileData.length
|
||||
? fileData.length
|
||||
: i + chunkSize;
|
||||
chunks.add(Uint8List.fromList(fileData.sublist(i, end)));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/models/file_pool.dart';
|
||||
import 'package:island/pods/file_pool.dart';
|
||||
import 'package:island/pods/drive/file_pool.dart';
|
||||
import 'package:island/widgets/content/attachment_preview.dart';
|
||||
import 'package:island/widgets/content/sheet.dart';
|
||||
import 'package:island/widgets/post/compose_shared.dart';
|
||||
@@ -79,8 +79,7 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
children: [
|
||||
DropdownButtonFormField<String>(
|
||||
value: selectedPoolId,
|
||||
items:
|
||||
pools.map((pool) {
|
||||
items: pools.map((pool) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: pool.id,
|
||||
child: Text(pool.name),
|
||||
@@ -140,8 +139,7 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.errorContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -155,19 +153,18 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
Icon(
|
||||
Symbols.warning,
|
||||
size: 18,
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.error,
|
||||
),
|
||||
const Gap(8),
|
||||
Text(
|
||||
'uploadConstraints'.tr(),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
Theme.of(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.error,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -183,11 +180,11 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
_formatFileSize(maxFileSize),
|
||||
],
|
||||
),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
Theme.of(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.error,
|
||||
),
|
||||
@@ -197,11 +194,11 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
const Gap(4),
|
||||
Text(
|
||||
'fileTypeNotAccepted'.tr(),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
Theme.of(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.error,
|
||||
),
|
||||
@@ -229,8 +226,7 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
),
|
||||
],
|
||||
),
|
||||
style:
|
||||
Theme.of(
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium,
|
||||
).fontSize(13),
|
||||
@@ -300,8 +296,8 @@ class _AttachmentUploaderSheetState extends State<AttachmentUploaderSheet> {
|
||||
final maxFileSize = selectedPool.policyConfig?['max_file_size'] as int?;
|
||||
final fileSizeExceeded = maxFileSize != null && fileSize > maxFileSize;
|
||||
|
||||
final acceptTypes =
|
||||
(selectedPool.policyConfig?['accept_types'] as List?)?.cast<String>();
|
||||
final acceptTypes = (selectedPool.policyConfig?['accept_types'] as List?)
|
||||
?.cast<String>();
|
||||
final mimeType =
|
||||
attachment.data.mimeType ??
|
||||
ComposeLogic.getMimeTypeFromFileType(attachment.type);
|
||||
|
||||
@@ -12,8 +12,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/file_list_item.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/models/file_pool.dart';
|
||||
import 'package:island/pods/file_list.dart';
|
||||
import 'package:island/pods/file_pool.dart';
|
||||
import 'package:island/pods/drive/file_list.dart';
|
||||
import 'package:island/pods/drive/file_pool.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/services/file_uploader.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
@@ -123,12 +123,8 @@ class FileListView extends HookConsumerWidget {
|
||||
notifier: unindexedFileListProvider.notifier,
|
||||
isRefreshable: false,
|
||||
isSliver: true,
|
||||
contentBuilder:
|
||||
(data, footer) =>
|
||||
data.isEmpty
|
||||
? SliverToBoxAdapter(
|
||||
child: _buildEmptyUnindexedFilesHint(ref),
|
||||
)
|
||||
contentBuilder: (data, footer) => data.isEmpty
|
||||
? SliverToBoxAdapter(child: _buildEmptyUnindexedFilesHint(ref))
|
||||
: _buildUnindexedFileListContent(
|
||||
data,
|
||||
ref,
|
||||
@@ -145,9 +141,7 @@ class FileListView extends HookConsumerWidget {
|
||||
notifier: indexedCloudFileListProvider.notifier,
|
||||
isRefreshable: false,
|
||||
isSliver: true,
|
||||
contentBuilder:
|
||||
(data, footer) =>
|
||||
data.isEmpty
|
||||
contentBuilder: (data, footer) => data.isEmpty
|
||||
? SliverToBoxAdapter(
|
||||
child: _buildEmptyDirectoryHint(ref, currentPath),
|
||||
)
|
||||
@@ -177,8 +171,7 @@ class FileListView extends HookConsumerWidget {
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
);
|
||||
} else {
|
||||
final pathParts =
|
||||
currentPath.value
|
||||
final pathParts = currentPath.value
|
||||
.split('/')
|
||||
.where((part) => part.isNotEmpty)
|
||||
.toList();
|
||||
@@ -266,8 +259,7 @@ class FileListView extends HookConsumerWidget {
|
||||
dragging.value = false;
|
||||
},
|
||||
child: Container(
|
||||
color:
|
||||
dragging.value
|
||||
color: dragging.value
|
||||
? Theme.of(context).primaryColor.withOpacity(0.1)
|
||||
: null,
|
||||
child: Column(
|
||||
@@ -302,23 +294,20 @@ class FileListView extends HookConsumerWidget {
|
||||
? Symbols.arrow_back
|
||||
: Symbols.folder,
|
||||
),
|
||||
onPressed:
|
||||
isRefreshing
|
||||
onPressed: isRefreshing
|
||||
? null
|
||||
: () {
|
||||
if (mode.value == FileListMode.unindexed) {
|
||||
mode.value = FileListMode.normal;
|
||||
currentPath.value = '/';
|
||||
} else {
|
||||
final pathParts =
|
||||
currentPath.value
|
||||
final pathParts = currentPath.value
|
||||
.split('/')
|
||||
.where((part) => part.isNotEmpty)
|
||||
.toList();
|
||||
if (pathParts.isNotEmpty) {
|
||||
pathParts.removeLast();
|
||||
currentPath.value =
|
||||
pathParts.isEmpty
|
||||
currentPath.value = pathParts.isEmpty
|
||||
? '/'
|
||||
: '/${pathParts.join('/')}';
|
||||
}
|
||||
@@ -342,14 +331,11 @@ class FileListView extends HookConsumerWidget {
|
||||
? Symbols.view_module
|
||||
: Symbols.list,
|
||||
),
|
||||
onPressed:
|
||||
() =>
|
||||
viewMode.value =
|
||||
onPressed: () => viewMode.value =
|
||||
viewMode.value == FileListViewMode.list
|
||||
? FileListViewMode.waterfall
|
||||
: FileListViewMode.list,
|
||||
tooltip:
|
||||
viewMode.value == FileListViewMode.list
|
||||
tooltip: viewMode.value == FileListViewMode.list
|
||||
? 'Switch to Waterfall View'
|
||||
: 'Switch to List View',
|
||||
visualDensity: const VisualDensity(
|
||||
@@ -363,10 +349,9 @@ class FileListView extends HookConsumerWidget {
|
||||
? Symbols.close
|
||||
: Symbols.select_check_box,
|
||||
),
|
||||
onPressed:
|
||||
() => isSelectionMode.value = !isSelectionMode.value,
|
||||
tooltip:
|
||||
isSelectionMode.value
|
||||
onPressed: () =>
|
||||
isSelectionMode.value = !isSelectionMode.value,
|
||||
tooltip: isSelectionMode.value
|
||||
? 'Exit Selection Mode'
|
||||
: 'Enter Selection Mode',
|
||||
visualDensity: const VisualDensity(
|
||||
@@ -377,8 +362,7 @@ class FileListView extends HookConsumerWidget {
|
||||
if (mode.value == FileListMode.normal)
|
||||
IconButton(
|
||||
icon: const Icon(Symbols.create_new_folder),
|
||||
onPressed:
|
||||
() =>
|
||||
onPressed: () =>
|
||||
onShowCreateDirectory(ref.context, currentPath),
|
||||
tooltip: 'Create Directory',
|
||||
visualDensity: const VisualDensity(
|
||||
@@ -397,8 +381,7 @@ class FileListView extends HookConsumerWidget {
|
||||
recycled.value = !recycled.value;
|
||||
unindexedNotifier.setRecycled(recycled.value);
|
||||
},
|
||||
tooltip:
|
||||
recycled.value
|
||||
tooltip: recycled.value
|
||||
? 'Show Active Files'
|
||||
: 'Show Recycle Bin',
|
||||
visualDensity: const VisualDensity(
|
||||
@@ -429,11 +412,13 @@ class FileListView extends HookConsumerWidget {
|
||||
if (mode.value == FileListMode.normal && currentPath.value == '/')
|
||||
_buildUnindexedFilesEntry(ref).padding(bottom: 12),
|
||||
Expanded(
|
||||
child: CustomScrollView(
|
||||
child:
|
||||
CustomScrollView(
|
||||
slivers: [bodyWidget, const SliverGap(12)],
|
||||
).padding(
|
||||
horizontal:
|
||||
viewMode.value == FileListViewMode.waterfall ? 12 : null,
|
||||
horizontal: viewMode.value == FileListViewMode.waterfall
|
||||
? 12
|
||||
: null,
|
||||
),
|
||||
),
|
||||
if (isSelectionMode.value)
|
||||
@@ -457,8 +442,7 @@ class FileListView extends HookConsumerWidget {
|
||||
const Gap(12),
|
||||
OutlinedButton(
|
||||
onPressed: () {
|
||||
final allIds =
|
||||
currentVisibleItems.value
|
||||
final allIds = currentVisibleItems.value
|
||||
.expand(
|
||||
(item) => item.maybeMap(
|
||||
file: (f) => [f.fileIndex.id],
|
||||
@@ -502,8 +486,7 @@ class FileListView extends HookConsumerWidget {
|
||||
ElevatedButton.icon(
|
||||
icon: const Icon(Symbols.delete),
|
||||
label: const Text('Delete'),
|
||||
onPressed:
|
||||
selectedFileIds.value.isNotEmpty
|
||||
onPressed: selectedFileIds.value.isNotEmpty
|
||||
? () async {
|
||||
final confirmed = await showConfirmAlert(
|
||||
'Are you sure you want to delete the selected files?',
|
||||
@@ -519,8 +502,8 @@ class FileListView extends HookConsumerWidget {
|
||||
final resp = await client.post(
|
||||
'/drive/files/batches/delete',
|
||||
data: {
|
||||
'file_ids':
|
||||
selectedFileIds.value.toList(),
|
||||
'file_ids': selectedFileIds.value
|
||||
.toList(),
|
||||
},
|
||||
);
|
||||
final count = resp.data['count'] as int;
|
||||
@@ -584,8 +567,7 @@ class FileListView extends HookConsumerWidget {
|
||||
|
||||
final item = items[index];
|
||||
return item.map(
|
||||
file:
|
||||
(fileItem) => _buildWaterfallFileTile(
|
||||
file: (fileItem) => _buildWaterfallFileTile(
|
||||
fileItem,
|
||||
ref,
|
||||
context,
|
||||
@@ -601,8 +583,7 @@ class FileListView extends HookConsumerWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
folder:
|
||||
(folderItem) =>
|
||||
folder: (folderItem) =>
|
||||
_buildWaterfallFolderTile(folderItem, currentPath, context),
|
||||
unindexedFile: (unindexedFileItem) {
|
||||
// Should not happen
|
||||
@@ -620,8 +601,7 @@ class FileListView extends HookConsumerWidget {
|
||||
}
|
||||
final item = items[index];
|
||||
return item.map(
|
||||
file:
|
||||
(fileItem) => _buildIndexedListTile(
|
||||
file: (fileItem) => _buildIndexedListTile(
|
||||
fileItem,
|
||||
ref,
|
||||
context,
|
||||
@@ -637,8 +617,7 @@ class FileListView extends HookConsumerWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
folder:
|
||||
(folderItem) => ListTile(
|
||||
folder: (folderItem) => ListTile(
|
||||
leading: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
child: SizedBox(
|
||||
@@ -654,8 +633,7 @@ class FileListView extends HookConsumerWidget {
|
||||
),
|
||||
subtitle: const Text('folder').tr(),
|
||||
onTap: () {
|
||||
final newPath =
|
||||
currentPath.value == '/'
|
||||
final newPath = currentPath.value == '/'
|
||||
? '/${folderItem.folderName}'
|
||||
: '${currentPath.value}/${folderItem.folderName}';
|
||||
currentPath.value = newPath;
|
||||
@@ -705,8 +683,7 @@ class FileListView extends HookConsumerWidget {
|
||||
ValueNotifier<String> currentPath,
|
||||
) {
|
||||
return Card(
|
||||
margin:
|
||||
viewMode.value == FileListViewMode.waterfall
|
||||
margin: viewMode.value == FileListViewMode.waterfall
|
||||
? const EdgeInsets.fromLTRB(0, 0, 0, 16)
|
||||
: const EdgeInsets.fromLTRB(12, 0, 12, 16),
|
||||
child: Padding(
|
||||
@@ -748,8 +725,8 @@ class FileListView extends HookConsumerWidget {
|
||||
),
|
||||
const Gap(12),
|
||||
OutlinedButton.icon(
|
||||
onPressed:
|
||||
() => onShowCreateDirectory(ref.context, currentPath),
|
||||
onPressed: () =>
|
||||
onShowCreateDirectory(ref.context, currentPath),
|
||||
icon: const Icon(Symbols.create_new_folder),
|
||||
label: const Text('Create Directory'),
|
||||
),
|
||||
@@ -822,8 +799,9 @@ class FileListView extends HookConsumerWidget {
|
||||
VoidCallback? toggleSelection,
|
||||
) {
|
||||
final meta = file.fileMeta is Map ? (file.fileMeta as Map) : const {};
|
||||
final ratio =
|
||||
meta['ratio'] is num ? (meta['ratio'] as num).toDouble() : 1.0;
|
||||
final ratio = meta['ratio'] is num
|
||||
? (meta['ratio'] as num).toDouble()
|
||||
: 1.0;
|
||||
final itemType = file.mimeType?.split('/').first;
|
||||
final uri =
|
||||
'${ref.read(apiClientProvider).options.baseUrl}/drive/files/${file.id}';
|
||||
@@ -851,9 +829,7 @@ class FileListView extends HookConsumerWidget {
|
||||
.read(apiClientProvider)
|
||||
.get(uri)
|
||||
.then((response) => response.data as String),
|
||||
builder:
|
||||
(context, snapshot) =>
|
||||
snapshot.hasData
|
||||
builder: (context, snapshot) => snapshot.hasData
|
||||
? SingleChildScrollView(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Text(
|
||||
@@ -961,8 +937,7 @@ class FileListView extends HookConsumerWidget {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () {
|
||||
final newPath =
|
||||
currentPath.value == '/'
|
||||
final newPath = currentPath.value == '/'
|
||||
? '/${folderItem.folderName}'
|
||||
: '${currentPath.value}/${folderItem.folderName}';
|
||||
currentPath.value = newPath;
|
||||
@@ -1038,8 +1013,8 @@ class FileListView extends HookConsumerWidget {
|
||||
// Should not happen in unindexed mode
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
unindexedFile:
|
||||
(unindexedFileItem) => _buildWaterfallUnindexedFileTile(
|
||||
unindexedFile: (unindexedFileItem) =>
|
||||
_buildWaterfallUnindexedFileTile(
|
||||
unindexedFileItem,
|
||||
ref,
|
||||
context,
|
||||
@@ -1077,17 +1052,14 @@ class FileListView extends HookConsumerWidget {
|
||||
// Should not happen in unindexed mode
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
unindexedFile:
|
||||
(unindexedFileItem) => _buildUnindexedListTile(
|
||||
unindexedFile: (unindexedFileItem) => _buildUnindexedListTile(
|
||||
unindexedFileItem,
|
||||
ref,
|
||||
context,
|
||||
isSelectionMode.value,
|
||||
selectedFileIds.value.contains(unindexedFileItem.file.id),
|
||||
() {
|
||||
if (selectedFileIds.value.contains(
|
||||
unindexedFileItem.file.id,
|
||||
)) {
|
||||
if (selectedFileIds.value.contains(unindexedFileItem.file.id)) {
|
||||
selectedFileIds.value = Set.from(selectedFileIds.value)
|
||||
..remove(unindexedFileItem.file.id);
|
||||
} else {
|
||||
@@ -1130,8 +1102,7 @@ class FileListView extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
title:
|
||||
file.name.isEmpty
|
||||
title: file.name.isEmpty
|
||||
? Text('untitled').tr().italic()
|
||||
: Text(file.name, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
subtitle: Text(formatFileSize(file.size)),
|
||||
@@ -1199,8 +1170,7 @@ class FileListView extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
title:
|
||||
file.name.isEmpty
|
||||
title: file.name.isEmpty
|
||||
? Text('untitled').tr().italic()
|
||||
: Text(file.name, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
subtitle: Text(formatFileSize(file.size)),
|
||||
@@ -1289,8 +1259,7 @@ class FileListView extends HookConsumerWidget {
|
||||
|
||||
Widget _buildEmptyUnindexedFilesHint(WidgetRef ref) {
|
||||
return Card(
|
||||
margin:
|
||||
viewMode.value == FileListViewMode.waterfall
|
||||
margin: viewMode.value == FileListViewMode.waterfall
|
||||
? EdgeInsets.zero
|
||||
: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
||||
child: Padding(
|
||||
@@ -1395,8 +1364,7 @@ class FileListView extends HookConsumerWidget {
|
||||
ObjectRef<Timer?> queryDebounceTimer,
|
||||
) {
|
||||
final poolDropdownItems = poolsAsync.when(
|
||||
data:
|
||||
(pools) => [
|
||||
data: (pools) => [
|
||||
const DropdownMenuItem<SnFilePool>(
|
||||
value: null,
|
||||
child: Text('All Pools', style: TextStyle(fontSize: 14)),
|
||||
@@ -1416,8 +1384,7 @@ class FileListView extends HookConsumerWidget {
|
||||
child: DropdownButton2<SnFilePool>(
|
||||
value: selectedPool.value,
|
||||
items: poolDropdownItems,
|
||||
onChanged:
|
||||
isRefreshing
|
||||
onChanged: isRefreshing
|
||||
? null
|
||||
: (value) {
|
||||
selectedPool.value = value;
|
||||
@@ -1493,13 +1460,11 @@ class FileListView extends HookConsumerWidget {
|
||||
final orderDropdown = DropdownButtonHideUnderline(
|
||||
child: DropdownButton2<String>(
|
||||
value: order.value,
|
||||
items:
|
||||
['date', 'size', 'name']
|
||||
items: ['date', 'size', 'name']
|
||||
.map(
|
||||
(e) => DropdownMenuItem(
|
||||
value: e,
|
||||
child:
|
||||
Text(
|
||||
child: Text(
|
||||
e == 'date' ? e : 'file${e.capitalizeEachWord()}',
|
||||
style: const TextStyle(fontSize: 14),
|
||||
).tr(),
|
||||
@@ -1517,8 +1482,7 @@ class FileListView extends HookConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child:
|
||||
Text(
|
||||
child: Text(
|
||||
(order.value ?? 'date') == 'date'
|
||||
? (order.value ?? 'date')
|
||||
: 'file${order.value?.capitalizeEachWord()}',
|
||||
|
||||
@@ -24,7 +24,7 @@ import 'package:island/widgets/post/compose_link_attachments.dart';
|
||||
import 'package:island/widgets/post/compose_poll.dart';
|
||||
import 'package:island/widgets/post/compose_fund.dart';
|
||||
import 'package:island/widgets/post/compose_recorder.dart';
|
||||
import 'package:island/pods/file_pool.dart';
|
||||
import 'package:island/pods/drive/file_pool.dart';
|
||||
import 'package:pasteboard/pasteboard.dart';
|
||||
import 'package:island/talker.dart';
|
||||
|
||||
@@ -108,8 +108,8 @@ class ComposeLogic {
|
||||
String? pollId;
|
||||
String? fundId;
|
||||
if (originalPost?.meta?['embeds'] is List) {
|
||||
final embeds =
|
||||
(originalPost!.meta!['embeds'] as List).cast<Map<String, dynamic>>();
|
||||
final embeds = (originalPost!.meta!['embeds'] as List)
|
||||
.cast<Map<String, dynamic>>();
|
||||
try {
|
||||
final pollEmbed = embeds.firstWhere((e) => e['type'] == 'poll');
|
||||
pollId = pollEmbed['id'];
|
||||
@@ -202,8 +202,7 @@ class ComposeLogic {
|
||||
final attachment = state.attachments.value[i];
|
||||
if (attachment.data is! SnCloudFile) {
|
||||
try {
|
||||
final cloudFile =
|
||||
await FileUploader.createCloudFile(
|
||||
final cloudFile = await FileUploader.createCloudFile(
|
||||
ref: ref,
|
||||
fileData: attachment,
|
||||
).future;
|
||||
@@ -242,8 +241,7 @@ class ComposeLogic {
|
||||
repliedPost: null,
|
||||
forwardedPostId: null,
|
||||
forwardedPost: null,
|
||||
attachments:
|
||||
state.attachments.value
|
||||
attachments: state.attachments.value
|
||||
.map((e) => e.data)
|
||||
.whereType<SnCloudFile>()
|
||||
.toList(),
|
||||
@@ -315,8 +313,7 @@ class ComposeLogic {
|
||||
repliedPost: null,
|
||||
forwardedPostId: null,
|
||||
forwardedPost: null,
|
||||
attachments:
|
||||
state.attachments.value
|
||||
attachments: state.attachments.value
|
||||
.map((e) => e.data)
|
||||
.whereType<SnCloudFile>()
|
||||
.toList(),
|
||||
@@ -501,8 +498,7 @@ class ComposeLogic {
|
||||
UniversalFile value,
|
||||
int index,
|
||||
) {
|
||||
state.attachments.value =
|
||||
state.attachments.value.mapIndexed((idx, ele) {
|
||||
state.attachments.value = state.attachments.value.mapIndexed((idx, ele) {
|
||||
if (idx == index) return value;
|
||||
return ele;
|
||||
}).toList();
|
||||
@@ -528,13 +524,11 @@ class ComposeLogic {
|
||||
final pools = await ref.read(poolsProvider.future);
|
||||
final selectedPoolId = resolveDefaultPoolId(ref, pools);
|
||||
|
||||
cloudFile =
|
||||
await FileUploader.createCloudFile(
|
||||
cloudFile = await FileUploader.createCloudFile(
|
||||
ref: ref,
|
||||
fileData: attachment,
|
||||
poolId: poolId ?? selectedPoolId,
|
||||
mode:
|
||||
attachment.type == UniversalFileType.file
|
||||
mode: attachment.type == UniversalFileType.file
|
||||
? FileUploadMode.generic
|
||||
: FileUploadMode.mediaSafe,
|
||||
onProgress: (progress, _) {
|
||||
@@ -713,8 +707,7 @@ class ComposeLogic {
|
||||
if (state.slugController.text.isNotEmpty)
|
||||
'slug': state.slugController.text,
|
||||
'visibility': state.visibility.value,
|
||||
'attachments':
|
||||
state.attachments.value
|
||||
'attachments': state.attachments.value
|
||||
.where((e) => e.isOnCloud)
|
||||
.map((e) => e.data.id)
|
||||
.toList(),
|
||||
|
||||
@@ -1,81 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
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';
|
||||
import 'package:island/pods/post/post_list.dart';
|
||||
import 'package:island/widgets/paging/pagination_list.dart';
|
||||
import 'package:island/widgets/post/post_item.dart';
|
||||
import 'package:island/widgets/post/post_item_creator.dart';
|
||||
import 'package:island/widgets/post/post_item_skeleton.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;
|
||||
}
|
||||
|
||||
final postListNotifierProvider = AsyncNotifierProvider.autoDispose
|
||||
.family<PostListNotifier, List<SnPost>, PostListQuery>(
|
||||
PostListNotifier.new,
|
||||
);
|
||||
|
||||
class PostListNotifier extends AsyncNotifier<List<SnPost>>
|
||||
with AsyncPaginationController<SnPost> {
|
||||
final PostListQuery arg;
|
||||
PostListNotifier(this.arg);
|
||||
|
||||
static const int pageSize = 20;
|
||||
|
||||
@override
|
||||
Future<List<SnPost>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
|
||||
final queryParams = {
|
||||
'offset': fetchedCount,
|
||||
'take': pageSize,
|
||||
'replies': arg.includeReplies,
|
||||
'orderDesc': arg.orderDesc,
|
||||
if (arg.shuffle) 'shuffle': arg.shuffle,
|
||||
if (arg.pubName != null) 'pub': arg.pubName,
|
||||
if (arg.realm != null) 'realm': arg.realm,
|
||||
if (arg.type != null) 'type': arg.type,
|
||||
if (arg.tags != null) 'tags': arg.tags,
|
||||
if (arg.categories != null) 'categories': arg.categories,
|
||||
if (arg.pinned != null) 'pinned': arg.pinned,
|
||||
if (arg.order != null) 'order': arg.order,
|
||||
if (arg.periodStart != null) 'periodStart': arg.periodStart,
|
||||
if (arg.periodEnd != null) 'periodEnd': arg.periodEnd,
|
||||
if (arg.queryTerm != null) 'query': arg.queryTerm,
|
||||
if (arg.mediaOnly != null) 'media': arg.mediaOnly,
|
||||
};
|
||||
|
||||
final response = await client.get(
|
||||
'/sphere/posts',
|
||||
queryParameters: queryParams,
|
||||
);
|
||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||
final List<dynamic> data = response.data;
|
||||
return data.map((json) => SnPost.fromJson(json)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines which post item widget to use in the list
|
||||
enum PostItemType {
|
||||
/// Regular post item with user information
|
||||
|
||||
@@ -113,10 +113,7 @@ return $default(_that);case _:
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ReactionListQuery():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
return $default(_that);}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
@@ -175,10 +172,7 @@ return $default(_that.symbol,_that.postId);case _:
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String symbol, String postId) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ReactionListQuery():
|
||||
return $default(_that.symbol,_that.postId);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
return $default(_that.symbol,_that.postId);}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
|
||||
271
lib/widgets/posts/post_filter.dart
Normal file
271
lib/widgets/posts/post_filter.dart
Normal file
@@ -0,0 +1,271 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
class PostFilterWidget extends StatelessWidget {
|
||||
final TabController categoryTabController;
|
||||
final ValueNotifier<bool?> includeReplies;
|
||||
final ValueNotifier<bool> mediaOnly;
|
||||
final ValueNotifier<String?> queryTerm;
|
||||
final ValueNotifier<String?> order;
|
||||
final ValueNotifier<bool> orderDesc;
|
||||
final ValueNotifier<int?> periodStart;
|
||||
final ValueNotifier<int?> periodEnd;
|
||||
final ValueNotifier<bool> showAdvancedFilters;
|
||||
final bool hideSearch;
|
||||
|
||||
const PostFilterWidget({
|
||||
super.key,
|
||||
required this.categoryTabController,
|
||||
required this.includeReplies,
|
||||
required this.mediaOnly,
|
||||
required this.queryTerm,
|
||||
required this.order,
|
||||
required this.orderDesc,
|
||||
required this.periodStart,
|
||||
required this.periodEnd,
|
||||
required this.showAdvancedFilters,
|
||||
this.hideSearch = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
controller: categoryTabController,
|
||||
dividerColor: Colors.transparent,
|
||||
splashBorderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
tabs: [
|
||||
Tab(text: 'all'.tr()),
|
||||
Tab(text: 'postTypePost'.tr()),
|
||||
Tab(text: 'postArticle'.tr()),
|
||||
],
|
||||
),
|
||||
const Divider(height: 1),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CheckboxListTile(
|
||||
title: Text('reply'.tr()),
|
||||
value: includeReplies.value,
|
||||
tristate: true,
|
||||
onChanged: (value) {
|
||||
// Cycle through: null -> false -> true -> null
|
||||
if (includeReplies.value == null) {
|
||||
includeReplies.value = false;
|
||||
} else if (includeReplies.value == false) {
|
||||
includeReplies.value = true;
|
||||
} else {
|
||||
includeReplies.value = null;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.reply),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CheckboxListTile(
|
||||
title: Text('attachments'.tr()),
|
||||
value: mediaOnly.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
mediaOnly.value = value;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.attachment),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
CheckboxListTile(
|
||||
title: Text('descendingOrder'.tr()),
|
||||
value: orderDesc.value,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
orderDesc.value = value;
|
||||
}
|
||||
},
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
secondary: const Icon(Symbols.sort),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
title: Text('advancedFilters'.tr()),
|
||||
leading: const Icon(Symbols.filter_list),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(const Radius.circular(8)),
|
||||
),
|
||||
trailing: Icon(
|
||||
showAdvancedFilters.value
|
||||
? Symbols.expand_less
|
||||
: Symbols.expand_more,
|
||||
),
|
||||
onTap: () {
|
||||
showAdvancedFilters.value = !showAdvancedFilters.value;
|
||||
},
|
||||
),
|
||||
if (showAdvancedFilters.value) ...[
|
||||
const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (!hideSearch)
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'search'.tr(),
|
||||
hintText: 'searchPosts'.tr(),
|
||||
prefixIcon: const Icon(Symbols.search),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
queryTerm.value = value.isEmpty ? null : value;
|
||||
},
|
||||
),
|
||||
if (!hideSearch) const Gap(12),
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'sortBy'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
),
|
||||
value: order.value,
|
||||
items: [
|
||||
DropdownMenuItem(value: 'date', child: Text('date'.tr())),
|
||||
DropdownMenuItem(
|
||||
value: 'popularity',
|
||||
child: Text('popularity'.tr()),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
order.value = value;
|
||||
},
|
||||
),
|
||||
const Gap(12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: periodStart.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodStart.value! * 1000,
|
||||
)
|
||||
: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now().add(
|
||||
const Duration(days: 365),
|
||||
),
|
||||
);
|
||||
if (pickedDate != null) {
|
||||
periodStart.value =
|
||||
pickedDate.millisecondsSinceEpoch ~/ 1000;
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'fromDate'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
suffixIcon: const Icon(Symbols.calendar_today),
|
||||
),
|
||||
child: Text(
|
||||
periodStart.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodStart.value! * 1000,
|
||||
).toString().split(' ')[0]
|
||||
: 'selectDate'.tr(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
final pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: periodEnd.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodEnd.value! * 1000,
|
||||
)
|
||||
: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now().add(
|
||||
const Duration(days: 365),
|
||||
),
|
||||
);
|
||||
if (pickedDate != null) {
|
||||
periodEnd.value =
|
||||
pickedDate.millisecondsSinceEpoch ~/ 1000;
|
||||
}
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'toDate'.tr(),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
suffixIcon: const Icon(Symbols.calendar_today),
|
||||
),
|
||||
child: Text(
|
||||
periodEnd.value != null
|
||||
? DateTime.fromMillisecondsSinceEpoch(
|
||||
periodEnd.value! * 1000,
|
||||
).toString().split(' ')[0]
|
||||
: 'selectDate'.tr(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/drive_task.dart';
|
||||
import 'package:island/pods/upload_tasks.dart';
|
||||
import 'package:island/pods/drive/upload_tasks.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@@ -223,11 +223,11 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
if (!isExpanded && activeTasks.isNotEmpty)
|
||||
Text(
|
||||
_getOverallProgressText(activeTasks),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
Theme.of(
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
@@ -244,8 +244,7 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
child: CircularProgressIndicator(
|
||||
value: _getOverallProgress(activeTasks),
|
||||
strokeWidth: 3,
|
||||
backgroundColor:
|
||||
Theme.of(
|
||||
backgroundColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
@@ -263,8 +262,8 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
onPressed:
|
||||
() => onExpansionChanged?.call(!isExpanded),
|
||||
onPressed: () =>
|
||||
onExpansionChanged?.call(!isExpanded),
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
@@ -297,8 +296,7 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
leading: Icon(
|
||||
Symbols.clear_all,
|
||||
size: 18,
|
||||
color:
|
||||
Theme.of(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
@@ -307,8 +305,7 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
onExpansionChanged?.call(false);
|
||||
},
|
||||
|
||||
tileColor:
|
||||
Theme.of(
|
||||
tileColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
@@ -326,15 +323,15 @@ class _UploadOverlayContent extends HookConsumerWidget {
|
||||
leading: Icon(
|
||||
Symbols.clear_all,
|
||||
size: 18,
|
||||
color:
|
||||
Theme.of(context).colorScheme.error,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.error,
|
||||
),
|
||||
onTap: () {
|
||||
taskNotifier.clearAllTasks();
|
||||
onExpansionChanged?.call(false);
|
||||
},
|
||||
tileColor:
|
||||
Theme.of(
|
||||
tileColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
@@ -556,8 +553,9 @@ class _UploadTaskTileState extends State<UploadTaskTile>
|
||||
child: CircularProgressIndicator(
|
||||
value: widget.task.progress,
|
||||
strokeWidth: 2.5,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
backgroundColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -604,8 +602,7 @@ class _UploadTaskTileState extends State<UploadTaskTile>
|
||||
color = Theme.of(context).colorScheme.secondary;
|
||||
break;
|
||||
case DriveTaskStatus.inProgress:
|
||||
icon =
|
||||
widget.task.type == 'FileDownload'
|
||||
icon = widget.task.type == 'FileDownload'
|
||||
? Symbols.download
|
||||
: Symbols.upload;
|
||||
color = Theme.of(context).colorScheme.primary;
|
||||
|
||||
Reference in New Issue
Block a user