diff --git a/assets/locales/en_us.json b/assets/locales/en_us.json index 7e89e81..32d9dd2 100644 --- a/assets/locales/en_us.json +++ b/assets/locales/en_us.json @@ -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", diff --git a/assets/locales/zh_cn.json b/assets/locales/zh_cn.json index 784360e..b1e23e6 100644 --- a/assets/locales/zh_cn.json +++ b/assets/locales/zh_cn.json @@ -23,6 +23,8 @@ "shareNoUri": "分享文字内容", "alias": "别名", "feed": "资讯", + "explore": "探索", + "posts": "帖子", "unlink": "移除链接", "dashboard": "仪表盘", "today": "今日", diff --git a/lib/models/account.dart b/lib/models/account.dart index be1534a..8b4cc66 100644 --- a/lib/models/account.dart +++ b/lib/models/account.dart @@ -18,7 +18,6 @@ class Account { AccountProfile? profile; List? 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 json) => diff --git a/lib/models/account.g.dart b/lib/models/account.g.dart index 416ecc7..81ad727 100644 --- a/lib/models/account.g.dart +++ b/lib/models/account.g.dart @@ -31,7 +31,6 @@ Account _$AccountFromJson(Map json) => Account( ?.map((e) => AccountBadge.fromJson(e as Map)) .toList(), emailAddress: json['email_address'] as String?, - externalId: (json['external_id'] as num?)?.toInt(), ); Map _$AccountToJson(Account instance) => { @@ -49,7 +48,6 @@ Map _$AccountToJson(Account instance) => { 'profile': instance.profile?.toJson(), 'badges': instance.badges?.map((e) => e.toJson()).toList(), 'email_address': instance.emailAddress, - 'external_id': instance.externalId, }; AccountBadge _$AccountBadgeFromJson(Map json) => AccountBadge( diff --git a/lib/screens/channel/channel_chat.dart b/lib/screens/channel/channel_chat.dart index 1f00409..67cdcfe 100644 --- a/lib/screens/channel/channel_chat.dart +++ b/lib/screens/channel/channel_chat.dart @@ -204,9 +204,8 @@ class _ChannelChatScreenState extends State 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}'}, diff --git a/lib/screens/channel/channel_detail.dart b/lib/screens/channel/channel_detail.dart index e0d8112..8369ae2 100644 --- a/lib/screens/channel/channel_detail.dart +++ b/lib/screens/channel/channel_detail.dart @@ -43,8 +43,7 @@ class _ChannelDetailScreenState extends State { 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; }); } diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index 747b70a..ab2dff8 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -102,6 +102,9 @@ class _DashboardScreenState extends State { 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 { 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, + ), + ); + }, + ), ), ), ], diff --git a/lib/widgets/channel/channel_list.dart b/lib/widgets/channel/channel_list.dart index 4ce79f6..3979382 100644 --- a/lib/widgets/channel/channel_list.dart +++ b/lib/widgets/channel/channel_list.dart @@ -127,9 +127,8 @@ class _ChannelListWidgetState extends State { : 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( diff --git a/lib/widgets/channel/channel_member.dart b/lib/widgets/channel/channel_member.dart index 27a3e7a..396f4c0 100644 --- a/lib/widgets/channel/channel_member.dart +++ b/lib/widgets/channel/channel_member.dart @@ -176,7 +176,7 @@ class _ChannelMemberListPopupState extends State { IconButton( color: Colors.red, icon: const Icon(Icons.remove_circle), - onPressed: element.account.externalId == _accountId + onPressed: element.account.id == _accountId ? null : () => removeMember(element), ), diff --git a/lib/widgets/chat/chat_event_action.dart b/lib/widgets/chat/chat_event_action.dart index 708e7fc..c01087d 100644 --- a/lib/widgets/chat/chat_event_action.dart +++ b/lib/widgets/chat/chat_event_action.dart @@ -41,8 +41,8 @@ class _ChatEventActionState extends State { 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; }); } diff --git a/lib/widgets/posts/post_action.dart b/lib/widgets/posts/post_action.dart index cbd1a97..f000a35 100644 --- a/lib/widgets/posts/post_action.dart +++ b/lib/widgets/posts/post_action.dart @@ -35,7 +35,7 @@ class _PostActionState extends State { setState(() { _canModifyContent = - auth.userProfile.value!['id'] == widget.item.author.externalId; + auth.userProfile.value!['id'] == widget.item.author.id; _isBusy = false; }); } diff --git a/lib/widgets/realms/realm_member.dart b/lib/widgets/realms/realm_member.dart index fe407c1..ba2e6e8 100644 --- a/lib/widgets/realms/realm_member.dart +++ b/lib/widgets/realms/realm_member.dart @@ -173,7 +173,7 @@ class _RealmMemberListPopupState extends State { IconButton( color: Colors.red, icon: const Icon(Icons.remove_circle), - onPressed: element.account.externalId == _accountId + onPressed: element.account.id == _accountId ? null : () => removeMember(element), ),