From 461aae253bfd7ee93cebe62ed6dffe7d158c8985 Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 27 Dec 2022 00:22:04 -0800 Subject: [PATCH 1/6] update publish_ios.yml (#92) --- .github/workflows/publish_ios.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish_ios.yml b/.github/workflows/publish_ios.yml index 485e9b15..8009d67e 100644 --- a/.github/workflows/publish_ios.yml +++ b/.github/workflows/publish_ios.yml @@ -7,8 +7,6 @@ on: push: branches: - master - tags: - - "v*" jobs: build_and_publish: From 8d7f66ecbc57c298a2e6537e7a5c4a582deca55e Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 27 Dec 2022 01:17:16 -0800 Subject: [PATCH 2/6] add timeout. (#93) --- .github/workflows/commit_check.yml | 1 + .github/workflows/publish_ios.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/commit_check.yml b/.github/workflows/commit_check.yml index 9007cfe0..2aa4422e 100644 --- a/.github/workflows/commit_check.yml +++ b/.github/workflows/commit_check.yml @@ -10,6 +10,7 @@ jobs: releases: name: Check commit runs-on: ubuntu-latest + timeout-minutes: 30 env: FLUTTER_VERSION: "3.3.10" steps: diff --git a/.github/workflows/publish_ios.yml b/.github/workflows/publish_ios.yml index 8009d67e..4ba81cd7 100644 --- a/.github/workflows/publish_ios.yml +++ b/.github/workflows/publish_ios.yml @@ -11,6 +11,7 @@ on: jobs: build_and_publish: runs-on: macos-latest + timeout-minutes: 30 env: # Point the `ruby/setup-ruby` action at this Gemfile, so it From 613ba12b052e6376e8281d920e7e6ef01513d461 Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 27 Dec 2022 12:54:18 -0800 Subject: [PATCH 3/6] fix time machine. (#94) * bumped version. * fix time machine. --- fastlane/metadata/android/en-US/changelogs/78.txt | 1 + lib/cubits/collapse/collapse_cubit.dart | 10 ++++++---- lib/screens/widgets/comment_tile.dart | 2 +- pubspec.yaml | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/78.txt diff --git a/fastlane/metadata/android/en-US/changelogs/78.txt b/fastlane/metadata/android/en-US/changelogs/78.txt new file mode 100644 index 00000000..71f547e1 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/78.txt @@ -0,0 +1 @@ +- Fixed time machine. diff --git a/lib/cubits/collapse/collapse_cubit.dart b/lib/cubits/collapse/collapse_cubit.dart index edbfce06..4891ab37 100644 --- a/lib/cubits/collapse/collapse_cubit.dart +++ b/lib/cubits/collapse/collapse_cubit.dart @@ -11,7 +11,7 @@ part 'collapse_state.dart'; class CollapseCubit extends Cubit { CollapseCubit({ required int commentId, - required CommentsCubit commentsCubit, + required CommentsCubit? commentsCubit, CollapseCache? collapseCache, }) : _commentId = commentId, _collapseCache = collapseCache ?? locator.get(), @@ -20,7 +20,7 @@ class CollapseCubit extends Cubit { final int _commentId; final CollapseCache _collapseCache; - final CommentsCubit _commentsCubit; + final CommentsCubit? _commentsCubit; late final StreamSubscription>> _streamSubscription; void init() { @@ -47,13 +47,15 @@ class CollapseCubit extends Cubit { ), ); } else { + if (_commentsCubit == null) return; + final Set collapsedCommentIds = _collapseCache.collapse(_commentId); - final int lastCommentId = _commentsCubit.state.comments.last.id; + final int lastCommentId = _commentsCubit!.state.comments.last.id; final bool shouldLoadMore = _commentId == lastCommentId || collapsedCommentIds.contains(lastCommentId); if (shouldLoadMore) { - _commentsCubit.loadMore(); + _commentsCubit!.loadMore(); } emit( diff --git a/lib/screens/widgets/comment_tile.dart b/lib/screens/widgets/comment_tile.dart index 4d86ed99..0236eecc 100644 --- a/lib/screens/widgets/comment_tile.dart +++ b/lib/screens/widgets/comment_tile.dart @@ -47,7 +47,7 @@ class CommentTile extends StatelessWidget { lazy: false, create: (_) => CollapseCubit( commentId: comment.id, - commentsCubit: context.read(), + commentsCubit: context.tryRead(), collapseCache: context.tryRead() ?? CollapseCache(), )..init(), child: BlocBuilder3 Date: Tue, 27 Dec 2022 13:36:14 -0800 Subject: [PATCH 4/6] add (#95) --- ios/Podfile.lock | 6 + lib/screens/profile/profile_screen.dart | 179 ++++++++++++------------ pubspec.lock | 14 ++ pubspec.yaml | 1 + 4 files changed, 113 insertions(+), 87 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index bdc3ff25..909340de 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -22,6 +22,8 @@ PODS: - integration_test (0.0.1): - Flutter - OrderedSet (5.0.0) + - package_info_plus (0.4.5): + - Flutter - path_provider_ios (0.0.1): - Flutter - ReachabilitySwift (5.0.0) @@ -53,6 +55,7 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - flutter_siri_suggestions (from `.symlinks/plugins/flutter_siri_suggestions/ios`) - integration_test (from `.symlinks/plugins/integration_test/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) @@ -85,6 +88,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_siri_suggestions/ios" integration_test: :path: ".symlinks/plugins/integration_test/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" path_provider_ios: :path: ".symlinks/plugins/path_provider_ios/ios" receive_sharing_intent: @@ -116,6 +121,7 @@ SPEC CHECKSUMS: FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1 diff --git a/lib/screens/profile/profile_screen.dart b/lib/screens/profile/profile_screen.dart index 08b30bee..6b312360 100644 --- a/lib/screens/profile/profile_screen.dart +++ b/lib/screens/profile/profile_screen.dart @@ -20,6 +20,7 @@ import 'package:hacki/screens/screens.dart'; import 'package:hacki/screens/widgets/widgets.dart'; import 'package:hacki/styles/styles.dart'; import 'package:hacki/utils/utils.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:tuple/tuple.dart'; @@ -422,93 +423,7 @@ class _ProfileScreenState extends State title: const Text('About'), subtitle: const Text('nothing interesting here.'), - onTap: () { - showAboutDialog( - context: context, - applicationName: 'Hacki', - applicationVersion: 'v1.0.0', - applicationIcon: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular( - Dimens.pt12, - ), - ), - child: Image.asset( - Constants.hackiIconPath, - height: Dimens.pt50, - width: Dimens.pt50, - ), - ), - children: [ - ElevatedButton( - onPressed: () => LinkUtil.launch( - Constants.portfolioLink, - ), - child: Row( - children: const [ - Icon( - FontAwesomeIcons.addressCard, - ), - SizedBox( - width: Dimens.pt12, - ), - Text('Developer'), - ], - ), - ), - ElevatedButton( - onPressed: () => LinkUtil.launch( - Constants.githubLink, - ), - child: Row( - children: const [ - Icon( - FontAwesomeIcons.github, - ), - SizedBox( - width: Dimens.pt12, - ), - Text('Source code'), - ], - ), - ), - ElevatedButton( - onPressed: () => LinkUtil.launch( - Platform.isIOS - ? Constants.appStoreLink - : Constants.googlePlayLink, - ), - child: Row( - children: const [ - Icon( - Icons.thumb_up, - ), - SizedBox( - width: Dimens.pt12, - ), - Text('Like the app?'), - ], - ), - ), - ElevatedButton( - onPressed: () => LinkUtil.launch( - Constants.sponsorLink, - ), - child: Row( - children: const [ - Icon( - FeatherIcons.coffee, - ), - SizedBox( - width: Dimens.pt12, - ), - Text('Buy me a coffee'), - ], - ), - ), - ], - ); - }, + onTap: showAboutHackiDialog, ), const SizedBox( height: Dimens.pt48, @@ -718,6 +633,96 @@ class _ProfileScreenState extends State ); } + Future showAboutHackiDialog() async { + final PackageInfo packageInfo = await PackageInfo.fromPlatform(); + + final String version = packageInfo.version; + + showAboutDialog( + context: context, + applicationName: 'Hacki', + applicationVersion: 'v$version', + applicationIcon: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular( + Dimens.pt12, + ), + ), + child: Image.asset( + Constants.hackiIconPath, + height: Dimens.pt50, + width: Dimens.pt50, + ), + ), + children: [ + ElevatedButton( + onPressed: () => LinkUtil.launch( + Constants.portfolioLink, + ), + child: Row( + children: const [ + Icon( + FontAwesomeIcons.addressCard, + ), + SizedBox( + width: Dimens.pt12, + ), + Text('Developer'), + ], + ), + ), + ElevatedButton( + onPressed: () => LinkUtil.launch( + Constants.githubLink, + ), + child: Row( + children: const [ + Icon( + FontAwesomeIcons.github, + ), + SizedBox( + width: Dimens.pt12, + ), + Text('Source code'), + ], + ), + ), + ElevatedButton( + onPressed: () => LinkUtil.launch( + Platform.isIOS ? Constants.appStoreLink : Constants.googlePlayLink, + ), + child: Row( + children: const [ + Icon( + Icons.thumb_up, + ), + SizedBox( + width: Dimens.pt12, + ), + Text('Like the app?'), + ], + ), + ), + ElevatedButton( + onPressed: () => LinkUtil.launch( + Constants.sponsorLink, + ), + child: Row( + children: const [ + Icon( + FeatherIcons.coffee, + ), + SizedBox( + width: Dimens.pt12, + ), + Text('Buy me a coffee'), + ], + ), + ), + ], + ); + } + void onCommentTapped(Comment comment, {VoidCallback? then}) { throttle.run(() { locator diff --git a/pubspec.lock b/pubspec.lock index 5745461e..7075c432 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -607,6 +607,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" path: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 851e78a9..81059848 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: hydrated_bloc: ^9.0.0-dev.3 intl: ^0.17.0 logger: ^1.1.0 + package_info_plus: ^3.0.2 path: ^1.8.0 path_provider: ^2.0.8 path_provider_android: ^2.0.8 From f823fdf2418c8933f4cb3872ee62e8360f350912 Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 27 Dec 2022 13:40:41 -0800 Subject: [PATCH 5/6] use version from `pubspec.yaml` (#95) (#96) From 03c01a0b78d0e93cd2943688d38adc7317811243 Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 27 Dec 2022 13:56:21 -0800 Subject: [PATCH 6/6] bump versions. (#97) --- fastlane/metadata/android/en-US/changelogs/79.txt | 1 + ios/Podfile | 3 --- lib/screens/profile/profile_screen.dart | 1 - pubspec.yaml | 4 +--- 4 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/79.txt diff --git a/fastlane/metadata/android/en-US/changelogs/79.txt b/fastlane/metadata/android/en-US/changelogs/79.txt new file mode 100644 index 00000000..71f547e1 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/79.txt @@ -0,0 +1 @@ +- Fixed time machine. diff --git a/ios/Podfile b/ios/Podfile index 88359b22..76df8f3c 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,6 +1,3 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '11.0' - # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/lib/screens/profile/profile_screen.dart b/lib/screens/profile/profile_screen.dart index 6b312360..8e7a8b87 100644 --- a/lib/screens/profile/profile_screen.dart +++ b/lib/screens/profile/profile_screen.dart @@ -635,7 +635,6 @@ class _ProfileScreenState extends State Future showAboutHackiDialog() async { final PackageInfo packageInfo = await PackageInfo.fromPlatform(); - final String version = packageInfo.version; showAboutDialog( diff --git a/pubspec.yaml b/pubspec.yaml index 81059848..db5bc9ff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: hacki description: A Hacker News reader. -version: 1.0.1+78 +version: 1.0.1+79 publish_to: none environment: @@ -18,7 +18,6 @@ dependencies: dio: ^4.0.4 equatable: ^2.0.5 fast_gbk: ^1.0.0 - # feature_discovery: ^0.14.0 feature_discovery: git: url: https://github.com/livinglist/feature_discovery @@ -50,7 +49,6 @@ dependencies: path_provider: ^2.0.8 path_provider_android: ^2.0.8 path_provider_ios: ^2.0.8 - # pull_to_refresh: ^2.0.0 pull_to_refresh: git: url: https://github.com/livinglist/flutter_pulltorefresh