👽 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", "shareNoUri": "Share text content",
"alias": "Alias", "alias": "Alias",
"feed": "Feed", "feed": "Feed",
"explore": "Explore",
"posts": "Posts",
"unlink": "Unlink", "unlink": "Unlink",
"feedSearch": "Search Feed", "feedSearch": "Search Feed",
"feedSearchWithTag": "Searching with tag #@key", "feedSearchWithTag": "Searching with tag #@key",

View File

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

View File

@ -18,7 +18,6 @@ class Account {
AccountProfile? profile; AccountProfile? profile;
List<AccountBadge>? badges; List<AccountBadge>? badges;
String? emailAddress; String? emailAddress;
int? externalId;
Account({ Account({
required this.id, required this.id,
@ -35,7 +34,6 @@ class Account {
required this.profile, required this.profile,
required this.badges, required this.badges,
required this.emailAddress, required this.emailAddress,
this.externalId,
}); });
factory Account.fromJson(Map<String, dynamic> json) => 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>)) ?.map((e) => AccountBadge.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
emailAddress: json['email_address'] as String?, emailAddress: json['email_address'] as String?,
externalId: (json['external_id'] as num?)?.toInt(),
); );
Map<String, dynamic> _$AccountToJson(Account instance) => <String, dynamic>{ Map<String, dynamic> _$AccountToJson(Account instance) => <String, dynamic>{
@ -49,7 +48,6 @@ Map<String, dynamic> _$AccountToJson(Account instance) => <String, dynamic>{
'profile': instance.profile?.toJson(), 'profile': instance.profile?.toJson(),
'badges': instance.badges?.map((e) => e.toJson()).toList(), 'badges': instance.badges?.map((e) => e.toJson()).toList(),
'email_address': instance.emailAddress, 'email_address': instance.emailAddress,
'external_id': instance.externalId,
}; };
AccountBadge _$AccountBadgeFromJson(Map<String, dynamic> json) => AccountBadge( AccountBadge _$AccountBadgeFromJson(Map<String, dynamic> json) => AccountBadge(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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