From f90baca7d3a47830143bb78a7b20425532df9ca4 Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:33:50 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=81=E3=81=99?= =?UTF-8?q?=E3=82=8B=E7=B5=B5=E6=96=87=E5=AD=97=E3=81=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88?= =?UTF-8?q?=E3=81=AE=E5=85=A5=E5=8A=9B=E8=A3=9C=E5=AE=8C=E3=82=92=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/common/note_create/emoji_keyboard.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/view/common/note_create/emoji_keyboard.dart b/lib/view/common/note_create/emoji_keyboard.dart index 626c4d592..7e10340fa 100644 --- a/lib/view/common/note_create/emoji_keyboard.dart +++ b/lib/view/common/note_create/emoji_keyboard.dart @@ -5,6 +5,7 @@ import 'package:miria/model/input_completion_type.dart'; import 'package:miria/model/misskey_emoji_data.dart'; import 'package:miria/providers.dart'; import 'package:miria/view/common/misskey_notes/custom_emoji.dart'; +import 'package:miria/view/common/note_create/basic_keyboard.dart'; import 'package:miria/view/common/note_create/input_completation.dart'; import 'package:miria/view/reaction_picker_dialog/reaction_picker_dialog.dart'; @@ -81,6 +82,13 @@ class EmojiKeyboard extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final filteredEmojis = ref.watch(_filteredEmojisProvider(account)); + if (filteredEmojis.isEmpty) { + return BasicKeyboard( + controller: controller, + focusNode: focusNode, + ); + } + return Row( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, From e903738f34534babc32c84305e03bd68d134688f Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Fri, 29 Sep 2023 03:05:39 +0900 Subject: [PATCH 2/5] =?UTF-8?q?TabSetting=E3=81=8B=E3=82=89Account?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/account.dart | 8 + lib/model/account_settings.dart | 10 + lib/model/account_settings.freezed.dart | 8 +- lib/model/acct.dart | 20 + lib/model/acct.freezed.dart | 156 ++ lib/model/acct.g.dart | 17 + lib/model/tab_setting.dart | 29 +- lib/model/tab_setting.freezed.dart | 160 +- lib/model/tab_setting.g.dart | 10 +- lib/providers.dart | 219 ++- lib/repository/account_repository.dart | 36 +- .../account_settings_repository.dart | 22 +- lib/repository/import_export_repository.dart | 42 +- .../socket_timeline_repository.dart | 2 +- lib/repository/tab_settings_repository.dart | 15 +- lib/router/app_router.gr.dart | 1522 ++++++++--------- lib/view/common/common_drawer.dart | 10 +- .../tab_settings_list_page.dart | 11 +- .../tab_settings_page/tab_settings_page.dart | 12 +- lib/view/time_line_page/time_line_page.dart | 124 +- test/test_util/mock.mocks.dart | 131 +- 21 files changed, 1413 insertions(+), 1151 deletions(-) create mode 100644 lib/model/acct.dart create mode 100644 lib/model/acct.freezed.dart create mode 100644 lib/model/acct.g.dart diff --git a/lib/model/account.dart b/lib/model/account.dart index cac5fa7c8..dea8b2747 100644 --- a/lib/model/account.dart +++ b/lib/model/account.dart @@ -1,4 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:miria/model/acct.dart'; import 'package:misskey_dart/misskey_dart.dart'; part 'account.freezed.dart'; @@ -29,6 +30,13 @@ class Account with _$Account { @override int get hashCode => Object.hash(runtimeType, host, userId); + Acct get acct { + return Acct( + host: host, + username: userId, + ); + } + factory Account.demoAccount(String host) => Account( host: host, userId: "", diff --git a/lib/model/account_settings.dart b/lib/model/account_settings.dart index 0292eac5f..93cc908da 100644 --- a/lib/model/account_settings.dart +++ b/lib/model/account_settings.dart @@ -1,4 +1,5 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:miria/model/acct.dart'; import 'package:misskey_dart/misskey_dart.dart'; part 'account_settings.freezed.dart'; @@ -6,6 +7,8 @@ part 'account_settings.g.dart'; @freezed class AccountSettings with _$AccountSettings { + const AccountSettings._(); + const factory AccountSettings({ required String userId, required String host, @@ -17,4 +20,11 @@ class AccountSettings with _$AccountSettings { factory AccountSettings.fromJson(Map json) => _$AccountSettingsFromJson(json); + + Acct get acct { + return Acct( + host: host, + username: userId, + ); + } } diff --git a/lib/model/account_settings.freezed.dart b/lib/model/account_settings.freezed.dart index 670fa0bb7..4715ce220 100644 --- a/lib/model/account_settings.freezed.dart +++ b/lib/model/account_settings.freezed.dart @@ -165,7 +165,7 @@ class __$$_AccountSettingsCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$_AccountSettings implements _AccountSettings { +class _$_AccountSettings extends _AccountSettings { const _$_AccountSettings( {required this.userId, required this.host, @@ -173,7 +173,8 @@ class _$_AccountSettings implements _AccountSettings { this.defaultNoteVisibility = NoteVisibility.public, this.defaultIsLocalOnly = false, this.defaultReactionAcceptance = null}) - : _reactions = reactions; + : _reactions = reactions, + super._(); factory _$_AccountSettings.fromJson(Map json) => _$$_AccountSettingsFromJson(json); @@ -249,7 +250,7 @@ class _$_AccountSettings implements _AccountSettings { } } -abstract class _AccountSettings implements AccountSettings { +abstract class _AccountSettings extends AccountSettings { const factory _AccountSettings( {required final String userId, required final String host, @@ -258,6 +259,7 @@ abstract class _AccountSettings implements AccountSettings { final bool defaultIsLocalOnly, final ReactionAcceptance? defaultReactionAcceptance}) = _$_AccountSettings; + const _AccountSettings._() : super._(); factory _AccountSettings.fromJson(Map json) = _$_AccountSettings.fromJson; diff --git a/lib/model/acct.dart b/lib/model/acct.dart new file mode 100644 index 000000000..e904d1015 --- /dev/null +++ b/lib/model/acct.dart @@ -0,0 +1,20 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'acct.freezed.dart'; +part 'acct.g.dart'; + +@freezed +class Acct with _$Acct { + const factory Acct({ + required String host, + required String username, + }) = _Acct; + const Acct._(); + + factory Acct.fromJson(Map json) => _$AcctFromJson(json); + + @override + String toString() { + return "@$username@$host"; + } +} diff --git a/lib/model/acct.freezed.dart b/lib/model/acct.freezed.dart new file mode 100644 index 000000000..257dfc8b9 --- /dev/null +++ b/lib/model/acct.freezed.dart @@ -0,0 +1,156 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'acct.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +Acct _$AcctFromJson(Map json) { + return _Acct.fromJson(json); +} + +/// @nodoc +mixin _$Acct { + String get host => throw _privateConstructorUsedError; + String get username => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AcctCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AcctCopyWith<$Res> { + factory $AcctCopyWith(Acct value, $Res Function(Acct) then) = + _$AcctCopyWithImpl<$Res, Acct>; + @useResult + $Res call({String host, String username}); +} + +/// @nodoc +class _$AcctCopyWithImpl<$Res, $Val extends Acct> + implements $AcctCopyWith<$Res> { + _$AcctCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? host = null, + Object? username = null, + }) { + return _then(_value.copyWith( + host: null == host + ? _value.host + : host // ignore: cast_nullable_to_non_nullable + as String, + username: null == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_AcctCopyWith<$Res> implements $AcctCopyWith<$Res> { + factory _$$_AcctCopyWith(_$_Acct value, $Res Function(_$_Acct) then) = + __$$_AcctCopyWithImpl<$Res>; + @override + @useResult + $Res call({String host, String username}); +} + +/// @nodoc +class __$$_AcctCopyWithImpl<$Res> extends _$AcctCopyWithImpl<$Res, _$_Acct> + implements _$$_AcctCopyWith<$Res> { + __$$_AcctCopyWithImpl(_$_Acct _value, $Res Function(_$_Acct) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? host = null, + Object? username = null, + }) { + return _then(_$_Acct( + host: null == host + ? _value.host + : host // ignore: cast_nullable_to_non_nullable + as String, + username: null == username + ? _value.username + : username // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_Acct extends _Acct { + const _$_Acct({required this.host, required this.username}) : super._(); + + factory _$_Acct.fromJson(Map json) => _$$_AcctFromJson(json); + + @override + final String host; + @override + final String username; + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_Acct && + (identical(other.host, host) || other.host == host) && + (identical(other.username, username) || + other.username == username)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, host, username); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_AcctCopyWith<_$_Acct> get copyWith => + __$$_AcctCopyWithImpl<_$_Acct>(this, _$identity); + + @override + Map toJson() { + return _$$_AcctToJson( + this, + ); + } +} + +abstract class _Acct extends Acct { + const factory _Acct( + {required final String host, required final String username}) = _$_Acct; + const _Acct._() : super._(); + + factory _Acct.fromJson(Map json) = _$_Acct.fromJson; + + @override + String get host; + @override + String get username; + @override + @JsonKey(ignore: true) + _$$_AcctCopyWith<_$_Acct> get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/model/acct.g.dart b/lib/model/acct.g.dart new file mode 100644 index 000000000..849b633f8 --- /dev/null +++ b/lib/model/acct.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'acct.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_Acct _$$_AcctFromJson(Map json) => _$_Acct( + host: json['host'] as String, + username: json['username'] as String, + ); + +Map _$$_AcctToJson(_$_Acct instance) => { + 'host': instance.host, + 'username': instance.username, + }; diff --git a/lib/model/tab_setting.dart b/lib/model/tab_setting.dart index eb2116cdd..db09e7019 100644 --- a/lib/model/tab_setting.dart +++ b/lib/model/tab_setting.dart @@ -1,14 +1,25 @@ -import 'package:miria/model/account.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:miria/model/acct.dart'; import 'package:miria/model/converters/icon_converter.dart'; import 'package:miria/model/tab_icon.dart'; import 'package:miria/model/tab_type.dart'; import 'package:miria/repository/time_line_repository.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; part 'tab_setting.freezed.dart'; part 'tab_setting.g.dart'; +Map _readAcct(Map json, String name) { + final account = json["account"]; + if (account != null) { + return { + "host": account["host"], + "username": account["userId"], + }; + } + return json[name]! as Map; +} + @freezed class TabSetting with _$TabSetting { const TabSetting._(); @@ -35,19 +46,23 @@ class TabSetting with _$TabSetting { String? antennaId, /// ノートの投稿のキャプチャをするかどうか - @Default(true) isSubscribe, + @Default(true) bool isSubscribe, /// 返信を含むかどうか - @Default(true) isIncludeReplies, + @Default(true) bool isIncludeReplies, /// ファイルのみにするかどうか - @Default(false) isMediaOnly, + @Default(false) bool isMediaOnly, /// タブ名 required String name, /// アカウント情報 - required Account account, + // https://github.com/rrousselGit/freezed/issues/488 + // ignore: invalid_annotation_target + @JsonKey(readValue: _readAcct) required Acct acct, + + /// Renoteを表示するかどうか @Default(true) bool renoteDisplay, }) = _TabSetting; diff --git a/lib/model/tab_setting.freezed.dart b/lib/model/tab_setting.freezed.dart index a71380d94..c1e4c1306 100644 --- a/lib/model/tab_setting.freezed.dart +++ b/lib/model/tab_setting.freezed.dart @@ -39,19 +39,24 @@ mixin _$TabSetting { String? get antennaId => throw _privateConstructorUsedError; /// ノートの投稿のキャプチャをするかどうか - dynamic get isSubscribe => throw _privateConstructorUsedError; + bool get isSubscribe => throw _privateConstructorUsedError; /// 返信を含むかどうか - dynamic get isIncludeReplies => throw _privateConstructorUsedError; + bool get isIncludeReplies => throw _privateConstructorUsedError; /// ファイルのみにするかどうか - dynamic get isMediaOnly => throw _privateConstructorUsedError; + bool get isMediaOnly => throw _privateConstructorUsedError; /// タブ名 String get name => throw _privateConstructorUsedError; /// アカウント情報 - Account get account => throw _privateConstructorUsedError; +// https://github.com/rrousselGit/freezed/issues/488 +// ignore: invalid_annotation_target + @JsonKey(readValue: _readAcct) + Acct get acct => throw _privateConstructorUsedError; + + /// Renoteを表示するかどうか bool get renoteDisplay => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -73,15 +78,15 @@ abstract class $TabSettingCopyWith<$Res> { String? channelId, String? listId, String? antennaId, - dynamic isSubscribe, - dynamic isIncludeReplies, - dynamic isMediaOnly, + bool isSubscribe, + bool isIncludeReplies, + bool isMediaOnly, String name, - Account account, + @JsonKey(readValue: _readAcct) Acct acct, bool renoteDisplay}); $TabIconCopyWith<$Res> get icon; - $AccountCopyWith<$Res> get account; + $AcctCopyWith<$Res> get acct; } /// @nodoc @@ -103,11 +108,11 @@ class _$TabSettingCopyWithImpl<$Res, $Val extends TabSetting> Object? channelId = freezed, Object? listId = freezed, Object? antennaId = freezed, - Object? isSubscribe = freezed, - Object? isIncludeReplies = freezed, - Object? isMediaOnly = freezed, + Object? isSubscribe = null, + Object? isIncludeReplies = null, + Object? isMediaOnly = null, Object? name = null, - Object? account = null, + Object? acct = null, Object? renoteDisplay = null, }) { return _then(_value.copyWith( @@ -135,26 +140,26 @@ class _$TabSettingCopyWithImpl<$Res, $Val extends TabSetting> ? _value.antennaId : antennaId // ignore: cast_nullable_to_non_nullable as String?, - isSubscribe: freezed == isSubscribe + isSubscribe: null == isSubscribe ? _value.isSubscribe : isSubscribe // ignore: cast_nullable_to_non_nullable - as dynamic, - isIncludeReplies: freezed == isIncludeReplies + as bool, + isIncludeReplies: null == isIncludeReplies ? _value.isIncludeReplies : isIncludeReplies // ignore: cast_nullable_to_non_nullable - as dynamic, - isMediaOnly: freezed == isMediaOnly + as bool, + isMediaOnly: null == isMediaOnly ? _value.isMediaOnly : isMediaOnly // ignore: cast_nullable_to_non_nullable - as dynamic, + as bool, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable as String, - account: null == account - ? _value.account - : account // ignore: cast_nullable_to_non_nullable - as Account, + acct: null == acct + ? _value.acct + : acct // ignore: cast_nullable_to_non_nullable + as Acct, renoteDisplay: null == renoteDisplay ? _value.renoteDisplay : renoteDisplay // ignore: cast_nullable_to_non_nullable @@ -172,9 +177,9 @@ class _$TabSettingCopyWithImpl<$Res, $Val extends TabSetting> @override @pragma('vm:prefer-inline') - $AccountCopyWith<$Res> get account { - return $AccountCopyWith<$Res>(_value.account, (value) { - return _then(_value.copyWith(account: value) as $Val); + $AcctCopyWith<$Res> get acct { + return $AcctCopyWith<$Res>(_value.acct, (value) { + return _then(_value.copyWith(acct: value) as $Val); }); } } @@ -194,17 +199,17 @@ abstract class _$$_TabSettingCopyWith<$Res> String? channelId, String? listId, String? antennaId, - dynamic isSubscribe, - dynamic isIncludeReplies, - dynamic isMediaOnly, + bool isSubscribe, + bool isIncludeReplies, + bool isMediaOnly, String name, - Account account, + @JsonKey(readValue: _readAcct) Acct acct, bool renoteDisplay}); @override $TabIconCopyWith<$Res> get icon; @override - $AccountCopyWith<$Res> get account; + $AcctCopyWith<$Res> get acct; } /// @nodoc @@ -224,11 +229,11 @@ class __$$_TabSettingCopyWithImpl<$Res> Object? channelId = freezed, Object? listId = freezed, Object? antennaId = freezed, - Object? isSubscribe = freezed, - Object? isIncludeReplies = freezed, - Object? isMediaOnly = freezed, + Object? isSubscribe = null, + Object? isIncludeReplies = null, + Object? isMediaOnly = null, Object? name = null, - Object? account = null, + Object? acct = null, Object? renoteDisplay = null, }) { return _then(_$_TabSetting( @@ -256,19 +261,26 @@ class __$$_TabSettingCopyWithImpl<$Res> ? _value.antennaId : antennaId // ignore: cast_nullable_to_non_nullable as String?, - isSubscribe: freezed == isSubscribe ? _value.isSubscribe! : isSubscribe, - isIncludeReplies: freezed == isIncludeReplies - ? _value.isIncludeReplies! - : isIncludeReplies, - isMediaOnly: freezed == isMediaOnly ? _value.isMediaOnly! : isMediaOnly, + isSubscribe: null == isSubscribe + ? _value.isSubscribe + : isSubscribe // ignore: cast_nullable_to_non_nullable + as bool, + isIncludeReplies: null == isIncludeReplies + ? _value.isIncludeReplies + : isIncludeReplies // ignore: cast_nullable_to_non_nullable + as bool, + isMediaOnly: null == isMediaOnly + ? _value.isMediaOnly + : isMediaOnly // ignore: cast_nullable_to_non_nullable + as bool, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable as String, - account: null == account - ? _value.account - : account // ignore: cast_nullable_to_non_nullable - as Account, + acct: null == acct + ? _value.acct + : acct // ignore: cast_nullable_to_non_nullable + as Acct, renoteDisplay: null == renoteDisplay ? _value.renoteDisplay : renoteDisplay // ignore: cast_nullable_to_non_nullable @@ -291,7 +303,7 @@ class _$_TabSetting extends _TabSetting { this.isIncludeReplies = true, this.isMediaOnly = false, required this.name, - required this.account, + @JsonKey(readValue: _readAcct) required this.acct, this.renoteDisplay = true}) : super._(); @@ -325,32 +337,37 @@ class _$_TabSetting extends _TabSetting { /// ノートの投稿のキャプチャをするかどうか @override @JsonKey() - final dynamic isSubscribe; + final bool isSubscribe; /// 返信を含むかどうか @override @JsonKey() - final dynamic isIncludeReplies; + final bool isIncludeReplies; /// ファイルのみにするかどうか @override @JsonKey() - final dynamic isMediaOnly; + final bool isMediaOnly; /// タブ名 @override final String name; /// アカウント情報 +// https://github.com/rrousselGit/freezed/issues/488 +// ignore: invalid_annotation_target @override - final Account account; + @JsonKey(readValue: _readAcct) + final Acct acct; + + /// Renoteを表示するかどうか @override @JsonKey() final bool renoteDisplay; @override String toString() { - return 'TabSetting(icon: $icon, tabType: $tabType, roleId: $roleId, channelId: $channelId, listId: $listId, antennaId: $antennaId, isSubscribe: $isSubscribe, isIncludeReplies: $isIncludeReplies, isMediaOnly: $isMediaOnly, name: $name, account: $account, renoteDisplay: $renoteDisplay)'; + return 'TabSetting(icon: $icon, tabType: $tabType, roleId: $roleId, channelId: $channelId, listId: $listId, antennaId: $antennaId, isSubscribe: $isSubscribe, isIncludeReplies: $isIncludeReplies, isMediaOnly: $isMediaOnly, name: $name, acct: $acct, renoteDisplay: $renoteDisplay)'; } @override @@ -366,14 +383,14 @@ class _$_TabSetting extends _TabSetting { (identical(other.listId, listId) || other.listId == listId) && (identical(other.antennaId, antennaId) || other.antennaId == antennaId) && - const DeepCollectionEquality() - .equals(other.isSubscribe, isSubscribe) && - const DeepCollectionEquality() - .equals(other.isIncludeReplies, isIncludeReplies) && - const DeepCollectionEquality() - .equals(other.isMediaOnly, isMediaOnly) && + (identical(other.isSubscribe, isSubscribe) || + other.isSubscribe == isSubscribe) && + (identical(other.isIncludeReplies, isIncludeReplies) || + other.isIncludeReplies == isIncludeReplies) && + (identical(other.isMediaOnly, isMediaOnly) || + other.isMediaOnly == isMediaOnly) && (identical(other.name, name) || other.name == name) && - (identical(other.account, account) || other.account == account) && + (identical(other.acct, acct) || other.acct == acct) && (identical(other.renoteDisplay, renoteDisplay) || other.renoteDisplay == renoteDisplay)); } @@ -388,11 +405,11 @@ class _$_TabSetting extends _TabSetting { channelId, listId, antennaId, - const DeepCollectionEquality().hash(isSubscribe), - const DeepCollectionEquality().hash(isIncludeReplies), - const DeepCollectionEquality().hash(isMediaOnly), + isSubscribe, + isIncludeReplies, + isMediaOnly, name, - account, + acct, renoteDisplay); @JsonKey(ignore: true) @@ -417,11 +434,11 @@ abstract class _TabSetting extends TabSetting { final String? channelId, final String? listId, final String? antennaId, - final dynamic isSubscribe, - final dynamic isIncludeReplies, - final dynamic isMediaOnly, + final bool isSubscribe, + final bool isIncludeReplies, + final bool isMediaOnly, required final String name, - required final Account account, + @JsonKey(readValue: _readAcct) required final Acct acct, final bool renoteDisplay}) = _$_TabSetting; const _TabSetting._() : super._(); @@ -454,15 +471,15 @@ abstract class _TabSetting extends TabSetting { @override /// ノートの投稿のキャプチャをするかどうか - dynamic get isSubscribe; + bool get isSubscribe; @override /// 返信を含むかどうか - dynamic get isIncludeReplies; + bool get isIncludeReplies; @override /// ファイルのみにするかどうか - dynamic get isMediaOnly; + bool get isMediaOnly; @override /// タブ名 @@ -470,8 +487,13 @@ abstract class _TabSetting extends TabSetting { @override /// アカウント情報 - Account get account; +// https://github.com/rrousselGit/freezed/issues/488 +// ignore: invalid_annotation_target + @JsonKey(readValue: _readAcct) + Acct get acct; @override + + /// Renoteを表示するかどうか bool get renoteDisplay; @override @JsonKey(ignore: true) diff --git a/lib/model/tab_setting.g.dart b/lib/model/tab_setting.g.dart index 57020b520..19f4293d2 100644 --- a/lib/model/tab_setting.g.dart +++ b/lib/model/tab_setting.g.dart @@ -14,11 +14,11 @@ _$_TabSetting _$$_TabSettingFromJson(Map json) => channelId: json['channelId'] as String?, listId: json['listId'] as String?, antennaId: json['antennaId'] as String?, - isSubscribe: json['isSubscribe'] ?? true, - isIncludeReplies: json['isIncludeReplies'] ?? true, - isMediaOnly: json['isMediaOnly'] ?? false, + isSubscribe: json['isSubscribe'] as bool? ?? true, + isIncludeReplies: json['isIncludeReplies'] as bool? ?? true, + isMediaOnly: json['isMediaOnly'] as bool? ?? false, name: json['name'] as String, - account: Account.fromJson(json['account'] as Map), + acct: Acct.fromJson(_readAcct(json, 'acct') as Map), renoteDisplay: json['renoteDisplay'] as bool? ?? true, ); @@ -34,7 +34,7 @@ Map _$$_TabSettingToJson(_$_TabSetting instance) => 'isIncludeReplies': instance.isIncludeReplies, 'isMediaOnly': instance.isMediaOnly, 'name': instance.name, - 'account': instance.account.toJson(), + 'acct': instance.acct.toJson(), 'renoteDisplay': instance.renoteDisplay, }; diff --git a/lib/providers.dart b/lib/providers.dart index 368dec969..a69c84594 100644 --- a/lib/providers.dart +++ b/lib/providers.dart @@ -3,6 +3,7 @@ import 'package:file/file.dart'; import 'package:file/local.dart'; import 'package:flutter/widgets.dart'; import 'package:miria/model/account.dart'; +import 'package:miria/model/acct.dart'; import 'package:miria/model/tab_setting.dart'; import 'package:miria/repository/account_repository.dart'; import 'package:miria/repository/account_settings_repository.dart'; @@ -30,117 +31,145 @@ 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( - (ref, tabSetting) => LocalTimeLineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return LocalTimeLineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); + final homeTimeLineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => HomeTimeLineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return HomeTimeLineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); + final globalTimeLineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => GlobalTimeLineRepository( - ref.read(misskeyProvider(tabSetting.account)), - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return GlobalTimeLineRepository( + ref.read(misskeyProvider(account)), + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ); +}); final hybridTimeLineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => HybridTimelineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return HybridTimelineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); final roleTimelineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => RoleTimelineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return RoleTimelineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); final channelTimelineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => ChannelTimelineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return ChannelTimelineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); final userListTimelineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => UserListTimelineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return UserListTimelineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); final antennaTimelineProvider = ChangeNotifierProvider.family( - (ref, tabSetting) => AntennaTimelineRepository( - ref.read(misskeyProvider(tabSetting.account)), - tabSetting.account, - ref.read(notesProvider(tabSetting.account)), - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(generalSettingsRepositoryProvider), - tabSetting, - ref.read(mainStreamRepositoryProvider(tabSetting.account)), - ref.read(accountRepository), - ref.read(emojiRepositoryProvider(tabSetting.account)), - )); + (ref, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return AntennaTimelineRepository( + ref.read(misskeyProvider(account)), + account, + ref.read(notesProvider(account)), + ref.read(mainStreamRepositoryProvider(account)), + ref.read(generalSettingsRepositoryProvider), + tabSetting, + ref.read(mainStreamRepositoryProvider(account)), + ref.read(accountRepository), + ref.read(emojiRepositoryProvider(account)), + ); +}); final mainStreamRepositoryProvider = ChangeNotifierProvider.family( @@ -171,6 +200,18 @@ final accountRepository = ChangeNotifierProvider((ref) => AccountRepository( ref.read(tabSettingsRepositoryProvider), ref.read(accountSettingsRepositoryProvider), ref.read)); + +final accountProvider = Provider.family( + (ref, acct) => ref.watch( + accountRepository.select( + (repository) => repository.account.firstWhere( + (account) => + account.host == acct.host && account.userId == acct.username, + ), + ), + ), +); + final tabSettingsRepositoryProvider = ChangeNotifierProvider((ref) => TabSettingsRepository()); diff --git a/lib/repository/account_repository.dart b/lib/repository/account_repository.dart index 06a56d9e0..e7f430152 100644 --- a/lib/repository/account_repository.dart +++ b/lib/repository/account_repository.dart @@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/model/account.dart'; +import 'package:miria/model/acct.dart'; import 'package:miria/model/tab_icon.dart'; import 'package:miria/model/tab_setting.dart'; import 'package:miria/model/tab_type.dart'; @@ -54,13 +55,13 @@ class AccountRepository extends ChangeNotifier { } } - Future loadFromSourceIfNeed(Account account) async { - final index = _account.indexOf(account); + Future loadFromSourceIfNeed(Acct acct) async { + final index = + _account.map((account) => account.acct).toList().indexOf(acct); if (index == -1) return; if (accountDataValidated.isNotEmpty && accountDataValidated[index]) return; final i = await reader(misskeyProvider(_account[index])).i.i(); _account[index] = _account[index].copyWith(i: i); - tabSettingsRepository.updateAccount(account, i); accountDataValidated[index] = true; notifyListeners(); @@ -75,7 +76,6 @@ class AccountRepository extends ChangeNotifier { ]); _account[_account.indexOf(account)] = _account[_account.indexOf(account)].copyWith(i: i); - tabSettingsRepository.updateAccount(account, i); notifyListeners(); } @@ -84,7 +84,6 @@ class AccountRepository extends ChangeNotifier { _account[_account.indexOf(account)].i.copyWith(unreadAnnouncements: []); _account[_account.indexOf(account)] = _account[_account.indexOf(account)].copyWith(i: i); - tabSettingsRepository.updateAccount(account, i); notifyListeners(); } @@ -94,20 +93,23 @@ class AccountRepository extends ChangeNotifier { final account = _account.first; await tabSettingsRepository.save([ TabSetting( - icon: TabIcon(codePoint: Icons.home.codePoint), - tabType: TabType.homeTimeline, - name: "ホームタイムライン", - account: account), + icon: TabIcon(codePoint: Icons.home.codePoint), + tabType: TabType.homeTimeline, + name: "ホームタイムライン", + acct: account.acct, + ), TabSetting( - icon: TabIcon(codePoint: Icons.public.codePoint), - tabType: TabType.localTimeline, - name: "ローカルタイムライン", - account: account), + icon: TabIcon(codePoint: Icons.public.codePoint), + tabType: TabType.localTimeline, + name: "ローカルタイムライン", + acct: account.acct, + ), TabSetting( - icon: TabIcon(codePoint: Icons.rocket_launch.codePoint), - tabType: TabType.globalTimeline, - name: "グローバルタイムライン", - account: account), + icon: TabIcon(codePoint: Icons.rocket_launch.codePoint), + tabType: TabType.globalTimeline, + name: "グローバルタイムライン", + acct: account.acct, + ), ]); } } diff --git a/lib/repository/account_settings_repository.dart b/lib/repository/account_settings_repository.dart index 6a68b3b75..ec0649367 100644 --- a/lib/repository/account_settings_repository.dart +++ b/lib/repository/account_settings_repository.dart @@ -4,6 +4,7 @@ import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:miria/model/account.dart'; import 'package:miria/model/account_settings.dart'; +import 'package:miria/model/acct.dart'; import 'package:shared_preferences/shared_preferences.dart'; class AccountSettingsRepository extends ChangeNotifier { @@ -28,8 +29,7 @@ class AccountSettingsRepository extends ChangeNotifier { Future save(AccountSettings settings) async { _accountSettings = _accountSettings - ..removeWhere((element) => - element.userId == settings.userId && element.host == settings.host) + ..removeWhere((oldSettings) => oldSettings.acct == settings.acct) ..add(settings) ..toList(); await _saveAsList(_accountSettings); @@ -43,19 +43,23 @@ class AccountSettingsRepository extends ChangeNotifier { } Future removeAccount(Account account) async { - _accountSettings.removeWhere((element) => - element.host == account.host && element.userId == account.userId); + _accountSettings + .removeWhere((accountSettings) => accountSettings.acct == account.acct); await _saveAsList(_accountSettings); notifyListeners(); } - AccountSettings fromAccount(Account account) { + AccountSettings fromAcct(Acct acct) { return _accountSettings.firstWhereOrNull( - (e) => e.host == account.host && e.userId == account.userId) ?? + (accountSettings) => accountSettings.acct == acct, + ) ?? AccountSettings( - userId: account.userId, - host: account.host, - reactions: [], + userId: acct.username, + host: acct.host, ); } + + AccountSettings fromAccount(Account account) { + return fromAcct(account.acct); + } } diff --git a/lib/repository/import_export_repository.dart b/lib/repository/import_export_repository.dart index b2891e688..321a0f9c2 100644 --- a/lib/repository/import_export_repository.dart +++ b/lib/repository/import_export_repository.dart @@ -7,9 +7,7 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/model/account.dart'; -import 'package:miria/model/account_settings.dart'; import 'package:miria/model/exported_setting.dart'; -import 'package:miria/model/general_settings.dart'; import 'package:miria/model/tab_setting.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; @@ -67,48 +65,33 @@ class ImportExportRepository extends ChangeNotifier { final json = jsonDecode(response.data); - final importedGeneralSettings = - GeneralSettings.fromJson(json["generalSettings"]); - final importedAccountSettings = (json["accountSettings"] as List) - .map((e) => AccountSettings.fromJson(e)); + final importedSettings = ExportedSetting.fromJson(json); // アカウント設定よみこみ final accounts = reader(accountRepository).account; - for (final accountSetting in importedAccountSettings) { + for (final accountSetting in importedSettings.accountSettings) { // この端末でログイン済みのアカウントであれば - if (accounts.any((element) => - element.host == accountSetting.host && - element.userId == accountSetting.userId)) { + if (accounts.any((account) => account.acct == accountSetting.acct)) { reader(accountSettingsRepositoryProvider).save(accountSetting); } } // 全般設定 - reader(generalSettingsRepositoryProvider).update(importedGeneralSettings); + reader(generalSettingsRepositoryProvider) + .update(importedSettings.generalSettings); // タブ設定 final tabSettings = []; - for (final tabSetting in json["tabSettings"]) { - final account = accounts.firstWhereOrNull( - (element) => - tabSetting["account"]["host"] == element.host && - tabSetting["account"]["userId"] == element.userId, - ); + for (final tabSetting in importedSettings.tabSettings) { + final account = accounts + .firstWhereOrNull((account) => tabSetting.acct == account.acct); if (account == null) { continue; } - // Unhandled Exception: type 'EqualUnmodifiableMapView' is not a subtype of type 'Map?' in type cast - // freezedがわるさしてそう - (tabSetting as Map) - ..remove("account") - ..addEntries( - [MapEntry("account", jsonDecode(jsonEncode(account.toJson())))], - ); - - tabSettings.add(TabSetting.fromJson(tabSetting)); + tabSettings.add(tabSetting); } reader(tabSettingsRepositoryProvider).save(tabSettings); @@ -167,13 +150,6 @@ class ImportExportRepository extends ChangeNotifier { reader(accountSettingsRepositoryProvider).accountSettings.toList(), ).toJson(); - // 外に漏れると困るので - for (final element in data["tabSettings"] as List) { - element["account"] - ..remove("token") - ..remove("i"); - } - await reader(misskeyProvider(account)).drive.files.createAsBinary( DriveFilesCreateRequest( folderId: folder?.id, diff --git a/lib/repository/socket_timeline_repository.dart b/lib/repository/socket_timeline_repository.dart index 48d60fd33..dd69ca97b 100644 --- a/lib/repository/socket_timeline_repository.dart +++ b/lib/repository/socket_timeline_repository.dart @@ -82,7 +82,7 @@ abstract class SocketTimelineRepository extends TimelineRepository { Future startTimeLine() async { try { await emojiRepository.loadFromSourceIfNeed(); - await accountRepository.loadFromSourceIfNeed(tabSetting.account); + await accountRepository.loadFromSourceIfNeed(tabSetting.acct); await mainStreamRepository.reconnect(); isLoading = false; error = null; diff --git a/lib/repository/tab_settings_repository.dart b/lib/repository/tab_settings_repository.dart index 5d36405c7..5dea90847 100644 --- a/lib/repository/tab_settings_repository.dart +++ b/lib/repository/tab_settings_repository.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:miria/model/account.dart'; import 'package:miria/model/tab_setting.dart'; -import 'package:misskey_dart/misskey_dart.dart'; import 'package:shared_preferences/shared_preferences.dart'; class TabSettingsRepository extends ChangeNotifier { @@ -29,16 +28,6 @@ class TabSettingsRepository extends ChangeNotifier { } } - void updateAccount(Account account, IResponse response) { - for (var i = 0; i < _tabSettings.length; i++) { - if (_tabSettings[i].account == account) { - _tabSettings[i] = _tabSettings[i] - .copyWith(account: _tabSettings[i].account.copyWith(i: response)); - } - } - notifyListeners(); - } - Future save(List tabSettings) async { _tabSettings = tabSettings.toList(); final prefs = await SharedPreferences.getInstance(); @@ -48,9 +37,7 @@ class TabSettingsRepository extends ChangeNotifier { } Future removeAccount(Account account) async { - _tabSettings.removeWhere((element) => - element.account.host == account.host && - element.account.userId == account.userId); + _tabSettings.removeWhere((tabSetting) => tabSetting.acct == account.acct); await save(_tabSettings); notifyListeners(); } diff --git a/lib/router/app_router.gr.dart b/lib/router/app_router.gr.dart index 51676ec6d..cc41f0e75 100644 --- a/lib/router/app_router.gr.dart +++ b/lib/router/app_router.gr.dart @@ -15,13 +15,23 @@ abstract class _$AppRouter extends RootStackRouter { @override final Map 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,227 +88,241 @@ 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, ), ); }, - HardMuteRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( + PhotoEditRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( routeData: routeData, - child: HardMutePage( - key: args.key, + child: PhotoEditPage( account: args.account, + file: args.file, + onSubmit: args.onSubmit, + key: args.key, ), ); }, - ReactionDeckRoute.name: (routeData) { - final args = routeData.argsAs(); + SearchRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ReactionDeckPage( + child: SearchPage( key: args.key, + initialSearchText: args.initialSearchText, account: args.account, ), ); }, - UsersListTimelineRoute.name: (routeData) { - final args = routeData.argsAs(); + AccountListRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: UsersListTimelinePage( - args.account, - args.list, - key: args.key, - ), + child: const AccountListPage(), ); }, - UsersListRoute.name: (routeData) { - final args = routeData.argsAs(); + AppInfoRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: UsersListPage( - args.account, - key: args.key, - ), + child: const AppInfoPage(), ); }, - UsersListDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + GeneralSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: UsersListDetailPage( + 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, - account: args.account, - listId: args.listId, + tabIndex: args.tabIndex, ), ); }, - ChannelDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + HardMuteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ChannelDetailPage( + child: HardMutePage( key: args.key, account: args.account, - channelId: args.channelId, ), ); }, - ChannelsRoute.name: (routeData) { - final args = routeData.argsAs(); + InstanceMuteRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ChannelsPage( + child: InstanceMutePage( key: args.key, account: args.account, ), ); }, - FederationRoute.name: (routeData) { - final args = routeData.argsAs(); + ReactionDeckRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: FederationPage( + child: ReactionDeckPage( key: args.key, account: args.account, - host: args.host, ), ); }, - NoteDetailRoute.name: (routeData) { - final args = routeData.argsAs(); + SeveralAccountGeneralSettingsRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: NoteDetailPage( + child: SeveralAccountGeneralSettingsPage( key: args.key, - note: args.note, account: args.account, ), ); }, - SearchRoute.name: (routeData) { - final args = routeData.argsAs(); + SeveralAccountSettingsRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: SearchPage( + child: SeveralAccountSettingsPage( key: args.key, - initialSearchText: args.initialSearchText, account: args.account, ), ); @@ -321,102 +339,84 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - ImportExportRoute.name: (routeData) { + SplashRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const ImportExportPage(), + child: const SplashPage(), ); }, - GeneralSettingsRoute.name: (routeData) { + TimeLineRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: const GeneralSettingsPage(), + child: TimeLinePage( + key: args.key, + initialTabSetting: args.initialTabSetting, + ), ); }, - TabSettingsRoute.name: (routeData) { - final args = routeData.argsAs( - orElse: () => const TabSettingsRouteArgs()); + UsersListDetailRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: TabSettingsPage( + child: UsersListDetailPage( key: args.key, - tabIndex: args.tabIndex, + account: args.account, + listId: args.listId, ), ); }, - TabSettingsListRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const TabSettingsListPage(), - ); - }, - AppInfoRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AppInfoPage(), - ); - }, - SettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const SettingsPage(), - ); - }, - AccountListRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AccountListPage(), - ); - }, - ExploreRoleUsersRoute.name: (routeData) { - final args = routeData.argsAs(); + UsersListRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ExploreRoleUsersPage( + child: UsersListPage( + args.account, key: args.key, - item: args.item, - account: args.account, ), ); }, - ExploreRoute.name: (routeData) { - final args = routeData.argsAs(); + UsersListTimelineRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ExplorePage( + child: UsersListTimelinePage( + args.account, + args.list, key: args.key, - account: args.account, ), ); }, - TimeLineRoute.name: (routeData) { - final args = routeData.argsAs(); + UserFolloweeRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: TimeLinePage( + child: UserFolloweePage( key: args.key, - initialTabSetting: args.initialTabSetting, + userId: args.userId, + account: args.account, ), ); }, - FavoritedNoteRoute.name: (routeData) { - final args = routeData.argsAs(); + UserFollowerRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: FavoritedNotePage( + child: UserFollowerPage( key: args.key, + userId: args.userId, account: args.account, ), ); }, - MisskeyRouteRoute.name: (routeData) { - final args = routeData.argsAs(); + UserRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: MisskeyPagePage( + child: UserPage( key: args.key, + userId: args.userId, account: args.account, - page: args.page, ), ); }, @@ -424,45 +424,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}'; } } @@ -505,100 +543,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 { @@ -681,527 +705,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, - Key? key, - List? children, - }) : super( - PhotoEditRoute.name, - args: PhotoEditRouteArgs( - account: account, - file: file, - onSubmit: onSubmit, - key: key, - ), +/// [LoginPage] +class LoginRoute extends PageRouteInfo { + const LoginRoute({List? children}) + : super( + LoginRoute.name, initialChildren: children, ); - static const String name = 'PhotoEditRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class PhotoEditRouteArgs { - const PhotoEditRouteArgs({ - required this.account, - required this.file, - required this.onSubmit, - this.key, - }); - - final Account account; - - final MisskeyPostFile file; - - final void Function(Uint8List) onSubmit; - - final Key? key; + static const String name = 'LoginRoute'; - @override - String toString() { - return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; - } + static const PageInfo page = PageInfo(name); } /// generated route for -/// [AnnouncementPage] -class AnnouncementRoute extends PageRouteInfo { - AnnouncementRoute({ +/// [MisskeyPagePage] +class MisskeyRouteRoute extends PageRouteInfo { + MisskeyRouteRoute({ Key? key, required Account account, + required Page page, List? children, }) : super( - AnnouncementRoute.name, - args: AnnouncementRouteArgs( + MisskeyRouteRoute.name, + args: MisskeyRouteRouteArgs( key: key, account: account, + page: page, ), initialChildren: children, ); - static const String name = 'AnnouncementRoute'; + static const String name = 'MisskeyRouteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class AnnouncementRouteArgs { - const AnnouncementRouteArgs({ +class MisskeyRouteRouteArgs { + const MisskeyRouteRouteArgs({ this.key, required this.account, + required this.page, }); final Key? key; final Account account; + final Page page; + @override String toString() { - return 'AnnouncementRouteArgs{key: $key, account: $account}'; + return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}'; } } /// generated route for -/// [SplashPage] -class SplashRoute extends PageRouteInfo { - 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({ +/// [NotesAfterRenotePage] +class NotesAfterRenoteRoute extends PageRouteInfo { + NotesAfterRenoteRoute({ Key? key, + required Note note, required Account account, List? children, }) : super( - SeveralAccountGeneralSettingsRoute.name, - args: SeveralAccountGeneralSettingsRouteArgs( + NotesAfterRenoteRoute.name, + args: NotesAfterRenoteRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'SeveralAccountGeneralSettingsRoute'; + static const String name = 'NotesAfterRenoteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SeveralAccountGeneralSettingsRouteArgs { - const SeveralAccountGeneralSettingsRouteArgs({ +class NotesAfterRenoteRouteArgs { + const NotesAfterRenoteRouteArgs({ this.key, + required this.note, required this.account, }); final Key? key; + final Note note; + final Account account; @override String toString() { - return 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}'; + return 'NotesAfterRenoteRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [SeveralAccountSettingsPage] -class SeveralAccountSettingsRoute - extends PageRouteInfo { - SeveralAccountSettingsRoute({ +/// [NoteCreatePage] +class NoteCreateRoute extends PageRouteInfo { + NoteCreateRoute({ Key? key, - required Account account, + required Account initialAccount, + String? initialText, + List? initialMediaFiles, + CommunityChannel? channel, + Note? reply, + Note? renote, + Note? note, + NoteCreationMode? noteCreationMode, List? children, }) : super( - SeveralAccountSettingsRoute.name, - args: SeveralAccountSettingsRouteArgs( + NoteCreateRoute.name, + args: NoteCreateRouteArgs( key: key, - account: account, + initialAccount: initialAccount, + initialText: initialText, + initialMediaFiles: initialMediaFiles, + channel: channel, + reply: reply, + renote: renote, + note: note, + noteCreationMode: noteCreationMode, ), initialChildren: children, ); - static const String name = 'SeveralAccountSettingsRoute'; + static const String name = 'NoteCreateRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SeveralAccountSettingsRouteArgs { - const SeveralAccountSettingsRouteArgs({ +class NoteCreateRouteArgs { + const NoteCreateRouteArgs({ this.key, - required this.account, + required this.initialAccount, + this.initialText, + this.initialMediaFiles, + this.channel, + this.reply, + this.renote, + this.note, + this.noteCreationMode, }); final Key? key; - final Account account; + final Account initialAccount; - @override - String toString() { - return 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; - } -} + final String? initialText; -/// generated route for -/// [InstanceMutePage] -class InstanceMuteRoute extends PageRouteInfo { - InstanceMuteRoute({ - Key? key, - required Account account, - List? children, - }) : super( - InstanceMuteRoute.name, - args: InstanceMuteRouteArgs( - key: key, - account: account, - ), - initialChildren: children, - ); + final List? initialMediaFiles; - static const String name = 'InstanceMuteRoute'; + final CommunityChannel? channel; - static const PageInfo page = - PageInfo(name); -} + final Note? reply; -class InstanceMuteRouteArgs { - const InstanceMuteRouteArgs({ - this.key, - required this.account, - }); + final Note? renote; - final Key? key; + final Note? note; - final Account account; + final NoteCreationMode? noteCreationMode; @override String toString() { - return 'InstanceMuteRouteArgs{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 -/// [HardMutePage] -class HardMuteRoute extends PageRouteInfo { - HardMuteRoute({ +/// [NoteDetailPage] +class NoteDetailRoute extends PageRouteInfo { + NoteDetailRoute({ Key? key, + required Note note, required Account account, List? children, }) : super( - HardMuteRoute.name, - args: HardMuteRouteArgs( + NoteDetailRoute.name, + args: NoteDetailRouteArgs( key: key, + note: note, account: account, ), initialChildren: children, ); - static const String name = 'HardMuteRoute'; + static const String name = 'NoteDetailRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class HardMuteRouteArgs { - const HardMuteRouteArgs({ +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 'HardMuteRouteArgs{key: $key, account: $account}'; + return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}'; } } /// generated route for -/// [ReactionDeckPage] -class ReactionDeckRoute extends PageRouteInfo { - ReactionDeckRoute({ +/// [NotificationPage] +class NotificationRoute extends PageRouteInfo { + NotificationRoute({ Key? key, required Account account, List? children, }) : super( - ReactionDeckRoute.name, - args: ReactionDeckRouteArgs( + NotificationRoute.name, + args: NotificationRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'ReactionDeckRoute'; + static const String name = 'NotificationRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ReactionDeckRouteArgs { - const ReactionDeckRouteArgs({ +class NotificationRouteArgs { + const NotificationRouteArgs({ this.key, required this.account, }); @@ -1212,201 +1159,284 @@ class ReactionDeckRouteArgs { @override String toString() { - return 'ReactionDeckRouteArgs{key: $key, account: $account}'; + return 'NotificationRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [UsersListTimelinePage] -class UsersListTimelineRoute extends PageRouteInfo { - UsersListTimelineRoute({ +/// [PhotoEditPage] +class PhotoEditRoute extends PageRouteInfo { + PhotoEditRoute({ required Account account, - required UsersList list, + required MisskeyPostFile file, + required void Function(Uint8List) onSubmit, Key? key, List? children, }) : super( - UsersListTimelineRoute.name, - args: UsersListTimelineRouteArgs( + PhotoEditRoute.name, + args: PhotoEditRouteArgs( account: account, - list: list, + file: file, + onSubmit: onSubmit, key: key, ), initialChildren: children, ); - static const String name = 'UsersListTimelineRoute'; + static const String name = 'PhotoEditRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class UsersListTimelineRouteArgs { - const UsersListTimelineRouteArgs({ +class PhotoEditRouteArgs { + const PhotoEditRouteArgs({ required this.account, - required this.list, + required this.file, + required this.onSubmit, this.key, }); final Account account; - final UsersList list; + final MisskeyPostFile file; + + final void Function(Uint8List) onSubmit; final Key? key; @override String toString() { - return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}'; + return 'PhotoEditRouteArgs{account: $account, file: $file, onSubmit: $onSubmit, key: $key}'; } } /// generated route for -/// [UsersListPage] -class UsersListRoute extends PageRouteInfo { - UsersListRoute({ - required Account account, +/// [SearchPage] +class SearchRoute extends PageRouteInfo { + SearchRoute({ Key? key, + String? initialSearchText, + required Account account, List? children, }) : super( - UsersListRoute.name, - args: UsersListRouteArgs( - account: account, + SearchRoute.name, + args: SearchRouteArgs( key: key, + initialSearchText: initialSearchText, + account: account, ), initialChildren: children, ); - static const String name = 'UsersListRoute'; + static const String name = 'SearchRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class UsersListRouteArgs { - const UsersListRouteArgs({ - required this.account, +class SearchRouteArgs { + const SearchRouteArgs({ this.key, + this.initialSearchText, + required this.account, }); - final Account account; - final Key? key; + final String? initialSearchText; + + final Account account; + @override String toString() { - return 'UsersListRouteArgs{account: $account, key: $key}'; + return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; } } /// generated route for -/// [UsersListDetailPage] -class UsersListDetailRoute extends PageRouteInfo { - UsersListDetailRoute({ +/// [AccountListPage] +class AccountListRoute extends PageRouteInfo { + const AccountListRoute({List? children}) + : super( + AccountListRoute.name, + initialChildren: children, + ); + + static const String name = 'AccountListRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AppInfoPage] +class AppInfoRoute extends PageRouteInfo { + const AppInfoRoute({List? children}) + : super( + AppInfoRoute.name, + initialChildren: children, + ); + + static const String name = 'AppInfoRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [GeneralSettingsPage] +class GeneralSettingsRoute extends PageRouteInfo { + const GeneralSettingsRoute({List? children}) + : super( + GeneralSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'GeneralSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// 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 +/// [SettingsPage] +class SettingsRoute extends PageRouteInfo { + const SettingsRoute({List? children}) + : super( + SettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'SettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [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, - required Account account, - required String listId, + int? tabIndex, List? children, }) : super( - UsersListDetailRoute.name, - args: UsersListDetailRouteArgs( + TabSettingsRoute.name, + args: TabSettingsRouteArgs( key: key, - account: account, - listId: listId, + tabIndex: tabIndex, ), initialChildren: children, ); - static const String name = 'UsersListDetailRoute'; + static const String name = 'TabSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class UsersListDetailRouteArgs { - const UsersListDetailRouteArgs({ +class TabSettingsRouteArgs { + const TabSettingsRouteArgs({ this.key, - required this.account, - required this.listId, + this.tabIndex, }); final Key? key; - final Account account; - - final String listId; + final int? tabIndex; @override String toString() { - return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}'; + return 'TabSettingsRouteArgs{key: $key, tabIndex: $tabIndex}'; } } /// generated route for -/// [ChannelDetailPage] -class ChannelDetailRoute extends PageRouteInfo { - ChannelDetailRoute({ +/// [HardMutePage] +class HardMuteRoute extends PageRouteInfo { + HardMuteRoute({ Key? key, required Account account, - required String channelId, List? children, }) : super( - ChannelDetailRoute.name, - args: ChannelDetailRouteArgs( + HardMuteRoute.name, + args: HardMuteRouteArgs( key: key, account: account, - channelId: channelId, ), initialChildren: children, ); - static const String name = 'ChannelDetailRoute'; + static const String name = 'HardMuteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ChannelDetailRouteArgs { - const ChannelDetailRouteArgs({ +class HardMuteRouteArgs { + const HardMuteRouteArgs({ this.key, required this.account, - required this.channelId, }); final Key? key; final Account account; - final String channelId; - @override String toString() { - return 'ChannelDetailRouteArgs{key: $key, account: $account, channelId: $channelId}'; + return 'HardMuteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [ChannelsPage] -class ChannelsRoute extends PageRouteInfo { - ChannelsRoute({ +/// [InstanceMutePage] +class InstanceMuteRoute extends PageRouteInfo { + InstanceMuteRoute({ Key? key, required Account account, List? children, }) : super( - ChannelsRoute.name, - args: ChannelsRouteArgs( + InstanceMuteRoute.name, + args: InstanceMuteRouteArgs( key: key, account: account, ), initialChildren: children, ); - static const String name = 'ChannelsRoute'; + static const String name = 'InstanceMuteRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ChannelsRouteArgs { - const ChannelsRouteArgs({ +class InstanceMuteRouteArgs { + const InstanceMuteRouteArgs({ this.key, required this.account, }); @@ -1417,135 +1447,123 @@ class ChannelsRouteArgs { @override String toString() { - return 'ChannelsRouteArgs{key: $key, account: $account}'; + return 'InstanceMuteRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [FederationPage] -class FederationRoute extends PageRouteInfo { - FederationRoute({ +/// [ReactionDeckPage] +class ReactionDeckRoute extends PageRouteInfo { + ReactionDeckRoute({ Key? key, required Account account, - required String host, List? children, }) : super( - FederationRoute.name, - args: FederationRouteArgs( + ReactionDeckRoute.name, + args: ReactionDeckRouteArgs( key: key, account: account, - host: host, ), initialChildren: children, ); - static const String name = 'FederationRoute'; + static const String name = 'ReactionDeckRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class FederationRouteArgs { - const FederationRouteArgs({ +class ReactionDeckRouteArgs { + const ReactionDeckRouteArgs({ this.key, required this.account, - required this.host, }); final Key? key; final Account account; - final String host; - @override String toString() { - return 'FederationRouteArgs{key: $key, account: $account, host: $host}'; + return 'ReactionDeckRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [NoteDetailPage] -class NoteDetailRoute extends PageRouteInfo { - NoteDetailRoute({ +/// [SeveralAccountGeneralSettingsPage] +class SeveralAccountGeneralSettingsRoute + extends PageRouteInfo { + SeveralAccountGeneralSettingsRoute({ Key? key, - required Note note, required Account account, List? children, }) : super( - NoteDetailRoute.name, - args: NoteDetailRouteArgs( + SeveralAccountGeneralSettingsRoute.name, + args: SeveralAccountGeneralSettingsRouteArgs( key: key, - note: note, account: account, ), initialChildren: children, ); - static const String name = 'NoteDetailRoute'; + static const String name = 'SeveralAccountGeneralSettingsRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class NoteDetailRouteArgs { - const NoteDetailRouteArgs({ +class SeveralAccountGeneralSettingsRouteArgs { + const SeveralAccountGeneralSettingsRouteArgs({ this.key, - required this.note, required this.account, }); final Key? key; - final Note note; - final Account account; @override String toString() { - return 'NoteDetailRouteArgs{key: $key, note: $note, account: $account}'; + return 'SeveralAccountGeneralSettingsRouteArgs{key: $key, account: $account}'; } } /// generated route for -/// [SearchPage] -class SearchRoute extends PageRouteInfo { - SearchRoute({ +/// [SeveralAccountSettingsPage] +class SeveralAccountSettingsRoute + extends PageRouteInfo { + SeveralAccountSettingsRoute({ Key? key, - String? initialSearchText, required Account account, List? children, }) : super( - SearchRoute.name, - args: SearchRouteArgs( + SeveralAccountSettingsRoute.name, + args: SeveralAccountSettingsRouteArgs( key: key, - initialSearchText: initialSearchText, account: account, ), initialChildren: children, ); - static const String name = 'SearchRoute'; + static const String name = 'SeveralAccountSettingsRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class SearchRouteArgs { - const SearchRouteArgs({ +class SeveralAccountSettingsRouteArgs { + const SeveralAccountSettingsRouteArgs({ this.key, - this.initialSearchText, required this.account, }); final Key? key; - final String? initialSearchText; - final Account account; @override String toString() { - return 'SearchRouteArgs{key: $key, initialSearchText: $initialSearchText, account: $account}'; + return 'SeveralAccountSettingsRouteArgs{key: $key, account: $account}'; } } @@ -1594,323 +1612,305 @@ class SharingAccountSelectRouteArgs { } /// generated route for -/// [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, - initialChildren: children, - ); - - static const String name = 'TabSettingsListRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [AppInfoPage] -class AppInfoRoute extends PageRouteInfo { - const AppInfoRoute({List? children}) - : super( - AppInfoRoute.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 = 'AppInfoRoute'; + static const String name = 'UsersListDetailRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); } -/// generated route for -/// [SettingsPage] -class SettingsRoute extends PageRouteInfo { - const SettingsRoute({List? children}) - : super( - SettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'SettingsRoute'; +class UsersListDetailRouteArgs { + const UsersListDetailRouteArgs({ + this.key, + required this.account, + required this.listId, + }); - static const PageInfo page = PageInfo(name); -} + final Key? key; -/// generated route for -/// [AccountListPage] -class AccountListRoute extends PageRouteInfo { - const AccountListRoute({List? children}) - : super( - AccountListRoute.name, - initialChildren: children, - ); + final Account account; - static const String name = 'AccountListRoute'; + final String listId; - static const PageInfo page = PageInfo(name); + @override + String toString() { + return 'UsersListDetailRouteArgs{key: $key, account: $account, listId: $listId}'; + } } /// generated route for -/// [ExploreRoleUsersPage] -class ExploreRoleUsersRoute extends PageRouteInfo { - ExploreRoleUsersRoute({ - Key? key, - required RolesListResponse item, +/// [UsersListPage] +class UsersListRoute extends PageRouteInfo { + UsersListRoute({ required Account account, + Key? key, List? children, }) : super( - ExploreRoleUsersRoute.name, - args: ExploreRoleUsersRouteArgs( - key: key, - item: item, + UsersListRoute.name, + args: UsersListRouteArgs( account: account, + key: key, ), initialChildren: children, ); - static const String name = 'ExploreRoleUsersRoute'; + static const String name = 'UsersListRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ExploreRoleUsersRouteArgs { - const ExploreRoleUsersRouteArgs({ - this.key, - required this.item, +class UsersListRouteArgs { + const UsersListRouteArgs({ required this.account, + this.key, }); - final Key? key; - - final RolesListResponse item; - final Account account; + final Key? key; + @override String toString() { - return 'ExploreRoleUsersRouteArgs{key: $key, item: $item, account: $account}'; + return 'UsersListRouteArgs{account: $account, key: $key}'; } } /// generated route for -/// [ExplorePage] -class ExploreRoute extends PageRouteInfo { - ExploreRoute({ - Key? key, +/// [UsersListTimelinePage] +class UsersListTimelineRoute extends PageRouteInfo { + UsersListTimelineRoute({ required Account account, + required UsersList list, + Key? key, List? children, }) : super( - ExploreRoute.name, - args: ExploreRouteArgs( - key: key, + UsersListTimelineRoute.name, + args: UsersListTimelineRouteArgs( account: account, + list: list, + key: key, ), initialChildren: children, ); - static const String name = 'ExploreRoute'; + static const String name = 'UsersListTimelineRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ExploreRouteArgs { - const ExploreRouteArgs({ - this.key, +class UsersListTimelineRouteArgs { + const UsersListTimelineRouteArgs({ required this.account, + required this.list, + this.key, }); - final Key? key; - final Account account; + final UsersList list; + + final Key? key; + @override String toString() { - return 'ExploreRouteArgs{key: $key, account: $account}'; + return 'UsersListTimelineRouteArgs{account: $account, list: $list, key: $key}'; } } /// generated route for -/// [TimeLinePage] -class TimeLineRoute extends PageRouteInfo { - TimeLineRoute({ +/// [UserFolloweePage] +class UserFolloweeRoute extends PageRouteInfo { + UserFolloweeRoute({ Key? key, - required TabSetting initialTabSetting, + required String userId, + required Account account, List? children, }) : super( - TimeLineRoute.name, - args: TimeLineRouteArgs( + UserFolloweeRoute.name, + args: UserFolloweeRouteArgs( key: key, - initialTabSetting: initialTabSetting, + userId: userId, + account: account, ), initialChildren: children, ); - static const String name = 'TimeLineRoute'; + static const String name = 'UserFolloweeRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class TimeLineRouteArgs { - const TimeLineRouteArgs({ +class UserFolloweeRouteArgs { + const UserFolloweeRouteArgs({ 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 'UserFolloweeRouteArgs{key: $key, userId: $userId, account: $account}'; } } /// generated route for -/// [FavoritedNotePage] -class FavoritedNoteRoute extends PageRouteInfo { - FavoritedNoteRoute({ +/// [UserFollowerPage] +class UserFollowerRoute extends PageRouteInfo { + UserFollowerRoute({ Key? key, + required String userId, required Account account, List? children, }) : super( - FavoritedNoteRoute.name, - args: FavoritedNoteRouteArgs( + UserFollowerRoute.name, + args: UserFollowerRouteArgs( key: key, + userId: userId, account: account, ), initialChildren: children, ); - static const String name = 'FavoritedNoteRoute'; + static const String name = 'UserFollowerRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class FavoritedNoteRouteArgs { - const FavoritedNoteRouteArgs({ +class UserFollowerRouteArgs { + const UserFollowerRouteArgs({ 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 'UserFollowerRouteArgs{key: $key, userId: $userId, account: $account}'; } } /// generated route for -/// [MisskeyPagePage] -class MisskeyRouteRoute extends PageRouteInfo { - MisskeyRouteRoute({ +/// [UserPage] +class UserRoute extends PageRouteInfo { + UserRoute({ Key? key, + required String userId, required Account account, - required Page page, List? children, }) : super( - MisskeyRouteRoute.name, - args: MisskeyRouteRouteArgs( + UserRoute.name, + args: UserRouteArgs( key: key, + userId: userId, account: account, - page: page, ), initialChildren: children, ); - static const String name = 'MisskeyRouteRoute'; + static const String name = 'UserRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class MisskeyRouteRouteArgs { - const MisskeyRouteRouteArgs({ +class UserRouteArgs { + const UserRouteArgs({ this.key, + required this.userId, required this.account, - required this.page, }); final Key? key; - final Account account; + final String userId; - final Page page; + final Account account; @override String toString() { - return 'MisskeyRouteRouteArgs{key: $key, account: $account, page: $page}'; + return 'UserRouteArgs{key: $key, userId: $userId, account: $account}'; } } diff --git a/lib/view/common/common_drawer.dart b/lib/view/common/common_drawer.dart index 8c4ff50de..d54982f4d 100644 --- a/lib/view/common/common_drawer.dart +++ b/lib/view/common/common_drawer.dart @@ -1,6 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; -import 'package:miria/model/account.dart'; +import 'package:miria/model/acct.dart'; import 'package:miria/providers.dart'; import 'package:miria/router/app_router.dart'; import 'package:miria/view/common/account_scope.dart'; @@ -9,9 +9,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/view/common/misskey_notes/mfm_text.dart'; class CommonDrawer extends ConsumerWidget { - final Account initialOpenAccount; + final Acct initialOpenAcct; - const CommonDrawer({super.key, required this.initialOpenAccount}); + const CommonDrawer({super.key, required this.initialOpenAcct}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -25,9 +25,7 @@ class CommonDrawer extends ConsumerWidget { account: account, child: ExpansionTile( leading: AvatarIcon.fromIResponse(account.i), - initiallyExpanded: - account.userId == initialOpenAccount.userId && - account.host == initialOpenAccount.host, + initiallyExpanded: account.acct == initialOpenAcct, title: SimpleMfmText(account.i.name ?? account.i.username, style: Theme.of(context).textTheme.titleMedium), subtitle: Text( diff --git a/lib/view/settings_page/tab_settings_page/tab_settings_list_page.dart b/lib/view/settings_page/tab_settings_page/tab_settings_list_page.dart index b78cef6b3..93467ba35 100644 --- a/lib/view/settings_page/tab_settings_page/tab_settings_list_page.dart +++ b/lib/view/settings_page/tab_settings_page/tab_settings_list_page.dart @@ -1,4 +1,3 @@ - import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:miria/model/tab_setting.dart'; @@ -46,14 +45,18 @@ class TabSettingsListPageState extends ConsumerState { Expanded( child: ReorderableListView.builder( itemBuilder: (context, index) { + final tabSetting = tabSettings[index]; + final account = ref.watch(accountProvider(tabSetting.acct)); return ListTile( key: Key("$index"), leading: AccountScope( - account: tabSettings[index].account, - child: TabIconView(icon: tabSettings[index].icon)), + account: account, + child: TabIconView(icon: tabSettings[index].icon), + ), title: Text(tabSettings[index].name), subtitle: Text( - "${tabSettings[index].tabType.displayName} / @${tabSettings[index].account.userId}@${tabSettings[index].account.host} "), + "${tabSetting.tabType.displayName} / ${account.acct}", + ), onTap: () => context.pushRoute(TabSettingsRoute(tabIndex: index)), ); diff --git a/lib/view/settings_page/tab_settings_page/tab_settings_page.dart b/lib/view/settings_page/tab_settings_page/tab_settings_page.dart index eb68a31bc..f552de503 100644 --- a/lib/view/settings_page/tab_settings_page/tab_settings_page.dart +++ b/lib/view/settings_page/tab_settings_page/tab_settings_page.dart @@ -54,7 +54,7 @@ class TabSettingsAddDialogState extends ConsumerState { if (tab != null) { final tabSetting = ref.read(tabSettingsRepositoryProvider).tabSettings.toList()[tab]; - selectedAccount = tabSetting.account; + selectedAccount = ref.read(accountProvider(tabSetting.acct)); selectedTabType = tabSetting.tabType; final roleId = tabSetting.roleId; final channelId = tabSetting.channelId; @@ -69,7 +69,7 @@ class TabSettingsAddDialogState extends ConsumerState { if (roleId != null) { Future(() async { selectedRole = await ref - .read(misskeyProvider(tabSetting.account)) + .read(misskeyProvider(selectedAccount!)) .roles .show(RolesShowRequest(roleId: roleId)); setState(() {}); @@ -78,7 +78,7 @@ class TabSettingsAddDialogState extends ConsumerState { if (channelId != null) { Future(() async { selectedChannel = await ref - .read(misskeyProvider(tabSetting.account)) + .read(misskeyProvider(selectedAccount!)) .channels .show(ChannelsShowRequest(channelId: channelId)); setState(() {}); @@ -87,7 +87,7 @@ class TabSettingsAddDialogState extends ConsumerState { if (listId != null) { Future(() async { final response = await ref - .read(misskeyProvider(tabSetting.account)) + .read(misskeyProvider(selectedAccount!)) .users .list .show(UsersListsShowRequest(listId: listId)); @@ -98,7 +98,7 @@ class TabSettingsAddDialogState extends ConsumerState { if (antennaId != null) { Future(() async { selectedAntenna = await ref - .read(misskeyProvider(tabSetting.account)) + .read(misskeyProvider(selectedAccount!)) .antennas .show(AntennasShowRequest(antennaId: antennaId)); setState(() {}); @@ -381,7 +381,7 @@ class TabSettingsAddDialogState extends ConsumerState { icon: icon, tabType: tabType, name: nameController.text, - account: account, + acct: account.acct, roleId: selectedRole?.id, channelId: selectedChannel?.id, listId: selectedUserList?.id, diff --git a/lib/view/time_line_page/time_line_page.dart b/lib/view/time_line_page/time_line_page.dart index abf2ddfed..b88b8d289 100644 --- a/lib/view/time_line_page/time_line_page.dart +++ b/lib/view/time_line_page/time_line_page.dart @@ -70,11 +70,12 @@ class TimeLinePageState extends ConsumerState { try { final accountSettings = ref .read(accountSettingsRepositoryProvider) - .fromAccount(currentTabSetting.account); + .fromAcct(currentTabSetting.acct); ref.read(timelineNoteProvider).clear(); FocusManager.instance.primaryFocus?.unfocus(); - await ref.read(misskeyProvider(currentTabSetting.account)).notes.create( + final account = ref.read(accountProvider(currentTabSetting.acct)); + await ref.read(misskeyProvider(account)).notes.create( NotesCreateRequest( text: text, channelId: currentTabSetting.channelId, @@ -143,46 +144,49 @@ class TimeLinePageState extends ConsumerState { } final sendText = ref.read(timelineNoteProvider).text; ref.read(timelineNoteProvider).text = ""; + final account = ref.read(accountProvider(currentTabSetting.acct)); context.pushRoute(NoteCreateRoute( channel: channel, initialText: sendText, - initialAccount: currentTabSetting.account, + initialAccount: account, )); } Widget buildAppbar() { + final account = ref.watch(accountProvider(currentTabSetting.acct)); return AppBar( title: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( - children: tabSettings - .mapIndexed( - (index, tabSetting) => Ink( - color: tabSetting == currentTabSetting - ? AppTheme.of(context).currentDisplayTabColor - : Colors.transparent, - child: AccountScope( - account: tabSetting.account, - child: IconButton( - icon: TabIconView( - icon: tabSetting.icon, - color: tabSetting == currentTabSetting - ? Theme.of(context).primaryColor - : Colors.white, - ), - onPressed: () => tabSetting == currentTabSetting - ? reload() - : pageController.jumpToPage(index), + children: tabSettings.mapIndexed( + (index, tabSetting) { + final account = ref.watch(accountProvider(tabSetting.acct)); + return Ink( + color: tabSetting == currentTabSetting + ? AppTheme.of(context).currentDisplayTabColor + : Colors.transparent, + child: AccountScope( + account: account, + child: IconButton( + icon: TabIconView( + icon: tabSetting.icon, + color: tabSetting == currentTabSetting + ? Theme.of(context).primaryColor + : Colors.white, ), + onPressed: () => tabSetting == currentTabSetting + ? reload() + : pageController.jumpToPage(index), ), ), - ) - .toList(), + ); + }, + ).toList(), ), ), actions: [ AccountScope( - account: currentTabSetting.account, + account: account, child: const NotificationIcon(), ), ], @@ -201,6 +205,7 @@ class TimeLinePageState extends ConsumerState { tabSettings = ref.watch( tabSettingsRepositoryProvider.select((repo) => repo.tabSettings.toList()), ); + final account = ref.watch(accountProvider(currentTabSetting.acct)); return Scaffold( key: scaffoldKey, @@ -244,7 +249,7 @@ class TimeLinePageState extends ConsumerState { context: context, builder: (context) => ChannelDialog( channelId: currentTabSetting.channelId ?? "", - account: currentTabSetting.account, + account: account, ), ); }, @@ -256,7 +261,7 @@ class TimeLinePageState extends ConsumerState { onPressed: () { context.pushRoute( UsersListDetailRoute( - account: currentTabSetting.account, + account: account, listId: currentTabSetting.listId!, ), ); @@ -274,7 +279,7 @@ class TimeLinePageState extends ConsumerState { showDialog( context: context, builder: (context) => ServerDetailDialog( - account: currentTabSetting.account, + account: account, ), ); }, @@ -316,8 +321,9 @@ class TimeLinePageState extends ConsumerState { onPageChanged: (index) => changeTab(index), itemBuilder: (_, index) { final tabSetting = tabSettings[index]; + final account = ref.watch(accountProvider(tabSetting.acct)); return AccountScope( - account: tabSetting.account, + account: account, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -374,7 +380,7 @@ class TimeLinePageState extends ConsumerState { resizeToAvoidBottomInset: true, drawerEnableOpenDragGesture: true, drawer: CommonDrawer( - initialOpenAccount: currentTabSetting.account, + initialOpenAcct: currentTabSetting.acct, ), ); } @@ -387,22 +393,19 @@ class BannerArea extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final bannerAnnouncement = ref.watch(accountRepository.select((value) => - value.account - .where((element) => - element == - ref - .read(tabSettingsRepositoryProvider) - .tabSettings - .toList()[index] - .account) - .firstOrNull - ?.i - .unreadAnnouncements)); + final acct = ref.watch( + tabSettingsRepositoryProvider + .select((repository) => repository.tabSettings.toList()[index].acct), + ); + final bannerAnnouncement = ref.watch( + accountProvider(acct).select( + (account) => account.i.unreadAnnouncements, + ), + ); // ダイアログの実装が大変なので(状態管理とか)いったんバナーと一緒に扱う final bannerData = bannerAnnouncement - ?.where((element) => + .where((element) => element.display == AnnouncementDisplayType.banner || element.display == AnnouncementDisplayType.dialog) .lastOrNull; @@ -437,34 +440,25 @@ class AnnoucementInfo extends ConsumerWidget { const AnnoucementInfo({super.key, required this.index}); void announcementsRoute(BuildContext context, WidgetRef ref) { - final account = ref.read(accountRepository.select((value) => value.account - .where((element) => - element == - ref - .read(tabSettingsRepositoryProvider) - .tabSettings - .toList()[index] - .account) - .firstOrNull)); - if (account == null) return; + final acct = ref + .read(tabSettingsRepositoryProvider) + .tabSettings + .toList()[index] + .acct; + final account = ref.read(accountProvider(acct)); context.pushRoute(AnnouncementRoute(account: account)); } @override Widget build(BuildContext context, WidgetRef ref) { - final hasUnread = ref.watch(accountRepository.select((value) => value - .account - .where((element) => - element == - ref - .read(tabSettingsRepositoryProvider) - .tabSettings - .toList()[index] - .account) - .firstOrNull - ?.i - .unreadAnnouncements - .isNotEmpty)); + final acct = ref.watch( + tabSettingsRepositoryProvider + .select((repository) => repository.tabSettings.toList()[index].acct), + ); + final hasUnread = ref.watch( + accountProvider(acct) + .select((account) => account.i.unreadAnnouncements.isNotEmpty), + ); if (hasUnread == true) { return IconButton( diff --git a/test/test_util/mock.mocks.dart b/test/test_util/mock.mocks.dart index 8ae33d4dd..5e3178fa5 100644 --- a/test/test_util/mock.mocks.dart +++ b/test/test_util/mock.mocks.dart @@ -5,25 +5,26 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i18; import 'dart:io' as _i15; -import 'dart:typed_data' as _i25; +import 'dart:typed_data' as _i26; import 'dart:ui' as _i20; -import 'package:dio/dio.dart' as _i26; +import 'package:dio/dio.dart' as _i27; import 'package:dio/src/adapter.dart' as _i11; -import 'package:dio/src/cancel_token.dart' as _i27; +import 'package:dio/src/cancel_token.dart' as _i28; import 'package:dio/src/dio_mixin.dart' as _i13; import 'package:dio/src/options.dart' as _i10; import 'package:dio/src/response.dart' as _i14; import 'package:dio/src/transformer.dart' as _i12; -import 'package:file_picker/file_picker.dart' as _i29; +import 'package:file_picker/file_picker.dart' as _i30; import 'package:miria/model/account.dart' as _i19; import 'package:miria/model/account_settings.dart' as _i2; +import 'package:miria/model/acct.dart' as _i22; import 'package:miria/model/general_settings.dart' as _i3; -import 'package:miria/model/misskey_emoji_data.dart' as _i23; +import 'package:miria/model/misskey_emoji_data.dart' as _i24; import 'package:miria/model/tab_setting.dart' as _i17; import 'package:miria/repository/account_settings_repository.dart' as _i21; -import 'package:miria/repository/emoji_repository.dart' as _i22; -import 'package:miria/repository/general_settings_repository.dart' as _i24; +import 'package:miria/repository/emoji_repository.dart' as _i23; +import 'package:miria/repository/general_settings_repository.dart' as _i25; import 'package:miria/repository/tab_settings_repository.dart' as _i16; import 'package:misskey_dart/misskey_dart.dart' as _i6; import 'package:misskey_dart/src/data/ping_response.dart' as _i9; @@ -33,7 +34,7 @@ import 'package:misskey_dart/src/services/api_service.dart' as _i4; import 'package:misskey_dart/src/services/streaming_service.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'mock.dart' as _i28; +import 'mock.dart' as _i29; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -673,21 +674,6 @@ class MockTabSettingsRepository extends _i1.Mock returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - void updateAccount( - _i19.Account? account, - _i6.IResponse? response, - ) => - super.noSuchMethod( - Invocation.method( - #updateAccount, - [ - account, - response, - ], - ), - returnValueForMissingStub: null, - ); - @override _i18.Future save(List<_i17.TabSetting>? tabSettings) => (super.noSuchMethod( Invocation.method( @@ -785,6 +771,27 @@ class MockAccountSettingsRepository extends _i1.Mock returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override + _i2.AccountSettings fromAcct(_i22.Acct? acct) => (super.noSuchMethod( + Invocation.method( + #fromAcct, + [acct], + ), + returnValue: _FakeAccountSettings_0( + this, + Invocation.method( + #fromAcct, + [acct], + ), + ), + returnValueForMissingStub: _FakeAccountSettings_0( + this, + Invocation.method( + #fromAcct, + [acct], + ), + ), + ) as _i2.AccountSettings); + @override _i2.AccountSettings fromAccount(_i19.Account? account) => (super.noSuchMethod( Invocation.method( #fromAccount, @@ -842,9 +849,9 @@ class MockAccountSettingsRepository extends _i1.Mock /// A class which mocks [EmojiRepository]. /// /// See the documentation for Mockito's code generation for more information. -class MockEmojiRepository extends _i1.Mock implements _i22.EmojiRepository { +class MockEmojiRepository extends _i1.Mock implements _i23.EmojiRepository { @override - set emoji(List<_i22.EmojiRepositoryData>? _emoji) => super.noSuchMethod( + set emoji(List<_i23.EmojiRepositoryData>? _emoji) => super.noSuchMethod( Invocation.setter( #emoji, _emoji, @@ -879,7 +886,7 @@ class MockEmojiRepository extends _i1.Mock implements _i22.EmojiRepository { returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future> searchEmojis( + _i18.Future> searchEmojis( String? name, { int? limit = 30, }) => @@ -889,30 +896,30 @@ class MockEmojiRepository extends _i1.Mock implements _i22.EmojiRepository { [name], {#limit: limit}, ), - returnValue: _i18.Future>.value( - <_i23.MisskeyEmojiData>[]), + returnValue: _i18.Future>.value( + <_i24.MisskeyEmojiData>[]), returnValueForMissingStub: - _i18.Future>.value( - <_i23.MisskeyEmojiData>[]), - ) as _i18.Future>); + _i18.Future>.value( + <_i24.MisskeyEmojiData>[]), + ) as _i18.Future>); @override - List<_i23.MisskeyEmojiData> defaultEmojis({int? limit}) => + List<_i24.MisskeyEmojiData> defaultEmojis({int? limit}) => (super.noSuchMethod( Invocation.method( #defaultEmojis, [], {#limit: limit}, ), - returnValue: <_i23.MisskeyEmojiData>[], - returnValueForMissingStub: <_i23.MisskeyEmojiData>[], - ) as List<_i23.MisskeyEmojiData>); + returnValue: <_i24.MisskeyEmojiData>[], + returnValueForMissingStub: <_i24.MisskeyEmojiData>[], + ) as List<_i24.MisskeyEmojiData>); } /// A class which mocks [GeneralSettingsRepository]. /// /// See the documentation for Mockito's code generation for more information. class MockGeneralSettingsRepository extends _i1.Mock - implements _i24.GeneralSettingsRepository { + implements _i25.GeneralSettingsRepository { @override _i3.GeneralSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), @@ -2912,7 +2919,7 @@ class MockMisskeyDriveFiles extends _i1.Mock implements _i6.MisskeyDriveFiles { @override _i18.Future<_i6.DriveFile> createAsBinary( _i6.DriveFilesCreateRequest? request, - _i25.Uint8List? fileContent, + _i26.Uint8List? fileContent, ) => (super.noSuchMethod( Invocation.method( @@ -3989,7 +3996,7 @@ class MockMisskeyUsers extends _i1.Mock implements _i6.MisskeyUsers { /// A class which mocks [Dio]. /// /// See the documentation for Mockito's code generation for more information. -class MockDio extends _i1.Mock implements _i26.Dio { +class MockDio extends _i1.Mock implements _i27.Dio { @override _i10.BaseOptions get options => (super.noSuchMethod( Invocation.getter(#options), @@ -4078,7 +4085,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( @@ -4128,7 +4135,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onReceiveProgress, }) => (super.noSuchMethod( @@ -4176,7 +4183,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4230,7 +4237,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4282,7 +4289,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4336,7 +4343,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4388,7 +4395,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( @@ -4434,7 +4441,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( @@ -4478,7 +4485,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( @@ -4524,7 +4531,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, }) => (super.noSuchMethod( Invocation.method( @@ -4568,7 +4575,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Object? data, Map? queryParameters, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4622,7 +4629,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, { Object? data, _i10.Options? options, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, }) => @@ -4674,7 +4681,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { dynamic savePath, { _i10.ProgressCallback? onReceiveProgress, Map? queryParameters, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, bool? deleteOnError = true, String? lengthHeader = r'content-length', Object? data, @@ -4743,7 +4750,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { Uri? uri, dynamic savePath, { _i10.ProgressCallback? onReceiveProgress, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, bool? deleteOnError = true, String? lengthHeader = r'content-length', Object? data, @@ -4809,7 +4816,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { String? path, { Object? data, Map? queryParameters, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.Options? options, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, @@ -4863,7 +4870,7 @@ class MockDio extends _i1.Mock implements _i26.Dio { _i18.Future<_i14.Response> requestUri( Uri? uri, { Object? data, - _i27.CancelToken? cancelToken, + _i28.CancelToken? cancelToken, _i10.Options? options, _i10.ProgressCallback? onSendProgress, _i10.ProgressCallback? onReceiveProgress, @@ -5580,14 +5587,14 @@ class MockHttpClient extends _i1.Mock implements _i15.HttpClient { /// /// See the documentation for Mockito's code generation for more information. class MockFilePickerPlatform extends _i1.Mock - implements _i28.FakeFilePickerPlatform { + implements _i29.FakeFilePickerPlatform { @override - _i18.Future<_i29.FilePickerResult?> pickFiles({ + _i18.Future<_i30.FilePickerResult?> pickFiles({ String? dialogTitle, String? initialDirectory, - _i29.FileType? type = _i29.FileType.any, + _i30.FileType? type = _i30.FileType.any, List? allowedExtensions, - dynamic Function(_i29.FilePickerStatus)? onFileLoading, + dynamic Function(_i30.FilePickerStatus)? onFileLoading, bool? allowCompression = true, bool? allowMultiple = false, bool? withData = false, @@ -5611,9 +5618,9 @@ class MockFilePickerPlatform extends _i1.Mock #lockParentWindow: lockParentWindow, }, ), - returnValue: _i18.Future<_i29.FilePickerResult?>.value(), - returnValueForMissingStub: _i18.Future<_i29.FilePickerResult?>.value(), - ) as _i18.Future<_i29.FilePickerResult?>); + returnValue: _i18.Future<_i30.FilePickerResult?>.value(), + returnValueForMissingStub: _i18.Future<_i30.FilePickerResult?>.value(), + ) as _i18.Future<_i30.FilePickerResult?>); @override _i18.Future clearTemporaryFiles() => (super.noSuchMethod( Invocation.method( @@ -5647,7 +5654,7 @@ class MockFilePickerPlatform extends _i1.Mock String? dialogTitle, String? fileName, String? initialDirectory, - _i29.FileType? type = _i29.FileType.any, + _i30.FileType? type = _i30.FileType.any, List? allowedExtensions, bool? lockParentWindow = false, }) => From c3026d500e3e82f194aa4fee10c728983fa61442 Mon Sep 17 00:00:00 2001 From: sorairo Date: Wed, 18 Oct 2023 07:45:03 +0900 Subject: [PATCH 3/5] refactor --- .../common/misskey_notes/in_note_button.dart | 27 +++++ .../misskey_notes/misskey_file_view.dart | 3 +- .../common/misskey_notes/misskey_note.dart | 101 +++--------------- 3 files changed, 46 insertions(+), 85 deletions(-) create mode 100644 lib/view/common/misskey_notes/in_note_button.dart diff --git a/lib/view/common/misskey_notes/in_note_button.dart b/lib/view/common/misskey_notes/in_note_button.dart new file mode 100644 index 000000000..b7d347be8 --- /dev/null +++ b/lib/view/common/misskey_notes/in_note_button.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:miria/view/themes/app_theme.dart'; + +class InNoteButton extends StatelessWidget { + final void Function() onPressed; + final Widget child; + + const InNoteButton({super.key, required this.onPressed, required this.child}); + + @override + Widget build(BuildContext context) { + return ElevatedButton( + onPressed: onPressed, + style: ElevatedButton.styleFrom( + elevation: 0, + backgroundColor: AppTheme.of(context).buttonBackground, + foregroundColor: Theme.of(context).textTheme.bodyMedium?.color, + padding: const EdgeInsets.all(5), + textStyle: TextStyle( + fontSize: Theme.of(context).textTheme.bodyMedium?.fontSize), + minimumSize: const Size(double.infinity, 0), + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + child: child, + ); + } +} diff --git a/lib/view/common/misskey_notes/misskey_file_view.dart b/lib/view/common/misskey_notes/misskey_file_view.dart index 1f5d19659..4d664407d 100644 --- a/lib/view/common/misskey_notes/misskey_file_view.dart +++ b/lib/view/common/misskey_notes/misskey_file_view.dart @@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:miria/model/general_settings.dart'; import 'package:miria/providers.dart'; import 'package:miria/view/common/image_dialog.dart'; +import 'package:miria/view/common/misskey_notes/in_note_button.dart'; import 'package:misskey_dart/misskey_dart.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -78,7 +79,7 @@ class MisskeyFileViewState extends ConsumerState { ], ), if (isElipsed) - ElevatedButton( + InNoteButton( onPressed: () => setState(() { isElipsed = !isElipsed; }), diff --git a/lib/view/common/misskey_notes/misskey_note.dart b/lib/view/common/misskey_notes/misskey_note.dart index eb7a69d31..ed743f629 100644 --- a/lib/view/common/misskey_notes/misskey_note.dart +++ b/lib/view/common/misskey_notes/misskey_note.dart @@ -17,6 +17,7 @@ import 'package:miria/view/common/account_scope.dart'; import 'package:miria/view/common/avatar_icon.dart'; import 'package:miria/view/common/constants.dart'; import 'package:miria/view/common/error_dialog_handler.dart'; +import 'package:miria/view/common/misskey_notes/in_note_button.dart'; import 'package:miria/view/common/misskey_notes/local_only_icon.dart'; import 'package:miria/view/common/misskey_notes/mfm_text.dart'; import 'package:miria/view/common/misskey_notes/misskey_file_view.dart'; @@ -390,46 +391,20 @@ class MisskeyNoteState extends ConsumerState { .read(generalSettingsRepositoryProvider) .settings .enableAnimatedMFM, - suffixSpan: [ - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - elevation: 0, - backgroundColor: - AppTheme.of(context).buttonBackground, - foregroundColor: Theme.of(context) - .textTheme - .bodyMedium - ?.color, - padding: const EdgeInsets.only( - left: 5, right: 5, top: 8, bottom: 8), - textStyle: TextStyle( - fontSize: Theme.of(context) - .textTheme - .bodyMedium - ?.fontSize), - minimumSize: - const Size(double.infinity, 0), - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, - ), - onPressed: () { - ref - .read(notesProvider( - AccountScope.of(context))) - .updateNoteStatus( - widget.note.id, - (status) => status.copyWith( - isCwOpened: - !status.isCwOpened)); - }, - child: Text( - isCwOpened ? "隠す" : "続きを見る", - ), - ), - ), - ], + ), + InNoteButton( + onPressed: () { + ref + .read( + notesProvider(AccountScope.of(context))) + .updateNoteStatus( + widget.note.id, + (status) => status.copyWith( + isCwOpened: !status.isCwOpened)); + }, + child: Text( + isCwOpened ? "隠す" : "続きを見る", + ), ), ], if (displayNote.cw == null || @@ -441,30 +416,7 @@ class MisskeyNoteState extends ConsumerState { emojis: displayNote.emojis, suffixSpan: [ WidgetSpan( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - elevation: 0, - backgroundColor: AppTheme.of(context) - .buttonBackground, - foregroundColor: Theme.of(context) - .textTheme - .bodyMedium - ?.color, - padding: const EdgeInsets.only( - left: 5, - right: 5, - top: 8, - bottom: 8), - textStyle: TextStyle( - fontSize: Theme.of(context) - .textTheme - .bodyMedium - ?.fontSize), - minimumSize: - const Size(double.infinity, 0), - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, - ), + child: InNoteButton( onPressed: () { ref .read(notesProvider( @@ -516,26 +468,7 @@ class MisskeyNoteState extends ConsumerState { emojis: displayNote.emojis, suffixSpan: [ WidgetSpan( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - elevation: 0, - backgroundColor: AppTheme.of(context) - .buttonBackground, - foregroundColor: Theme.of(context) - .textTheme - .bodyMedium - ?.color, - padding: const EdgeInsets.all(5), - textStyle: TextStyle( - fontSize: Theme.of(context) - .textTheme - .bodyMedium - ?.fontSize), - minimumSize: - const Size(double.infinity, 0), - tapTargetSize: - MaterialTapTargetSize.shrinkWrap, - ), + child: InNoteButton( onPressed: () { ref .read(notesProvider( From 503bcceacf62b75e5ddc8a4871b7d0b84c541c96 Mon Sep 17 00:00:00 2001 From: sorairo Date: Wed, 18 Oct 2023 07:01:14 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Fix:=20Play=E3=82=92=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6=E3=81=A7=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/explore_page/explore_plays.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/view/explore_page/explore_plays.dart b/lib/view/explore_page/explore_plays.dart index 3442550ca..716ad5f4f 100644 --- a/lib/view/explore_page/explore_plays.dart +++ b/lib/view/explore_page/explore_plays.dart @@ -27,10 +27,12 @@ class ExplorePagesState extends ConsumerState { }(), builder: (context, item) { return ListTile( onTap: () async { - await launchUrl(Uri( - scheme: "https", - host: AccountScope.of(context).host, - pathSegments: ["play", item.id])); + await launchUrl( + Uri( + scheme: "https", + host: AccountScope.of(context).host, + pathSegments: ["play", item.id]), + mode: LaunchMode.externalApplication); }, title: MfmText(mfmText: item.title), subtitle: MfmText(mfmText: item.summary), From 80e30d8eb4ac60d47885dfbfc2f431d69ef77c4e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 19:59:06 +0000 Subject: [PATCH 5/5] Bumped version number to 1.0.7+76 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b6b956c65..fadb611ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: miria description: Miria is Misskey Client for Mobile App. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.7+75 +version: 1.0.7+76 environment: sdk: '>=3.0.0 <4.0.0'