diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 23c147f..69848bc 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -27,7 +27,7 @@ android:enableOnBackInvokedCallback="true"> + diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f38d64b..2c18039 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,4 +1,6 @@ PODS: + - app_links (7.0.0): + - Flutter - connectivity_plus (0.0.1): - Flutter - device_info_plus (0.0.1): @@ -52,6 +54,7 @@ PODS: - Flutter DEPENDENCIES: + - app_links (from `.symlinks/plugins/app_links/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) @@ -79,6 +82,8 @@ SPEC REPOS: - OrderedSet EXTERNAL SOURCES: + app_links: + :path: ".symlinks/plugins/app_links/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" device_info_plus: @@ -123,12 +128,13 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/workmanager_apple/ios" SPEC CHECKSUMS: + app_links: 6d01271b3907b0ee7325c5297c75d697c4226c4d connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_email_sender: e03bdda7637bcd3539bfe718fddd980e9508efaa flutter_inappwebview_ios: 6f63631e2c62a7c350263b13fa5427aedefe81d4 - flutter_local_notifications: ff50f8405aaa0ccdc7dcfb9022ca192e8ad9688f + flutter_local_notifications: eda81afddbf18f8589f6ec069ce593c4c6378769 flutter_native_splash: df59bb2e1421aa0282cb2e95618af4dcb0c56c29 flutter_secure_storage_darwin: 557817588b80e60213cbecb573c45c76b788018d in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index c8b6983..0344321 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -106,6 +106,6 @@ AppGroupId group.com.jiaqi.hacki FlutterDeepLinkingEnabled - + diff --git a/ios/StoryWidget/StoryWidget.swift b/ios/StoryWidget/StoryWidget.swift index 53ea44f..ee25519 100644 --- a/ios/StoryWidget/StoryWidget.swift +++ b/ios/StoryWidget/StoryWidget.swift @@ -23,7 +23,7 @@ struct StoryWidgetView : View { .containerBackground(for: .widget) { Color(UIColor.secondarySystemBackground) } - .widgetURL(URL(string: "/item/\(story.id)")) + .widgetURL(URL(string: "hacki:///item/\(story.id)")) default: HStack { VStack { @@ -62,7 +62,7 @@ struct StoryWidgetView : View { .containerBackground(for: .widget) { Color(UIColor.secondarySystemBackground) } - .widgetURL(URL(string: "/item/\(story.id)")) + .widgetURL(URL(string: "hacki:///item/\(story.id)")) } } } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 0609469..852da27 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; +import 'package:app_links/app_links.dart'; import 'package:feature_discovery/feature_discovery.dart'; import 'package:flutter/material.dart' hide Badge; import 'package:flutter/scheduler.dart'; @@ -40,6 +41,7 @@ class _HomeScreenState extends State intentDataStreamSubscription; late final StreamSubscription notificationStreamSubscription; late final StreamSubscription siriSuggestionStreamSubscription; + final AppLinks appLinks = AppLinks(); static final int tabLength = StoryType.values.length + 1; @@ -60,6 +62,13 @@ class _HomeScreenState extends State void initState() { super.initState(); + appLinks.uriLinkStream.listen((Uri uri) { + logInfo('deeplink uri received: ${uri.path}'); + if (mounted) { + context.push(uri.path); + } + }); + ReceiveSharingIntent.instance .getInitialMedia() .then(onShareExtensionTapped); diff --git a/pubspec.lock b/pubspec.lock index 523af4b..827fca3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + app_links: + dependency: "direct main" + description: + name: app_links + sha256: "3462d9defc61565fde4944858b59bec5be2b9d5b05f20aed190adb3ad08a7abc" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + app_links_linux: + dependency: transitive + description: + name: app_links_linux + sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + app_links_platform_interface: + dependency: transitive + description: + name: app_links_platform_interface + sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + app_links_web: + dependency: transitive + description: + name: app_links_web + sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555 + url: "https://pub.dev" + source: hosted + version: "1.0.4" archive: dependency: transitive description: @@ -455,34 +487,34 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: "2b50e938a275e1ad77352d6a25e25770f4130baa61eaf02de7a9a884680954ad" + sha256: "0d9035862236fe38250fe1644d7ed3b8254e34a21b2c837c9f539fbb3bba5ef1" url: "https://pub.dev" source: hosted - version: "20.1.0" + version: "21.0.0" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - sha256: dce0116868cedd2cdf768af0365fc37ff1cbef7c02c4f51d0587482e625868d0 + sha256: e0f25e243c6c44c825bbbc6b2b2e76f7d9222362adcfe9fd780bf01923c840bd url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "8.0.0" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "23de31678a48c084169d7ae95866df9de5c9d2a44be3e5915a2ff067aeeba899" + sha256: e7db3d5b49c2b7ecc68deba4aaaa67a348f92ee0fef34c8e4b4459dbef0d7307 url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "11.0.0" flutter_local_notifications_windows: dependency: transitive description: name: flutter_local_notifications_windows - sha256: e97a1a3016512437d9c0b12fae7d1491c3c7b9aa7f03a69b974308840656b02a + sha256: "3a2654ba104fbb52c618ebed9def24ef270228470718c43b3a6afcd5c81bef0c" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" flutter_material_color_picker: dependency: "direct main" description: @@ -610,6 +642,14 @@ packages: url: "https://pub.dev" source: hosted version: "17.1.0" + gtk: + dependency: transitive + description: + name: gtk + sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c + url: "https://pub.dev" + source: hosted + version: "2.1.0" hive: dependency: "direct main" description: @@ -794,10 +834,10 @@ packages: dependency: transitive description: name: matcher - sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.18" + version: "0.12.19" material_color_utilities: dependency: transitive description: @@ -1367,34 +1407,34 @@ packages: dependency: transitive description: name: test - sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a" + sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7" url: "https://pub.dev" source: hosted - version: "1.29.0" + version: "1.30.0" test_api: dependency: transitive description: name: test_api - sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.9" + version: "0.7.10" test_core: dependency: transitive description: name: test_core - sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943" + sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51" url: "https://pub.dev" source: hosted - version: "0.6.15" + version: "0.6.16" timezone: dependency: transitive description: name: timezone - sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1 + sha256: "784a5e34d2eb62e1326f24d6f600aaaee452eb8ca8ef2f384a59244e292d158b" url: "https://pub.dev" source: hosted - version: "0.10.1" + version: "0.11.0" typed_data: dependency: transitive description: @@ -1693,4 +1733,4 @@ packages: version: "3.1.3" sdks: dart: ">=3.11.0 <4.0.0" - flutter: ">=3.41.3" + flutter: ">=3.41.4" diff --git a/pubspec.yaml b/pubspec.yaml index 37b0593..462328a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,11 +5,12 @@ publish_to: none environment: sdk: ">=3.0.0 <4.0.0" - flutter: "3.41.3" + flutter: "3.41.4" dependencies: adaptive_theme: ^3.2.0 animations: ^2.0.8 + app_links: ^7.0.0 badges: ^3.0.2 bloc: ^9.0.0 bloc_concurrency: ^0.3.0 @@ -30,7 +31,7 @@ dependencies: flutter_fadein: ^2.0.0 flutter_feather_icons: 2.0.0+1 flutter_inappwebview: ^6.1.5 - flutter_local_notifications: ^20.1.0 + flutter_local_notifications: ^21.0.0 flutter_material_color_picker: ^1.2.0 flutter_native_splash: ^2.4.4 flutter_secure_storage: ^10.0.0 diff --git a/submodules/flutter b/submodules/flutter index 48c32af..ff37bef 160000 --- a/submodules/flutter +++ b/submodules/flutter @@ -1 +1 @@ -Subproject commit 48c32af0345e9ad5747f78ddce828c7f795f7159 +Subproject commit ff37bef603469fb030f2b72995ab929ccfc227f0