👽 The removal of external id

This commit is contained in:
LittleSheep 2024-09-11 23:40:23 +08:00
parent bba38e6845
commit f3b2a2a0ac
12 changed files with 33 additions and 31 deletions

View File

@ -18,6 +18,8 @@
"shareNoUri": "Share text content",
"alias": "Alias",
"feed": "Feed",
"explore": "Explore",
"posts": "Posts",
"unlink": "Unlink",
"feedSearch": "Search Feed",
"feedSearchWithTag": "Searching with tag #@key",

View File

@ -23,6 +23,8 @@
"shareNoUri": "分享文字内容",
"alias": "别名",
"feed": "资讯",
"explore": "探索",
"posts": "帖子",
"unlink": "移除链接",
"dashboard": "仪表盘",
"today": "今日",

View File

@ -18,7 +18,6 @@ class Account {
AccountProfile? profile;
List<AccountBadge>? badges;
String? emailAddress;
int? externalId;
Account({
required this.id,
@ -35,7 +34,6 @@ class Account {
required this.profile,
required this.badges,
required this.emailAddress,
this.externalId,
});
factory Account.fromJson(Map<String, dynamic> json) =>

View File

@ -31,7 +31,6 @@ Account _$AccountFromJson(Map<String, dynamic> json) => Account(
?.map((e) => AccountBadge.fromJson(e as Map<String, dynamic>))
.toList(),
emailAddress: json['email_address'] as String?,
externalId: (json['external_id'] as num?)?.toInt(),
);
Map<String, dynamic> _$AccountToJson(Account instance) => <String, dynamic>{
@ -49,7 +48,6 @@ Map<String, dynamic> _$AccountToJson(Account instance) => <String, dynamic>{
'profile': instance.profile?.toJson(),
'badges': instance.badges?.map((e) => e.toJson()).toList(),
'email_address': instance.emailAddress,
'external_id': instance.externalId,
};
AccountBadge _$AccountBadgeFromJson(Map<String, dynamic> json) => AccountBadge(

View File

@ -204,9 +204,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
String? placeholder;
if (_channel?.type == 1) {
final otherside = _channel!.members!
.where((e) => e.account.externalId != _accountId)
.first;
final otherside =
_channel!.members!.where((e) => e.account.id != _accountId).first;
title = otherside.account.nick;
placeholder = 'messageInputPlaceholder'.trParams(
{'channel': '@${otherside.account.name}'},

View File

@ -43,8 +43,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
void checkOwner() async {
final AuthProvider auth = Get.find();
setState(() {
_isOwned =
auth.userProfile.value!['id'] == widget.channel.account.externalId;
_isOwned = auth.userProfile.value!['id'] == widget.channel.account.id;
});
}

View File

@ -102,6 +102,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
try {
_signRecord = await _dailySign.signToday();
_dailySign.listLastRecord(30).then((value) {
setState(() => _signRecordHistory = value);
});
} catch (e) {
context.showErrorDialog(e);
}
@ -201,20 +204,22 @@ class _DashboardScreenState extends State<DashboardScreen> {
icon: const Icon(Icons.local_fire_department),
onPressed: _signingDaily ? null : _signDaily,
)
: IconButton(
tooltip: 'dailySignHistoryAction'.tr,
icon: const Icon(Icons.history),
onPressed: () {
showDialog(
context: context,
useRootNavigator: true,
builder: (context) =>
DailySignHistoryChartDialog(
data: _signRecordHistory,
),
);
},
),
: (_signRecordHistory?.isEmpty ?? true)
? const SizedBox.shrink()
: IconButton(
tooltip: 'dailySignHistoryAction'.tr,
icon: const Icon(Icons.history),
onPressed: () {
showDialog(
context: context,
useRootNavigator: true,
builder: (context) =>
DailySignHistoryChartDialog(
data: _signRecordHistory,
),
);
},
),
),
),
],

View File

@ -127,9 +127,8 @@ class _ChannelListWidgetState extends State<ChannelListWidget> {
: const EdgeInsets.symmetric(horizontal: 16);
if (item.type == 1) {
final otherside = item.members!
.where((e) => e.account.externalId != widget.selfId)
.first;
final otherside =
item.members!.where((e) => e.account.id != widget.selfId).first;
return ListTile(
leading: AccountAvatar(

View File

@ -176,7 +176,7 @@ class _ChannelMemberListPopupState extends State<ChannelMemberListPopup> {
IconButton(
color: Colors.red,
icon: const Icon(Icons.remove_circle),
onPressed: element.account.externalId == _accountId
onPressed: element.account.id == _accountId
? null
: () => removeMember(element),
),

View File

@ -41,8 +41,8 @@ class _ChatEventActionState extends State<ChatEventAction> {
setState(() => _isBusy = true);
setState(() {
_canModifyContent = auth.userProfile.value!['id'] ==
widget.item.sender.account.externalId;
_canModifyContent =
auth.userProfile.value!['id'] == widget.item.sender.account.id;
_isBusy = false;
});
}

View File

@ -35,7 +35,7 @@ class _PostActionState extends State<PostAction> {
setState(() {
_canModifyContent =
auth.userProfile.value!['id'] == widget.item.author.externalId;
auth.userProfile.value!['id'] == widget.item.author.id;
_isBusy = false;
});
}

View File

@ -173,7 +173,7 @@ class _RealmMemberListPopupState extends State<RealmMemberListPopup> {
IconButton(
color: Colors.red,
icon: const Icon(Icons.remove_circle),
onPressed: element.account.externalId == _accountId
onPressed: element.account.id == _accountId
? null
: () => removeMember(element),
),