diff --git a/lib/providers.dart b/lib/providers.dart index daee1bd48..569a42da2 100644 --- a/lib/providers.dart +++ b/lib/providers.dart @@ -29,8 +29,11 @@ import 'package:misskey_dart/misskey_dart.dart'; final dioProvider = Provider((ref) => Dio()); final fileSystemProvider = Provider((ref) => const LocalFileSystem()); -final misskeyProvider = Provider.family( - (ref, account) => Misskey(token: account.token, host: account.host, socketConnectionTimeout: const Duration(seconds: 20))); +final misskeyProvider = Provider.family((ref, account) => + Misskey( + token: account.token, + host: account.host, + socketConnectionTimeout: const Duration(seconds: 20))); final localTimeLineProvider = ChangeNotifierProvider.family( @@ -194,5 +197,6 @@ final noteCreateProvider = StateNotifierProvider.family ref.read(fileSystemProvider), ref.read(dioProvider), ref.read(misskeyProvider(account)), - ref.read(errorEventProvider.notifier)), + ref.read(errorEventProvider.notifier), + ref.read(notesProvider(account))), ); diff --git a/lib/router/app_router.gr.dart b/lib/router/app_router.gr.dart index 7a9825e77..46c92668b 100644 --- a/lib/router/app_router.gr.dart +++ b/lib/router/app_router.gr.dart @@ -96,7 +96,8 @@ abstract class _$AppRouter extends RootStackRouter { channel: args.channel, reply: args.reply, renote: args.renote, - deletedNote: args.deletedNote, + note: args.note, + noteCreationMode: args.noteCreationMode, ), ); }, @@ -668,7 +669,8 @@ class NoteCreateRoute extends PageRouteInfo { CommunityChannel? channel, Note? reply, Note? renote, - Note? deletedNote, + Note? note, + NoteCreationMode? noteCreationMode, List? children, }) : super( NoteCreateRoute.name, @@ -680,7 +682,8 @@ class NoteCreateRoute extends PageRouteInfo { channel: channel, reply: reply, renote: renote, - deletedNote: deletedNote, + note: note, + noteCreationMode: noteCreationMode, ), initialChildren: children, ); @@ -700,7 +703,8 @@ class NoteCreateRouteArgs { this.channel, this.reply, this.renote, - this.deletedNote, + this.note, + this.noteCreationMode, }); final Key? key; @@ -717,11 +721,13 @@ class NoteCreateRouteArgs { final Note? renote; - final Note? deletedNote; + final Note? note; + + final NoteCreationMode? noteCreationMode; @override String toString() { - return 'NoteCreateRouteArgs{key: $key, initialAccount: $initialAccount, initialText: $initialText, initialMediaFiles: $initialMediaFiles, channel: $channel, reply: $reply, renote: $renote, deletedNote: $deletedNote}'; + return 'NoteCreateRouteArgs{key: $key, initialAccount: $initialAccount, initialText: $initialText, initialMediaFiles: $initialMediaFiles, channel: $channel, reply: $reply, renote: $renote, note: $note, noteCreationMode: $noteCreationMode}'; } } 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 944b5aa09..140d3e1de 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 @@ -10,11 +10,13 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:mfm_parser/mfm_parser.dart'; import 'package:miria/model/account.dart'; import 'package:miria/model/image_file.dart'; +import 'package:miria/repository/note_repository.dart'; import 'package:miria/view/common/error_dialog_handler.dart'; import 'package:miria/view/dialogs/simple_message_dialog.dart'; import 'package:miria/view/note_create_page/drive_file_select_dialog.dart'; import 'package:miria/view/note_create_page/drive_modal_sheet.dart'; import 'package:miria/view/note_create_page/file_settings_dialog.dart'; +import 'package:miria/view/note_create_page/note_create_page.dart'; import 'package:miria/view/user_select_dialog.dart'; import 'package:misskey_dart/misskey_dart.dart'; @@ -68,6 +70,8 @@ class NoteCreate with _$NoteCreate { int? voteDuration, @Default(VoteExpireDurationType.seconds) VoteExpireDurationType voteDurationType, + NoteCreationMode? noteCreationMode, + String? noteId, }) = _NoteCreate; } @@ -83,6 +87,7 @@ class NoteCreateNotifier extends StateNotifier { FileSystem fileSystem; Dio dio; Misskey misskey; + NoteRepository noteRepository; StateNotifier<(Object? error, BuildContext? context)> errorNotifier; NoteCreateNotifier( @@ -91,6 +96,7 @@ class NoteCreateNotifier extends StateNotifier { this.dio, this.misskey, this.errorNotifier, + this.noteRepository, ); /// 初期化する @@ -98,9 +104,10 @@ class NoteCreateNotifier extends StateNotifier { CommunityChannel? channel, String? initialText, List? initialMediaFiles, - Note? deletedNote, + Note? note, Note? renote, Note? reply, + NoteCreationMode? noteCreationMode, ) async { var resultState = state; @@ -148,9 +155,9 @@ class NoteCreateNotifier extends StateNotifier { } // 削除されたノートの反映 - if (deletedNote != null) { + if (note != null) { final files = []; - for (final file in deletedNote.files) { + for (final file in note.files) { if (file.type.startsWith("image")) { final response = await dio.get(file.url, options: Options(responseType: ResponseType.bytes)); @@ -172,33 +179,33 @@ class NoteCreateNotifier extends StateNotifier { )); } } - final deletedNoteChannel = deletedNote.channel; + final deletedNoteChannel = note.channel; resultState = resultState.copyWith( - noteVisibility: deletedNote.visibility, - localOnly: deletedNote.localOnly, + noteVisibility: note.visibility, + localOnly: note.localOnly, files: files, channel: deletedNoteChannel != null ? NoteCreateChannel( id: deletedNoteChannel.id, name: deletedNoteChannel.name) : null, - cwText: deletedNote.cw ?? "", - isCw: deletedNote.cw?.isNotEmpty == true, - text: deletedNote.text ?? "", - reactionAcceptance: deletedNote.reactionAcceptance, + cwText: note.cw ?? "", + isCw: note.cw?.isNotEmpty == true, + text: note.text ?? "", + reactionAcceptance: note.reactionAcceptance, replyTo: [ - for (final userId in deletedNote.mentions) + for (final userId in note.mentions) (await misskey.users.show(UsersShowRequest(userId: userId))) .toUser() ], - isVote: deletedNote.poll != null, - isVoteMultiple: deletedNote.poll?.multiple ?? false, + isVote: note.poll != null, + isVoteMultiple: note.poll?.multiple ?? false, voteExpireType: VoteExpireType.date, - voteContentCount: - deletedNote.poll?.choices.map((e) => e.text).length ?? 2, - voteContent: - deletedNote.poll?.choices.map((e) => e.text).toList() ?? [], - voteDate: deletedNote.poll?.expiresAt, + voteContentCount: note.poll?.choices.map((e) => e.text).length ?? 2, + voteContent: note.poll?.choices.map((e) => e.text).toList() ?? [], + voteDate: note.poll?.expiresAt, + noteCreationMode: noteCreationMode, + noteId: note.id, ); state = resultState; return; @@ -390,19 +397,30 @@ class NoteCreateNotifier extends StateNotifier { ? voteDuration : null); - await misskey.notes.create(NotesCreateRequest( - visibility: state.noteVisibility, - text: postText, - cw: state.isCw ? state.cwText : null, - localOnly: state.localOnly, - replyId: state.reply?.id, - renoteId: state.renote?.id, - channelId: state.channel?.id, - fileIds: fileIds.isEmpty ? null : fileIds, - visibleUserIds: visibleUserIds.toSet().toList(), //distinct list - reactionAcceptance: state.reactionAcceptance, - poll: state.isVote ? poll : null, - )); + if (state.noteCreationMode == NoteCreationMode.update) { + await misskey.notes.update(NotesUpdateRequest( + noteId: state.noteId!, + text: postText ?? "", + cw: state.isCw ? state.cwText : null, + )); + noteRepository.registerNote(noteRepository.notes[state.noteId!]! + .copyWith( + text: postText ?? "", cw: state.isCw ? state.cwText : null)); + } else { + await misskey.notes.create(NotesCreateRequest( + visibility: state.noteVisibility, + text: postText, + cw: state.isCw ? state.cwText : null, + localOnly: state.localOnly, + replyId: state.reply?.id, + renoteId: state.renote?.id, + channelId: state.channel?.id, + fileIds: fileIds.isEmpty ? null : fileIds, + visibleUserIds: visibleUserIds.toSet().toList(), //distinct list + reactionAcceptance: state.reactionAcceptance, + poll: state.isVote ? poll : null, + )); + } if (!mounted) return; state = state.copyWith(isNoteSending: NoteSendStatus.finished); } catch (e) { diff --git a/lib/state_notifier/note_create_page/note_create_state_notifier.freezed.dart b/lib/state_notifier/note_create_page/note_create_state_notifier.freezed.dart index 38a78bfc1..9520a7259 100644 --- a/lib/state_notifier/note_create_page/note_create_state_notifier.freezed.dart +++ b/lib/state_notifier/note_create_page/note_create_state_notifier.freezed.dart @@ -40,6 +40,8 @@ mixin _$NoteCreate { int? get voteDuration => throw _privateConstructorUsedError; VoteExpireDurationType get voteDurationType => throw _privateConstructorUsedError; + NoteCreationMode? get noteCreationMode => throw _privateConstructorUsedError; + String? get noteId => throw _privateConstructorUsedError; @JsonKey(ignore: true) $NoteCreateCopyWith get copyWith => @@ -74,7 +76,9 @@ abstract class $NoteCreateCopyWith<$Res> { bool isVoteMultiple, DateTime? voteDate, int? voteDuration, - VoteExpireDurationType voteDurationType}); + VoteExpireDurationType voteDurationType, + NoteCreationMode? noteCreationMode, + String? noteId}); $AccountCopyWith<$Res> get account; $NoteCreateChannelCopyWith<$Res>? get channel; @@ -117,6 +121,8 @@ class _$NoteCreateCopyWithImpl<$Res, $Val extends NoteCreate> Object? voteDate = freezed, Object? voteDuration = freezed, Object? voteDurationType = null, + Object? noteCreationMode = freezed, + Object? noteId = freezed, }) { return _then(_value.copyWith( account: null == account @@ -207,6 +213,14 @@ class _$NoteCreateCopyWithImpl<$Res, $Val extends NoteCreate> ? _value.voteDurationType : voteDurationType // ignore: cast_nullable_to_non_nullable as VoteExpireDurationType, + noteCreationMode: freezed == noteCreationMode + ? _value.noteCreationMode + : noteCreationMode // ignore: cast_nullable_to_non_nullable + as NoteCreationMode?, + noteId: freezed == noteId + ? _value.noteId + : noteId // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } @@ -285,7 +299,9 @@ abstract class _$$_NoteCreateCopyWith<$Res> bool isVoteMultiple, DateTime? voteDate, int? voteDuration, - VoteExpireDurationType voteDurationType}); + VoteExpireDurationType voteDurationType, + NoteCreationMode? noteCreationMode, + String? noteId}); @override $AccountCopyWith<$Res> get account; @@ -330,6 +346,8 @@ class __$$_NoteCreateCopyWithImpl<$Res> Object? voteDate = freezed, Object? voteDuration = freezed, Object? voteDurationType = null, + Object? noteCreationMode = freezed, + Object? noteId = freezed, }) { return _then(_$_NoteCreate( account: null == account @@ -420,6 +438,14 @@ class __$$_NoteCreateCopyWithImpl<$Res> ? _value.voteDurationType : voteDurationType // ignore: cast_nullable_to_non_nullable as VoteExpireDurationType, + noteCreationMode: freezed == noteCreationMode + ? _value.noteCreationMode + : noteCreationMode // ignore: cast_nullable_to_non_nullable + as NoteCreationMode?, + noteId: freezed == noteId + ? _value.noteId + : noteId // ignore: cast_nullable_to_non_nullable + as String?, )); } } @@ -449,7 +475,9 @@ class _$_NoteCreate implements _NoteCreate { this.isVoteMultiple = false, this.voteDate, this.voteDuration, - this.voteDurationType = VoteExpireDurationType.seconds}) + this.voteDurationType = VoteExpireDurationType.seconds, + this.noteCreationMode, + this.noteId}) : _replyTo = replyTo, _files = files, _voteContent = voteContent; @@ -528,10 +556,14 @@ class _$_NoteCreate implements _NoteCreate { @override @JsonKey() final VoteExpireDurationType voteDurationType; + @override + final NoteCreationMode? noteCreationMode; + @override + final String? noteId; @override String toString() { - return 'NoteCreate(account: $account, noteVisibility: $noteVisibility, localOnly: $localOnly, replyTo: $replyTo, files: $files, channel: $channel, reply: $reply, renote: $renote, reactionAcceptance: $reactionAcceptance, isCw: $isCw, cwText: $cwText, text: $text, isTextFocused: $isTextFocused, isNoteSending: $isNoteSending, isVote: $isVote, voteContent: $voteContent, voteContentCount: $voteContentCount, voteExpireType: $voteExpireType, isVoteMultiple: $isVoteMultiple, voteDate: $voteDate, voteDuration: $voteDuration, voteDurationType: $voteDurationType)'; + return 'NoteCreate(account: $account, noteVisibility: $noteVisibility, localOnly: $localOnly, replyTo: $replyTo, files: $files, channel: $channel, reply: $reply, renote: $renote, reactionAcceptance: $reactionAcceptance, isCw: $isCw, cwText: $cwText, text: $text, isTextFocused: $isTextFocused, isNoteSending: $isNoteSending, isVote: $isVote, voteContent: $voteContent, voteContentCount: $voteContentCount, voteExpireType: $voteExpireType, isVoteMultiple: $isVoteMultiple, voteDate: $voteDate, voteDuration: $voteDuration, voteDurationType: $voteDurationType, noteCreationMode: $noteCreationMode, noteId: $noteId)'; } @override @@ -572,7 +604,10 @@ class _$_NoteCreate implements _NoteCreate { (identical(other.voteDuration, voteDuration) || other.voteDuration == voteDuration) && (identical(other.voteDurationType, voteDurationType) || - other.voteDurationType == voteDurationType)); + other.voteDurationType == voteDurationType) && + (identical(other.noteCreationMode, noteCreationMode) || + other.noteCreationMode == noteCreationMode) && + (identical(other.noteId, noteId) || other.noteId == noteId)); } @override @@ -599,7 +634,9 @@ class _$_NoteCreate implements _NoteCreate { isVoteMultiple, voteDate, voteDuration, - voteDurationType + voteDurationType, + noteCreationMode, + noteId ]); @JsonKey(ignore: true) @@ -632,7 +669,9 @@ abstract class _NoteCreate implements NoteCreate { final bool isVoteMultiple, final DateTime? voteDate, final int? voteDuration, - final VoteExpireDurationType voteDurationType}) = _$_NoteCreate; + final VoteExpireDurationType voteDurationType, + final NoteCreationMode? noteCreationMode, + final String? noteId}) = _$_NoteCreate; @override Account get account; @@ -679,6 +718,10 @@ abstract class _NoteCreate implements NoteCreate { @override VoteExpireDurationType get voteDurationType; @override + NoteCreationMode? get noteCreationMode; + @override + String? get noteId; + @override @JsonKey(ignore: true) _$$_NoteCreateCopyWith<_$_NoteCreate> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/view/common/misskey_notes/note_modal_sheet.dart b/lib/view/common/misskey_notes/note_modal_sheet.dart index 7c22a0d83..b310ef7fb 100644 --- a/lib/view/common/misskey_notes/note_modal_sheet.dart +++ b/lib/view/common/misskey_notes/note_modal_sheet.dart @@ -13,6 +13,7 @@ import 'package:miria/view/common/misskey_notes/clip_modal_sheet.dart'; import 'package:miria/view/common/misskey_notes/open_another_account.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/view/dialogs/simple_confirm_dialog.dart'; +import 'package:miria/view/note_create_page/note_create_page.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; @@ -219,6 +220,19 @@ class NoteModalSheet extends ConsumerWidget { baseNote.renote != null && baseNote.poll == null && baseNote.files.isEmpty)) ...[ + if (account.i.policies.canEditNote) + ListTile( + title: const Text("編集する"), + onTap: () async { + Navigator.of(context).pop(); + context.pushRoute( + NoteCreateRoute( + initialAccount: account, + note: targetNote, + noteCreationMode: NoteCreationMode.update, + ), + ); + }), ListTile( title: const Text("削除する"), onTap: () async { @@ -263,7 +277,8 @@ class NoteModalSheet extends ConsumerWidget { context.pushRoute( NoteCreateRoute( initialAccount: account, - deletedNote: targetNote, + note: targetNote, + noteCreationMode: NoteCreationMode.recreate, ), ); } diff --git a/lib/view/note_create_page/note_create_page.dart b/lib/view/note_create_page/note_create_page.dart index bfdff0aaa..d3a2365d8 100644 --- a/lib/view/note_create_page/note_create_page.dart +++ b/lib/view/note_create_page/note_create_page.dart @@ -35,6 +35,8 @@ final noteInputTextProvider = final noteFocusProvider = ChangeNotifierProvider.autoDispose((ref) => FocusNode()); +enum NoteCreationMode { update, recreate } + @RoutePage() class NoteCreatePage extends ConsumerStatefulWidget { final Account initialAccount; @@ -43,7 +45,8 @@ class NoteCreatePage extends ConsumerStatefulWidget { final CommunityChannel? channel; final Note? reply; final Note? renote; - final Note? deletedNote; + final Note? note; + final NoteCreationMode? noteCreationMode; const NoteCreatePage({ super.key, @@ -53,7 +56,8 @@ class NoteCreatePage extends ConsumerStatefulWidget { this.channel, this.reply, this.renote, - this.deletedNote, + this.note, + this.noteCreationMode, }); @override @@ -80,12 +84,14 @@ class NoteCreatePageState extends ConsumerState { isFirstChangeDependenciesCalled = true; Future(() async { notifier.initialize( - widget.channel, - widget.initialText, - widget.initialMediaFiles, - widget.deletedNote, - widget.renote, - widget.reply); + widget.channel, + widget.initialText, + widget.initialMediaFiles, + widget.note, + widget.renote, + widget.reply, + widget.noteCreationMode, + ); ref.read(noteInputTextProvider).addListener(() { notifier.setContentText(ref.read(noteInputTextProvider).text); @@ -156,7 +162,10 @@ class NoteCreatePageState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - const NoteCreateSettingTop(), + if (widget.noteCreationMode != NoteCreationMode.update) + const NoteCreateSettingTop() + else + const Padding(padding: EdgeInsets.only(top: 30)), const ChannelArea(), const ReplyArea(), const ReplyToArea(), @@ -172,23 +181,30 @@ class NoteCreatePageState extends ConsumerState { ), Row( children: [ - IconButton( - onPressed: () async => - await notifier.chooseFile(context), - icon: const Icon(Icons.image)), - IconButton( - onPressed: () { - ref - .read(noteCreateProvider( - widget.initialAccount) - .notifier) - .toggleVote(); - }, - icon: const Icon(Icons.how_to_vote)), + if (widget.noteCreationMode != + NoteCreationMode.update) ...[ + IconButton( + onPressed: () async => + await notifier.chooseFile(context), + icon: const Icon(Icons.image)), + if (widget.noteCreationMode != + NoteCreationMode.update) + IconButton( + onPressed: () { + ref + .read(noteCreateProvider( + widget.initialAccount) + .notifier) + .toggleVote(); + }, + icon: const Icon(Icons.how_to_vote)), + ], const CwToggleButton(), - IconButton( - onPressed: () => notifier.addReplyUser(context), - icon: const Icon(Icons.mail_outline)), + if (widget.noteCreationMode != + NoteCreationMode.update) + IconButton( + onPressed: () => notifier.addReplyUser(context), + icon: const Icon(Icons.mail_outline)), IconButton( onPressed: () async { final selectedEmoji = @@ -220,9 +236,15 @@ class NoteCreatePageState extends ConsumerState { ], ), const MfmPreview(), - const FilePreview(), + if (widget.noteCreationMode != NoteCreationMode.update) + const FilePreview() + else if (widget.note?.files.isNotEmpty == true) + const Text("メディアがあります(編集はできません)"), const RenoteArea(), - const VoteArea(), + if (widget.noteCreationMode != NoteCreationMode.update) + const VoteArea() + else if (widget.note?.poll != null) + const Text("投票があります(編集はできません)"), ], ), ), diff --git a/pubspec.lock b/pubspec.lock index 1d2f59f6e..6bcb814d5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -790,7 +790,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: d4de5d69b936f92b63bd5446fe5fd295ad173b6e + resolved-ref: "3d29f965251597c87e8b5117ae011d91596e9385" url: "https://github.com/shiosyakeyakini-info/misskey_dart.git" source: git version: "1.0.0" diff --git a/test/test_util/mock.mocks.dart b/test/test_util/mock.mocks.dart index 2894a8a7d..7dc27ddd4 100644 --- a/test/test_util/mock.mocks.dart +++ b/test/test_util/mock.mocks.dart @@ -2139,6 +2139,16 @@ class MockMisskeyNotes extends _i1.Mock implements _i6.MisskeyNotes { returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); @override + _i16.Future update(_i6.NotesUpdateRequest? request) => + (super.noSuchMethod( + Invocation.method( + #update, + [request], + ), + returnValue: _i16.Future.value(), + returnValueForMissingStub: _i16.Future.value(), + ) as _i16.Future); + @override _i16.Future delete(_i6.NotesDeleteRequest? request) => (super.noSuchMethod( Invocation.method( 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 96dd70de3..846ec8b96 100644 --- a/test/view/note_create_page/note_create_page_test.dart +++ b/test/view/note_create_page/note_create_page_test.dart @@ -72,7 +72,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith( + note: TestData.note1.copyWith( channelId: TestData.channel1.id, channel: NoteChannelInfo( id: TestData.channel1.id, @@ -198,7 +198,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1 + note: TestData.note1 .copyWith(visibility: NoteVisibility.specified)), ))); await tester.pumpAndSettle(); @@ -365,7 +365,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith(localOnly: true)), + note: TestData.note1.copyWith(localOnly: true)), ))); await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.send)); @@ -506,7 +506,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith( + note: TestData.note1.copyWith( reactionAcceptance: ReactionAcceptance.likeOnly)), ))); await tester.pumpAndSettle(); @@ -602,7 +602,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith(cw: "えっちなやつ")), + note: TestData.note1.copyWith(cw: "えっちなやつ")), ))); await tester.pumpAndSettle(); @@ -681,8 +681,7 @@ void main() { ], child: DefaultRootWidget( initialRoute: NoteCreateRoute( - initialAccount: TestData.account, - deletedNote: TestData.note1), + initialAccount: TestData.account, note: TestData.note1), ))); await tester.pumpAndSettle(); @@ -752,7 +751,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith( + note: TestData.note1.copyWith( files: [TestData.drive1], fileIds: [TestData.drive1.id])), ))); await tester.pumpAndSettle(); @@ -943,7 +942,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note1.copyWith(mentions: ["@ai"]), + note: TestData.note1.copyWith(mentions: ["@ai"]), )))); await tester.pumpAndSettle(); expect(find.text("返信先:"), findsOneWidget); @@ -1015,7 +1014,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note4AsVote.copyWith( + note: TestData.note4AsVote.copyWith( poll: TestData.note4AsVote.poll?.copyWith(multiple: false)), )))); await tester.pumpAndSettle(); @@ -1045,7 +1044,7 @@ void main() { child: DefaultRootWidget( initialRoute: NoteCreateRoute( initialAccount: TestData.account, - deletedNote: TestData.note4AsVote.copyWith( + note: TestData.note4AsVote.copyWith( poll: TestData.note4AsVote.poll?.copyWith(multiple: true)), )))); await tester.pumpAndSettle();