From 8ab7e5bc121ebf3344d19cf14d1022131b6381ba Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:31:37 +0900 Subject: [PATCH] =?UTF-8?q?shiosyakeyakini-info/misskey=5Fdart#25=20?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users_show_response_extension.dart | 7 - lib/model/account.dart | 6 +- lib/model/account.freezed.dart | 24 +- lib/model/account.g.dart | 2 +- lib/router/app_router.gr.dart | 1552 ++++++++--------- .../note_create_state_notifier.dart | 26 +- lib/view/common/avatar_icon.dart | 33 - lib/view/common/common_drawer.dart | 2 +- .../misskey_notes/open_another_account.dart | 2 +- .../note_create_setting_top.dart | 4 +- .../account_settings_page/account_list.dart | 3 +- .../hard_mute_page/hard_mute_page.dart | 2 +- .../instance_mute_page.dart | 2 +- .../account_select_page.dart | 2 +- lib/view/user_page/user_control_dialog.dart | 23 +- lib/view/user_page/user_detail.dart | 233 +-- lib/view/user_page/user_page.dart | 8 +- .../users_list_detail_page.dart | 2 +- test/test_util/mock.mocks.dart | 146 +- test/test_util/test_datas.dart | 48 +- .../misskey_notes/misskey_notes_test.dart | 2 +- .../note_create_page_test.dart | 8 +- test/view/user_page/user_page_test.dart | 28 +- 23 files changed, 1084 insertions(+), 1081 deletions(-) delete mode 100644 lib/extensions/users_show_response_extension.dart diff --git a/lib/extensions/users_show_response_extension.dart b/lib/extensions/users_show_response_extension.dart deleted file mode 100644 index 687db5449..000000000 --- a/lib/extensions/users_show_response_extension.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:misskey_dart/misskey_dart.dart'; - -extension UsersShowResponseExtension on UsersShowResponse { - String get acct { - return "@$username${host != null ? "@$host" : ""}"; - } -} diff --git a/lib/model/account.dart b/lib/model/account.dart index dea8b2747..98c472a84 100644 --- a/lib/model/account.dart +++ b/lib/model/account.dart @@ -13,7 +13,7 @@ class Account with _$Account { required String host, required String userId, String? token, - required IResponse i, + required MeDetailed i, }) = _Account; factory Account.fromJson(Map<String, Object?> json) => @@ -41,7 +41,7 @@ class Account with _$Account { host: host, userId: "", token: null, - i: IResponse( + i: MeDetailed( id: "", username: "", createdAt: DateTime.now(), @@ -56,7 +56,7 @@ class Account with _$Account { followersCount: 0, notesCount: 0, publicReactions: false, - ffVisibility: "", + ffVisibility: FFVisibility.public, twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, diff --git a/lib/model/account.freezed.dart b/lib/model/account.freezed.dart index ed2914c05..5a8c0cbeb 100644 --- a/lib/model/account.freezed.dart +++ b/lib/model/account.freezed.dart @@ -23,7 +23,7 @@ mixin _$Account { String get host => throw _privateConstructorUsedError; String get userId => throw _privateConstructorUsedError; String? get token => throw _privateConstructorUsedError; - IResponse get i => throw _privateConstructorUsedError; + MeDetailed get i => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -35,9 +35,9 @@ abstract class $AccountCopyWith<$Res> { factory $AccountCopyWith(Account value, $Res Function(Account) then) = _$AccountCopyWithImpl<$Res, Account>; @useResult - $Res call({String host, String userId, String? token, IResponse i}); + $Res call({String host, String userId, String? token, MeDetailed i}); - $IResponseCopyWith<$Res> get i; + $MeDetailedCopyWith<$Res> get i; } /// @nodoc @@ -74,14 +74,14 @@ class _$AccountCopyWithImpl<$Res, $Val extends Account> i: null == i ? _value.i : i // ignore: cast_nullable_to_non_nullable - as IResponse, + as MeDetailed, ) as $Val); } @override @pragma('vm:prefer-inline') - $IResponseCopyWith<$Res> get i { - return $IResponseCopyWith<$Res>(_value.i, (value) { + $MeDetailedCopyWith<$Res> get i { + return $MeDetailedCopyWith<$Res>(_value.i, (value) { return _then(_value.copyWith(i: value) as $Val); }); } @@ -94,10 +94,10 @@ abstract class _$$AccountImplCopyWith<$Res> implements $AccountCopyWith<$Res> { __$$AccountImplCopyWithImpl<$Res>; @override @useResult - $Res call({String host, String userId, String? token, IResponse i}); + $Res call({String host, String userId, String? token, MeDetailed i}); @override - $IResponseCopyWith<$Res> get i; + $MeDetailedCopyWith<$Res> get i; } /// @nodoc @@ -132,7 +132,7 @@ class __$$AccountImplCopyWithImpl<$Res> i: null == i ? _value.i : i // ignore: cast_nullable_to_non_nullable - as IResponse, + as MeDetailed, )); } } @@ -154,7 +154,7 @@ class _$AccountImpl extends _Account { @override final String? token; @override - final IResponse i; + final MeDetailed i; @override String toString() { @@ -180,7 +180,7 @@ abstract class _Account extends Account { {required final String host, required final String userId, final String? token, - required final IResponse i}) = _$AccountImpl; + required final MeDetailed i}) = _$AccountImpl; const _Account._() : super._(); factory _Account.fromJson(Map<String, dynamic> json) = _$AccountImpl.fromJson; @@ -192,7 +192,7 @@ abstract class _Account extends Account { @override String? get token; @override - IResponse get i; + MeDetailed get i; @override @JsonKey(ignore: true) _$$AccountImplCopyWith<_$AccountImpl> get copyWith => diff --git a/lib/model/account.g.dart b/lib/model/account.g.dart index fac86496a..7e9213d1f 100644 --- a/lib/model/account.g.dart +++ b/lib/model/account.g.dart @@ -11,7 +11,7 @@ _$AccountImpl _$$AccountImplFromJson(Map<String, dynamic> json) => host: json['host'] as String, userId: json['userId'] as String, token: json['token'] as String?, - i: IResponse.fromJson(json['i'] as Map<String, dynamic>), + i: MeDetailed.fromJson(json['i'] as Map<String, dynamic>), ); Map<String, dynamic> _$$AccountImplToJson(_$AccountImpl instance) => diff --git a/lib/router/app_router.gr.dart b/lib/router/app_router.gr.dart index b80597323..cc41f0e75 100644 --- a/lib/router/app_router.gr.dart +++ b/lib/router/app_router.gr.dart @@ -15,13 +15,23 @@ abstract class _$AppRouter extends RootStackRouter { @override final Map<String, PageFactory> pagesMap = { - NotesAfterRenoteRoute.name: (routeData) { - final args = routeData.argsAs<NotesAfterRenoteRouteArgs>(); + AnnouncementRoute.name: (routeData) { + final args = routeData.argsAs<AnnouncementRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: NotesAfterRenotePage( + child: AnnouncementPage( key: args.key, - note: args.note, + account: args.account, + ), + ); + }, + AntennaNotesRoute.name: (routeData) { + final args = routeData.argsAs<AntennaNotesRouteArgs>(); + return AutoRoutePage<dynamic>( + routeData: routeData, + child: AntennaNotesPage( + key: args.key, + antenna: args.antenna, account: args.account, ), ); @@ -36,33 +46,27 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - AntennaNotesRoute.name: (routeData) { - final args = routeData.argsAs<AntennaNotesRouteArgs>(); + ChannelsRoute.name: (routeData) { + final args = routeData.argsAs<ChannelsRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: AntennaNotesPage( + child: ChannelsPage( key: args.key, - antenna: args.antenna, account: args.account, ), ); }, - NotificationRoute.name: (routeData) { - final args = routeData.argsAs<NotificationRouteArgs>(); + ChannelDetailRoute.name: (routeData) { + final args = routeData.argsAs<ChannelDetailRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: NotificationPage( + child: ChannelDetailPage( key: args.key, account: args.account, + channelId: args.channelId, ), ); }, - LoginRoute.name: (routeData) { - return AutoRoutePage<dynamic>( - routeData: routeData, - child: const LoginPage(), - ); - }, ClipDetailRoute.name: (routeData) { final args = routeData.argsAs<ClipDetailRouteArgs>(); return AutoRoutePage<dynamic>( @@ -84,227 +88,241 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - NoteCreateRoute.name: (routeData) { - final args = routeData.argsAs<NoteCreateRouteArgs>(); + ExploreRoute.name: (routeData) { + final args = routeData.argsAs<ExploreRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: NoteCreatePage( + child: ExplorePage( key: args.key, - initialAccount: args.initialAccount, - initialText: args.initialText, - initialMediaFiles: args.initialMediaFiles, - channel: args.channel, - reply: args.reply, - renote: args.renote, - note: args.note, - noteCreationMode: args.noteCreationMode, + account: args.account, ), ); }, - HashtagRoute.name: (routeData) { - final args = routeData.argsAs<HashtagRouteArgs>(); + ExploreRoleUsersRoute.name: (routeData) { + final args = routeData.argsAs<ExploreRoleUsersRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: HashtagPage( + child: ExploreRoleUsersPage( key: args.key, - hashtag: args.hashtag, + item: args.item, account: args.account, ), ); }, - UserFolloweeRoute.name: (routeData) { - final args = routeData.argsAs<UserFolloweeRouteArgs>(); + FavoritedNoteRoute.name: (routeData) { + final args = routeData.argsAs<FavoritedNoteRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: UserFolloweePage( + child: FavoritedNotePage( key: args.key, - userId: args.userId, account: args.account, ), ); }, - UserRoute.name: (routeData) { - final args = routeData.argsAs<UserRouteArgs>(); + FederationRoute.name: (routeData) { + final args = routeData.argsAs<FederationRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: UserPage( + child: FederationPage( key: args.key, - userId: args.userId, account: args.account, + host: args.host, ), ); }, - UserFollowerRoute.name: (routeData) { - final args = routeData.argsAs<UserFollowerRouteArgs>(); + HashtagRoute.name: (routeData) { + final args = routeData.argsAs<HashtagRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: UserFollowerPage( + child: HashtagPage( key: args.key, - userId: args.userId, + hashtag: args.hashtag, account: args.account, ), ); }, - PhotoEditRoute.name: (routeData) { - final args = routeData.argsAs<PhotoEditRouteArgs>(); - return AutoRoutePage<Uint8List?>( + LoginRoute.name: (routeData) { + return AutoRoutePage<dynamic>( routeData: routeData, - child: PhotoEditPage( - account: args.account, - file: args.file, - onSubmit: args.onSubmit, - key: args.key, - ), + child: const LoginPage(), ); }, - AnnouncementRoute.name: (routeData) { - final args = routeData.argsAs<AnnouncementRouteArgs>(); + MisskeyRouteRoute.name: (routeData) { + final args = routeData.argsAs<MisskeyRouteRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: AnnouncementPage( + child: MisskeyPagePage( key: args.key, account: args.account, + page: args.page, ), ); }, - SplashRoute.name: (routeData) { + NotesAfterRenoteRoute.name: (routeData) { + final args = routeData.argsAs<NotesAfterRenoteRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: const SplashPage(), + child: NotesAfterRenotePage( + key: args.key, + note: args.note, + account: args.account, + ), ); }, - SeveralAccountGeneralSettingsRoute.name: (routeData) { - final args = routeData.argsAs<SeveralAccountGeneralSettingsRouteArgs>(); + NoteCreateRoute.name: (routeData) { + final args = routeData.argsAs<NoteCreateRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: SeveralAccountGeneralSettingsPage( + child: NoteCreatePage( key: args.key, - account: args.account, + initialAccount: args.initialAccount, + initialText: args.initialText, + initialMediaFiles: args.initialMediaFiles, + channel: args.channel, + reply: args.reply, + renote: args.renote, + note: args.note, + noteCreationMode: args.noteCreationMode, ), ); }, - SeveralAccountSettingsRoute.name: (routeData) { - final args = routeData.argsAs<SeveralAccountSettingsRouteArgs>(); + NoteDetailRoute.name: (routeData) { + final args = routeData.argsAs<NoteDetailRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: SeveralAccountSettingsPage( + child: NoteDetailPage( key: args.key, + note: args.note, account: args.account, ), ); }, - InstanceMuteRoute.name: (routeData) { - final args = routeData.argsAs<InstanceMuteRouteArgs>(); + NotificationRoute.name: (routeData) { + final args = routeData.argsAs<NotificationRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: InstanceMutePage( + child: NotificationPage( key: args.key, account: args.account, ), ); }, - HardMuteRoute.name: (routeData) { - final args = routeData.argsAs<HardMuteRouteArgs>(); - return AutoRoutePage<dynamic>( + PhotoEditRoute.name: (routeData) { + final args = routeData.argsAs<PhotoEditRouteArgs>(); + return AutoRoutePage<Uint8List?>( routeData: routeData, - child: HardMutePage( - key: args.key, + child: PhotoEditPage( account: args.account, + file: args.file, + onSubmit: args.onSubmit, + key: args.key, ), ); }, - ReactionDeckRoute.name: (routeData) { - final args = routeData.argsAs<ReactionDeckRouteArgs>(); + SearchRoute.name: (routeData) { + final args = routeData.argsAs<SearchRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: ReactionDeckPage( + child: SearchPage( key: args.key, + initialSearchText: args.initialSearchText, account: args.account, ), ); }, - UsersListTimelineRoute.name: (routeData) { - final args = routeData.argsAs<UsersListTimelineRouteArgs>(); + AccountListRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, - child: UsersListTimelinePage( - args.account, - args.list, - key: args.key, - ), + child: const AccountListPage(), ); }, - UsersListRoute.name: (routeData) { - final args = routeData.argsAs<UsersListRouteArgs>(); + AppInfoRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, - child: UsersListPage( - args.account, - key: args.key, - ), + child: const AppInfoPage(), ); }, - UsersListDetailRoute.name: (routeData) { - final args = routeData.argsAs<UsersListDetailRouteArgs>(); + GeneralSettingsRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, - child: UsersListDetailPage( + child: const GeneralSettingsPage(), + ); + }, + ImportExportRoute.name: (routeData) { + return AutoRoutePage<dynamic>( + routeData: routeData, + child: const ImportExportPage(), + ); + }, + SettingsRoute.name: (routeData) { + return AutoRoutePage<dynamic>( + routeData: routeData, + child: const SettingsPage(), + ); + }, + TabSettingsListRoute.name: (routeData) { + return AutoRoutePage<dynamic>( + routeData: routeData, + child: const TabSettingsListPage(), + ); + }, + TabSettingsRoute.name: (routeData) { + final args = routeData.argsAs<TabSettingsRouteArgs>( + orElse: () => const TabSettingsRouteArgs()); + return AutoRoutePage<dynamic>( + routeData: routeData, + child: TabSettingsPage( key: args.key, - account: args.account, - listId: args.listId, + tabIndex: args.tabIndex, ), ); }, - ChannelDetailRoute.name: (routeData) { - final args = routeData.argsAs<ChannelDetailRouteArgs>(); + HardMuteRoute.name: (routeData) { + final args = routeData.argsAs<HardMuteRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: ChannelDetailPage( + child: HardMutePage( key: args.key, account: args.account, - channelId: args.channelId, ), ); }, - ChannelsRoute.name: (routeData) { - final args = routeData.argsAs<ChannelsRouteArgs>(); + InstanceMuteRoute.name: (routeData) { + final args = routeData.argsAs<InstanceMuteRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: ChannelsPage( + child: InstanceMutePage( key: args.key, account: args.account, ), ); }, - FederationRoute.name: (routeData) { - final args = routeData.argsAs<FederationRouteArgs>(); + ReactionDeckRoute.name: (routeData) { + final args = routeData.argsAs<ReactionDeckRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: FederationPage( + child: ReactionDeckPage( key: args.key, account: args.account, - host: args.host, ), ); }, - NoteDetailRoute.name: (routeData) { - final args = routeData.argsAs<NoteDetailRouteArgs>(); + SeveralAccountGeneralSettingsRoute.name: (routeData) { + final args = routeData.argsAs<SeveralAccountGeneralSettingsRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: NoteDetailPage( + child: SeveralAccountGeneralSettingsPage( key: args.key, - note: args.note, account: args.account, ), ); }, - SearchRoute.name: (routeData) { - final args = routeData.argsAs<SearchRouteArgs>(); + SeveralAccountSettingsRoute.name: (routeData) { + final args = routeData.argsAs<SeveralAccountSettingsRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: SearchPage( + child: SeveralAccountSettingsPage( key: args.key, - initialSearchText: args.initialSearchText, account: args.account, ), ); @@ -321,101 +339,83 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - MisskeyRouteRoute.name: (routeData) { - final args = routeData.argsAs<MisskeyRouteRouteArgs>(); + SplashRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, - child: MisskeyPagePage( - key: args.key, - account: args.account, - page: args.page, - ), + child: const SplashPage(), ); }, - ImportExportRoute.name: (routeData) { + TimeLineRoute.name: (routeData) { + final args = routeData.argsAs<TimeLineRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: const ImportExportPage(), - ); - }, - GeneralSettingsRoute.name: (routeData) { - return AutoRoutePage<dynamic>( - routeData: routeData, - child: const GeneralSettingsPage(), - ); - }, - TabSettingsRoute.name: (routeData) { - final args = routeData.argsAs<TabSettingsRouteArgs>( - orElse: () => const TabSettingsRouteArgs()); - return AutoRoutePage<dynamic>( - routeData: routeData, - child: TabSettingsPage( + child: TimeLinePage( key: args.key, - tabIndex: args.tabIndex, + initialTabSetting: args.initialTabSetting, ), ); }, - TabSettingsListRoute.name: (routeData) { - return AutoRoutePage<dynamic>( - routeData: routeData, - child: const TabSettingsListPage(), - ); - }, - AppInfoRoute.name: (routeData) { - return AutoRoutePage<dynamic>( - routeData: routeData, - child: const AppInfoPage(), - ); - }, - SettingsRoute.name: (routeData) { + UsersListDetailRoute.name: (routeData) { + final args = routeData.argsAs<UsersListDetailRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: const SettingsPage(), + child: UsersListDetailPage( + key: args.key, + account: args.account, + listId: args.listId, + ), ); }, - AccountListRoute.name: (routeData) { + UsersListRoute.name: (routeData) { + final args = routeData.argsAs<UsersListRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: const AccountListPage(), + child: UsersListPage( + args.account, + key: args.key, + ), ); }, - ExploreRoleUsersRoute.name: (routeData) { - final args = routeData.argsAs<ExploreRoleUsersRouteArgs>(); + UsersListTimelineRoute.name: (routeData) { + final args = routeData.argsAs<UsersListTimelineRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: ExploreRoleUsersPage( + child: UsersListTimelinePage( + args.account, + args.list, key: args.key, - item: args.item, - account: args.account, ), ); }, - ExploreRoute.name: (routeData) { - final args = routeData.argsAs<ExploreRouteArgs>(); + UserFolloweeRoute.name: (routeData) { + final args = routeData.argsAs<UserFolloweeRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: ExplorePage( + child: UserFolloweePage( key: args.key, + userId: args.userId, account: args.account, ), ); }, - TimeLineRoute.name: (routeData) { - final args = routeData.argsAs<TimeLineRouteArgs>(); + UserFollowerRoute.name: (routeData) { + final args = routeData.argsAs<UserFollowerRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: TimeLinePage( + child: UserFollowerPage( key: args.key, - initialTabSetting: args.initialTabSetting, + userId: args.userId, + account: args.account, ), ); }, - FavoritedNoteRoute.name: (routeData) { - final args = routeData.argsAs<FavoritedNoteRouteArgs>(); + UserRoute.name: (routeData) { + final args = routeData.argsAs<UserRouteArgs>(); return AutoRoutePage<dynamic>( routeData: routeData, - child: FavoritedNotePage( + child: UserPage( key: args.key, + userId: args.userId, account: args.account, ), ); @@ -424,45 +424,83 @@ abstract class _$AppRouter extends RootStackRouter { } /// generated route for -/// [NotesAfterRenotePage] -class NotesAfterRenoteRoute extends PageRouteInfo<NotesAfterRenoteRouteArgs> { - NotesAfterRenoteRoute({ +/// [AnnouncementPage] +class AnnouncementRoute extends PageRouteInfo<AnnouncementRouteArgs> { + AnnouncementRoute({ Key? key, - required Note note, required Account account, List<PageRouteInfo>? children, }) : super( - NotesAfterRenoteRoute.name, - args: NotesAfterRenoteRouteArgs( + AnnouncementRoute.name, + args: AnnouncementRouteArgs( key: key, - note: note, account: account, ), initialChildren: children, ); - static const String name = 'NotesAfterRenoteRoute'; + static const String name = 'AnnouncementRoute'; - static const PageInfo<NotesAfterRenoteRouteArgs> page = - PageInfo<NotesAfterRenoteRouteArgs>(name); + static const PageInfo<AnnouncementRouteArgs> page = + PageInfo<AnnouncementRouteArgs>(name); } -class NotesAfterRenoteRouteArgs { - const NotesAfterRenoteRouteArgs({ +class AnnouncementRouteArgs { + const AnnouncementRouteArgs({ this.key, - required this.note, required this.account, }); final Key? key; - final Note note; + final Account account; + + @override + String toString() { + return 'AnnouncementRouteArgs{key: $key, account: $account}'; + } +} + +/// generated route for +/// [AntennaNotesPage] +class AntennaNotesRoute extends PageRouteInfo<AntennaNotesRouteArgs> { + AntennaNotesRoute({ + Key? key, + required Antenna antenna, + required Account account, + List<PageRouteInfo>? children, + }) : super( + AntennaNotesRoute.name, + args: AntennaNotesRouteArgs( + key: key, + antenna: antenna, + account: account, + ), + initialChildren: children, + ); + + static const String name = 'AntennaNotesRoute'; + + static const PageInfo<AntennaNotesRouteArgs> page = + PageInfo<AntennaNotesRouteArgs>(name); +} + +class AntennaNotesRouteArgs { + const AntennaNotesRouteArgs({ + this.key, + required this.antenna, + required this.account, + }); + + final Key? key; + + final Antenna antenna; final Account account; @override String toString() { - return 'NotesAfterRenoteRouteArgs{key: $key, note: $note, account: $account}'; + return 'AntennaNotesRouteArgs{key: $key, antenna: $antenna, account: $account}'; } } @@ -505,100 +543,86 @@ class AntennaRouteArgs { } /// generated route for -/// [AntennaNotesPage] -class AntennaNotesRoute extends PageRouteInfo<AntennaNotesRouteArgs> { - AntennaNotesRoute({ +/// [ChannelsPage] +class ChannelsRoute extends PageRouteInfo<ChannelsRouteArgs> { + ChannelsRoute({ Key? key, - required Antenna antenna, required Account account, List<PageRouteInfo>? children, }) : super( - AntennaNotesRoute.name, - args: AntennaNotesRouteArgs( + ChannelsRoute.name, + args: ChannelsRouteArgs( key: key, - antenna: antenna, account: account, ), initialChildren: children, ); - static const String name = 'AntennaNotesRoute'; + static const String name = 'ChannelsRoute'; - static const PageInfo<AntennaNotesRouteArgs> page = - PageInfo<AntennaNotesRouteArgs>(name); + static const PageInfo<ChannelsRouteArgs> page = + PageInfo<ChannelsRouteArgs>(name); } -class AntennaNotesRouteArgs { - const AntennaNotesRouteArgs({ +class ChannelsRouteArgs { + const ChannelsRouteArgs({ this.key, - required this.antenna, required this.account, }); final Key? key; - final Antenna antenna; - final Account account; @override String toString() { - return 'AntennaNotesRouteArgs{key: $key, antenna: $antenna, account: $account}'; + return 'ChannelsRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [NotificationPage] -class NotificationRoute extends PageRouteInfo<NotificationRouteArgs> { - NotificationRoute({ +/// [ChannelDetailPage] +class ChannelDetailRoute extends PageRouteInfo<ChannelDetailRouteArgs> { + ChannelDetailRoute({ Key? key, required Account account, + required String channelId, List<PageRouteInfo>? children, }) : super( - NotificationRoute.name, - args: NotificationRouteArgs( + ChannelDetailRoute.name, + args: ChannelDetailRouteArgs( key: key, account: account, + channelId: channelId, ), initialChildren: children, ); - static const String name = 'NotificationRoute'; + static const String name = 'ChannelDetailRoute'; - static const PageInfo<NotificationRouteArgs> page = - PageInfo<NotificationRouteArgs>(name); + static const PageInfo<ChannelDetailRouteArgs> page = + PageInfo<ChannelDetailRouteArgs>(name); } -class NotificationRouteArgs { - const NotificationRouteArgs({ +class ChannelDetailRouteArgs { + const ChannelDetailRouteArgs({ this.key, required this.account, + required this.channelId, }); final Key? key; final Account account; + final String channelId; + @override String toString() { - return 'NotificationRouteArgs{key: $key, account: $account}'; + return 'ChannelDetailRouteArgs{key: $key, account: $account, channelId: $channelId}'; } } -/// generated route for -/// [LoginPage] -class LoginRoute extends PageRouteInfo<void> { - const LoginRoute({List<PageRouteInfo>? children}) - : super( - LoginRoute.name, - initialChildren: children, - ); - - static const String name = 'LoginRoute'; - - static const PageInfo<void> page = PageInfo<void>(name); -} - /// generated route for /// [ClipDetailPage] class ClipDetailRoute extends PageRouteInfo<ClipDetailRouteArgs> { @@ -681,489 +705,450 @@ class ClipListRouteArgs { } /// generated route for -/// [NoteCreatePage] -class NoteCreateRoute extends PageRouteInfo<NoteCreateRouteArgs> { - NoteCreateRoute({ +/// [ExplorePage] +class ExploreRoute extends PageRouteInfo<ExploreRouteArgs> { + ExploreRoute({ Key? key, - required Account initialAccount, - String? initialText, - List<String>? initialMediaFiles, - CommunityChannel? channel, - Note? reply, - Note? renote, - Note? note, - NoteCreationMode? noteCreationMode, + required Account account, List<PageRouteInfo>? children, }) : super( - NoteCreateRoute.name, - args: NoteCreateRouteArgs( + ExploreRoute.name, + args: ExploreRouteArgs( key: key, - initialAccount: initialAccount, - initialText: initialText, - initialMediaFiles: initialMediaFiles, - channel: channel, - reply: reply, - renote: renote, - note: note, - noteCreationMode: noteCreationMode, + account: account, ), initialChildren: children, ); - static const String name = 'NoteCreateRoute'; + static const String name = 'ExploreRoute'; - static const PageInfo<NoteCreateRouteArgs> page = - PageInfo<NoteCreateRouteArgs>(name); + static const PageInfo<ExploreRouteArgs> page = + PageInfo<ExploreRouteArgs>(name); } -class NoteCreateRouteArgs { - const NoteCreateRouteArgs({ +class ExploreRouteArgs { + const ExploreRouteArgs({ this.key, - required this.initialAccount, - this.initialText, - this.initialMediaFiles, - this.channel, - this.reply, - this.renote, - this.note, - this.noteCreationMode, + required this.account, }); final Key? key; - final Account initialAccount; - - final String? initialText; - - final List<String>? initialMediaFiles; - - final CommunityChannel? channel; - - final Note? reply; - - final Note? renote; - - final Note? note; - - final NoteCreationMode? noteCreationMode; + final Account account; @override String toString() { - return 'NoteCreateRouteArgs{key: $key, initialAccount: $initialAccount, initialText: $initialText, initialMediaFiles: $initialMediaFiles, channel: $channel, reply: $reply, renote: $renote, note: $note, noteCreationMode: $noteCreationMode}'; + return 'ExploreRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [HashtagPage] -class HashtagRoute extends PageRouteInfo<HashtagRouteArgs> { - HashtagRoute({ +/// [ExploreRoleUsersPage] +class ExploreRoleUsersRoute extends PageRouteInfo<ExploreRoleUsersRouteArgs> { + ExploreRoleUsersRoute({ Key? key, - required String hashtag, + required RolesListResponse item, required Account account, List<PageRouteInfo>? children, }) : super( - HashtagRoute.name, - args: HashtagRouteArgs( + ExploreRoleUsersRoute.name, + args: ExploreRoleUsersRouteArgs( key: key, - hashtag: hashtag, + item: item, account: account, ), initialChildren: children, ); - static const String name = 'HashtagRoute'; + static const String name = 'ExploreRoleUsersRoute'; - static const PageInfo<HashtagRouteArgs> page = - PageInfo<HashtagRouteArgs>(name); + static const PageInfo<ExploreRoleUsersRouteArgs> page = + PageInfo<ExploreRoleUsersRouteArgs>(name); } -class HashtagRouteArgs { - const HashtagRouteArgs({ +class ExploreRoleUsersRouteArgs { + const ExploreRoleUsersRouteArgs({ this.key, - required this.hashtag, + required this.item, required this.account, }); final Key? key; - final String hashtag; + final RolesListResponse item; final Account account; @override String toString() { - return 'HashtagRouteArgs{key: $key, hashtag: $hashtag, account: $account}'; + return 'ExploreRoleUsersRouteArgs{key: $key, item: $item, account: $account}'; } } /// generated route for -/// [UserFolloweePage] -class UserFolloweeRoute extends PageRouteInfo<UserFolloweeRouteArgs> { - UserFolloweeRoute({ +/// [FavoritedNotePage] +class FavoritedNoteRoute extends PageRouteInfo<FavoritedNoteRouteArgs> { + FavoritedNoteRoute({ Key? key, - required String userId, required Account account, List<PageRouteInfo>? children, }) : super( - UserFolloweeRoute.name, - args: UserFolloweeRouteArgs( + FavoritedNoteRoute.name, + args: FavoritedNoteRouteArgs( key: key, - userId: userId, account: account, ), initialChildren: children, ); - static const String name = 'UserFolloweeRoute'; + static const String name = 'FavoritedNoteRoute'; - static const PageInfo<UserFolloweeRouteArgs> page = - PageInfo<UserFolloweeRouteArgs>(name); + static const PageInfo<FavoritedNoteRouteArgs> page = + PageInfo<FavoritedNoteRouteArgs>(name); } -class UserFolloweeRouteArgs { - const UserFolloweeRouteArgs({ +class FavoritedNoteRouteArgs { + const FavoritedNoteRouteArgs({ this.key, - required this.userId, required this.account, }); final Key? key; - final String userId; - final Account account; @override String toString() { - return 'UserFolloweeRouteArgs{key: $key, userId: $userId, account: $account}'; + return 'FavoritedNoteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [UserPage] -class UserRoute extends PageRouteInfo<UserRouteArgs> { - UserRoute({ +/// [FederationPage] +class FederationRoute extends PageRouteInfo<FederationRouteArgs> { + FederationRoute({ Key? key, - required String userId, required Account account, + required String host, List<PageRouteInfo>? children, }) : super( - UserRoute.name, - args: UserRouteArgs( + FederationRoute.name, + args: FederationRouteArgs( key: key, - userId: userId, account: account, + host: host, ), initialChildren: children, ); - static const String name = 'UserRoute'; + static const String name = 'FederationRoute'; - static const PageInfo<UserRouteArgs> page = PageInfo<UserRouteArgs>(name); + static const PageInfo<FederationRouteArgs> page = + PageInfo<FederationRouteArgs>(name); } -class UserRouteArgs { - const UserRouteArgs({ +class FederationRouteArgs { + const FederationRouteArgs({ this.key, - required this.userId, required this.account, + required this.host, }); final Key? key; - final String userId; - final Account account; + final String host; + @override String toString() { - return 'UserRouteArgs{key: $key, userId: $userId, account: $account}'; + return 'FederationRouteArgs{key: $key, account: $account, host: $host}'; } } /// generated route for -/// [UserFollowerPage] -class UserFollowerRoute extends PageRouteInfo<UserFollowerRouteArgs> { - UserFollowerRoute({ +/// [HashtagPage] +class HashtagRoute extends PageRouteInfo<HashtagRouteArgs> { + HashtagRoute({ Key? key, - required String userId, + required String hashtag, required Account account, List<PageRouteInfo>? children, }) : super( - UserFollowerRoute.name, - args: UserFollowerRouteArgs( + HashtagRoute.name, + args: HashtagRouteArgs( key: key, - userId: userId, + hashtag: hashtag, account: account, ), initialChildren: children, ); - static const String name = 'UserFollowerRoute'; + static const String name = 'HashtagRoute'; - static const PageInfo<UserFollowerRouteArgs> page = - PageInfo<UserFollowerRouteArgs>(name); + static const PageInfo<HashtagRouteArgs> page = + PageInfo<HashtagRouteArgs>(name); } -class UserFollowerRouteArgs { - const UserFollowerRouteArgs({ +class HashtagRouteArgs { + const HashtagRouteArgs({ this.key, - required this.userId, + required this.hashtag, required this.account, }); final Key? key; - final String userId; + final String hashtag; final Account account; @override String toString() { - return 'UserFollowerRouteArgs{key: $key, userId: $userId, account: $account}'; + return 'HashtagRouteArgs{key: $key, hashtag: $hashtag, account: $account}'; } } /// generated route for -/// [PhotoEditPage] -class PhotoEditRoute extends PageRouteInfo<PhotoEditRouteArgs> { - PhotoEditRoute({ - required Account account, - required MisskeyPostFile file, - required void Function(Uint8List) onSubmit, - Key? key, - List<PageRouteInfo>? children, - }) : super( - PhotoEditRoute.name, - args: PhotoEditRouteArgs( - account: account, - file: file, - onSubmit: onSubmit, - key: key, - ), +/// [LoginPage] +class LoginRoute extends PageRouteInfo<void> { + const LoginRoute({List<PageRouteInfo>? children}) + : super( + LoginRoute.name, initialChildren: children, ); - static const String name = 'PhotoEditRoute'; - - static const PageInfo<PhotoEditRouteArgs> page = - PageInfo<PhotoEditRouteArgs>(name); -} - -class PhotoEditRouteArgs { - const PhotoEditRouteArgs({ - required this.account, - required this.file, - required this.onSubmit, - this.key, - }); - - final Account account; - - final MisskeyPostFile file; - - final void Function(Uint8List) onSubmit; - - final Key? key; + static const String name = 'LoginRoute'; - @override - String toString() { - return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; - } + static const PageInfo<void> page = PageInfo<void>(name); } /// generated route for -/// [AnnouncementPage] -class AnnouncementRoute extends PageRouteInfo<AnnouncementRouteArgs> { - AnnouncementRoute({ +/// [MisskeyPagePage] +class MisskeyRouteRoute extends PageRouteInfo<MisskeyRouteRouteArgs> { + MisskeyRouteRoute({ Key? key, required Account account, + required Page page, List<PageRouteInfo>? children, }) : super( - AnnouncementRoute.name, - args: AnnouncementRouteArgs( + MisskeyRouteRoute.name, + args: MisskeyRouteRouteArgs( key: key, account: account, + page: page, ), initialChildren: children, ); - static const String name = 'AnnouncementRoute'; + static const String name = 'MisskeyRouteRoute'; - static const PageInfo<AnnouncementRouteArgs> page = - PageInfo<AnnouncementRouteArgs>(name); + static const PageInfo<MisskeyRouteRouteArgs> page = + PageInfo<MisskeyRouteRouteArgs>(name); } -class AnnouncementRouteArgs { - const AnnouncementRouteArgs({ +class MisskeyRouteRouteArgs { + const MisskeyRouteRouteArgs({ this.key, required this.account, + required this.page, }); final Key? key; final Account account; + final Page page; + @override String toString() { - return 'AnnouncementRouteArgs{key: $key, account: $account}'; + return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}'; } } /// generated route for -/// [SplashPage] -class SplashRoute extends PageRouteInfo<void> { - const SplashRoute({List<PageRouteInfo>? children}) - : super( - SplashRoute.name, - initialChildren: children, - ); - - static const String name = 'SplashRoute'; - - static const PageInfo<void> page = PageInfo<void>(name); -} - -/// generated route for -/// [SeveralAccountGeneralSettingsPage] -class SeveralAccountGeneralSettingsRoute - extends PageRouteInfo<SeveralAccountGeneralSettingsRouteArgs> { - SeveralAccountGeneralSettingsRoute({ +/// [NotesAfterRenotePage] +class NotesAfterRenoteRoute extends PageRouteInfo<NotesAfterRenoteRouteArgs> { + NotesAfterRenoteRoute({ Key? key, + required Note note, required Account account, List<PageRouteInfo>? children, }) : super( - SeveralAccountGeneralSettingsRoute.name, - args: SeveralAccountGeneralSettingsRouteArgs( + NotesAfterRenoteRoute.name, + args: NotesAfterRenoteRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'SeveralAccountGeneralSettingsRoute'; + static const String name = 'NotesAfterRenoteRoute'; - static const PageInfo<SeveralAccountGeneralSettingsRouteArgs> page = - PageInfo<SeveralAccountGeneralSettingsRouteArgs>(name); + static const PageInfo<NotesAfterRenoteRouteArgs> page = + PageInfo<NotesAfterRenoteRouteArgs>(name); } -class SeveralAccountGeneralSettingsRouteArgs { - const SeveralAccountGeneralSettingsRouteArgs({ +class NotesAfterRenoteRouteArgs { + const NotesAfterRenoteRouteArgs({ this.key, + required this.note, required this.account, }); final Key? key; + final Note note; + final Account account; @override String toString() { - return 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}'; + return 'NotesAfterRenoteRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [SeveralAccountSettingsPage] -class SeveralAccountSettingsRoute - extends PageRouteInfo<SeveralAccountSettingsRouteArgs> { - SeveralAccountSettingsRoute({ +/// [NoteCreatePage] +class NoteCreateRoute extends PageRouteInfo<NoteCreateRouteArgs> { + NoteCreateRoute({ Key? key, - required Account account, + required Account initialAccount, + String? initialText, + List<String>? initialMediaFiles, + CommunityChannel? channel, + Note? reply, + Note? renote, + Note? note, + NoteCreationMode? noteCreationMode, List<PageRouteInfo>? children, }) : super( - SeveralAccountSettingsRoute.name, - args: SeveralAccountSettingsRouteArgs( + NoteCreateRoute.name, + args: NoteCreateRouteArgs( key: key, - account: account, + initialAccount: initialAccount, + initialText: initialText, + initialMediaFiles: initialMediaFiles, + channel: channel, + reply: reply, + renote: renote, + note: note, + noteCreationMode: noteCreationMode, ), initialChildren: children, ); - static const String name = 'SeveralAccountSettingsRoute'; + static const String name = 'NoteCreateRoute'; - static const PageInfo<SeveralAccountSettingsRouteArgs> page = - PageInfo<SeveralAccountSettingsRouteArgs>(name); + static const PageInfo<NoteCreateRouteArgs> page = + PageInfo<NoteCreateRouteArgs>(name); } -class SeveralAccountSettingsRouteArgs { - const SeveralAccountSettingsRouteArgs({ +class NoteCreateRouteArgs { + const NoteCreateRouteArgs({ this.key, - required this.account, + required this.initialAccount, + this.initialText, + this.initialMediaFiles, + this.channel, + this.reply, + this.renote, + this.note, + this.noteCreationMode, }); final Key? key; - final Account account; + final Account initialAccount; + + final String? initialText; + + final List<String>? initialMediaFiles; + + final CommunityChannel? channel; + + final Note? reply; + + final Note? renote; + + final Note? note; + + final NoteCreationMode? noteCreationMode; @override String toString() { - return 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; + return 'NoteCreateRouteArgs{key: $key, initialAccount: $initialAccount, initialText: $initialText, initialMediaFiles: $initialMediaFiles, channel: $channel, reply: $reply, renote: $renote, note: $note, noteCreationMode: $noteCreationMode}'; } } /// generated route for -/// [InstanceMutePage] -class InstanceMuteRoute extends PageRouteInfo<InstanceMuteRouteArgs> { - InstanceMuteRoute({ +/// [NoteDetailPage] +class NoteDetailRoute extends PageRouteInfo<NoteDetailRouteArgs> { + NoteDetailRoute({ Key? key, + required Note note, required Account account, List<PageRouteInfo>? children, }) : super( - InstanceMuteRoute.name, - args: InstanceMuteRouteArgs( + NoteDetailRoute.name, + args: NoteDetailRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'InstanceMuteRoute'; + static const String name = 'NoteDetailRoute'; - static const PageInfo<InstanceMuteRouteArgs> page = - PageInfo<InstanceMuteRouteArgs>(name); + static const PageInfo<NoteDetailRouteArgs> page = + PageInfo<NoteDetailRouteArgs>(name); } -class InstanceMuteRouteArgs { - const InstanceMuteRouteArgs({ +class NoteDetailRouteArgs { + const NoteDetailRouteArgs({ this.key, + required this.note, required this.account, }); final Key? key; + final Note note; + final Account account; @override String toString() { - return 'InstanceMuteRouteArgs{key: $key, account: $account}'; + return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [HardMutePage] -class HardMuteRoute extends PageRouteInfo<HardMuteRouteArgs> { - HardMuteRoute({ +/// [NotificationPage] +class NotificationRoute extends PageRouteInfo<NotificationRouteArgs> { + NotificationRoute({ Key? key, required Account account, List<PageRouteInfo>? children, }) : super( - HardMuteRoute.name, - args: HardMuteRouteArgs( + NotificationRoute.name, + args: NotificationRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'HardMuteRoute'; + static const String name = 'NotificationRoute'; - static const PageInfo<HardMuteRouteArgs> page = - PageInfo<HardMuteRouteArgs>(name); + static const PageInfo<NotificationRouteArgs> page = + PageInfo<NotificationRouteArgs>(name); } -class HardMuteRouteArgs { - const HardMuteRouteArgs({ +class NotificationRouteArgs { + const NotificationRouteArgs({ this.key, required this.account, }); @@ -1174,239 +1159,284 @@ class HardMuteRouteArgs { @override String toString() { - return 'HardMuteRouteArgs{key: $key, account: $account}'; + return 'NotificationRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [ReactionDeckPage] -class ReactionDeckRoute extends PageRouteInfo<ReactionDeckRouteArgs> { - ReactionDeckRoute({ - Key? key, +/// [PhotoEditPage] +class PhotoEditRoute extends PageRouteInfo<PhotoEditRouteArgs> { + PhotoEditRoute({ required Account account, + required MisskeyPostFile file, + required void Function(Uint8List) onSubmit, + Key? key, List<PageRouteInfo>? children, }) : super( - ReactionDeckRoute.name, - args: ReactionDeckRouteArgs( - key: key, + PhotoEditRoute.name, + args: PhotoEditRouteArgs( account: account, + file: file, + onSubmit: onSubmit, + key: key, ), initialChildren: children, ); - static const String name = 'ReactionDeckRoute'; + static const String name = 'PhotoEditRoute'; - static const PageInfo<ReactionDeckRouteArgs> page = - PageInfo<ReactionDeckRouteArgs>(name); + static const PageInfo<PhotoEditRouteArgs> page = + PageInfo<PhotoEditRouteArgs>(name); } -class ReactionDeckRouteArgs { - const ReactionDeckRouteArgs({ - this.key, +class PhotoEditRouteArgs { + const PhotoEditRouteArgs({ required this.account, + required this.file, + required this.onSubmit, + this.key, }); - final Key? key; - final Account account; + final MisskeyPostFile file; + + final void Function(Uint8List) onSubmit; + + final Key? key; + @override String toString() { - return 'ReactionDeckRouteArgs{key: $key, account: $account}'; + return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; } } /// generated route for -/// [UsersListTimelinePage] -class UsersListTimelineRoute extends PageRouteInfo<UsersListTimelineRouteArgs> { - UsersListTimelineRoute({ - required Account account, - required UsersList list, +/// [SearchPage] +class SearchRoute extends PageRouteInfo<SearchRouteArgs> { + SearchRoute({ Key? key, + String? initialSearchText, + required Account account, List<PageRouteInfo>? children, }) : super( - UsersListTimelineRoute.name, - args: UsersListTimelineRouteArgs( - account: account, - list: list, + SearchRoute.name, + args: SearchRouteArgs( key: key, + initialSearchText: initialSearchText, + account: account, ), initialChildren: children, ); - static const String name = 'UsersListTimelineRoute'; + static const String name = 'SearchRoute'; - static const PageInfo<UsersListTimelineRouteArgs> page = - PageInfo<UsersListTimelineRouteArgs>(name); + static const PageInfo<SearchRouteArgs> page = PageInfo<SearchRouteArgs>(name); } -class UsersListTimelineRouteArgs { - const UsersListTimelineRouteArgs({ - required this.account, - required this.list, +class SearchRouteArgs { + const SearchRouteArgs({ this.key, + this.initialSearchText, + required this.account, }); - final Account account; + final Key? key; - final UsersList list; + final String? initialSearchText; - final Key? key; + final Account account; @override String toString() { - return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}'; + return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; } } /// generated route for -/// [UsersListPage] -class UsersListRoute extends PageRouteInfo<UsersListRouteArgs> { - UsersListRoute({ - required Account account, - Key? key, - List<PageRouteInfo>? children, - }) : super( - UsersListRoute.name, - args: UsersListRouteArgs( - account: account, - key: key, - ), +/// [AccountListPage] +class AccountListRoute extends PageRouteInfo<void> { + const AccountListRoute({List<PageRouteInfo>? children}) + : super( + AccountListRoute.name, + initialChildren: children, + ); + + static const String name = 'AccountListRoute'; + + static const PageInfo<void> page = PageInfo<void>(name); +} + +/// generated route for +/// [AppInfoPage] +class AppInfoRoute extends PageRouteInfo<void> { + const AppInfoRoute({List<PageRouteInfo>? children}) + : super( + AppInfoRoute.name, + initialChildren: children, + ); + + static const String name = 'AppInfoRoute'; + + static const PageInfo<void> page = PageInfo<void>(name); +} + +/// generated route for +/// [GeneralSettingsPage] +class GeneralSettingsRoute extends PageRouteInfo<void> { + const GeneralSettingsRoute({List<PageRouteInfo>? children}) + : super( + GeneralSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'GeneralSettingsRoute'; + + static const PageInfo<void> page = PageInfo<void>(name); +} + +/// generated route for +/// [ImportExportPage] +class ImportExportRoute extends PageRouteInfo<void> { + const ImportExportRoute({List<PageRouteInfo>? children}) + : super( + ImportExportRoute.name, + initialChildren: children, + ); + + static const String name = 'ImportExportRoute'; + + static const PageInfo<void> page = PageInfo<void>(name); +} + +/// generated route for +/// [SettingsPage] +class SettingsRoute extends PageRouteInfo<void> { + const SettingsRoute({List<PageRouteInfo>? children}) + : super( + SettingsRoute.name, initialChildren: children, ); - static const String name = 'UsersListRoute'; + static const String name = 'SettingsRoute'; - static const PageInfo<UsersListRouteArgs> page = - PageInfo<UsersListRouteArgs>(name); + static const PageInfo<void> page = PageInfo<void>(name); } -class UsersListRouteArgs { - const UsersListRouteArgs({ - required this.account, - this.key, - }); - - final Account account; +/// generated route for +/// [TabSettingsListPage] +class TabSettingsListRoute extends PageRouteInfo<void> { + const TabSettingsListRoute({List<PageRouteInfo>? children}) + : super( + TabSettingsListRoute.name, + initialChildren: children, + ); - final Key? key; + static const String name = 'TabSettingsListRoute'; - @override - String toString() { - return 'UsersListRouteArgs{account: $account, key: $key}'; - } + static const PageInfo<void> page = PageInfo<void>(name); } /// generated route for -/// [UsersListDetailPage] -class UsersListDetailRoute extends PageRouteInfo<UsersListDetailRouteArgs> { - UsersListDetailRoute({ +/// [TabSettingsPage] +class TabSettingsRoute extends PageRouteInfo<TabSettingsRouteArgs> { + TabSettingsRoute({ Key? key, - required Account account, - required String listId, + int? tabIndex, List<PageRouteInfo>? children, }) : super( - UsersListDetailRoute.name, - args: UsersListDetailRouteArgs( + TabSettingsRoute.name, + args: TabSettingsRouteArgs( key: key, - account: account, - listId: listId, + tabIndex: tabIndex, ), initialChildren: children, ); - static const String name = 'UsersListDetailRoute'; + static const String name = 'TabSettingsRoute'; - static const PageInfo<UsersListDetailRouteArgs> page = - PageInfo<UsersListDetailRouteArgs>(name); + static const PageInfo<TabSettingsRouteArgs> page = + PageInfo<TabSettingsRouteArgs>(name); } -class UsersListDetailRouteArgs { - const UsersListDetailRouteArgs({ +class TabSettingsRouteArgs { + const TabSettingsRouteArgs({ this.key, - required this.account, - required this.listId, + this.tabIndex, }); final Key? key; - final Account account; - - final String listId; + final int? tabIndex; @override String toString() { - return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}'; + return 'TabSettingsRouteArgs{key: $key, tabIndex: $tabIndex}'; } } /// generated route for -/// [ChannelDetailPage] -class ChannelDetailRoute extends PageRouteInfo<ChannelDetailRouteArgs> { - ChannelDetailRoute({ +/// [HardMutePage] +class HardMuteRoute extends PageRouteInfo<HardMuteRouteArgs> { + HardMuteRoute({ Key? key, required Account account, - required String channelId, List<PageRouteInfo>? children, }) : super( - ChannelDetailRoute.name, - args: ChannelDetailRouteArgs( + HardMuteRoute.name, + args: HardMuteRouteArgs( key: key, account: account, - channelId: channelId, ), initialChildren: children, ); - static const String name = 'ChannelDetailRoute'; + static const String name = 'HardMuteRoute'; - static const PageInfo<ChannelDetailRouteArgs> page = - PageInfo<ChannelDetailRouteArgs>(name); + static const PageInfo<HardMuteRouteArgs> page = + PageInfo<HardMuteRouteArgs>(name); } -class ChannelDetailRouteArgs { - const ChannelDetailRouteArgs({ +class HardMuteRouteArgs { + const HardMuteRouteArgs({ this.key, required this.account, - required this.channelId, }); final Key? key; final Account account; - final String channelId; - @override String toString() { - return 'ChannelDetailRouteArgs{key: $key, account: $account, channelId: $channelId}'; + return 'HardMuteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [ChannelsPage] -class ChannelsRoute extends PageRouteInfo<ChannelsRouteArgs> { - ChannelsRoute({ +/// [InstanceMutePage] +class InstanceMuteRoute extends PageRouteInfo<InstanceMuteRouteArgs> { + InstanceMuteRoute({ Key? key, required Account account, List<PageRouteInfo>? children, }) : super( - ChannelsRoute.name, - args: ChannelsRouteArgs( + InstanceMuteRoute.name, + args: InstanceMuteRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'ChannelsRoute'; + static const String name = 'InstanceMuteRoute'; - static const PageInfo<ChannelsRouteArgs> page = - PageInfo<ChannelsRouteArgs>(name); + static const PageInfo<InstanceMuteRouteArgs> page = + PageInfo<InstanceMuteRouteArgs>(name); } -class ChannelsRouteArgs { - const ChannelsRouteArgs({ +class InstanceMuteRouteArgs { + const InstanceMuteRouteArgs({ this.key, required this.account, }); @@ -1417,135 +1447,123 @@ class ChannelsRouteArgs { @override String toString() { - return 'ChannelsRouteArgs{key: $key, account: $account}'; + return 'InstanceMuteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [FederationPage] -class FederationRoute extends PageRouteInfo<FederationRouteArgs> { - FederationRoute({ +/// [ReactionDeckPage] +class ReactionDeckRoute extends PageRouteInfo<ReactionDeckRouteArgs> { + ReactionDeckRoute({ Key? key, required Account account, - required String host, List<PageRouteInfo>? children, }) : super( - FederationRoute.name, - args: FederationRouteArgs( + ReactionDeckRoute.name, + args: ReactionDeckRouteArgs( key: key, account: account, - host: host, ), initialChildren: children, ); - static const String name = 'FederationRoute'; + static const String name = 'ReactionDeckRoute'; - static const PageInfo<FederationRouteArgs> page = - PageInfo<FederationRouteArgs>(name); + static const PageInfo<ReactionDeckRouteArgs> page = + PageInfo<ReactionDeckRouteArgs>(name); } -class FederationRouteArgs { - const FederationRouteArgs({ +class ReactionDeckRouteArgs { + const ReactionDeckRouteArgs({ this.key, required this.account, - required this.host, }); final Key? key; final Account account; - final String host; - @override String toString() { - return 'FederationRouteArgs{key: $key, account: $account, host: $host}'; + return 'ReactionDeckRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [NoteDetailPage] -class NoteDetailRoute extends PageRouteInfo<NoteDetailRouteArgs> { - NoteDetailRoute({ +/// [SeveralAccountGeneralSettingsPage] +class SeveralAccountGeneralSettingsRoute + extends PageRouteInfo<SeveralAccountGeneralSettingsRouteArgs> { + SeveralAccountGeneralSettingsRoute({ Key? key, - required Note note, required Account account, List<PageRouteInfo>? children, }) : super( - NoteDetailRoute.name, - args: NoteDetailRouteArgs( + SeveralAccountGeneralSettingsRoute.name, + args: SeveralAccountGeneralSettingsRouteArgs( key: key, - note: note, account: account, ), initialChildren: children, ); - static const String name = 'NoteDetailRoute'; + static const String name = 'SeveralAccountGeneralSettingsRoute'; - static const PageInfo<NoteDetailRouteArgs> page = - PageInfo<NoteDetailRouteArgs>(name); + static const PageInfo<SeveralAccountGeneralSettingsRouteArgs> page = + PageInfo<SeveralAccountGeneralSettingsRouteArgs>(name); } -class NoteDetailRouteArgs { - const NoteDetailRouteArgs({ +class SeveralAccountGeneralSettingsRouteArgs { + const SeveralAccountGeneralSettingsRouteArgs({ this.key, - required this.note, required this.account, }); final Key? key; - final Note note; - final Account account; @override String toString() { - return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}'; + return 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [SearchPage] -class SearchRoute extends PageRouteInfo<SearchRouteArgs> { - SearchRoute({ +/// [SeveralAccountSettingsPage] +class SeveralAccountSettingsRoute + extends PageRouteInfo<SeveralAccountSettingsRouteArgs> { + SeveralAccountSettingsRoute({ Key? key, - String? initialSearchText, required Account account, List<PageRouteInfo>? children, }) : super( - SearchRoute.name, - args: SearchRouteArgs( + SeveralAccountSettingsRoute.name, + args: SeveralAccountSettingsRouteArgs( key: key, - initialSearchText: initialSearchText, account: account, ), initialChildren: children, ); - static const String name = 'SearchRoute'; + static const String name = 'SeveralAccountSettingsRoute'; - static const PageInfo<SearchRouteArgs> page = PageInfo<SearchRouteArgs>(name); + static const PageInfo<SeveralAccountSettingsRouteArgs> page = + PageInfo<SeveralAccountSettingsRouteArgs>(name); } -class SearchRouteArgs { - const SearchRouteArgs({ +class SeveralAccountSettingsRouteArgs { + const SeveralAccountSettingsRouteArgs({ this.key, - this.initialSearchText, required this.account, }); final Key? key; - final String? initialSearchText; - final Account account; @override String toString() { - return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; + return 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; } } @@ -1594,323 +1612,305 @@ class SharingAccountSelectRouteArgs { } /// generated route for -/// [MisskeyPagePage] -class MisskeyRouteRoute extends PageRouteInfo<MisskeyRouteRouteArgs> { - MisskeyRouteRoute({ - Key? key, - required Account account, - required Page page, - List<PageRouteInfo>? children, - }) : super( - MisskeyRouteRoute.name, - args: MisskeyRouteRouteArgs( - key: key, - account: account, - page: page, - ), - initialChildren: children, - ); - - static const String name = 'MisskeyRouteRoute'; - - static const PageInfo<MisskeyRouteRouteArgs> page = - PageInfo<MisskeyRouteRouteArgs>(name); -} - -class MisskeyRouteRouteArgs { - const MisskeyRouteRouteArgs({ - this.key, - required this.account, - required this.page, - }); - - final Key? key; - - final Account account; - - final Page page; - - @override - String toString() { - return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}'; - } -} - -/// generated route for -/// [ImportExportPage] -class ImportExportRoute extends PageRouteInfo<void> { - const ImportExportRoute({List<PageRouteInfo>? children}) - : super( - ImportExportRoute.name, - initialChildren: children, - ); - - static const String name = 'ImportExportRoute'; - - static const PageInfo<void> page = PageInfo<void>(name); -} - -/// generated route for -/// [GeneralSettingsPage] -class GeneralSettingsRoute extends PageRouteInfo<void> { - const GeneralSettingsRoute({List<PageRouteInfo>? children}) +/// [SplashPage] +class SplashRoute extends PageRouteInfo<void> { + const SplashRoute({List<PageRouteInfo>? children}) : super( - GeneralSettingsRoute.name, + SplashRoute.name, initialChildren: children, ); - static const String name = 'GeneralSettingsRoute'; + static const String name = 'SplashRoute'; static const PageInfo<void> page = PageInfo<void>(name); } /// generated route for -/// [TabSettingsPage] -class TabSettingsRoute extends PageRouteInfo<TabSettingsRouteArgs> { - TabSettingsRoute({ +/// [TimeLinePage] +class TimeLineRoute extends PageRouteInfo<TimeLineRouteArgs> { + TimeLineRoute({ Key? key, - int? tabIndex, + required TabSetting initialTabSetting, List<PageRouteInfo>? children, }) : super( - TabSettingsRoute.name, - args: TabSettingsRouteArgs( + TimeLineRoute.name, + args: TimeLineRouteArgs( key: key, - tabIndex: tabIndex, + initialTabSetting: initialTabSetting, ), initialChildren: children, ); - static const String name = 'TabSettingsRoute'; + static const String name = 'TimeLineRoute'; - static const PageInfo<TabSettingsRouteArgs> page = - PageInfo<TabSettingsRouteArgs>(name); + static const PageInfo<TimeLineRouteArgs> page = + PageInfo<TimeLineRouteArgs>(name); } -class TabSettingsRouteArgs { - const TabSettingsRouteArgs({ +class TimeLineRouteArgs { + const TimeLineRouteArgs({ this.key, - this.tabIndex, + required this.initialTabSetting, }); final Key? key; - final int? tabIndex; + final TabSetting initialTabSetting; @override String toString() { - return 'TabSettingsRouteArgs{key: $key, tabIndex: $tabIndex}'; + return 'TimeLineRouteArgs{key: $key, initialTabSetting: $initialTabSetting}'; } } /// generated route for -/// [TabSettingsListPage] -class TabSettingsListRoute extends PageRouteInfo<void> { - const TabSettingsListRoute({List<PageRouteInfo>? children}) - : super( - TabSettingsListRoute.name, +/// [UsersListDetailPage] +class UsersListDetailRoute extends PageRouteInfo<UsersListDetailRouteArgs> { + UsersListDetailRoute({ + Key? key, + required Account account, + required String listId, + List<PageRouteInfo>? children, + }) : super( + UsersListDetailRoute.name, + args: UsersListDetailRouteArgs( + key: key, + account: account, + listId: listId, + ), initialChildren: children, ); - static const String name = 'TabSettingsListRoute'; + static const String name = 'UsersListDetailRoute'; - static const PageInfo<void> page = PageInfo<void>(name); + static const PageInfo<UsersListDetailRouteArgs> page = + PageInfo<UsersListDetailRouteArgs>(name); } -/// generated route for -/// [AppInfoPage] -class AppInfoRoute extends PageRouteInfo<void> { - const AppInfoRoute({List<PageRouteInfo>? children}) - : super( - AppInfoRoute.name, - initialChildren: children, - ); +class UsersListDetailRouteArgs { + const UsersListDetailRouteArgs({ + this.key, + required this.account, + required this.listId, + }); - static const String name = 'AppInfoRoute'; + final Key? key; - static const PageInfo<void> page = PageInfo<void>(name); + final Account account; + + final String listId; + + @override + String toString() { + return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}'; + } } /// generated route for -/// [SettingsPage] -class SettingsRoute extends PageRouteInfo<void> { - const SettingsRoute({List<PageRouteInfo>? children}) - : super( - SettingsRoute.name, +/// [UsersListPage] +class UsersListRoute extends PageRouteInfo<UsersListRouteArgs> { + UsersListRoute({ + required Account account, + Key? key, + List<PageRouteInfo>? children, + }) : super( + UsersListRoute.name, + args: UsersListRouteArgs( + account: account, + key: key, + ), initialChildren: children, ); - static const String name = 'SettingsRoute'; + static const String name = 'UsersListRoute'; - static const PageInfo<void> page = PageInfo<void>(name); + static const PageInfo<UsersListRouteArgs> page = + PageInfo<UsersListRouteArgs>(name); } -/// generated route for -/// [AccountListPage] -class AccountListRoute extends PageRouteInfo<void> { - const AccountListRoute({List<PageRouteInfo>? children}) - : super( - AccountListRoute.name, - initialChildren: children, - ); +class UsersListRouteArgs { + const UsersListRouteArgs({ + required this.account, + this.key, + }); - static const String name = 'AccountListRoute'; + final Account account; - static const PageInfo<void> page = PageInfo<void>(name); + final Key? key; + + @override + String toString() { + return 'UsersListRouteArgs{account: $account, key: $key}'; + } } /// generated route for -/// [ExploreRoleUsersPage] -class ExploreRoleUsersRoute extends PageRouteInfo<ExploreRoleUsersRouteArgs> { - ExploreRoleUsersRoute({ - Key? key, - required RolesListResponse item, +/// [UsersListTimelinePage] +class UsersListTimelineRoute extends PageRouteInfo<UsersListTimelineRouteArgs> { + UsersListTimelineRoute({ required Account account, + required UsersList list, + Key? key, List<PageRouteInfo>? children, }) : super( - ExploreRoleUsersRoute.name, - args: ExploreRoleUsersRouteArgs( - key: key, - item: item, + UsersListTimelineRoute.name, + args: UsersListTimelineRouteArgs( account: account, + list: list, + key: key, ), initialChildren: children, ); - static const String name = 'ExploreRoleUsersRoute'; + static const String name = 'UsersListTimelineRoute'; - static const PageInfo<ExploreRoleUsersRouteArgs> page = - PageInfo<ExploreRoleUsersRouteArgs>(name); + static const PageInfo<UsersListTimelineRouteArgs> page = + PageInfo<UsersListTimelineRouteArgs>(name); } -class ExploreRoleUsersRouteArgs { - const ExploreRoleUsersRouteArgs({ - this.key, - required this.item, +class UsersListTimelineRouteArgs { + const UsersListTimelineRouteArgs({ required this.account, + required this.list, + this.key, }); - final Key? key; + final Account account; - final RolesListResponse item; + final UsersList list; - final Account account; + final Key? key; @override String toString() { - return 'ExploreRoleUsersRouteArgs{key: $key, item: $item, account: $account}'; + return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}'; } } /// generated route for -/// [ExplorePage] -class ExploreRoute extends PageRouteInfo<ExploreRouteArgs> { - ExploreRoute({ +/// [UserFolloweePage] +class UserFolloweeRoute extends PageRouteInfo<UserFolloweeRouteArgs> { + UserFolloweeRoute({ Key? key, + required String userId, required Account account, List<PageRouteInfo>? children, }) : super( - ExploreRoute.name, - args: ExploreRouteArgs( + UserFolloweeRoute.name, + args: UserFolloweeRouteArgs( key: key, + userId: userId, account: account, ), initialChildren: children, ); - static const String name = 'ExploreRoute'; + static const String name = 'UserFolloweeRoute'; - static const PageInfo<ExploreRouteArgs> page = - PageInfo<ExploreRouteArgs>(name); + static const PageInfo<UserFolloweeRouteArgs> page = + PageInfo<UserFolloweeRouteArgs>(name); } -class ExploreRouteArgs { - const ExploreRouteArgs({ +class UserFolloweeRouteArgs { + const UserFolloweeRouteArgs({ this.key, + required this.userId, required this.account, }); final Key? key; + final String userId; + final Account account; @override String toString() { - return 'ExploreRouteArgs{key: $key, account: $account}'; + return 'UserFolloweeRouteArgs{key: $key, userId: $userId, account: $account}'; } } /// generated route for -/// [TimeLinePage] -class TimeLineRoute extends PageRouteInfo<TimeLineRouteArgs> { - TimeLineRoute({ +/// [UserFollowerPage] +class UserFollowerRoute extends PageRouteInfo<UserFollowerRouteArgs> { + UserFollowerRoute({ Key? key, - required TabSetting initialTabSetting, + required String userId, + required Account account, List<PageRouteInfo>? children, }) : super( - TimeLineRoute.name, - args: TimeLineRouteArgs( + UserFollowerRoute.name, + args: UserFollowerRouteArgs( key: key, - initialTabSetting: initialTabSetting, + userId: userId, + account: account, ), initialChildren: children, ); - static const String name = 'TimeLineRoute'; + static const String name = 'UserFollowerRoute'; - static const PageInfo<TimeLineRouteArgs> page = - PageInfo<TimeLineRouteArgs>(name); + static const PageInfo<UserFollowerRouteArgs> page = + PageInfo<UserFollowerRouteArgs>(name); } -class TimeLineRouteArgs { - const TimeLineRouteArgs({ +class UserFollowerRouteArgs { + const UserFollowerRouteArgs({ this.key, - required this.initialTabSetting, + required this.userId, + required this.account, }); final Key? key; - final TabSetting initialTabSetting; + final String userId; + + final Account account; @override String toString() { - return 'TimeLineRouteArgs{key: $key, initialTabSetting: $initialTabSetting}'; + return 'UserFollowerRouteArgs{key: $key, userId: $userId, account: $account}'; } } /// generated route for -/// [FavoritedNotePage] -class FavoritedNoteRoute extends PageRouteInfo<FavoritedNoteRouteArgs> { - FavoritedNoteRoute({ +/// [UserPage] +class UserRoute extends PageRouteInfo<UserRouteArgs> { + UserRoute({ Key? key, + required String userId, required Account account, List<PageRouteInfo>? children, }) : super( - FavoritedNoteRoute.name, - args: FavoritedNoteRouteArgs( + UserRoute.name, + args: UserRouteArgs( key: key, + userId: userId, account: account, ), initialChildren: children, ); - static const String name = 'FavoritedNoteRoute'; + static const String name = 'UserRoute'; - static const PageInfo<FavoritedNoteRouteArgs> page = - PageInfo<FavoritedNoteRouteArgs>(name); + static const PageInfo<UserRouteArgs> page = PageInfo<UserRouteArgs>(name); } -class FavoritedNoteRouteArgs { - const FavoritedNoteRouteArgs({ +class UserRouteArgs { + const UserRouteArgs({ this.key, + required this.userId, required this.account, }); final Key? key; + final String userId; + final Account account; @override String toString() { - return 'FavoritedNoteRouteArgs{key: $key, account: $account}'; + return 'UserRouteArgs{key: $key, userId: $userId, account: $account}'; } } diff --git a/lib/state_notifier/note_create_page/note_create_state_notifier.dart b/lib/state_notifier/note_create_page/note_create_state_notifier.dart index d90c7216b..23753e16c 100644 --- a/lib/state_notifier/note_create_page/note_create_state_notifier.dart +++ b/lib/state_notifier/note_create_page/note_create_state_notifier.dart @@ -181,6 +181,14 @@ class NoteCreateNotifier extends StateNotifier<NoteCreate> { } final deletedNoteChannel = note.channel; + final replyTo = <User>[]; + if (note.mentions.isNotEmpty) { + replyTo.addAll( + await misskey.users + .showByIds(UsersShowByIdsRequest(userIds: note.mentions)), + ); + } + resultState = resultState.copyWith( noteVisibility: note.visibility, localOnly: note.localOnly, @@ -193,11 +201,7 @@ class NoteCreateNotifier extends StateNotifier<NoteCreate> { isCw: note.cw?.isNotEmpty == true, text: note.text ?? "", reactionAcceptance: note.reactionAcceptance, - replyTo: [ - for (final userId in note.mentions) - (await misskey.users.show(UsersShowRequest(userId: userId))) - .toUser() - ], + replyTo: replyTo.toList(), isVote: note.poll != null, isVoteMultiple: note.poll?.multiple ?? false, voteExpireType: VoteExpireType.date, @@ -219,6 +223,14 @@ class NoteCreateNotifier extends StateNotifier<NoteCreate> { } if (reply != null) { + final replyTo = <User>[]; + if (reply.mentions.isNotEmpty) { + replyTo.addAll( + await misskey.users + .showByIds(UsersShowByIdsRequest(userIds: reply.mentions)), + ); + } + resultState = resultState.copyWith( reply: reply, noteVisibility: @@ -227,9 +239,7 @@ class NoteCreateNotifier extends StateNotifier<NoteCreate> { isCw: reply.cw?.isNotEmpty == true, replyTo: [ reply.user, - for (final userId in reply.mentions) - (await misskey.users.show(UsersShowRequest(userId: userId))) - .toUser() + ...replyTo, ]..removeWhere((element) => element.id == state.account.i.id), ); } diff --git a/lib/view/common/avatar_icon.dart b/lib/view/common/avatar_icon.dart index d743125ba..176a588cd 100644 --- a/lib/view/common/avatar_icon.dart +++ b/lib/view/common/avatar_icon.dart @@ -19,39 +19,6 @@ class AvatarIcon extends StatefulWidget { this.onTap, }); - factory AvatarIcon.fromIResponse(IResponse response, {double height = 48}) { - return AvatarIcon( - user: User( - id: response.id, - username: response.username, - avatarUrl: response.avatarUrl, - avatarBlurhash: response.avatarBlurhash, - avatarDecorations: response.avatarDecorations, - isCat: response.isCat, - isBot: response.isBot, - ), - height: height, - ); - } - - factory AvatarIcon.fromUserResponse( - UsersShowResponse response, { - double height = 48, - }) { - return AvatarIcon( - user: User( - id: response.id, - username: response.username, - avatarUrl: response.avatarUrl, - avatarBlurhash: response.avatarBlurhash, - avatarDecorations: response.avatarDecorations, - isCat: response.isCat, - isBot: response.isBot, - ), - height: height, - ); - } - @override State<StatefulWidget> createState() => AvatarIconState(); } diff --git a/lib/view/common/common_drawer.dart b/lib/view/common/common_drawer.dart index d54982f4d..677e681f9 100644 --- a/lib/view/common/common_drawer.dart +++ b/lib/view/common/common_drawer.dart @@ -24,7 +24,7 @@ class CommonDrawer extends ConsumerWidget { AccountScope( account: account, child: ExpansionTile( - leading: AvatarIcon.fromIResponse(account.i), + leading: AvatarIcon(user: account.i), initiallyExpanded: account.acct == initialOpenAcct, title: SimpleMfmText(account.i.name ?? account.i.username, style: Theme.of(context).textTheme.titleMedium), diff --git a/lib/view/common/misskey_notes/open_another_account.dart b/lib/view/common/misskey_notes/open_another_account.dart index 151ee6f59..00af9b9b2 100644 --- a/lib/view/common/misskey_notes/open_another_account.dart +++ b/lib/view/common/misskey_notes/open_another_account.dart @@ -104,7 +104,7 @@ class AccountSelectDialog extends ConsumerWidget { AccountScope( account: account, child: ListTile( - leading: AvatarIcon.fromIResponse(account.i), + leading: AvatarIcon(user: account.i), title: SimpleMfmText(account.i.name ?? account.i.username, style: Theme.of(context).textTheme.titleMedium), subtitle: Text( diff --git a/lib/view/note_create_page/note_create_setting_top.dart b/lib/view/note_create_page/note_create_setting_top.dart index 518b78e5a..56595adf4 100644 --- a/lib/view/note_create_page/note_create_setting_top.dart +++ b/lib/view/note_create_page/note_create_setting_top.dart @@ -62,8 +62,8 @@ class NoteCreateSettingTop extends ConsumerWidget { return Row( children: [ const Padding(padding: EdgeInsets.only(left: 5)), - AvatarIcon.fromIResponse( - AccountScope.of(context).i, + AvatarIcon( + user: AccountScope.of(context).i, height: Theme.of(context).iconButtonTheme.style?.iconSize?.resolve({}) ?? 32, diff --git a/lib/view/settings_page/account_settings_page/account_list.dart b/lib/view/settings_page/account_settings_page/account_list.dart index 83d8f9420..304a710e3 100644 --- a/lib/view/settings_page/account_settings_page/account_list.dart +++ b/lib/view/settings_page/account_settings_page/account_list.dart @@ -1,4 +1,3 @@ - import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:miria/providers.dart'; @@ -37,7 +36,7 @@ class AccountListPageState extends ConsumerState<AccountListPage> { child: ListView.builder( itemCount: accounts.length, itemBuilder: (context, index) => ListTile( - leading: AvatarIcon.fromIResponse(accounts[index].i), + leading: AvatarIcon(user: accounts[index].i), onLongPress: () { showDialog( context: context, diff --git a/lib/view/several_account_settings_page/hard_mute_page/hard_mute_page.dart b/lib/view/several_account_settings_page/hard_mute_page/hard_mute_page.dart index 82c44f402..18def7ca8 100644 --- a/lib/view/several_account_settings_page/hard_mute_page/hard_mute_page.dart +++ b/lib/view/several_account_settings_page/hard_mute_page/hard_mute_page.dart @@ -68,7 +68,7 @@ class HardMutePageState extends ConsumerState<HardMutePage> { body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(10), - child: CommonFuture<IResponse>( + child: CommonFuture<MeDetailed>( future: ref.read(misskeyProvider(widget.account)).i.i(), futureFinished: (data) { controller.text = muteValueString(data.mutedWords); diff --git a/lib/view/several_account_settings_page/instance_mute_page/instance_mute_page.dart b/lib/view/several_account_settings_page/instance_mute_page/instance_mute_page.dart index 31c89ed1c..f879fb02a 100644 --- a/lib/view/several_account_settings_page/instance_mute_page/instance_mute_page.dart +++ b/lib/view/several_account_settings_page/instance_mute_page/instance_mute_page.dart @@ -48,7 +48,7 @@ class InstanceMutePageState extends ConsumerState<InstanceMutePage> { body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(10), - child: CommonFuture<IResponse>( + child: CommonFuture<MeDetailed>( future: ref.read(misskeyProvider(widget.account)).i.i(), futureFinished: (data) { controller.text = data.mutedInstances.join("\n"); diff --git a/lib/view/sharing_account_select_page/account_select_page.dart b/lib/view/sharing_account_select_page/account_select_page.dart index 3a2c04fd9..a9af7898e 100644 --- a/lib/view/sharing_account_select_page/account_select_page.dart +++ b/lib/view/sharing_account_select_page/account_select_page.dart @@ -36,7 +36,7 @@ class SharingAccountSelectPageState initialMediaFiles: widget.filePath, )); }, - leading: AvatarIcon.fromIResponse(account.i), + leading: AvatarIcon(user: account.i), title: Text(account.i.name ?? account.i.username, style: Theme.of(context).textTheme.titleMedium), subtitle: Text( diff --git a/lib/view/user_page/user_control_dialog.dart b/lib/view/user_page/user_control_dialog.dart index e0ffab0e2..28e049ea3 100644 --- a/lib/view/user_page/user_control_dialog.dart +++ b/lib/view/user_page/user_control_dialog.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:miria/extensions/users_show_response_extension.dart'; +import 'package:miria/extensions/user_extension.dart'; import 'package:miria/model/account.dart'; import 'package:miria/providers.dart'; import 'package:miria/view/common/error_dialog_handler.dart'; @@ -21,14 +21,12 @@ enum UserControl { class UserControlDialog extends ConsumerStatefulWidget { final Account account; - final UsersShowResponse response; - final bool isMe; + final UserDetailed response; const UserControlDialog({ super.key, required this.account, required this.response, - required this.isMe, }); @override @@ -138,6 +136,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { @override Widget build(BuildContext context) { + final user = widget.response; return ListView(children: [ ListTile( onTap: () { @@ -146,7 +145,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { text: Uri( scheme: "https", host: widget.account.host, - path: widget.response.acct, + path: user.acct, ).toString(), ), ); @@ -161,7 +160,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { onTap: () { Clipboard.setData( ClipboardData( - text: widget.response.name ?? widget.response.username, + text: user.name ?? user.username, ), ); ScaffoldMessenger.of(context).showSnackBar( @@ -173,7 +172,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { ), ListTile( onTap: () { - Clipboard.setData(ClipboardData(text: widget.response.acct)); + Clipboard.setData(ClipboardData(text: user.acct)); ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text("コピーしました")), ); @@ -188,7 +187,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { Uri( scheme: "https", host: widget.account.host, - path: widget.response.acct, + path: user.acct, ), ); Navigator.of(context).pop(); @@ -202,8 +201,8 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { onTap: addToAntenna, title: const Text("アンテナに追加"), ), - if (!widget.isMe) ...[ - if (widget.response.isRenoteMuted ?? false) + if (user is UserDetailedNotMeWithRelations) ...[ + if (user.isRenoteMuted) ListTile( onTap: renoteMuteDelete.expectFailure(context), title: const Text("Renoteのミュート解除する"), @@ -213,7 +212,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { onTap: renoteMuteCreate.expectFailure(context), title: const Text("Renoteをミュートする"), ), - if (widget.response.isMuted ?? false) + if (user.isMuted) ListTile( onTap: muteDelete.expectFailure(context), title: const Text("ミュート解除する"), @@ -223,7 +222,7 @@ class UserControlDialogState extends ConsumerState<UserControlDialog> { onTap: muteCreate.expectFailure(context), title: const Text("ミュートする"), ), - if (widget.response.isBlocking ?? false) + if (user.isBlocking) ListTile( onTap: blockingDelete.expectFailure(context), title: const Text("ブロックを解除する"), diff --git a/lib/view/user_page/user_detail.dart b/lib/view/user_page/user_detail.dart index e29091ab0..3e1243022 100644 --- a/lib/view/user_page/user_detail.dart +++ b/lib/view/user_page/user_detail.dart @@ -3,6 +3,7 @@ import 'package:confetti/confetti.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/extensions/date_time_extension.dart'; +import 'package:miria/extensions/user_extension.dart'; import 'package:miria/model/account.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; @@ -21,7 +22,7 @@ import 'package:misskey_dart/misskey_dart.dart'; class UserDetail extends ConsumerStatefulWidget { final Account account; final Account? controlAccount; - final UsersShowResponse response; + final UserDetailed response; const UserDetail({ super.key, @@ -35,12 +36,18 @@ class UserDetail extends ConsumerStatefulWidget { } class UserDetailState extends ConsumerState<UserDetail> { - late UsersShowResponse response; + late UserDetailed response; bool isFollowEditing = false; String memo = ""; Future<void> followCreate() async { if (isFollowEditing) return; + + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + setState(() { isFollowEditing = true; }); @@ -48,13 +55,14 @@ class UserDetailState extends ConsumerState<UserDetail> { await ref .read(misskeyProvider(AccountScope.of(context))) .following - .create(FollowingCreateRequest(userId: response.id)); + .create(FollowingCreateRequest(userId: user.id)); if (!mounted) return; + final requiresFollowRequest = user.isLocked && !user.isFollowed; setState(() { isFollowEditing = false; - response = response.copyWith( - isFollowing: !response.requiresFollowRequest, - hasPendingFollowRequestFromYou: response.requiresFollowRequest, + response = user.copyWith( + isFollowing: !requiresFollowRequest, + hasPendingFollowRequestFromYou: requiresFollowRequest, ); }); } catch (e) { @@ -68,6 +76,12 @@ class UserDetailState extends ConsumerState<UserDetail> { Future<void> followDelete() async { if (isFollowEditing) return; + + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + final account = AccountScope.of(context); if (await SimpleConfirmDialog.show( context: context, @@ -84,11 +98,11 @@ class UserDetailState extends ConsumerState<UserDetail> { await ref .read(misskeyProvider(account)) .following - .delete(FollowingDeleteRequest(userId: response.id)); + .delete(FollowingDeleteRequest(userId: user.id)); if (!mounted) return; setState(() { isFollowEditing = false; - response = response.copyWith(isFollowing: false); + response = user.copyWith(isFollowing: false); }); } catch (e) { if (!mounted) return; @@ -101,6 +115,12 @@ class UserDetailState extends ConsumerState<UserDetail> { Future<void> followRequestCancel() async { if (isFollowEditing) return; + + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + setState(() { isFollowEditing = true; }); @@ -109,11 +129,11 @@ class UserDetailState extends ConsumerState<UserDetail> { .read(misskeyProvider(AccountScope.of(context))) .following .requests - .cancel(FollowingRequestsCancelRequest(userId: response.id)); + .cancel(FollowingRequestsCancelRequest(userId: user.id)); if (!mounted) return; setState(() { isFollowEditing = false; - response = response.copyWith(hasPendingFollowRequestFromYou: false); + response = user.copyWith(hasPendingFollowRequestFromYou: false); }); } catch (e) { if (!mounted) return; @@ -124,45 +144,50 @@ class UserDetailState extends ConsumerState<UserDetail> { } } - Future<void> userControl(bool isMe) async { + Future<void> userControl() async { final result = await showModalBottomSheet<UserControl?>( - context: context, - builder: (context) => UserControlDialog( - account: widget.account, - response: response, - isMe: isMe, - )); + context: context, + builder: (context) => UserControlDialog( + account: widget.account, + response: response, + ), + ); if (result == null) return; + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + switch (result) { case UserControl.createMute: setState(() { - response = response.copyWith(isMuted: true); + response = user.copyWith(isMuted: true); }); break; case UserControl.deleteMute: setState(() { - response = response.copyWith(isMuted: false); + response = user.copyWith(isMuted: false); }); break; case UserControl.createRenoteMute: setState(() { - response = response.copyWith(isRenoteMuted: true); + response = user.copyWith(isRenoteMuted: true); }); break; case UserControl.deleteRenoteMute: setState(() { - response = response.copyWith(isRenoteMuted: false); + response = user.copyWith(isRenoteMuted: false); }); break; case UserControl.createBlock: setState(() { - response = response.copyWith(isBlocking: true); + response = user.copyWith(isBlocking: true); }); break; case UserControl.deleteBlock: setState(() { - response = response.copyWith(isBlocking: false); + response = user.copyWith(isBlocking: false); }); break; } @@ -176,10 +201,7 @@ class UserDetailState extends ConsumerState<UserDetail> { } Widget buildContent() { - final userName = - "${response.username}${response.host != null ? "@${response.host ?? ""}" : ""}"; - final isMe = (widget.response.host == null && - widget.response.username == AccountScope.of(context).userId); + final user = response; return Column(children: [ if (widget.controlAccount == null) @@ -189,9 +211,7 @@ class UserDetailState extends ConsumerState<UserDetail> { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (isMe) - const Spacer() - else + if (user is UserDetailedNotMeWithRelations) Expanded( child: Align( alignment: Alignment.centerRight, @@ -200,86 +220,92 @@ class UserDetailState extends ConsumerState<UserDetail> { child: Wrap( crossAxisAlignment: WrapCrossAlignment.center, children: [ - if (response.isRenoteMuted ?? false) + if (user.isRenoteMuted) const Card( - child: Padding( - padding: EdgeInsets.all(10), - child: Text("Renoteのミュート中"), - )), - if (response.isMuted ?? false) + child: Padding( + padding: EdgeInsets.all(10), + child: Text("Renoteのミュート中"), + ), + ), + if (user.isMuted) const Card( - child: Padding( - padding: EdgeInsets.all(10), - child: Text("ミュート中"), - )), - if (response.isBlocking ?? false) + child: Padding( + padding: EdgeInsets.all(10), + child: Text("ミュート中"), + ), + ), + if (user.isBlocking) const Card( - child: Padding( - padding: EdgeInsets.all(10), - child: Text("ブロック中"), - )), - if ((response.isFollowed ?? false)) + child: Padding( + padding: EdgeInsets.all(10), + child: Text("ブロック中"), + ), + ), + if (user.isFollowed) const Padding( padding: EdgeInsets.only(right: 8.0), child: Card( - child: Padding( - padding: EdgeInsets.all(10), - child: Text("フォローされています"), - )), + child: Padding( + padding: EdgeInsets.all(10), + child: Text("フォローされています"), + ), + ), ), if (!isFollowEditing) - (response.isFollowing ?? false) - ? ElevatedButton( - onPressed: - followDelete.expectFailure(context), - child: const Text("フォロー解除"), - ) - : (response.hasPendingFollowRequestFromYou ?? - false) - ? ElevatedButton( - onPressed: followRequestCancel - .expectFailure(context), - child: const Text("フォロー許可待ち"), - ) - : OutlinedButton( - onPressed: followCreate - .expectFailure(context), - child: Text( - (response.requiresFollowRequest) - ? "フォロー申請" - : "フォローする", - ), - ) + if (user.isFollowing) + ElevatedButton( + onPressed: + followDelete.expectFailure(context), + child: const Text("フォロー解除"), + ) + else if (user.hasPendingFollowRequestFromYou) + ElevatedButton( + onPressed: followRequestCancel + .expectFailure(context), + child: const Text("フォロー許可待ち"), + ) + else + OutlinedButton( + onPressed: + followCreate.expectFailure(context), + child: Text( + user.isLocked ? "フォロー申請" : "フォローする", + ), + ) else Align( alignment: Alignment.centerRight, child: TextButton.icon( - onPressed: () {}, - icon: SizedBox( - width: Theme.of(context) - .textTheme - .bodyMedium - ?.fontSize ?? - 22, - height: Theme.of(context) - .textTheme - .bodyMedium - ?.fontSize ?? - 22, - child: - const CircularProgressIndicator()), - label: const Text("更新中")), + onPressed: () {}, + icon: SizedBox( + width: Theme.of(context) + .textTheme + .bodyMedium + ?.fontSize ?? + 22, + height: Theme.of(context) + .textTheme + .bodyMedium + ?.fontSize ?? + 22, + child: const CircularProgressIndicator(), + ), + label: const Text("更新中"), + ), ), ], ), ), ), - ), + ) + else + const Spacer(), Align( alignment: Alignment.center, child: IconButton( - onPressed: () => userControl(isMe), - icon: const Icon(Icons.more_vert)), + onPressed: userControl, + icon: const Icon(Icons.more_vert), + ), ) ], )), @@ -289,8 +315,8 @@ class UserDetailState extends ConsumerState<UserDetail> { child: Column(children: [ Row( children: [ - AvatarIcon.fromUserResponse( - response, + AvatarIcon( + user: response, height: 80, ), Expanded( @@ -304,16 +330,16 @@ class UserDetailState extends ConsumerState<UserDetail> { MfmText( mfmText: response.name ?? response.username, style: Theme.of(context).textTheme.headlineSmall, - emoji: response.emojis ?? {}, + emoji: response.emojis, ), Text( - "@$userName", + response.acct, style: Theme.of(context).textTheme.bodyLarge, - ) + ), ], ), ), - ) + ), ], ), const Padding(padding: EdgeInsets.only(top: 5)), @@ -399,7 +425,7 @@ class UserDetailState extends ConsumerState<UserDetail> { alignment: Alignment.center, child: MfmText( mfmText: response.description ?? "", - emoji: response.emojis ?? {}, + emoji: response.emojis, ), ), const Padding(padding: EdgeInsets.only(top: 20)), @@ -450,13 +476,13 @@ class UserDetailState extends ConsumerState<UserDetail> { TableCell( child: MfmText( mfmText: field.name, - emoji: response.emojis ?? {}, + emoji: response.emojis, ), ), TableCell( child: MfmText( mfmText: field.value, - emoji: response.emojis ?? {}, + emoji: response.emojis, )), ]) ], @@ -545,7 +571,7 @@ class UserDetailState extends ConsumerState<UserDetail> { } class BirthdayConfetti extends StatefulWidget { - final UsersShowResponse response; + final UserDetailed response; final Widget child; const BirthdayConfetti({ @@ -589,10 +615,3 @@ class BirthdayConfettiState extends State<BirthdayConfetti> { return widget.child; } } - -extension on UsersShowResponse { - bool get requiresFollowRequest { - return isLocked && - !((isFollowed ?? false) && (autoAcceptFollowed ?? false)); - } -} diff --git a/lib/view/user_page/user_page.dart b/lib/view/user_page/user_page.dart index 4e705a1a7..92bd24c0e 100644 --- a/lib/view/user_page/user_page.dart +++ b/lib/view/user_page/user_page.dart @@ -16,9 +16,9 @@ import 'package:misskey_dart/misskey_dart.dart'; class UserInfo { final String userId; - final UsersShowResponse? response; + final UserDetailed? response; final String? remoteUserId; - final UsersShowResponse? remoteResponse; + final UserDetailed? remoteResponse; const UserInfo({ required this.userId, @@ -179,8 +179,8 @@ class UserDetailTab extends ConsumerStatefulWidget { } class UserDetailTabState extends ConsumerState<UserDetailTab> { - UsersShowResponse? response; - UsersShowResponse? remoteResponse; + UserDetailed? response; + UserDetailed? remoteResponse; (Object?, StackTrace)? error; @override diff --git a/lib/view/users_list_page/users_list_detail_page.dart b/lib/view/users_list_page/users_list_detail_page.dart index c0034225f..152ad6895 100644 --- a/lib/view/users_list_page/users_list_detail_page.dart +++ b/lib/view/users_list_page/users_list_detail_page.dart @@ -66,7 +66,7 @@ class _UsersListUsers userIds: list.userIds, ), ); - return response.map((e) => e.toUser()).toList(); + return response.toList(); } Misskey get _misskey => arg.$1; diff --git a/test/test_util/mock.mocks.dart b/test/test_util/mock.mocks.dart index 7f3879ee9..279ac89c3 100644 --- a/test/test_util/mock.mocks.dart +++ b/test/test_util/mock.mocks.dart @@ -487,8 +487,8 @@ class _FakeMisskeyFollowingRequests_40 extends _i1.SmartFake ); } -class _FakeUser_41 extends _i1.SmartFake implements _i6.User { - _FakeUser_41( +class _FakeUserLite_41 extends _i1.SmartFake implements _i6.UserLite { + _FakeUserLite_41( Object parent, Invocation parentInvocation, ) : super( @@ -507,8 +507,8 @@ class _FakeHashtag_42 extends _i1.SmartFake implements _i6.Hashtag { ); } -class _FakeIResponse_43 extends _i1.SmartFake implements _i6.IResponse { - _FakeIResponse_43( +class _FakeMeDetailed_43 extends _i1.SmartFake implements _i6.MeDetailed { + _FakeMeDetailed_43( Object parent, Invocation parentInvocation, ) : super( @@ -604,9 +604,8 @@ class _FakeMisskeyUsersLists_51 extends _i1.SmartFake ); } -class _FakeUsersShowResponse_52 extends _i1.SmartFake - implements _i6.UsersShowResponse { - _FakeUsersShowResponse_52( +class _FakeUserDetailed_52 extends _i1.SmartFake implements _i6.UserDetailed { + _FakeUserDetailed_52( Object parent, Invocation parentInvocation, ) : super( @@ -2148,15 +2147,16 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { ) as _i17.Future<Iterable<_i6.GetAvatarDecorationsResponse>>); @override - _i17.Future<Iterable<_i6.User>> pinnedUsers() => (super.noSuchMethod( + _i17.Future<Iterable<_i6.UserDetailed>> pinnedUsers() => (super.noSuchMethod( Invocation.method( #pinnedUsers, [], ), - returnValue: _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), + returnValue: + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), returnValueForMissingStub: - _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), - ) as _i17.Future<Iterable<_i6.User>>); + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), + ) as _i17.Future<Iterable<_i6.UserDetailed>>); @override _i6.SocketController homeTimelineStream({ @@ -2470,6 +2470,10 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { String, _i6.TimelineVoted, )? onVoted, + _i17.FutureOr<void> Function( + String, + _i6.NoteEdited, + )? onUpdated, }) => (super.noSuchMethod( Invocation.method( @@ -2482,6 +2486,7 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, + #onUpdated: onUpdated, }, ), returnValue: _FakeSocketController_31( @@ -2496,6 +2501,7 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, + #onUpdated: onUpdated, }, ), ), @@ -2511,6 +2517,7 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { #onUnreacted: onUnreacted, #onDeleted: onDeleted, #onVoted: onVoted, + #onUpdated: onUpdated, }, ), ), @@ -2593,8 +2600,8 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { _i6.SocketController userListStream({ required String? listId, _i17.FutureOr<void> Function(_i6.Note)? onNoteReceived, - _i17.FutureOr<void> Function(_i6.User)? onUserAdded, - _i17.FutureOr<void> Function(_i6.User)? onUserRemoved, + _i17.FutureOr<void> Function(_i6.UserLite)? onUserAdded, + _i17.FutureOr<void> Function(_i6.UserLite)? onUserRemoved, _i17.FutureOr<void> Function( String, _i6.TimelineReacted, @@ -2822,10 +2829,10 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { _i17.FutureOr<void> Function(_i6.Note)? onMention, _i17.FutureOr<void> Function(_i6.Note)? onReply, _i17.FutureOr<void> Function(_i6.Note)? onRenote, - _i17.FutureOr<void> Function(_i6.User)? onFollow, - _i17.FutureOr<void> Function(_i6.User)? onFollowed, - _i17.FutureOr<void> Function(_i6.User)? onUnfollow, - _i17.FutureOr<void> Function(_i6.User)? onMeUpdated, + _i17.FutureOr<void> Function(_i6.UserDetailedNotMe)? onFollow, + _i17.FutureOr<void> Function(_i6.UserLite)? onFollowed, + _i17.FutureOr<void> Function(_i6.UserDetailedNotMe)? onUnfollow, + _i17.FutureOr<void> Function(_i6.MeDetailed)? onMeUpdated, _i17.FutureOr<void> Function()? onReadAllNotifications, _i17.FutureOr<void> Function(_i6.INotificationsResponse)? onUnreadNotification, @@ -2833,7 +2840,7 @@ class MockMisskey extends _i1.Mock implements _i6.Misskey { _i17.FutureOr<void> Function()? onReadAllUnreadMentions, _i17.FutureOr<void> Function(String)? onUnreadSpecifiedNote, _i17.FutureOr<void> Function()? onReadAllUnreadSpecifiedNotes, - _i17.FutureOr<void> Function(_i6.User)? onReceiveFollowRequest, + _i17.FutureOr<void> Function(_i6.UserLite)? onReceiveFollowRequest, _i17.FutureOr<void> Function()? onReadAllAnnouncements, }) => (super.noSuchMethod( @@ -3671,16 +3678,18 @@ class MockMisskeyFederation extends _i1.Mock implements _i6.MisskeyFederation { ) as _i17.Future<_i6.FederationShowInstanceResponse>); @override - _i17.Future<Iterable<_i6.User>> users(_i6.FederationUsersRequest? request) => + _i17.Future<Iterable<_i6.UserDetailed>> users( + _i6.FederationUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), + returnValue: + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), returnValueForMissingStub: - _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), - ) as _i17.Future<Iterable<_i6.User>>); + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), + ) as _i17.Future<Iterable<_i6.UserDetailed>>); } /// A class which mocks [MisskeyFollowing]. @@ -3701,73 +3710,77 @@ class MockMisskeyFollowing extends _i1.Mock implements _i6.MisskeyFollowing { ) as _i6.MisskeyFollowingRequests); @override - _i17.Future<_i6.User> create(_i6.FollowingCreateRequest? request) => + _i17.Future<_i6.UserLite> create(_i6.FollowingCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), - returnValue: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValue: _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #create, [request], ), )), - returnValueForMissingStub: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValueForMissingStub: + _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #create, [request], ), )), - ) as _i17.Future<_i6.User>); + ) as _i17.Future<_i6.UserLite>); @override - _i17.Future<_i6.User> delete(_i6.FollowingDeleteRequest? request) => + _i17.Future<_i6.UserLite> delete(_i6.FollowingDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), - returnValue: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValue: _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #delete, [request], ), )), - returnValueForMissingStub: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValueForMissingStub: + _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #delete, [request], ), )), - ) as _i17.Future<_i6.User>); + ) as _i17.Future<_i6.UserLite>); @override - _i17.Future<_i6.User> invalidate(_i6.FollowingInvalidateRequest? request) => + _i17.Future<_i6.UserLite> invalidate( + _i6.FollowingInvalidateRequest? request) => (super.noSuchMethod( Invocation.method( #invalidate, [request], ), - returnValue: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValue: _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #invalidate, [request], ), )), - returnValueForMissingStub: _i17.Future<_i6.User>.value(_FakeUser_41( + returnValueForMissingStub: + _i17.Future<_i6.UserLite>.value(_FakeUserLite_41( this, Invocation.method( #invalidate, [request], ), )), - ) as _i17.Future<_i6.User>); + ) as _i17.Future<_i6.UserLite>); @override _i17.Future<void> updateAll(_i6.FollowingUpdateAllRequest? request) => @@ -3848,16 +3861,18 @@ class MockMisskeyHashtags extends _i1.Mock implements _i6.MisskeyHashtags { ) as _i17.Future<Iterable<_i6.HashtagsTrendResponse>>); @override - _i17.Future<Iterable<_i6.User>> users(_i6.HashtagsUsersRequest? request) => + _i17.Future<Iterable<_i6.UserDetailed>> users( + _i6.HashtagsUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), + returnValue: + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), returnValueForMissingStub: - _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), - ) as _i17.Future<Iterable<_i6.User>>); + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), + ) as _i17.Future<Iterable<_i6.UserDetailed>>); } /// A class which mocks [MisskeyI]. @@ -3865,12 +3880,12 @@ class MockMisskeyHashtags extends _i1.Mock implements _i6.MisskeyHashtags { /// See the documentation for Mockito's code generation for more information. class MockMisskeyI extends _i1.Mock implements _i6.MisskeyI { @override - _i17.Future<_i6.IResponse> i() => (super.noSuchMethod( + _i17.Future<_i6.MeDetailed> i() => (super.noSuchMethod( Invocation.method( #i, [], ), - returnValue: _i17.Future<_i6.IResponse>.value(_FakeIResponse_43( + returnValue: _i17.Future<_i6.MeDetailed>.value(_FakeMeDetailed_43( this, Invocation.method( #i, @@ -3878,14 +3893,14 @@ class MockMisskeyI extends _i1.Mock implements _i6.MisskeyI { ), )), returnValueForMissingStub: - _i17.Future<_i6.IResponse>.value(_FakeIResponse_43( + _i17.Future<_i6.MeDetailed>.value(_FakeMeDetailed_43( this, Invocation.method( #i, [], ), )), - ) as _i17.Future<_i6.IResponse>); + ) as _i17.Future<_i6.MeDetailed>); @override _i17.Future<Iterable<_i6.INotificationsResponse>> notifications( @@ -3929,13 +3944,13 @@ class MockMisskeyI extends _i1.Mock implements _i6.MisskeyI { ) as _i17.Future<Iterable<_i6.IFavoritesResponse>>); @override - _i17.Future<_i6.IResponse> update(_i6.IUpdateRequest? request) => + _i17.Future<_i6.MeDetailed> update(_i6.IUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), - returnValue: _i17.Future<_i6.IResponse>.value(_FakeIResponse_43( + returnValue: _i17.Future<_i6.MeDetailed>.value(_FakeMeDetailed_43( this, Invocation.method( #update, @@ -3943,14 +3958,14 @@ class MockMisskeyI extends _i1.Mock implements _i6.MisskeyI { ), )), returnValueForMissingStub: - _i17.Future<_i6.IResponse>.value(_FakeIResponse_43( + _i17.Future<_i6.MeDetailed>.value(_FakeMeDetailed_43( this, Invocation.method( #update, [request], ), )), - ) as _i17.Future<_i6.IResponse>); + ) as _i17.Future<_i6.MeDetailed>); } /// A class which mocks [MisskeyNotes]. @@ -4504,14 +4519,13 @@ class MockMisskeyUsers extends _i1.Mock implements _i6.MisskeyUsers { ) as _i6.MisskeyUsersLists); @override - _i17.Future<_i6.UsersShowResponse> show(_i6.UsersShowRequest? request) => + _i17.Future<_i6.UserDetailed> show(_i6.UsersShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), - returnValue: - _i17.Future<_i6.UsersShowResponse>.value(_FakeUsersShowResponse_52( + returnValue: _i17.Future<_i6.UserDetailed>.value(_FakeUserDetailed_52( this, Invocation.method( #show, @@ -4519,40 +4533,38 @@ class MockMisskeyUsers extends _i1.Mock implements _i6.MisskeyUsers { ), )), returnValueForMissingStub: - _i17.Future<_i6.UsersShowResponse>.value(_FakeUsersShowResponse_52( + _i17.Future<_i6.UserDetailed>.value(_FakeUserDetailed_52( this, Invocation.method( #show, [request], ), )), - ) as _i17.Future<_i6.UsersShowResponse>); + ) as _i17.Future<_i6.UserDetailed>); @override - _i17.Future<Iterable<_i6.UsersShowResponse>> showByIds( + _i17.Future<Iterable<_i6.UserDetailed>> showByIds( _i6.UsersShowByIdsRequest? request) => (super.noSuchMethod( Invocation.method( #showByIds, [request], ), - returnValue: _i17.Future<Iterable<_i6.UsersShowResponse>>.value( - <_i6.UsersShowResponse>[]), + returnValue: + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), returnValueForMissingStub: - _i17.Future<Iterable<_i6.UsersShowResponse>>.value( - <_i6.UsersShowResponse>[]), - ) as _i17.Future<Iterable<_i6.UsersShowResponse>>); + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), + ) as _i17.Future<Iterable<_i6.UserDetailed>>); @override - _i17.Future<_i6.UsersShowResponse> showByName( + _i17.Future<_i6.UserDetailed> showByName( _i6.UsersShowByUserNameRequest? request) => (super.noSuchMethod( Invocation.method( #showByName, [request], ), - returnValue: - _i17.Future<_i6.UsersShowResponse>.value(_FakeUsersShowResponse_52( + returnValue: _i17.Future<_i6.UserDetailed>.value(_FakeUserDetailed_52( this, Invocation.method( #showByName, @@ -4560,14 +4572,14 @@ class MockMisskeyUsers extends _i1.Mock implements _i6.MisskeyUsers { ), )), returnValueForMissingStub: - _i17.Future<_i6.UsersShowResponse>.value(_FakeUsersShowResponse_52( + _i17.Future<_i6.UserDetailed>.value(_FakeUserDetailed_52( this, Invocation.method( #showByName, [request], ), )), - ) as _i17.Future<_i6.UsersShowResponse>); + ) as _i17.Future<_i6.UserDetailed>); @override _i17.Future<Iterable<_i6.Note>> notes(_i6.UsersNotesRequest? request) => @@ -4673,16 +4685,18 @@ class MockMisskeyUsers extends _i1.Mock implements _i6.MisskeyUsers { ) as _i17.Future<Iterable<_i6.User>>); @override - _i17.Future<Iterable<_i6.User>> users(_i6.UsersUsersRequest? request) => + _i17.Future<Iterable<_i6.UserDetailed>> users( + _i6.UsersUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), + returnValue: + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), returnValueForMissingStub: - _i17.Future<Iterable<_i6.User>>.value(<_i6.User>[]), - ) as _i17.Future<Iterable<_i6.User>>); + _i17.Future<Iterable<_i6.UserDetailed>>.value(<_i6.UserDetailed>[]), + ) as _i17.Future<Iterable<_i6.UserDetailed>>); @override _i17.Future<void> updateMemo(_i6.UsersUpdateMemoRequest? request) => diff --git a/test/test_util/test_datas.dart b/test/test_util/test_datas.dart index c53826662..30fb45a87 100644 --- a/test/test_util/test_datas.dart +++ b/test/test_util/test_datas.dart @@ -11,7 +11,7 @@ class TestData { Account(host: "example.miria.shiosyakeyakini.info", userId: "ai", i: i1); // i - static IResponse i1 = IResponse.fromJson(JSON5.parse(r""" + static MeDetailed i1 = MeDetailed.fromJson(JSON5.parse(r""" { id: '7rkr3b1c1c', name: '藍', @@ -376,8 +376,8 @@ class TestData { files: [], replyId: null, renoteId: null, -} - +} + ''')); static Note note2 = Note.fromJson(JSON5.parse(r''' @@ -415,7 +415,7 @@ class TestData { files: [], replyId: null, renoteId: null, -} +} ''')); /// 自身でないノート1 @@ -460,7 +460,7 @@ class TestData { files: [], replyId: null, renoteId: null, -} +} ''')); /// 自身のノート(投票込みのノート) @@ -641,7 +641,7 @@ class TestData { replyId: null, renoteId: null, myReaction: ':ultra_igyo@.:', -} +} ''')); /// Renote @@ -776,7 +776,7 @@ class TestData { folder: null, userId: null, user: null, - } + } ''')); static DriveFile drive2AsVideo = DriveFile.fromJson(JSON5.parse(r''' @@ -809,7 +809,7 @@ class TestData { data: await binaryImage); // ユーザー情報 - static User user1 = User.fromJson(JSON5.parse(r''' + static UserLite user1 = UserLite.fromJson(JSON5.parse(r''' { id: '7rkr3b1c1c', name: '藍', @@ -825,7 +825,8 @@ class TestData { }''')); static String user1ExpectId = "7rkr3b1c1c"; - static User detailedUser1 = User.fromJson(JSON5.parse(r''' + static UserDetailedNotMeWithRelations detailedUser1 = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7z9zua5kyv', name: 'おいしいBot', @@ -994,7 +995,8 @@ class TestData { isRenoteMuted: false, } ''')); - static User detailedUser2 = User.fromJson(JSON5.parse(r''' + static UserDetailedNotMeWithRelations detailedUser2 = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '9gbzuv2cze', name: '藍ちゃんにおじさん構文でメンションを送るbot', @@ -1106,8 +1108,8 @@ class TestData { static String detailedUser2ExpectedId = "9gbzuv2cze"; // ユーザー情報 - static UsersShowResponse usersShowResponse1 = - UsersShowResponse.fromJson(JSON5.parse(r''' + static UserDetailedNotMeWithRelations usersShowResponse1 = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7rkr3b1c1c', name: '藍', @@ -1214,12 +1216,12 @@ class TestData { isBlocked: false, isMuted: false, isRenoteMuted: false, -} - +} + ''')); - static UsersShowResponse usersShowResponse2 = - UsersShowResponse.fromJson(JSON5.parse(r''' + static UserDetailedNotMeWithRelations usersShowResponse2 = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '7z9zua5kyv', name: 'おいしいBot', @@ -1388,12 +1390,12 @@ class TestData { isBlocked: false, isMuted: false, isRenoteMuted: false, -} - +} + ''')); - static UsersShowResponse usersShowResponse3AsRemoteUser = - UsersShowResponse.fromJson(JSON5.parse(r''' + static UserDetailedNotMeWithRelations usersShowResponse3AsRemoteUser = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(r''' { id: '9i08deo0vj', name: 'あけおめらんか~', @@ -1473,8 +1475,8 @@ class TestData { } ''')); - static UsersShowResponse usersShowResponse3AsLocalUser = - UsersShowResponse.fromJson(JSON5.parse(''' + static UserDetailedNotMeWithRelations usersShowResponse3AsLocalUser = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(''' { id: '9i07ia9bf0', name: 'あけおめらんか~', @@ -1673,7 +1675,7 @@ class TestData { isFollowing: true, isFavorited: true, hasUnreadNote: false, -} +} ''')); // アンテナ diff --git a/test/view/common/misskey_notes/misskey_notes_test.dart b/test/view/common/misskey_notes/misskey_notes_test.dart index 5da4e8d60..8fd0a45f0 100644 --- a/test/view/common/misskey_notes/misskey_notes_test.dart +++ b/test/view/common/misskey_notes/misskey_notes_test.dart @@ -257,7 +257,7 @@ System.out.println("@ai uneune"); NotesReactionsResponse( id: "reaction1", createdAt: DateTime.now(), - user: TestData.detailedUser2, + user: UserLite.fromJson(TestData.detailedUser2.toJson()), type: ":ai_yay:") ]); await tester.pumpWidget(buildTestWidget( diff --git a/test/view/note_create_page/note_create_page_test.dart b/test/view/note_create_page/note_create_page_test.dart index 3bb268d8b..a31e501c5 100644 --- a/test/view/note_create_page/note_create_page_test.dart +++ b/test/view/note_create_page/note_create_page_test.dart @@ -904,8 +904,8 @@ void main() { final misskey = MockMisskey(); final users = MockMisskeyUsers(); when(misskey.users).thenReturn(users); - when(users.show(any)) - .thenAnswer((_) async => TestData.usersShowResponse2); + when(users.showByIds(any)) + .thenAnswer((_) async => [TestData.usersShowResponse2]); await tester.pumpWidget(ProviderScope( overrides: [ @@ -941,8 +941,8 @@ void main() { final misskey = MockMisskey(); final users = MockMisskeyUsers(); when(misskey.users).thenReturn(users); - when(users.show(any)) - .thenAnswer((_) async => TestData.usersShowResponse1); + when(users.showByIds(any)) + .thenAnswer((_) async => [TestData.usersShowResponse1]); await tester.pumpWidget(ProviderScope( overrides: [ misskeyProvider.overrideWith((ref, arg) => misskey), diff --git a/test/view/user_page/user_page_test.dart b/test/view/user_page/user_page_test.dart index 179efe071..ab2fe8d5c 100644 --- a/test/view/user_page/user_page_test.dart +++ b/test/view/user_page/user_page_test.dart @@ -136,11 +136,12 @@ void main() { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); - when(mockUser.show(any)).thenAnswer((_) async => - TestData.usersShowResponse2.copyWith( - isFollowing: false, - isLocked: false, - autoAcceptFollowed: true)); + when(mockUser.show(any)).thenAnswer( + (_) async => TestData.usersShowResponse2.copyWith( + isFollowing: false, + isLocked: false, + ), + ); await tester.pumpWidget(ProviderScope( overrides: [ @@ -161,13 +162,14 @@ void main() { final mockMisskey = MockMisskey(); final mockUser = MockMisskeyUsers(); when(mockMisskey.users).thenReturn(mockUser); - when(mockUser.show(any)).thenAnswer((_) async => - TestData.usersShowResponse2.copyWith( - isFollowing: false, - hasPendingFollowRequestFromYou: false, - isLocked: true, - isFollowed: false, - autoAcceptFollowed: false)); + when(mockUser.show(any)).thenAnswer( + (_) async => TestData.usersShowResponse2.copyWith( + isFollowing: false, + hasPendingFollowRequestFromYou: false, + isLocked: true, + isFollowed: false, + ), + ); await tester.pumpWidget(ProviderScope( overrides: [ @@ -517,7 +519,6 @@ void main() { followeeId: TestData.usersShowResponse2.id, followerId: TestData.account.i.id, followee: TestData.detailedUser2, - follower: TestData.user1, ) ]); @@ -555,7 +556,6 @@ void main() { createdAt: DateTime.now(), followeeId: TestData.account.i.id, followerId: TestData.usersShowResponse2.id, - followee: TestData.user1, follower: TestData.detailedUser2, ) ]);