From 170ea4f2c0825fdf880a8f7f58057d56caf58c2a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 23 Jul 2025 02:33:28 +0800 Subject: [PATCH] :bug: Dozens of bug fixes --- ios/Podfile.lock | 34 +++++++-------- lib/pods/article_detail.dart | 47 ++++++++++----------- lib/widgets/content/attachment_preview.dart | 6 ++- lib/widgets/content/cloud_files.dart | 7 +-- lib/widgets/post/post_item.dart | 1 + macos/Podfile.lock | 30 ++++++------- 6 files changed, 65 insertions(+), 60 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2750d58..86b00dc 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -45,10 +45,10 @@ PODS: - Firebase/Messaging (11.15.0): - Firebase/CoreOnly - FirebaseMessaging (~> 11.15.0) - - firebase_core (3.15.1): + - firebase_core (3.15.2): - Firebase/CoreOnly (= 11.15.0) - Flutter - - firebase_messaging (15.2.9): + - firebase_messaging (15.2.10): - Firebase/Messaging (= 11.15.0) - firebase_core - Flutter @@ -130,7 +130,7 @@ PODS: - Flutter - irondash_engine_context (0.0.1): - Flutter - - Kingfisher (8.4.0) + - Kingfisher (8.5.0) - livekit_client (2.4.9): - Flutter - flutter_webrtc @@ -178,23 +178,23 @@ PODS: - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - - sqlite3 (3.50.2): - - sqlite3/common (= 3.50.2) - - sqlite3/common (3.50.2) - - sqlite3/dbstatvtab (3.50.2): + - sqlite3 (3.50.3): + - sqlite3/common (= 3.50.3) + - sqlite3/common (3.50.3) + - sqlite3/dbstatvtab (3.50.3): - sqlite3/common - - sqlite3/fts5 (3.50.2): + - sqlite3/fts5 (3.50.3): - sqlite3/common - - sqlite3/math (3.50.2): + - sqlite3/math (3.50.3): - sqlite3/common - - sqlite3/perf-threadsafe (3.50.2): + - sqlite3/perf-threadsafe (3.50.3): - sqlite3/common - - sqlite3/rtree (3.50.2): + - sqlite3/rtree (3.50.3): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - Flutter - FlutterMacOS - - sqlite3 (~> 3.50.1) + - sqlite3 (~> 3.50.3) - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/math @@ -362,8 +362,8 @@ SPEC CHECKSUMS: DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e - firebase_core: ece862f94b2bc72ee0edbeec7ab5c7cb09fe1ab5 - firebase_messaging: e1a5fae495603115be1d0183bc849da748734e2b + firebase_core: 995454a784ff288be5689b796deb9e9fa3601818 + firebase_messaging: f4a41dd102ac18b840eba3f39d67e77922d3f707 FirebaseCore: efb3893e5b94f32b86e331e3bd6dadf18b66568e FirebaseCoreInternal: 9afa45b1159304c963da48addb78275ef701c6b4 FirebaseInstallations: 317270fec08a5d418fdbc8429282238cab3ac843 @@ -382,7 +382,7 @@ SPEC CHECKSUMS: GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1 image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a irondash_engine_context: 8e58ca8e0212ee9d1c7dc6a42121849986c88486 - Kingfisher: b14cc47bbfa7a3c150dd12962ee9c86338545629 + Kingfisher: ff0d31a1f07bdff6a1ebb3ba08b8e6e567b6500c livekit_client: 3f79d79233a5bd13d5b541732624ef959d7c538e local_auth_darwin: d2e8c53ef0c4f43c646462e3415432c4dab3ae19 media_kit_libs_ios_video: 5a18affdb97d1f5d466dc79988b13eff6c5e2854 @@ -403,8 +403,8 @@ SPEC CHECKSUMS: shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 sign_in_with_apple: c5dcc141574c8c54d5ac99dd2163c0c72ad22418 sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - sqlite3: 3e82a2daae39ba3b41ae6ee84a130494585460fc - sqlite3_flutter_libs: e7fc8c9ea2200ff3271f08f127842131746b70e2 + sqlite3: 83105acd294c9137c026e2da1931c30b4588ab81 + sqlite3_flutter_libs: ce0522d143cee6ef5e16587acfce8f476316e005 super_native_extensions: b763c02dc3a8fd078389f410bf15149179020cb4 SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 url_launcher_ios: 694010445543906933d732453a59da0a173ae33d diff --git a/lib/pods/article_detail.dart b/lib/pods/article_detail.dart index 354cd16..c93d95a 100644 --- a/lib/pods/article_detail.dart +++ b/lib/pods/article_detail.dart @@ -4,28 +4,27 @@ import 'package:island/models/webfeed.dart'; import 'package:island/pods/network.dart'; /// Provider that fetches a single article by its ID -final articleDetailProvider = FutureProvider.autoDispose.family( - (ref, articleId) async { - final dio = ref.watch(apiClientProvider); - - try { - final response = await dio.get>( - '/feeds/articles/$articleId', - ); - - if (response.statusCode == 200 && response.data != null) { - return SnWebArticle.fromJson(response.data!); - } else { - throw Exception('Failed to load article'); +final articleDetailProvider = FutureProvider.autoDispose + .family((ref, articleId) async { + final dio = ref.watch(apiClientProvider); + + try { + final response = await dio.get>( + '/sphere/feeds/articles/$articleId', + ); + + if (response.statusCode == 200 && response.data != null) { + return SnWebArticle.fromJson(response.data!); + } else { + throw Exception('Failed to load article'); + } + } on DioException catch (e) { + if (e.response?.statusCode == 404) { + throw Exception('Article not found'); + } else { + throw Exception('Failed to load article: ${e.message}'); + } + } catch (e) { + throw Exception('Failed to load article: $e'); } - } on DioException catch (e) { - if (e.response?.statusCode == 404) { - throw Exception('Article not found'); - } else { - throw Exception('Failed to load article: ${e.message}'); - } - } catch (e) { - throw Exception('Failed to load article: $e'); - } - }, -); + }); diff --git a/lib/widgets/content/attachment_preview.dart b/lib/widgets/content/attachment_preview.dart index abbc083..730eacf 100644 --- a/lib/widgets/content/attachment_preview.dart +++ b/lib/widgets/content/attachment_preview.dart @@ -30,7 +30,11 @@ class AttachmentPreview extends StatelessWidget { @override Widget build(BuildContext context) { var ratio = - (item.isOnCloud ? (item.data.fileMeta?['ratio'] ?? 1) : 1).toDouble(); + item.isOnCloud + ? (item.data.fileMeta?['ratio'] is num + ? item.data.fileMeta!['ratio'].toDouble() + : 1.0) + : 1.0; if (ratio == 0) ratio = 1.0; return AspectRatio( diff --git a/lib/widgets/content/cloud_files.dart b/lib/widgets/content/cloud_files.dart index d486d77..73055e3 100644 --- a/lib/widgets/content/cloud_files.dart +++ b/lib/widgets/content/cloud_files.dart @@ -30,8 +30,6 @@ class CloudFileWidget extends ConsumerWidget { var ratio = item.fileMeta?['ratio'] is num ? item.fileMeta!['ratio'].toDouble() - : item.fileMeta?['ratio'] is String - ? double.parse(item.fileMeta!['ratio']) : 1.0; if (ratio == 0) ratio = 1.0; final content = switch (item.mimeType?.split('/').firstOrNull) { @@ -39,7 +37,10 @@ class CloudFileWidget extends ConsumerWidget { aspectRatio: ratio, child: UniversalImage( uri: uri, - blurHash: noBlurhash ? null : item.fileMeta?['blur'], + blurHash: + noBlurhash + ? null + : (item.fileMeta is String ? item.fileMeta!['blur'] : null), ), ), "video" => AspectRatio( diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 3753228..64499c3 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -609,6 +609,7 @@ Widget _buildReferencePost(BuildContext context, SnPost item) { final isReply = item.repliedPost != null; return Container( + margin: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5), diff --git a/macos/Podfile.lock b/macos/Podfile.lock index d38d360..dac9ee5 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -16,10 +16,10 @@ PODS: - Firebase/Messaging (11.15.0): - Firebase/CoreOnly - FirebaseMessaging (~> 11.15.0) - - firebase_core (3.15.1): + - firebase_core (3.15.2): - Firebase/CoreOnly (~> 11.15.0) - FlutterMacOS - - firebase_messaging (15.2.9): + - firebase_messaging (15.2.10): - Firebase/CoreOnly (~> 11.15.0) - Firebase/Messaging (~> 11.15.0) - firebase_core @@ -130,23 +130,23 @@ PODS: - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - - sqlite3 (3.50.1): - - sqlite3/common (= 3.50.1) - - sqlite3/common (3.50.1) - - sqlite3/dbstatvtab (3.50.1): + - sqlite3 (3.50.3): + - sqlite3/common (= 3.50.3) + - sqlite3/common (3.50.3) + - sqlite3/dbstatvtab (3.50.3): - sqlite3/common - - sqlite3/fts5 (3.50.1): + - sqlite3/fts5 (3.50.3): - sqlite3/common - - sqlite3/math (3.50.1): + - sqlite3/math (3.50.3): - sqlite3/common - - sqlite3/perf-threadsafe (3.50.1): + - sqlite3/perf-threadsafe (3.50.3): - sqlite3/common - - sqlite3/rtree (3.50.1): + - sqlite3/rtree (3.50.3): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - Flutter - FlutterMacOS - - sqlite3 (~> 3.50.1) + - sqlite3 (~> 3.50.3) - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/math @@ -292,8 +292,8 @@ SPEC CHECKSUMS: file_picker: 7584aae6fa07a041af2b36a2655122d42f578c1a file_selector_macos: 6280b52b459ae6c590af5d78fc35c7267a3c4b31 Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e - firebase_core: 8dc569d17b3a9fc3ee5ebc21b322411b4a796833 - firebase_messaging: adaf7fc22897a7aa49410d15f8a595bef2dbca2d + firebase_core: 7667f880631ae8ad10e3d6567ab7582fe0682326 + firebase_messaging: df39858bcbbcce792c9e4f1ca51b41123d6181fd FirebaseCore: efb3893e5b94f32b86e331e3bd6dadf18b66568e FirebaseCoreInternal: 9afa45b1159304c963da48addb78275ef701c6b4 FirebaseInstallations: 317270fec08a5d418fdbc8429282238cab3ac843 @@ -325,8 +325,8 @@ SPEC CHECKSUMS: shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 sign_in_with_apple: 6673c03c9e3643f6c8d33601943fbfa9ae99f94e sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - sqlite3: 1d85290c3321153511f6e900ede7a1608718bbd5 - sqlite3_flutter_libs: e7fc8c9ea2200ff3271f08f127842131746b70e2 + sqlite3: 83105acd294c9137c026e2da1931c30b4588ab81 + sqlite3_flutter_libs: ce0522d143cee6ef5e16587acfce8f476316e005 super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189 url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673 volume_controller: 5c068e6d085c80dadd33fc2c918d2114b775b3dd