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 69e3c004d..797b786de 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, MetaResponse? meta, }) = _Account; @@ -43,7 +43,7 @@ class Account with _$Account { userId: "", token: null, meta: meta, - i: IResponse( + i: MeDetailed( id: "", username: "", createdAt: DateTime.now(), @@ -58,7 +58,6 @@ class Account with _$Account { followersCount: 0, notesCount: 0, publicReactions: false, - ffVisibility: "", twoFactorEnabled: false, usePasswordLessLogin: false, securityKeys: false, diff --git a/lib/model/account.freezed.dart b/lib/model/account.freezed.dart index 081757924..c760e880d 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; MetaResponse? get meta => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -40,10 +40,10 @@ abstract class $AccountCopyWith<$Res> { {String host, String userId, String? token, - IResponse i, + MeDetailed i, MetaResponse? meta}); - $IResponseCopyWith<$Res> get i; + $MeDetailedCopyWith<$Res> get i; $MetaResponseCopyWith<$Res>? get meta; } @@ -82,7 +82,7 @@ class _$AccountCopyWithImpl<$Res, $Val extends Account> i: null == i ? _value.i : i // ignore: cast_nullable_to_non_nullable - as IResponse, + as MeDetailed, meta: freezed == meta ? _value.meta : meta // ignore: cast_nullable_to_non_nullable @@ -92,8 +92,8 @@ class _$AccountCopyWithImpl<$Res, $Val extends Account> @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); }); } @@ -122,11 +122,11 @@ abstract class _$$AccountImplCopyWith<$Res> implements $AccountCopyWith<$Res> { {String host, String userId, String? token, - IResponse i, + MeDetailed i, MetaResponse? meta}); @override - $IResponseCopyWith<$Res> get i; + $MeDetailedCopyWith<$Res> get i; @override $MetaResponseCopyWith<$Res>? get meta; } @@ -164,7 +164,7 @@ class __$$AccountImplCopyWithImpl<$Res> i: null == i ? _value.i : i // ignore: cast_nullable_to_non_nullable - as IResponse, + as MeDetailed, meta: freezed == meta ? _value.meta : meta // ignore: cast_nullable_to_non_nullable @@ -194,7 +194,7 @@ class _$AccountImpl extends _Account { @override final String? token; @override - final IResponse i; + final MeDetailed i; @override final MetaResponse? meta; @@ -222,7 +222,7 @@ abstract class _Account extends Account { {required final String host, required final String userId, final String? token, - required final IResponse i, + required final MeDetailed i, final MetaResponse? meta}) = _$AccountImpl; const _Account._() : super._(); @@ -235,7 +235,7 @@ abstract class _Account extends Account { @override String? get token; @override - IResponse get i; + MeDetailed get i; @override MetaResponse? get meta; @override diff --git a/lib/model/account.g.dart b/lib/model/account.g.dart index 0b4ff1737..754427110 100644 --- a/lib/model/account.g.dart +++ b/lib/model/account.g.dart @@ -11,7 +11,7 @@ _$AccountImpl _$$AccountImplFromJson(Map json) => host: json['host'] as String, userId: json['userId'] as String, token: json['token'] as String?, - i: IResponse.fromJson(json['i'] as Map), + i: MeDetailed.fromJson(json['i'] as Map), meta: json['meta'] == null ? null : MetaResponse.fromJson(json['meta'] as Map), diff --git a/lib/providers.dart b/lib/providers.dart index fd347b370..9423ebca2 100644 --- a/lib/providers.dart +++ b/lib/providers.dart @@ -213,7 +213,7 @@ final accountRepositoryProvider = final accountsProvider = Provider>((ref) => ref.watch(accountRepositoryProvider)); -final iProvider = Provider.family((ref, acct) { +final iProvider = Provider.family((ref, acct) { final accounts = ref.watch(accountsProvider); final account = accounts.firstWhere((account) => account.acct == acct); return account.i; diff --git a/lib/router/app_router.gr.dart b/lib/router/app_router.gr.dart index e52bd04c6..68023f2a6 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 pagesMap = { - NotesAfterRenoteRoute.name: (routeData) { - final args = routeData.argsAs(); + AnnouncementRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: NotesAfterRenotePage( + child: AnnouncementPage( key: args.key, - note: args.note, + account: args.account, + ), + ); + }, + AntennaNotesRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( + 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(); + ChannelsRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: AntennaNotesPage( + child: ChannelsPage( key: args.key, - antenna: args.antenna, account: args.account, ), ); }, - NotificationRoute.name: (routeData) { - final args = routeData.argsAs(); + ChannelDetailRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: NotificationPage( + child: ChannelDetailPage( key: args.key, account: args.account, + channelId: args.channelId, ), ); }, - LoginRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const LoginPage(), - ); - }, ClipDetailRoute.name: (routeData) { final args = routeData.argsAs(); return AutoRoutePage( @@ -84,239 +88,253 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - NoteCreateRoute.name: (routeData) { - final args = routeData.argsAs(); + ExploreRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + ExploreRoleUsersRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + FavoritedNoteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: UserFolloweePage( + child: FavoritedNotePage( key: args.key, - userId: args.userId, account: args.account, ), ); }, - UserRoute.name: (routeData) { - final args = routeData.argsAs(); + FederationRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + HashtagRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); - return AutoRoutePage( + LoginRoute.name: (routeData) { + return AutoRoutePage( 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(); + MisskeyRouteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); return AutoRoutePage( routeData: routeData, - child: const SplashPage(), + child: NotesAfterRenotePage( + key: args.key, + note: args.note, + account: args.account, + ), ); }, - SeveralAccountGeneralSettingsRoute.name: (routeData) { - final args = routeData.argsAs(); + NoteCreateRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + NoteDetailRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: SeveralAccountSettingsPage( + child: NoteDetailPage( key: args.key, + note: args.note, account: args.account, ), ); }, - InstanceMuteRoute.name: (routeData) { - final args = routeData.argsAs(); + NotificationRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: InstanceMutePage( + child: NotificationPage( key: args.key, account: args.account, ), ); }, - WordMuteRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( + PhotoEditRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( routeData: routeData, - child: WordMutePage( - key: args.key, + child: PhotoEditPage( account: args.account, - muteType: args.muteType, + file: args.file, + onSubmit: args.onSubmit, + key: args.key, ), ); }, - CacheManagementRoute.name: (routeData) { - final args = routeData.argsAs(); + SearchRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: CacheManagementPage( + child: SearchPage( key: args.key, + initialSearchText: args.initialSearchText, account: args.account, ), ); }, - ReactionDeckRoute.name: (routeData) { - final args = routeData.argsAs(); + AccountListRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: ReactionDeckPage( - key: args.key, - account: args.account, - ), + child: const AccountListPage(), ); }, - UsersListTimelineRoute.name: (routeData) { - final args = routeData.argsAs(); + AppInfoRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: UsersListTimelinePage( - args.account, - args.list, - key: args.key, - ), + child: const AppInfoPage(), ); }, - UsersListRoute.name: (routeData) { - final args = routeData.argsAs(); + GeneralSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: UsersListPage( - args.account, + child: const GeneralSettingsPage(), + ); + }, + ImportExportRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ImportExportPage(), + ); + }, + SettingsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const SettingsPage(), + ); + }, + TabSettingsListRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const TabSettingsListPage(), + ); + }, + TabSettingsRoute.name: (routeData) { + final args = routeData.argsAs( + orElse: () => const TabSettingsRouteArgs()); + return AutoRoutePage( + routeData: routeData, + child: TabSettingsPage( key: args.key, + tabIndex: args.tabIndex, ), ); }, - UsersListDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + CacheManagementRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: UsersListDetailPage( + child: CacheManagementPage( key: args.key, account: args.account, - listId: args.listId, ), ); }, - ChannelDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + InstanceMuteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ChannelDetailPage( + child: InstanceMutePage( key: args.key, account: args.account, - channelId: args.channelId, ), ); }, - ChannelsRoute.name: (routeData) { - final args = routeData.argsAs(); + ReactionDeckRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ChannelsPage( + child: ReactionDeckPage( key: args.key, account: args.account, ), ); }, - FederationRoute.name: (routeData) { - final args = routeData.argsAs(); + SeveralAccountGeneralSettingsRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: FederationPage( + child: SeveralAccountGeneralSettingsPage( key: args.key, account: args.account, - host: args.host, ), ); }, - NoteDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + SeveralAccountSettingsRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: NoteDetailPage( + child: SeveralAccountSettingsPage( key: args.key, - note: args.note, account: args.account, ), ); }, - SearchRoute.name: (routeData) { - final args = routeData.argsAs(); + WordMuteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: SearchPage( + child: WordMutePage( key: args.key, - initialSearchText: args.initialSearchText, account: args.account, + muteType: args.muteType, ), ); }, @@ -332,101 +350,83 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - MisskeyRouteRoute.name: (routeData) { - final args = routeData.argsAs(); + SplashRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: MisskeyPagePage( - key: args.key, - account: args.account, - page: args.page, - ), - ); - }, - ImportExportRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ImportExportPage(), - ); - }, - GeneralSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const GeneralSettingsPage(), + child: const SplashPage(), ); }, - TabSettingsRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const TabSettingsRouteArgs()); + TimeLineRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: TabSettingsPage( + child: TimeLinePage( key: args.key, - tabIndex: args.tabIndex, + initialTabSetting: args.initialTabSetting, ), ); }, - TabSettingsListRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const TabSettingsListPage(), - ); - }, - AppInfoRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AppInfoPage(), - ); - }, - SettingsRoute.name: (routeData) { + UsersListDetailRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); return AutoRoutePage( routeData: routeData, - child: const AccountListPage(), + child: UsersListPage( + args.account, + key: args.key, + ), ); }, - ExploreRoleUsersRoute.name: (routeData) { - final args = routeData.argsAs(); + UsersListTimelineRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + UserFolloweeRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ExplorePage( + child: UserFolloweePage( key: args.key, + userId: args.userId, account: args.account, ), ); }, - TimeLineRoute.name: (routeData) { - final args = routeData.argsAs(); + UserFollowerRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( 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(); + UserRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: FavoritedNotePage( + child: UserPage( key: args.key, + userId: args.userId, account: args.account, ), ); @@ -435,45 +435,83 @@ abstract class _$AppRouter extends RootStackRouter { } /// generated route for -/// [NotesAfterRenotePage] -class NotesAfterRenoteRoute extends PageRouteInfo { - NotesAfterRenoteRoute({ +/// [AnnouncementPage] +class AnnouncementRoute extends PageRouteInfo { + AnnouncementRoute({ Key? key, - required Note note, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { + AntennaNotesRoute({ + Key? key, + required Antenna antenna, + required Account account, + List? children, + }) : super( + AntennaNotesRoute.name, + args: AntennaNotesRouteArgs( + key: key, + antenna: antenna, + account: account, + ), + initialChildren: children, + ); + + static const String name = 'AntennaNotesRoute'; + + static const PageInfo page = + PageInfo(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}'; } } @@ -516,100 +554,86 @@ class AntennaRouteArgs { } /// generated route for -/// [AntennaNotesPage] -class AntennaNotesRoute extends PageRouteInfo { - AntennaNotesRoute({ +/// [ChannelsPage] +class ChannelsRoute extends PageRouteInfo { + ChannelsRoute({ Key? key, - required Antenna antenna, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - NotificationRoute({ +/// [ChannelDetailPage] +class ChannelDetailRoute extends PageRouteInfo { + ChannelDetailRoute({ Key? key, required Account account, + required String channelId, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - const LoginRoute({List? children}) - : super( - LoginRoute.name, - initialChildren: children, - ); - - static const String name = 'LoginRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [ClipDetailPage] class ClipDetailRoute extends PageRouteInfo { @@ -692,451 +716,450 @@ class ClipListRouteArgs { } /// generated route for -/// [NoteCreatePage] -class NoteCreateRoute extends PageRouteInfo { - NoteCreateRoute({ +/// [ExplorePage] +class ExploreRoute extends PageRouteInfo { + ExploreRoute({ Key? key, - required Account initialAccount, - String? initialText, - List? initialMediaFiles, - CommunityChannel? channel, - Note? reply, - Note? renote, - Note? note, - NoteCreationMode? noteCreationMode, + required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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? 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 { - HashtagRoute({ +/// [ExploreRoleUsersPage] +class ExploreRoleUsersRoute extends PageRouteInfo { + ExploreRoleUsersRoute({ Key? key, - required String hashtag, + required RolesListResponse item, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - UserFolloweeRoute({ +/// [FavoritedNotePage] +class FavoritedNoteRoute extends PageRouteInfo { + FavoritedNoteRoute({ Key? key, - required String userId, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - UserRoute({ +/// [FederationPage] +class FederationRoute extends PageRouteInfo { + FederationRoute({ Key? key, - required String userId, required Account account, + required String host, List? 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 page = PageInfo(name); + static const PageInfo page = + PageInfo(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 { - UserFollowerRoute({ +/// [HashtagPage] +class HashtagRoute extends PageRouteInfo { + HashtagRoute({ Key? key, - required String userId, + required String hashtag, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - PhotoEditRoute({ - required Account account, - required MisskeyPostFile file, - required void Function(Uint8List) onSubmit, +/// [LoginPage] +class LoginRoute extends PageRouteInfo { + const LoginRoute({List? children}) + : super( + LoginRoute.name, + initialChildren: children, + ); + + static const String name = 'LoginRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [MisskeyPagePage] +class MisskeyRouteRoute extends PageRouteInfo { + MisskeyRouteRoute({ Key? key, + required Account account, + required Page page, List? children, }) : super( - PhotoEditRoute.name, - args: PhotoEditRouteArgs( - account: account, - file: file, - onSubmit: onSubmit, + MisskeyRouteRoute.name, + args: MisskeyRouteRouteArgs( key: key, + account: account, + page: page, ), initialChildren: children, ); - static const String name = 'PhotoEditRoute'; + static const String name = 'MisskeyRouteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class PhotoEditRouteArgs { - const PhotoEditRouteArgs({ - required this.account, - required this.file, - required this.onSubmit, +class MisskeyRouteRouteArgs { + const MisskeyRouteRouteArgs({ this.key, + required this.account, + required this.page, }); - final Account account; - - final MisskeyPostFile file; + final Key? key; - final void Function(Uint8List) onSubmit; + final Account account; - final Key? key; + final Page page; @override String toString() { - return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; + return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}'; } } /// generated route for -/// [AnnouncementPage] -class AnnouncementRoute extends PageRouteInfo { - AnnouncementRoute({ +/// [NotesAfterRenotePage] +class NotesAfterRenoteRoute extends PageRouteInfo { + NotesAfterRenoteRoute({ Key? key, + required Note note, required Account account, List? children, }) : super( - AnnouncementRoute.name, - args: AnnouncementRouteArgs( + NotesAfterRenoteRoute.name, + args: NotesAfterRenoteRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'AnnouncementRoute'; + static const String name = 'NotesAfterRenoteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class AnnouncementRouteArgs { - const AnnouncementRouteArgs({ +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 'AnnouncementRouteArgs{key: $key, account: $account}'; + return 'NotesAfterRenoteRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [SplashPage] -class SplashRoute extends PageRouteInfo { - const SplashRoute({List? children}) - : super( - SplashRoute.name, - initialChildren: children, - ); - - static const String name = 'SplashRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [SeveralAccountGeneralSettingsPage] -class SeveralAccountGeneralSettingsRoute - extends PageRouteInfo { - SeveralAccountGeneralSettingsRoute({ - Key? key, - required Account account, +/// [NoteCreatePage] +class NoteCreateRoute extends PageRouteInfo { + NoteCreateRoute({ + Key? key, + required Account initialAccount, + String? initialText, + List? initialMediaFiles, + CommunityChannel? channel, + Note? reply, + Note? renote, + Note? note, + NoteCreationMode? noteCreationMode, List? children, }) : super( - SeveralAccountGeneralSettingsRoute.name, - args: SeveralAccountGeneralSettingsRouteArgs( + 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 = 'SeveralAccountGeneralSettingsRoute'; + static const String name = 'NoteCreateRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SeveralAccountGeneralSettingsRouteArgs { - const SeveralAccountGeneralSettingsRouteArgs({ +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? initialMediaFiles; + + final CommunityChannel? channel; + + final Note? reply; + + final Note? renote; + + final Note? note; + + final NoteCreationMode? noteCreationMode; @override String toString() { - return 'SeveralAccountGeneralSettingsRouteArgs{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 -/// [SeveralAccountSettingsPage] -class SeveralAccountSettingsRoute - extends PageRouteInfo { - SeveralAccountSettingsRoute({ +/// [NoteDetailPage] +class NoteDetailRoute extends PageRouteInfo { + NoteDetailRoute({ Key? key, + required Note note, required Account account, List? children, }) : super( - SeveralAccountSettingsRoute.name, - args: SeveralAccountSettingsRouteArgs( + NoteDetailRoute.name, + args: NoteDetailRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'SeveralAccountSettingsRoute'; + static const String name = 'NoteDetailRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SeveralAccountSettingsRouteArgs { - const SeveralAccountSettingsRouteArgs({ +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 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; + return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [InstanceMutePage] -class InstanceMuteRoute extends PageRouteInfo { - InstanceMuteRoute({ +/// [NotificationPage] +class NotificationRoute extends PageRouteInfo { + NotificationRoute({ Key? key, required Account account, List? children, }) : super( - InstanceMuteRoute.name, - args: InstanceMuteRouteArgs( + NotificationRoute.name, + args: NotificationRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'InstanceMuteRoute'; + static const String name = 'NotificationRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class InstanceMuteRouteArgs { - const InstanceMuteRouteArgs({ +class NotificationRouteArgs { + const NotificationRouteArgs({ this.key, required this.account, }); @@ -1147,320 +1170,322 @@ class InstanceMuteRouteArgs { @override String toString() { - return 'InstanceMuteRouteArgs{key: $key, account: $account}'; + return 'NotificationRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [WordMutePage] -class WordMuteRoute extends PageRouteInfo { - WordMuteRoute({ - Key? key, +/// [PhotoEditPage] +class PhotoEditRoute extends PageRouteInfo { + PhotoEditRoute({ required Account account, - required MuteType muteType, + required MisskeyPostFile file, + required void Function(Uint8List) onSubmit, + Key? key, List? children, }) : super( - WordMuteRoute.name, - args: WordMuteRouteArgs( - key: key, + PhotoEditRoute.name, + args: PhotoEditRouteArgs( account: account, - muteType: muteType, + file: file, + onSubmit: onSubmit, + key: key, ), initialChildren: children, ); - static const String name = 'WordMuteRoute'; + static const String name = 'PhotoEditRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class WordMuteRouteArgs { - const WordMuteRouteArgs({ - this.key, +class PhotoEditRouteArgs { + const PhotoEditRouteArgs({ required this.account, - required this.muteType, + required this.file, + required this.onSubmit, + this.key, }); - final Key? key; - final Account account; - final MuteType muteType; + final MisskeyPostFile file; + + final void Function(Uint8List) onSubmit; + + final Key? key; @override String toString() { - return 'WordMuteRouteArgs{key: $key, account: $account, muteType: $muteType}'; + return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; } } /// generated route for -/// [CacheManagementPage] -class CacheManagementRoute extends PageRouteInfo { - CacheManagementRoute({ +/// [SearchPage] +class SearchRoute extends PageRouteInfo { + SearchRoute({ Key? key, + String? initialSearchText, required Account account, List? children, }) : super( - CacheManagementRoute.name, - args: CacheManagementRouteArgs( + SearchRoute.name, + args: SearchRouteArgs( key: key, + initialSearchText: initialSearchText, account: account, ), initialChildren: children, ); - static const String name = 'CacheManagementRoute'; + static const String name = 'SearchRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class CacheManagementRouteArgs { - const CacheManagementRouteArgs({ +class SearchRouteArgs { + const SearchRouteArgs({ this.key, + this.initialSearchText, required this.account, }); final Key? key; + final String? initialSearchText; + final Account account; @override String toString() { - return 'CacheManagementRouteArgs{key: $key, account: $account}'; + return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; } } /// generated route for -/// [ReactionDeckPage] -class ReactionDeckRoute extends PageRouteInfo { - ReactionDeckRoute({ - Key? key, - required Account account, - List? children, - }) : super( - ReactionDeckRoute.name, - args: ReactionDeckRouteArgs( - key: key, - account: account, - ), +/// [AccountListPage] +class AccountListRoute extends PageRouteInfo { + const AccountListRoute({List? children}) + : super( + AccountListRoute.name, initialChildren: children, ); - static const String name = 'ReactionDeckRoute'; + static const String name = 'AccountListRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class ReactionDeckRouteArgs { - const ReactionDeckRouteArgs({ - this.key, - required this.account, - }); - - final Key? key; +/// generated route for +/// [AppInfoPage] +class AppInfoRoute extends PageRouteInfo { + const AppInfoRoute({List? children}) + : super( + AppInfoRoute.name, + initialChildren: children, + ); - final Account account; + static const String name = 'AppInfoRoute'; - @override - String toString() { - return 'ReactionDeckRouteArgs{key: $key, account: $account}'; - } + static const PageInfo page = PageInfo(name); } /// generated route for -/// [UsersListTimelinePage] -class UsersListTimelineRoute extends PageRouteInfo { - UsersListTimelineRoute({ - required Account account, - required UsersList list, - Key? key, - List? children, - }) : super( - UsersListTimelineRoute.name, - args: UsersListTimelineRouteArgs( - account: account, - list: list, - key: key, - ), +/// [GeneralSettingsPage] +class GeneralSettingsRoute extends PageRouteInfo { + const GeneralSettingsRoute({List? children}) + : super( + GeneralSettingsRoute.name, initialChildren: children, ); - static const String name = 'UsersListTimelineRoute'; + static const String name = 'GeneralSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class UsersListTimelineRouteArgs { - const UsersListTimelineRouteArgs({ - required this.account, - required this.list, - this.key, - }); +/// generated route for +/// [ImportExportPage] +class ImportExportRoute extends PageRouteInfo { + const ImportExportRoute({List? children}) + : super( + ImportExportRoute.name, + initialChildren: children, + ); - final Account account; + static const String name = 'ImportExportRoute'; - final UsersList list; + static const PageInfo page = PageInfo(name); +} - final Key? key; +/// generated route for +/// [SettingsPage] +class SettingsRoute extends PageRouteInfo { + const SettingsRoute({List? children}) + : super( + SettingsRoute.name, + initialChildren: children, + ); - @override - String toString() { - return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}'; - } + static const String name = 'SettingsRoute'; + + static const PageInfo page = PageInfo(name); } /// generated route for -/// [UsersListPage] -class UsersListRoute extends PageRouteInfo { - UsersListRoute({ - required Account account, +/// [TabSettingsListPage] +class TabSettingsListRoute extends PageRouteInfo { + const TabSettingsListRoute({List? children}) + : super( + TabSettingsListRoute.name, + initialChildren: children, + ); + + static const String name = 'TabSettingsListRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [TabSettingsPage] +class TabSettingsRoute extends PageRouteInfo { + TabSettingsRoute({ Key? key, + int? tabIndex, List? children, }) : super( - UsersListRoute.name, - args: UsersListRouteArgs( - account: account, + TabSettingsRoute.name, + args: TabSettingsRouteArgs( key: key, + tabIndex: tabIndex, ), initialChildren: children, ); - static const String name = 'UsersListRoute'; + static const String name = 'TabSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class UsersListRouteArgs { - const UsersListRouteArgs({ - required this.account, +class TabSettingsRouteArgs { + const TabSettingsRouteArgs({ this.key, + this.tabIndex, }); - final Account account; - final Key? key; + final int? tabIndex; + @override String toString() { - return 'UsersListRouteArgs{account: $account, key: $key}'; + return 'TabSettingsRouteArgs{key: $key, tabIndex: $tabIndex}'; } } /// generated route for -/// [UsersListDetailPage] -class UsersListDetailRoute extends PageRouteInfo { - UsersListDetailRoute({ +/// [CacheManagementPage] +class CacheManagementRoute extends PageRouteInfo { + CacheManagementRoute({ Key? key, required Account account, - required String listId, List? children, }) : super( - UsersListDetailRoute.name, - args: UsersListDetailRouteArgs( + CacheManagementRoute.name, + args: CacheManagementRouteArgs( key: key, account: account, - listId: listId, ), initialChildren: children, ); - static const String name = 'UsersListDetailRoute'; + static const String name = 'CacheManagementRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class UsersListDetailRouteArgs { - const UsersListDetailRouteArgs({ +class CacheManagementRouteArgs { + const CacheManagementRouteArgs({ this.key, required this.account, - required this.listId, }); final Key? key; final Account account; - final String listId; - @override String toString() { - return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}'; + return 'CacheManagementRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [ChannelDetailPage] -class ChannelDetailRoute extends PageRouteInfo { - ChannelDetailRoute({ +/// [InstanceMutePage] +class InstanceMuteRoute extends PageRouteInfo { + InstanceMuteRoute({ Key? key, required Account account, - required String channelId, List? children, }) : super( - ChannelDetailRoute.name, - args: ChannelDetailRouteArgs( + InstanceMuteRoute.name, + args: InstanceMuteRouteArgs( key: key, account: account, - channelId: channelId, ), initialChildren: children, ); - static const String name = 'ChannelDetailRoute'; + static const String name = 'InstanceMuteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ChannelDetailRouteArgs { - const ChannelDetailRouteArgs({ +class InstanceMuteRouteArgs { + const InstanceMuteRouteArgs({ 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 'InstanceMuteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [ChannelsPage] -class ChannelsRoute extends PageRouteInfo { - ChannelsRoute({ +/// [ReactionDeckPage] +class ReactionDeckRoute extends PageRouteInfo { + ReactionDeckRoute({ Key? key, required Account account, List? children, }) : super( - ChannelsRoute.name, - args: ChannelsRouteArgs( + ReactionDeckRoute.name, + args: ReactionDeckRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'ChannelsRoute'; + static const String name = 'ReactionDeckRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ChannelsRouteArgs { - const ChannelsRouteArgs({ +class ReactionDeckRouteArgs { + const ReactionDeckRouteArgs({ this.key, required this.account, }); @@ -1471,135 +1496,128 @@ class ChannelsRouteArgs { @override String toString() { - return 'ChannelsRouteArgs{key: $key, account: $account}'; + return 'ReactionDeckRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [FederationPage] -class FederationRoute extends PageRouteInfo { - FederationRoute({ +/// [SeveralAccountGeneralSettingsPage] +class SeveralAccountGeneralSettingsRoute + extends PageRouteInfo { + SeveralAccountGeneralSettingsRoute({ Key? key, required Account account, - required String host, List? children, }) : super( - FederationRoute.name, - args: FederationRouteArgs( + SeveralAccountGeneralSettingsRoute.name, + args: SeveralAccountGeneralSettingsRouteArgs( key: key, account: account, - host: host, ), initialChildren: children, ); - static const String name = 'FederationRoute'; + static const String name = 'SeveralAccountGeneralSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class FederationRouteArgs { - const FederationRouteArgs({ +class SeveralAccountGeneralSettingsRouteArgs { + const SeveralAccountGeneralSettingsRouteArgs({ 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 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [NoteDetailPage] -class NoteDetailRoute extends PageRouteInfo { - NoteDetailRoute({ +/// [SeveralAccountSettingsPage] +class SeveralAccountSettingsRoute + extends PageRouteInfo { + SeveralAccountSettingsRoute({ Key? key, - required Note note, required Account account, List? children, }) : super( - NoteDetailRoute.name, - args: NoteDetailRouteArgs( + SeveralAccountSettingsRoute.name, + args: SeveralAccountSettingsRouteArgs( key: key, - note: note, account: account, ), initialChildren: children, ); - static const String name = 'NoteDetailRoute'; + static const String name = 'SeveralAccountSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class NoteDetailRouteArgs { - const NoteDetailRouteArgs({ +class SeveralAccountSettingsRouteArgs { + const SeveralAccountSettingsRouteArgs({ 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 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [SearchPage] -class SearchRoute extends PageRouteInfo { - SearchRoute({ +/// [WordMutePage] +class WordMuteRoute extends PageRouteInfo { + WordMuteRoute({ Key? key, - String? initialSearchText, required Account account, + required MuteType muteType, List? children, }) : super( - SearchRoute.name, - args: SearchRouteArgs( + WordMuteRoute.name, + args: WordMuteRouteArgs( key: key, - initialSearchText: initialSearchText, account: account, + muteType: muteType, ), initialChildren: children, ); - static const String name = 'SearchRoute'; + static const String name = 'WordMuteRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SearchRouteArgs { - const SearchRouteArgs({ +class WordMuteRouteArgs { + const WordMuteRouteArgs({ this.key, - this.initialSearchText, required this.account, + required this.muteType, }); final Key? key; - final String? initialSearchText; - final Account account; + final MuteType muteType; + @override String toString() { - return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; + return 'WordMuteRouteArgs{key: $key, account: $account, muteType: $muteType}'; } } @@ -1648,323 +1666,305 @@ class SharingAccountSelectRouteArgs { } /// generated route for -/// [MisskeyPagePage] -class MisskeyRouteRoute extends PageRouteInfo { - MisskeyRouteRoute({ - Key? key, - required Account account, - required Page page, - List? children, - }) : super( - MisskeyRouteRoute.name, - args: MisskeyRouteRouteArgs( - key: key, - account: account, - page: page, - ), - initialChildren: children, - ); - - static const String name = 'MisskeyRouteRoute'; - - static const PageInfo page = - PageInfo(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 { - const ImportExportRoute({List? children}) - : super( - ImportExportRoute.name, - initialChildren: children, - ); - - static const String name = 'ImportExportRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [GeneralSettingsPage] -class GeneralSettingsRoute extends PageRouteInfo { - const GeneralSettingsRoute({List? children}) +/// [SplashPage] +class SplashRoute extends PageRouteInfo { + const SplashRoute({List? children}) : super( - GeneralSettingsRoute.name, + SplashRoute.name, initialChildren: children, ); - static const String name = 'GeneralSettingsRoute'; + static const String name = 'SplashRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [TabSettingsPage] -class TabSettingsRoute extends PageRouteInfo { - TabSettingsRoute({ +/// [TimeLinePage] +class TimeLineRoute extends PageRouteInfo { + TimeLineRoute({ Key? key, - int? tabIndex, + required TabSetting initialTabSetting, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - const TabSettingsListRoute({List? children}) - : super( - TabSettingsListRoute.name, +/// [UsersListDetailPage] +class UsersListDetailRoute extends PageRouteInfo { + UsersListDetailRoute({ + Key? key, + required Account account, + required String listId, + List? 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 page = PageInfo(name); + static const PageInfo page = + PageInfo(name); } -/// generated route for -/// [AppInfoPage] -class AppInfoRoute extends PageRouteInfo { - const AppInfoRoute({List? 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 page = PageInfo(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 { - const SettingsRoute({List? children}) - : super( - SettingsRoute.name, +/// [UsersListPage] +class UsersListRoute extends PageRouteInfo { + UsersListRoute({ + required Account account, + Key? key, + List? 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 page = PageInfo(name); + static const PageInfo page = + PageInfo(name); } -/// generated route for -/// [AccountListPage] -class AccountListRoute extends PageRouteInfo { - const AccountListRoute({List? 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 page = PageInfo(name); + final Key? key; + + @override + String toString() { + return 'UsersListRouteArgs{account: $account, key: $key}'; + } } /// generated route for -/// [ExploreRoleUsersPage] -class ExploreRoleUsersRoute extends PageRouteInfo { - ExploreRoleUsersRoute({ - Key? key, - required RolesListResponse item, +/// [UsersListTimelinePage] +class UsersListTimelineRoute extends PageRouteInfo { + UsersListTimelineRoute({ required Account account, + required UsersList list, + Key? key, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - ExploreRoute({ +/// [UserFolloweePage] +class UserFolloweeRoute extends PageRouteInfo { + UserFolloweeRoute({ Key? key, + required String userId, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - TimeLineRoute({ +/// [UserFollowerPage] +class UserFollowerRoute extends PageRouteInfo { + UserFollowerRoute({ Key? key, - required TabSetting initialTabSetting, + required String userId, + required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = + PageInfo(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 { - FavoritedNoteRoute({ +/// [UserPage] +class UserRoute extends PageRouteInfo { + UserRoute({ Key? key, + required String userId, required Account account, List? 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 page = - PageInfo(name); + static const PageInfo page = PageInfo(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/common/misskey_notes/misskey_note_notifier.dart b/lib/state_notifier/common/misskey_notes/misskey_note_notifier.dart index ebe5c9005..9ad0c1aa8 100644 --- a/lib/state_notifier/common/misskey_notes/misskey_note_notifier.dart +++ b/lib/state_notifier/common/misskey_notes/misskey_note_notifier.dart @@ -77,14 +77,12 @@ class MisskeyNoteNotifier extends FamilyNotifier { final host = user.host ?? _account.host; try { - final response = - await ref.read(misskeyProvider(account)).users.showByName( - UsersShowByUserNameRequest( - userName: user.username, - host: host, - ), - ); - return response.toUser(); + return ref.read(misskeyProvider(account)).users.showByName( + UsersShowByUserNameRequest( + userName: user.username, + host: host, + ), + ); } catch (e) { // 最終手段として、連合で照会する // `users/show` で自動的に照会されるから必要ない @@ -97,7 +95,7 @@ class MisskeyNoteNotifier extends FamilyNotifier { ), ), ); - return UsersShowResponse.fromJson(response.object).toUser(); + return UserDetailed.fromJson(response.object); } } 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 f04731706..a5949efa9 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 { } final deletedNoteChannel = note.channel; + final replyTo = []; + 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 { 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: note.poll?.expiresAt == null @@ -223,6 +227,14 @@ class NoteCreateNotifier extends StateNotifier { } if (reply != null) { + final replyTo = []; + if (reply.mentions.isNotEmpty) { + replyTo.addAll( + await misskey.users + .showByIds(UsersShowByIdsRequest(userIds: reply.mentions)), + ); + } + resultState = resultState.copyWith( reply: reply, noteVisibility: @@ -231,9 +243,7 @@ class NoteCreateNotifier extends StateNotifier { 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/account_select_dialog.dart b/lib/view/common/account_select_dialog.dart index ab9932032..589133831 100644 --- a/lib/view/common/account_select_dialog.dart +++ b/lib/view/common/account_select_dialog.dart @@ -26,7 +26,7 @@ class AccountSelectDialog extends ConsumerWidget { (account) => 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, diff --git a/lib/view/common/avatar_icon.dart b/lib/view/common/avatar_icon.dart index c27b440de..78d7f50cb 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 createState() => AvatarIconState(); } diff --git a/lib/view/common/common_drawer.dart b/lib/view/common/common_drawer.dart index eba70f9a1..8f244bd38 100644 --- a/lib/view/common/common_drawer.dart +++ b/lib/view/common/common_drawer.dart @@ -26,7 +26,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, diff --git a/lib/view/common/misskey_notes/note_modal_sheet.dart b/lib/view/common/misskey_notes/note_modal_sheet.dart index c475110f1..4cfc22125 100644 --- a/lib/view/common/misskey_notes/note_modal_sheet.dart +++ b/lib/view/common/misskey_notes/note_modal_sheet.dart @@ -86,8 +86,6 @@ class NoteModalSheet extends ConsumerWidget { builder: (context) => UserControlDialog( account: account, response: response, - isMe: targetNote.user.host == null && - targetNote.user.username == account.userId, ), ); }, 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 52effc461..6e1e3b0c4 100644 --- a/lib/view/settings_page/account_settings_page/account_list.dart +++ b/lib/view/settings_page/account_settings_page/account_list.dart @@ -82,7 +82,7 @@ class AccountListItem extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return ListTile( - leading: AvatarIcon.fromIResponse(account.i), + leading: AvatarIcon(user: account.i), title: Text( account.i.name ?? account.i.username, style: Theme.of(context).textTheme.titleMedium, 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 { body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(10), - child: CommonFuture( + child: CommonFuture( future: ref.read(misskeyProvider(widget.account)).i.i(), futureFinished: (data) { controller.text = data.mutedInstances.join("\n"); diff --git a/lib/view/several_account_settings_page/word_mute_page/word_mute_page.dart b/lib/view/several_account_settings_page/word_mute_page/word_mute_page.dart index 34455d088..8f14b88db 100644 --- a/lib/view/several_account_settings_page/word_mute_page/word_mute_page.dart +++ b/lib/view/several_account_settings_page/word_mute_page/word_mute_page.dart @@ -77,7 +77,7 @@ class WordMutePageState extends ConsumerState { body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(10), - child: CommonFuture( + child: CommonFuture( future: ref.read(misskeyProvider(widget.account)).i.i(), futureFinished: (data) { controller.text = muteValueString( 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 5fdabebf7..51e82ce3b 100644 --- a/lib/view/sharing_account_select_page/account_select_page.dart +++ b/lib/view/sharing_account_select_page/account_select_page.dart @@ -29,7 +29,7 @@ class SharingAccountSelectPage extends ConsumerWidget { initialMediaFiles: 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 6af367449..345d6f253 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'; @@ -22,14 +22,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 @@ -43,7 +41,7 @@ class UserControlDialogState extends ConsumerState { context: context, builder: (context) => UsersListModalSheet( account: widget.account, - user: widget.response.toUser(), + user: widget.response, ), ); } @@ -53,7 +51,7 @@ class UserControlDialogState extends ConsumerState { context: context, builder: (context) => AntennaModalSheet( account: widget.account, - user: widget.response.toUser(), + user: widget.response, ), ); } @@ -131,6 +129,7 @@ class UserControlDialogState extends ConsumerState { @override Widget build(BuildContext context) { + final user = widget.response; return ListView( children: [ ListTile( @@ -209,7 +208,7 @@ class UserControlDialogState extends ConsumerState { title: const Text("別のアカウントで開く"), onTap: () => ref .read(misskeyNoteNotifierProvider(widget.account).notifier) - .openUserInOtherAccount(context, widget.response.toUser()) + .openUserInOtherAccount(context, user) .expectFailure(context), ), ListTile( @@ -222,8 +221,8 @@ class UserControlDialogState extends ConsumerState { title: const Text("アンテナに追加"), onTap: addToAntenna, ), - if (!widget.isMe) ...[ - if (widget.response.isRenoteMuted ?? false) + if (user is UserDetailedNotMeWithRelations) ...[ + if (user.isRenoteMuted) ListTile( leading: const Icon(Icons.repeat_rounded), title: const Text("Renoteのミュート解除する"), @@ -235,7 +234,7 @@ class UserControlDialogState extends ConsumerState { title: const Text("Renoteをミュートする"), onTap: renoteMuteCreate.expectFailure(context), ), - if (widget.response.isMuted ?? false) + if (user.isMuted) ListTile( leading: const Icon(Icons.visibility), title: const Text("ミュート解除する"), @@ -247,7 +246,7 @@ class UserControlDialogState extends ConsumerState { title: const Text("ミュートする"), onTap: muteCreate.expectFailure(context), ), - if (widget.response.isBlocking ?? false) + if (user.isBlocking) ListTile( leading: const Icon(Icons.block), title: const Text("ブロックを解除する"), diff --git a/lib/view/user_page/user_detail.dart b/lib/view/user_page/user_detail.dart index 858602e51..79adeda74 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 { - late UsersShowResponse response; + late UserDetailed response; bool isFollowEditing = false; String memo = ""; Future followCreate() async { if (isFollowEditing) return; + + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + setState(() { isFollowEditing = true; }); @@ -48,13 +55,14 @@ class UserDetailState extends ConsumerState { 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 { Future 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 { 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 { Future followRequestCancel() async { if (isFollowEditing) return; + + final user = response; + if (user is! UserDetailedNotMeWithRelations) { + return; + } + setState(() { isFollowEditing = true; }); @@ -109,11 +129,11 @@ class UserDetailState extends ConsumerState { .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 { } } - Future userControl(bool isMe) async { + Future userControl() async { final result = await showModalBottomSheet( - 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 { } 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 { 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 { 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 { child: Column(children: [ Row( children: [ - AvatarIcon.fromUserResponse( - response, + AvatarIcon( + user: response, height: 80, ), Expanded( @@ -304,16 +330,16 @@ class UserDetailState extends ConsumerState { 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 { 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 { 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 { } class BirthdayConfetti extends StatefulWidget { - final UsersShowResponse response; + final UserDetailed response; final Widget child; const BirthdayConfetti({ @@ -589,10 +615,3 @@ class BirthdayConfettiState extends State { 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 56acda8bb..e1c32f694 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; final MetaResponse? metaResponse; const UserInfo({ @@ -190,8 +190,8 @@ class UserDetailTab extends ConsumerStatefulWidget { } class UserDetailTabState extends ConsumerState { - 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 e1ab96da0..9f5815f80 100644 --- a/test/test_util/mock.mocks.dart +++ b/test/test_util/mock.mocks.dart @@ -498,8 +498,8 @@ class _FakeMisskeyFollowingRequests_41 extends _i1.SmartFake ); } -class _FakeUser_42 extends _i1.SmartFake implements _i5.User { - _FakeUser_42( +class _FakeUserLite_42 extends _i1.SmartFake implements _i5.UserLite { + _FakeUserLite_42( Object parent, Invocation parentInvocation, ) : super( @@ -518,8 +518,8 @@ class _FakeHashtag_43 extends _i1.SmartFake implements _i5.Hashtag { ); } -class _FakeIResponse_44 extends _i1.SmartFake implements _i5.IResponse { - _FakeIResponse_44( +class _FakeMeDetailed_44 extends _i1.SmartFake implements _i5.MeDetailed { + _FakeMeDetailed_44( Object parent, Invocation parentInvocation, ) : super( @@ -615,9 +615,8 @@ class _FakeMisskeyUsersLists_52 extends _i1.SmartFake ); } -class _FakeUsersShowResponse_53 extends _i1.SmartFake - implements _i5.UsersShowResponse { - _FakeUsersShowResponse_53( +class _FakeUserDetailed_53 extends _i1.SmartFake implements _i5.UserDetailed { + _FakeUserDetailed_53( Object parent, Invocation parentInvocation, ) : super( @@ -2181,15 +2180,16 @@ class MockMisskey extends _i1.Mock implements _i5.Misskey { ) as _i18.Future>); @override - _i18.Future> pinnedUsers() => (super.noSuchMethod( + _i18.Future> pinnedUsers() => (super.noSuchMethod( Invocation.method( #pinnedUsers, [], ), - returnValue: _i18.Future>.value(<_i5.User>[]), + returnValue: + _i18.Future>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: - _i18.Future>.value(<_i5.User>[]), - ) as _i18.Future>); + _i18.Future>.value(<_i5.UserDetailed>[]), + ) as _i18.Future>); @override _i5.SocketController homeTimelineStream({ @@ -2633,8 +2633,8 @@ class MockMisskey extends _i1.Mock implements _i5.Misskey { _i5.SocketController userListStream({ required String? listId, _i18.FutureOr Function(_i5.Note)? onNoteReceived, - _i18.FutureOr Function(_i5.User)? onUserAdded, - _i18.FutureOr Function(_i5.User)? onUserRemoved, + _i18.FutureOr Function(_i5.UserLite)? onUserAdded, + _i18.FutureOr Function(_i5.UserLite)? onUserRemoved, _i18.FutureOr Function( String, _i5.TimelineReacted, @@ -2862,10 +2862,10 @@ class MockMisskey extends _i1.Mock implements _i5.Misskey { _i18.FutureOr Function(_i5.Note)? onMention, _i18.FutureOr Function(_i5.Note)? onReply, _i18.FutureOr Function(_i5.Note)? onRenote, - _i18.FutureOr Function(_i5.User)? onFollow, - _i18.FutureOr Function(_i5.User)? onFollowed, - _i18.FutureOr Function(_i5.User)? onUnfollow, - _i18.FutureOr Function(_i5.User)? onMeUpdated, + _i18.FutureOr Function(_i5.UserDetailedNotMe)? onFollow, + _i18.FutureOr Function(_i5.UserLite)? onFollowed, + _i18.FutureOr Function(_i5.UserDetailedNotMe)? onUnfollow, + _i18.FutureOr Function(_i5.MeDetailed)? onMeUpdated, _i18.FutureOr Function()? onReadAllNotifications, _i18.FutureOr Function(_i5.INotificationsResponse)? onUnreadNotification, @@ -2873,7 +2873,7 @@ class MockMisskey extends _i1.Mock implements _i5.Misskey { _i18.FutureOr Function()? onReadAllUnreadMentions, _i18.FutureOr Function(String)? onUnreadSpecifiedNote, _i18.FutureOr Function()? onReadAllUnreadSpecifiedNotes, - _i18.FutureOr Function(_i5.User)? onReceiveFollowRequest, + _i18.FutureOr Function(_i5.UserLite)? onReceiveFollowRequest, _i18.FutureOr Function()? onReadAllAnnouncements, }) => (super.noSuchMethod( @@ -3897,16 +3897,18 @@ class MockMisskeyFederation extends _i1.Mock implements _i5.MisskeyFederation { ) as _i18.Future<_i5.FederationShowInstanceResponse>); @override - _i18.Future> users(_i5.FederationUsersRequest? request) => + _i18.Future> users( + _i5.FederationUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i18.Future>.value(<_i5.User>[]), + returnValue: + _i18.Future>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: - _i18.Future>.value(<_i5.User>[]), - ) as _i18.Future>); + _i18.Future>.value(<_i5.UserDetailed>[]), + ) as _i18.Future>); } /// A class which mocks [MisskeyFollowing]. @@ -3927,73 +3929,77 @@ class MockMisskeyFollowing extends _i1.Mock implements _i5.MisskeyFollowing { ) as _i5.MisskeyFollowingRequests); @override - _i18.Future<_i5.User> create(_i5.FollowingCreateRequest? request) => + _i18.Future<_i5.UserLite> create(_i5.FollowingCreateRequest? request) => (super.noSuchMethod( Invocation.method( #create, [request], ), - returnValue: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #create, [request], ), )), - returnValueForMissingStub: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValueForMissingStub: + _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #create, [request], ), )), - ) as _i18.Future<_i5.User>); + ) as _i18.Future<_i5.UserLite>); @override - _i18.Future<_i5.User> delete(_i5.FollowingDeleteRequest? request) => + _i18.Future<_i5.UserLite> delete(_i5.FollowingDeleteRequest? request) => (super.noSuchMethod( Invocation.method( #delete, [request], ), - returnValue: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #delete, [request], ), )), - returnValueForMissingStub: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValueForMissingStub: + _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #delete, [request], ), )), - ) as _i18.Future<_i5.User>); + ) as _i18.Future<_i5.UserLite>); @override - _i18.Future<_i5.User> invalidate(_i5.FollowingInvalidateRequest? request) => + _i18.Future<_i5.UserLite> invalidate( + _i5.FollowingInvalidateRequest? request) => (super.noSuchMethod( Invocation.method( #invalidate, [request], ), - returnValue: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValue: _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #invalidate, [request], ), )), - returnValueForMissingStub: _i18.Future<_i5.User>.value(_FakeUser_42( + returnValueForMissingStub: + _i18.Future<_i5.UserLite>.value(_FakeUserLite_42( this, Invocation.method( #invalidate, [request], ), )), - ) as _i18.Future<_i5.User>); + ) as _i18.Future<_i5.UserLite>); @override _i18.Future updateAll(_i5.FollowingUpdateAllRequest? request) => @@ -4074,16 +4080,18 @@ class MockMisskeyHashtags extends _i1.Mock implements _i5.MisskeyHashtags { ) as _i18.Future>); @override - _i18.Future> users(_i5.HashtagsUsersRequest? request) => + _i18.Future> users( + _i5.HashtagsUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i18.Future>.value(<_i5.User>[]), + returnValue: + _i18.Future>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: - _i18.Future>.value(<_i5.User>[]), - ) as _i18.Future>); + _i18.Future>.value(<_i5.UserDetailed>[]), + ) as _i18.Future>); } /// A class which mocks [MisskeyI]. @@ -4091,12 +4099,12 @@ class MockMisskeyHashtags extends _i1.Mock implements _i5.MisskeyHashtags { /// See the documentation for Mockito's code generation for more information. class MockMisskeyI extends _i1.Mock implements _i5.MisskeyI { @override - _i18.Future<_i5.IResponse> i() => (super.noSuchMethod( + _i18.Future<_i5.MeDetailed> i() => (super.noSuchMethod( Invocation.method( #i, [], ), - returnValue: _i18.Future<_i5.IResponse>.value(_FakeIResponse_44( + returnValue: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_44( this, Invocation.method( #i, @@ -4104,14 +4112,14 @@ class MockMisskeyI extends _i1.Mock implements _i5.MisskeyI { ), )), returnValueForMissingStub: - _i18.Future<_i5.IResponse>.value(_FakeIResponse_44( + _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_44( this, Invocation.method( #i, [], ), )), - ) as _i18.Future<_i5.IResponse>); + ) as _i18.Future<_i5.MeDetailed>); @override _i18.Future> notifications( @@ -4155,13 +4163,13 @@ class MockMisskeyI extends _i1.Mock implements _i5.MisskeyI { ) as _i18.Future>); @override - _i18.Future<_i5.IResponse> update(_i5.IUpdateRequest? request) => + _i18.Future<_i5.MeDetailed> update(_i5.IUpdateRequest? request) => (super.noSuchMethod( Invocation.method( #update, [request], ), - returnValue: _i18.Future<_i5.IResponse>.value(_FakeIResponse_44( + returnValue: _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_44( this, Invocation.method( #update, @@ -4169,14 +4177,14 @@ class MockMisskeyI extends _i1.Mock implements _i5.MisskeyI { ), )), returnValueForMissingStub: - _i18.Future<_i5.IResponse>.value(_FakeIResponse_44( + _i18.Future<_i5.MeDetailed>.value(_FakeMeDetailed_44( this, Invocation.method( #update, [request], ), )), - ) as _i18.Future<_i5.IResponse>); + ) as _i18.Future<_i5.MeDetailed>); } /// A class which mocks [MisskeyNotes]. @@ -4730,14 +4738,13 @@ class MockMisskeyUsers extends _i1.Mock implements _i5.MisskeyUsers { ) as _i5.MisskeyUsersLists); @override - _i18.Future<_i5.UsersShowResponse> show(_i5.UsersShowRequest? request) => + _i18.Future<_i5.UserDetailed> show(_i5.UsersShowRequest? request) => (super.noSuchMethod( Invocation.method( #show, [request], ), - returnValue: - _i18.Future<_i5.UsersShowResponse>.value(_FakeUsersShowResponse_53( + returnValue: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_53( this, Invocation.method( #show, @@ -4745,40 +4752,38 @@ class MockMisskeyUsers extends _i1.Mock implements _i5.MisskeyUsers { ), )), returnValueForMissingStub: - _i18.Future<_i5.UsersShowResponse>.value(_FakeUsersShowResponse_53( + _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_53( this, Invocation.method( #show, [request], ), )), - ) as _i18.Future<_i5.UsersShowResponse>); + ) as _i18.Future<_i5.UserDetailed>); @override - _i18.Future> showByIds( + _i18.Future> showByIds( _i5.UsersShowByIdsRequest? request) => (super.noSuchMethod( Invocation.method( #showByIds, [request], ), - returnValue: _i18.Future>.value( - <_i5.UsersShowResponse>[]), + returnValue: + _i18.Future>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: - _i18.Future>.value( - <_i5.UsersShowResponse>[]), - ) as _i18.Future>); + _i18.Future>.value(<_i5.UserDetailed>[]), + ) as _i18.Future>); @override - _i18.Future<_i5.UsersShowResponse> showByName( + _i18.Future<_i5.UserDetailed> showByName( _i5.UsersShowByUserNameRequest? request) => (super.noSuchMethod( Invocation.method( #showByName, [request], ), - returnValue: - _i18.Future<_i5.UsersShowResponse>.value(_FakeUsersShowResponse_53( + returnValue: _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_53( this, Invocation.method( #showByName, @@ -4786,14 +4791,14 @@ class MockMisskeyUsers extends _i1.Mock implements _i5.MisskeyUsers { ), )), returnValueForMissingStub: - _i18.Future<_i5.UsersShowResponse>.value(_FakeUsersShowResponse_53( + _i18.Future<_i5.UserDetailed>.value(_FakeUserDetailed_53( this, Invocation.method( #showByName, [request], ), )), - ) as _i18.Future<_i5.UsersShowResponse>); + ) as _i18.Future<_i5.UserDetailed>); @override _i18.Future> notes(_i5.UsersNotesRequest? request) => @@ -4899,16 +4904,18 @@ class MockMisskeyUsers extends _i1.Mock implements _i5.MisskeyUsers { ) as _i18.Future>); @override - _i18.Future> users(_i5.UsersUsersRequest? request) => + _i18.Future> users( + _i5.UsersUsersRequest? request) => (super.noSuchMethod( Invocation.method( #users, [request], ), - returnValue: _i18.Future>.value(<_i5.User>[]), + returnValue: + _i18.Future>.value(<_i5.UserDetailed>[]), returnValueForMissingStub: - _i18.Future>.value(<_i5.User>[]), - ) as _i18.Future>); + _i18.Future>.value(<_i5.UserDetailed>[]), + ) as _i18.Future>); @override _i18.Future updateMemo(_i5.UsersUpdateMemoRequest? request) => diff --git a/test/test_util/test_datas.dart b/test/test_util/test_datas.dart index 7c4b47224..4642be7c0 100644 --- a/test/test_util/test_datas.dart +++ b/test/test_util/test_datas.dart @@ -14,7 +14,7 @@ class TestData { meta: meta); // i - static IResponse i1 = IResponse.fromJson(JSON5.parse(r""" + static MeDetailed i1 = MeDetailed.fromJson(JSON5.parse(r""" { id: '7rkr3b1c1c', name: '藍', @@ -379,8 +379,8 @@ class TestData { files: [], replyId: null, renoteId: null, -} - +} + ''')); static Note note2 = Note.fromJson(JSON5.parse(r''' @@ -418,7 +418,7 @@ class TestData { files: [], replyId: null, renoteId: null, -} +} ''')); /// 自身でないノート1 @@ -463,7 +463,7 @@ class TestData { files: [], replyId: null, renoteId: null, -} +} ''')); /// 自身のノート(投票込みのノート) @@ -644,7 +644,7 @@ class TestData { replyId: null, renoteId: null, myReaction: ':ultra_igyo@.:', -} +} ''')); /// Renote @@ -779,7 +779,7 @@ class TestData { folder: null, userId: null, user: null, - } + } ''')); static DriveFile drive2AsVideo = DriveFile.fromJson(JSON5.parse(r''' @@ -812,7 +812,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: '藍', @@ -828,7 +828,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', @@ -997,7 +998,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', @@ -1109,8 +1111,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: '藍', @@ -1217,12 +1219,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', @@ -1391,12 +1393,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: 'あけおめらんか~', @@ -1476,8 +1478,8 @@ class TestData { } ''')); - static UsersShowResponse usersShowResponse3AsLocalUser = - UsersShowResponse.fromJson(JSON5.parse(''' + static UserDetailedNotMeWithRelations usersShowResponse3AsLocalUser = + UserDetailedNotMeWithRelations.fromJson(JSON5.parse(''' { id: '9i07ia9bf0', name: 'あけおめらんか~', @@ -1676,7 +1678,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 00b85aed3..30d45cfc4 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 76302f393..dc2a4ec2b 100644 --- a/test/view/user_page/user_page_test.dart +++ b/test/view/user_page/user_page_test.dart @@ -138,11 +138,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: [ @@ -163,13 +164,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: [ @@ -519,7 +521,6 @@ void main() { followeeId: TestData.usersShowResponse2.id, followerId: TestData.account.i.id, followee: TestData.detailedUser2, - follower: TestData.user1, ) ]); @@ -557,7 +558,6 @@ void main() { createdAt: DateTime.now(), followeeId: TestData.account.i.id, followerId: TestData.usersShowResponse2.id, - followee: TestData.user1, follower: TestData.detailedUser2, ) ]);