From 81103ba8b691732e56bbd4423c736d89fd97c205 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 24 May 2025 22:21:33 +0800 Subject: [PATCH] :wastebasket: Remove some settings --- ios/Runner/Info.plist | 126 +++++++++++++++--------------- lib/pods/config.dart | 21 ----- lib/pods/config.freezed.dart | 37 ++++----- lib/screens/chat/chat.dart | 146 ++++++++++++++++++++++------------- lib/screens/settings.dart | 40 ---------- 5 files changed, 171 insertions(+), 199 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 73b00f7..137c6de 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -1,67 +1,67 @@ - - CADisableMinimumFrameDurationOnPhone - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Island - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - island - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UIApplicationSupportsIndirectInputEvents - - UIBackgroundModes - - fetch - audio - remote-notification - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - NSCalendarsUsageDescription - Grant access to Calander help us to shows Solar Calander with your own events. - NSCameraUsageDescription - Grant access to Camera will allow Solian take photo or video for your post. - NSMicrophoneUsageDescription - Grant access to Microphone will allow Solian record audio for your post. - NSPhotoLibraryAddUsageDescription - Grant access to Photo Library will allow Solian download photo to album for you. - NSPhotoLibraryUsageDescription - Grant access to Photo Library will allow Solian upload photo or video for your post. - UIStatusBarHidden - - + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Solian + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + solian + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UIApplicationSupportsIndirectInputEvents + + UIBackgroundModes + + fetch + audio + remote-notification + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSCalendarsUsageDescription + Grant access to Calander help us to shows Solar Calander with your own events. + NSCameraUsageDescription + Grant access to Camera will allow Solian take photo or video for your post. + NSMicrophoneUsageDescription + Grant access to Microphone will allow Solian record audio for your post. + NSPhotoLibraryAddUsageDescription + Grant access to Photo Library will allow Solian download photo to album for you. + NSPhotoLibraryUsageDescription + Grant access to Photo Library will allow Solian upload photo or video for your post. + UIStatusBarHidden + + diff --git a/lib/pods/config.dart b/lib/pods/config.dart index 59a3969..d286055 100644 --- a/lib/pods/config.dart +++ b/lib/pods/config.dart @@ -53,10 +53,7 @@ final serverUrlProvider = Provider((ref) { @freezed abstract class AppSettings with _$AppSettings { const factory AppSettings({ - required bool realmCompactView, - required bool mixedFeed, required bool autoTranslate, - required bool hideBottomNav, required bool soundEffects, required bool aprilFoolFeatures, required bool enterToSend, @@ -69,36 +66,18 @@ class AppSettingsNotifier extends StateNotifier { AppSettingsNotifier(this.prefs) : super( AppSettings( - realmCompactView: prefs.getBool(kAppRealmCompactView) ?? false, - mixedFeed: prefs.getBool(kAppMixedFeed) ?? true, autoTranslate: prefs.getBool(kAppAutoTranslate) ?? false, - hideBottomNav: prefs.getBool(kAppHideBottomNav) ?? false, soundEffects: prefs.getBool(kAppSoundEffects) ?? true, aprilFoolFeatures: prefs.getBool(kAppAprilFoolFeatures) ?? true, enterToSend: prefs.getBool(kAppEnterToSend) ?? true, ), ); - void setRealmCompactView(bool value) { - prefs.setBool(kAppRealmCompactView, value); - state = state.copyWith(realmCompactView: value); - } - - void setMixedFeed(bool value) { - prefs.setBool(kAppMixedFeed, value); - state = state.copyWith(mixedFeed: value); - } - void setAutoTranslate(bool value) { prefs.setBool(kAppAutoTranslate, value); state = state.copyWith(autoTranslate: value); } - void setHideBottomNav(bool value) { - prefs.setBool(kAppHideBottomNav, value); - state = state.copyWith(hideBottomNav: value); - } - void setSoundEffects(bool value) { prefs.setBool(kAppSoundEffects, value); state = state.copyWith(soundEffects: value); diff --git a/lib/pods/config.freezed.dart b/lib/pods/config.freezed.dart index 0cd24bb..afb0848 100644 --- a/lib/pods/config.freezed.dart +++ b/lib/pods/config.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AppSettings { - bool get realmCompactView; bool get mixedFeed; bool get autoTranslate; bool get hideBottomNav; bool get soundEffects; bool get aprilFoolFeatures; bool get enterToSend; + bool get autoTranslate; bool get soundEffects; bool get aprilFoolFeatures; bool get enterToSend; /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -26,16 +26,16 @@ $AppSettingsCopyWith get copyWith => _$AppSettingsCopyWithImpl Object.hash(runtimeType,realmCompactView,mixedFeed,autoTranslate,hideBottomNav,soundEffects,aprilFoolFeatures,enterToSend); +int get hashCode => Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend); @override String toString() { - return 'AppSettings(realmCompactView: $realmCompactView, mixedFeed: $mixedFeed, autoTranslate: $autoTranslate, hideBottomNav: $hideBottomNav, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend)'; + return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend)'; } @@ -46,7 +46,7 @@ abstract mixin class $AppSettingsCopyWith<$Res> { factory $AppSettingsCopyWith(AppSettings value, $Res Function(AppSettings) _then) = _$AppSettingsCopyWithImpl; @useResult $Res call({ - bool realmCompactView, bool mixedFeed, bool autoTranslate, bool hideBottomNav, bool soundEffects, bool aprilFoolFeatures, bool enterToSend + bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend }); @@ -63,12 +63,9 @@ class _$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? realmCompactView = null,Object? mixedFeed = null,Object? autoTranslate = null,Object? hideBottomNav = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,}) { return _then(_self.copyWith( -realmCompactView: null == realmCompactView ? _self.realmCompactView : realmCompactView // ignore: cast_nullable_to_non_nullable -as bool,mixedFeed: null == mixedFeed ? _self.mixedFeed : mixedFeed // ignore: cast_nullable_to_non_nullable -as bool,autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable -as bool,hideBottomNav: null == hideBottomNav ? _self.hideBottomNav : hideBottomNav // ignore: cast_nullable_to_non_nullable +autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable as bool,aprilFoolFeatures: null == aprilFoolFeatures ? _self.aprilFoolFeatures : aprilFoolFeatures // ignore: cast_nullable_to_non_nullable as bool,enterToSend: null == enterToSend ? _self.enterToSend : enterToSend // ignore: cast_nullable_to_non_nullable @@ -83,13 +80,10 @@ as bool, class _AppSettings implements AppSettings { - const _AppSettings({required this.realmCompactView, required this.mixedFeed, required this.autoTranslate, required this.hideBottomNav, required this.soundEffects, required this.aprilFoolFeatures, required this.enterToSend}); + const _AppSettings({required this.autoTranslate, required this.soundEffects, required this.aprilFoolFeatures, required this.enterToSend}); -@override final bool realmCompactView; -@override final bool mixedFeed; @override final bool autoTranslate; -@override final bool hideBottomNav; @override final bool soundEffects; @override final bool aprilFoolFeatures; @override final bool enterToSend; @@ -104,16 +98,16 @@ _$AppSettingsCopyWith<_AppSettings> get copyWith => __$AppSettingsCopyWithImpl<_ @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.realmCompactView, realmCompactView) || other.realmCompactView == realmCompactView)&&(identical(other.mixedFeed, mixedFeed) || other.mixedFeed == mixedFeed)&&(identical(other.autoTranslate, autoTranslate) || other.autoTranslate == autoTranslate)&&(identical(other.hideBottomNav, hideBottomNav) || other.hideBottomNav == hideBottomNav)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.aprilFoolFeatures, aprilFoolFeatures) || other.aprilFoolFeatures == aprilFoolFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettings&&(identical(other.autoTranslate, autoTranslate) || other.autoTranslate == autoTranslate)&&(identical(other.soundEffects, soundEffects) || other.soundEffects == soundEffects)&&(identical(other.aprilFoolFeatures, aprilFoolFeatures) || other.aprilFoolFeatures == aprilFoolFeatures)&&(identical(other.enterToSend, enterToSend) || other.enterToSend == enterToSend)); } @override -int get hashCode => Object.hash(runtimeType,realmCompactView,mixedFeed,autoTranslate,hideBottomNav,soundEffects,aprilFoolFeatures,enterToSend); +int get hashCode => Object.hash(runtimeType,autoTranslate,soundEffects,aprilFoolFeatures,enterToSend); @override String toString() { - return 'AppSettings(realmCompactView: $realmCompactView, mixedFeed: $mixedFeed, autoTranslate: $autoTranslate, hideBottomNav: $hideBottomNav, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend)'; + return 'AppSettings(autoTranslate: $autoTranslate, soundEffects: $soundEffects, aprilFoolFeatures: $aprilFoolFeatures, enterToSend: $enterToSend)'; } @@ -124,7 +118,7 @@ abstract mixin class _$AppSettingsCopyWith<$Res> implements $AppSettingsCopyWith factory _$AppSettingsCopyWith(_AppSettings value, $Res Function(_AppSettings) _then) = __$AppSettingsCopyWithImpl; @override @useResult $Res call({ - bool realmCompactView, bool mixedFeed, bool autoTranslate, bool hideBottomNav, bool soundEffects, bool aprilFoolFeatures, bool enterToSend + bool autoTranslate, bool soundEffects, bool aprilFoolFeatures, bool enterToSend }); @@ -141,12 +135,9 @@ class __$AppSettingsCopyWithImpl<$Res> /// Create a copy of AppSettings /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? realmCompactView = null,Object? mixedFeed = null,Object? autoTranslate = null,Object? hideBottomNav = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? autoTranslate = null,Object? soundEffects = null,Object? aprilFoolFeatures = null,Object? enterToSend = null,}) { return _then(_AppSettings( -realmCompactView: null == realmCompactView ? _self.realmCompactView : realmCompactView // ignore: cast_nullable_to_non_nullable -as bool,mixedFeed: null == mixedFeed ? _self.mixedFeed : mixedFeed // ignore: cast_nullable_to_non_nullable -as bool,autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable -as bool,hideBottomNav: null == hideBottomNav ? _self.hideBottomNav : hideBottomNav // ignore: cast_nullable_to_non_nullable +autoTranslate: null == autoTranslate ? _self.autoTranslate : autoTranslate // ignore: cast_nullable_to_non_nullable as bool,soundEffects: null == soundEffects ? _self.soundEffects : soundEffects // ignore: cast_nullable_to_non_nullable as bool,aprilFoolFeatures: null == aprilFoolFeatures ? _self.aprilFoolFeatures : aprilFoolFeatures // ignore: cast_nullable_to_non_nullable as bool,enterToSend: null == enterToSend ? _self.enterToSend : enterToSend // ignore: cast_nullable_to_non_nullable diff --git a/lib/screens/chat/chat.dart b/lib/screens/chat/chat.dart index 572637d..d9b57f5 100644 --- a/lib/screens/chat/chat.dart +++ b/lib/screens/chat/chat.dart @@ -241,9 +241,30 @@ class ChatListScreen extends HookConsumerWidget { bottom: TabBar( controller: tabController, tabs: [ - Tab(text: 'chatTabAll'.tr()), - Tab(text: 'chatTabDirect'.tr()), - Tab(text: 'chatTabGroup'.tr()), + Tab( + child: Text( + 'chatTabAll'.tr(), + style: TextStyle( + color: Theme.of(context).appBarTheme.foregroundColor!, + ), + ), + ), + Tab( + child: Text( + 'chatTabDirect'.tr(), + style: TextStyle( + color: Theme.of(context).appBarTheme.foregroundColor!, + ), + ), + ), + Tab( + child: Text( + 'chatTabGroup'.tr(), + style: TextStyle( + color: Theme.of(context).appBarTheme.foregroundColor!, + ), + ), + ), ], ), actions: [ @@ -310,57 +331,78 @@ class ChatListScreen extends HookConsumerWidget { }, child: const Icon(Symbols.add), ), - body: chats.when( - data: - (items) => RefreshIndicator( - onRefresh: - () => Future.sync(() { - ref.invalidate(chatroomsJoinedProvider); - }), - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: - items - .where( - (item) => - selectedTab.value == 0 || - (selectedTab.value == 1 && item.type == 1) || - (selectedTab.value == 2 && item.type != 1), - ) - .length, - itemBuilder: (context, index) { - final filteredItems = - items - .where( - (item) => - selectedTab.value == 0 || - (selectedTab.value == 1 && item.type == 1) || - (selectedTab.value == 2 && item.type != 1), - ) - .toList(); - final item = filteredItems[index]; - return ChatRoomListTile( - room: item, - isDirect: item.type == 1, - onTap: () { - if (context.router.topRoute.name == ChatRoomRoute.name) { - context.router.replace(ChatRoomRoute(id: item.id)); - } else { - context.router.push(ChatRoomRoute(id: item.id)); - } + body: Column( + children: [ + Consumer( + builder: (context, ref, _) { + final summaryState = ref.watch(chatSummaryProvider); + return summaryState.maybeWhen( + loading: () => const LinearProgressIndicator(), + orElse: () => const SizedBox.shrink(), + ); + }, + ), + Expanded( + child: chats.when( + data: + (items) => RefreshIndicator( + onRefresh: + () => Future.sync(() { + ref.invalidate(chatroomsJoinedProvider); + }), + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: + items + .where( + (item) => + selectedTab.value == 0 || + (selectedTab.value == 1 && + item.type == 1) || + (selectedTab.value == 2 && item.type != 1), + ) + .length, + itemBuilder: (context, index) { + final filteredItems = + items + .where( + (item) => + selectedTab.value == 0 || + (selectedTab.value == 1 && + item.type == 1) || + (selectedTab.value == 2 && + item.type != 1), + ) + .toList(); + final item = filteredItems[index]; + return ChatRoomListTile( + room: item, + isDirect: item.type == 1, + onTap: () { + if (context.router.topRoute.name == + ChatRoomRoute.name) { + context.router.replace( + ChatRoomRoute(id: item.id), + ); + } else { + context.router.push(ChatRoomRoute(id: item.id)); + } + }, + ); + }, + ), + ), + loading: () => const Center(child: CircularProgressIndicator()), + error: + (error, stack) => ResponseErrorWidget( + error: error, + onRetry: () { + ref.invalidate(chatroomsJoinedProvider); }, - ); - }, - ), - ), - loading: () => const Center(child: CircularProgressIndicator()), - error: - (error, stack) => ResponseErrorWidget( - error: error, - onRetry: () { - ref.invalidate(chatroomsJoinedProvider); - }, + ), ), + ), + ], ), ); } diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 50ca482..13c67c1 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -176,32 +176,6 @@ class SettingsScreen extends HookConsumerWidget { }, ), const Divider(), - ListTile( - minLeadingWidth: 48, - title: Text('settingsRealmCompactView').tr(), - contentPadding: const EdgeInsets.only(left: 24, right: 17), - leading: const Icon(Symbols.view_compact), - trailing: Switch( - value: settings.realmCompactView, - onChanged: (value) { - ref - .read(appSettingsProvider.notifier) - .setRealmCompactView(value); - }, - ), - ), - ListTile( - minLeadingWidth: 48, - title: Text('settingsMixedFeed').tr(), - contentPadding: const EdgeInsets.only(left: 24, right: 17), - leading: const Icon(Symbols.merge), - trailing: Switch( - value: settings.mixedFeed, - onChanged: (value) { - ref.read(appSettingsProvider.notifier).setMixedFeed(value); - }, - ), - ), ListTile( minLeadingWidth: 48, title: Text('settingsAutoTranslate').tr(), @@ -216,20 +190,6 @@ class SettingsScreen extends HookConsumerWidget { }, ), ), - ListTile( - minLeadingWidth: 48, - title: Text('settingsHideBottomNav').tr(), - contentPadding: const EdgeInsets.only(left: 24, right: 17), - leading: const Icon(Symbols.navigation), - trailing: Switch( - value: settings.hideBottomNav, - onChanged: (value) { - ref - .read(appSettingsProvider.notifier) - .setHideBottomNav(value); - }, - ), - ), ListTile( minLeadingWidth: 48, title: Text('settingsSoundEffects').tr(),