✨ Better DM
This commit is contained in:
@ -15,13 +15,13 @@ class Account {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.deletedAt,
|
||||
required this.name,
|
||||
required this.nick,
|
||||
required this.avatar,
|
||||
required this.banner,
|
||||
required this.description,
|
||||
this.emailAddress,
|
||||
required this.emailAddress,
|
||||
this.externalId,
|
||||
});
|
||||
|
||||
|
@ -15,8 +15,8 @@ class Call {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
this.endedAt,
|
||||
required this.deletedAt,
|
||||
required this.endedAt,
|
||||
required this.externalId,
|
||||
required this.founderId,
|
||||
required this.channelId,
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:solian/models/account.dart';
|
||||
import 'package:solian/models/realm.dart';
|
||||
|
||||
@ -12,6 +10,7 @@ class Channel {
|
||||
String name;
|
||||
String description;
|
||||
int type;
|
||||
List<ChannelMember>? members;
|
||||
Account account;
|
||||
int accountId;
|
||||
Realm? realm;
|
||||
@ -24,16 +23,17 @@ class Channel {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.deletedAt,
|
||||
required this.alias,
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.type,
|
||||
required this.members,
|
||||
required this.account,
|
||||
required this.accountId,
|
||||
required this.isEncrypted,
|
||||
this.realm,
|
||||
this.realmId,
|
||||
required this.realm,
|
||||
required this.realmId,
|
||||
});
|
||||
|
||||
factory Channel.fromJson(Map<String, dynamic> json) => Channel(
|
||||
@ -45,6 +45,10 @@ class Channel {
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
type: json['type'],
|
||||
members: json['members']
|
||||
?.map((e) => ChannelMember.fromJson(e))
|
||||
.toList()
|
||||
.cast<ChannelMember>(),
|
||||
account: Account.fromJson(json['account']),
|
||||
accountId: json['account_id'],
|
||||
realm: json['realm'] != null ? Realm.fromJson(json['realm']) : null,
|
||||
@ -61,21 +65,13 @@ class Channel {
|
||||
'name': name,
|
||||
'description': description,
|
||||
'type': type,
|
||||
'members': members?.map((e) => e.toJson()).toList(),
|
||||
'account': account.toJson(),
|
||||
'account_id': accountId,
|
||||
'realm': realm?.toJson(),
|
||||
'realm_id': realmId,
|
||||
'is_encrypted': isEncrypted,
|
||||
};
|
||||
|
||||
IconData get icon {
|
||||
switch (type) {
|
||||
case 1:
|
||||
return FontAwesomeIcons.userGroup;
|
||||
default:
|
||||
return FontAwesomeIcons.hashtag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ChannelMember {
|
||||
|
@ -16,10 +16,10 @@ class Friendship {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.deletedAt,
|
||||
required this.accountId,
|
||||
required this.relatedId,
|
||||
this.blockedBy,
|
||||
required this.blockedBy,
|
||||
required this.account,
|
||||
required this.related,
|
||||
required this.status,
|
||||
|
@ -16,25 +16,31 @@ class Notification {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.deletedAt,
|
||||
required this.subject,
|
||||
required this.content,
|
||||
this.links,
|
||||
required this.links,
|
||||
required this.isImportant,
|
||||
required this.isRealtime,
|
||||
this.readAt,
|
||||
this.senderId,
|
||||
required this.readAt,
|
||||
required this.senderId,
|
||||
required this.recipientId,
|
||||
});
|
||||
|
||||
factory Notification.fromJson(Map<String, dynamic> json) => Notification(
|
||||
id: json['id'] ?? 0,
|
||||
createdAt: json['created_at'] == null ? DateTime.now() : DateTime.parse(json['created_at']),
|
||||
updatedAt: json['updated_at'] == null ? DateTime.now() : DateTime.parse(json['updated_at']),
|
||||
createdAt: json['created_at'] == null
|
||||
? DateTime.now()
|
||||
: DateTime.parse(json['created_at']),
|
||||
updatedAt: json['updated_at'] == null
|
||||
? DateTime.now()
|
||||
: DateTime.parse(json['updated_at']),
|
||||
deletedAt: json['deleted_at'],
|
||||
subject: json['subject'],
|
||||
content: json['content'],
|
||||
links: json['links'] != null ? List<Link>.from(json['links'].map((x) => Link.fromJson(x))) : List.empty(),
|
||||
links: json['links'] != null
|
||||
? List<Link>.from(json['links'].map((x) => Link.fromJson(x)))
|
||||
: List.empty(),
|
||||
isImportant: json['is_important'],
|
||||
isRealtime: json['is_realtime'],
|
||||
readAt: json['read_at'],
|
||||
@ -49,7 +55,9 @@ class Notification {
|
||||
'deleted_at': deletedAt,
|
||||
'subject': subject,
|
||||
'content': content,
|
||||
'links': links != null ? List<dynamic>.from(links!.map((x) => x.toJson())) : List.empty(),
|
||||
'links': links != null
|
||||
? List<dynamic>.from(links!.map((x) => x.toJson()))
|
||||
: List.empty(),
|
||||
'is_important': isImportant,
|
||||
'is_realtime': isRealtime,
|
||||
'read_at': readAt,
|
||||
|
@ -13,11 +13,11 @@ class PersonalPage {
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.deletedAt,
|
||||
required this.content,
|
||||
required this.script,
|
||||
required this.style,
|
||||
this.links,
|
||||
required this.links,
|
||||
required this.accountId,
|
||||
});
|
||||
|
||||
@ -25,7 +25,9 @@ class PersonalPage {
|
||||
id: json['id'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
deletedAt: json['deleted_at'] != null ? DateTime.parse(json['deleted_at']) : null,
|
||||
deletedAt: json['deleted_at'] != null
|
||||
? DateTime.parse(json['deleted_at'])
|
||||
: null,
|
||||
content: json['content'],
|
||||
script: json['script'],
|
||||
style: json['style'],
|
||||
|
Reference in New Issue
Block a user