firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.69k stars 3.97k forks source link

[firebase_dynamic_links] Keep obtaining same information from the first link resolved after installation #1833

Closed leejh10003 closed 3 years ago

leejh10003 commented 4 years ago

I open another issue similar to #692, which seems to be closed

Describe the bug Handling dynamic link in WidgetsBindingObserver's didChangeAppLifecycleState method always handle initial used dynamic link address on iOS

To Reproduce Steps to reproduce the behavior:

  1. First, tap first dynamic link in memo app on iPhone(XS, iOS13.3) after initial installation
  2. It works as expected
  3. Then tap another link
  4. Still obtaining informations from first link

Expected behavior Second dynamic link tap must resolve different information from first one

Additional context

This is my implementation of handling and generating of dynamic link

//Link generation code
final DynamicLinkParameters parameters = DynamicLinkParameters(
    uriPrefix: "<MY-FIREBASE-DYNAMIC-LINK-PREFIX>",
    link: Uri.parse("<MY-FIREBASE-DYNAMIC-LINK-PREFIX>/product/${widget.id}")
  );
  final Uri dynamicUrl = (await parameters.buildShortLink()).shortUrl;
  print(dynamicUrl);
  Share.share(dynamicUrl.toString());
//Link resolve code
class CustomWidgetState extends State<CustomWidget> with WidgetsBindingObserver{
  Timer _timerLink;
  //...
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
  }
  @override
  void didChangeAppLifecycleState(AppLifecycleState state) async{
    if (state == AppLifecycleState.resumed){
      _timerLink = new Timer(const Duration(milliseconds: 850), () {
        retrieveDynamicLink(context);
      });
    }
  }
}
//...
void retrieveDynamicLink(BuildContext context) async {
  final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
  final Uri deepLink = data?.link;
    print(deepLink.pathSegments);
  }
}

This is result from flutter doctor command:

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    βœ— Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[βœ“] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[βœ“] Android Studio (version 3.5)
[βœ“] VS Code (version 1.41.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

My detailed flutter version is:

* stable 27321ebba v1.12.13+hotfix.5 cherry-picks (#46726)

And this is my flutter pubspec.yml except app's name , description, version

As you see in my podfile.lock, I'm using 0.5.0+9 version of firebase_dynamic_links

module:
  androidX: true
environment:
  sdk: ^2.4.0
  flutter: ^1.7.0

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.0+2
  share: ^0.6.3+5
  flutter_slidable: "^0.5.4"
  json_serializable: ^3.2.2
  firebase_core: ^0.4.0+9
  firebase_analytics: ^5.0.2
  graphql_flutter: ^2.1.1-beta.4
  cupertino_icons: ^0.1.2
  iamport_flutter: ^0.9.3
  intl: ^0.16.0
  provider: ^3.0.0+1
  carousel_slider: ^1.3.0
  flutter_kakao_login: "^0.5.0"
  flutter_secure_storage: ^3.3.1+1
  firebase_dynamic_links: ^0.5.0+9
  jaguar_jwt: ^2.1.6
  autocomplete_textfield: ^1.6.4
  native_widgets: ^1.3.5
  flutter_typeahead: ^1.7.0
  badges: ^1.1.0
  tuple: ^1.0.3
  firebase_messaging: ^5.1.6
  flutter_datetime_picker: ^1.2.8
  loadmore: ^1.0.4
  validators: ^2.0.0+1

dev_dependencies:
  pedantic: ^1.8.0

Finally, this is my Podfile.lock(checksum removed)

PODS:
  - connectivity (0.0.1):
    - Flutter
    - Reachability
  - Firebase/Analytics (6.15.0):
    - Firebase/Core
  - Firebase/Core (6.15.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 6.2.1)
  - Firebase/CoreOnly (6.15.0):
    - FirebaseCore (= 6.6.0)
  - Firebase/DynamicLinks (6.15.0):
    - Firebase/CoreOnly
    - FirebaseDynamicLinks (~> 4.0.6)
  - Firebase/Messaging (6.15.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (~> 4.2.0)
  - firebase_analytics (0.0.1):
    - Firebase/Analytics (~> 6.0)
    - Firebase/Core
    - Flutter
  - firebase_core (0.0.1):
    - Firebase/Core
    - Flutter
  - firebase_dynamic_links (0.1.0):
    - Firebase/DynamicLinks
    - Flutter
  - firebase_messaging (0.0.1):
    - Firebase/Core
    - Firebase/Messaging
    - Flutter
  - FirebaseAnalytics (6.2.1):
    - FirebaseCore (~> 6.6)
    - FirebaseInstanceID (~> 4.3)
    - GoogleAppMeasurement (= 6.2.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (= 0.3.9011)
  - FirebaseAnalyticsInterop (1.5.0)
  - FirebaseCore (6.6.0):
    - FirebaseCoreDiagnostics (~> 1.2)
    - FirebaseCoreDiagnosticsInterop (~> 1.2)
    - GoogleUtilities/Environment (~> 6.5)
    - GoogleUtilities/Logger (~> 6.5)
  - FirebaseCoreDiagnostics (1.2.0):
    - FirebaseCoreDiagnosticsInterop (~> 1.2)
    - GoogleDataTransportCCTSupport (~> 1.3)
    - GoogleUtilities/Environment (~> 6.5)
    - GoogleUtilities/Logger (~> 6.5)
    - nanopb (~> 0.3.901)
  - FirebaseCoreDiagnosticsInterop (1.2.0)
  - FirebaseDynamicLinks (4.0.6):
    - FirebaseAnalyticsInterop (~> 1.3)
    - FirebaseCore (~> 6.2)
  - FirebaseInstallations (1.1.0):
    - FirebaseCore (~> 6.6)
    - GoogleUtilities/UserDefaults (~> 6.5)
    - PromisesObjC (~> 1.2)
  - FirebaseInstanceID (4.3.0):
    - FirebaseCore (~> 6.6)
    - FirebaseInstallations (~> 1.0)
    - GoogleUtilities/Environment (~> 6.5)
    - GoogleUtilities/UserDefaults (~> 6.5)
  - FirebaseMessaging (4.2.0):
    - FirebaseAnalyticsInterop (~> 1.5)
    - FirebaseCore (~> 6.6)
    - FirebaseInstanceID (~> 4.3)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.5)
    - GoogleUtilities/Environment (~> 6.5)
    - GoogleUtilities/Reachability (~> 6.5)
    - GoogleUtilities/UserDefaults (~> 6.5)
    - Protobuf (>= 3.9.2, ~> 3.9)
  - Flutter (1.0.0)
  - flutter_kakao_login (0.0.8):
    - Flutter
    - KakaoOpenSDK (~> 1.17.2)
  - flutter_keyboard_visibility (0.7.0):
    - Flutter
  - flutter_secure_storage (3.3.1):
    - Flutter
  - flutter_webview_plugin (0.0.1):
    - Flutter
  - GoogleAppMeasurement (6.2.1):
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (= 0.3.9011)
  - GoogleDataTransport (3.3.0)
  - GoogleDataTransportCCTSupport (1.3.0):
    - GoogleDataTransport (~> 3.3)
    - nanopb (~> 0.3.901)
  - GoogleUtilities/AppDelegateSwizzler (6.5.0):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (6.5.0)
  - GoogleUtilities/Logger (6.5.0):
    - GoogleUtilities/Environment
  - GoogleUtilities/MethodSwizzler (6.5.0):
    - GoogleUtilities/Logger
  - GoogleUtilities/Network (6.5.0):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (6.5.0)"
  - GoogleUtilities/Reachability (6.5.0):
    - GoogleUtilities/Logger
  - GoogleUtilities/UserDefaults (6.5.0):
    - GoogleUtilities/Logger
  - iamport_flutter (0.0.1):
    - Flutter
  - KakaoOpenSDK (1.17.2):
    - KakaoOpenSDK/KakaoCommon (= 1.17.2)
    - KakaoOpenSDK/KakaoLink (= 1.17.2)
    - KakaoOpenSDK/KakaoMessageTemplate (= 1.17.2)
    - KakaoOpenSDK/KakaoNavi (= 1.17.2)
    - KakaoOpenSDK/KakaoOpenSDK (= 1.17.2)
  - KakaoOpenSDK/KakaoCommon (1.17.2)
  - KakaoOpenSDK/KakaoLink (1.17.2):
    - KakaoOpenSDK/KakaoCommon
  - KakaoOpenSDK/KakaoMessageTemplate (1.17.2)
  - KakaoOpenSDK/KakaoNavi (1.17.2):
    - KakaoOpenSDK/KakaoCommon
  - KakaoOpenSDK/KakaoOpenSDK (1.17.2)
  - nanopb (0.3.9011):
    - nanopb/decode (= 0.3.9011)
    - nanopb/encode (= 0.3.9011)
  - nanopb/decode (0.3.9011)
  - nanopb/encode (0.3.9011)
  - path_provider (0.0.1):
    - Flutter
  - PromisesObjC (1.2.8)
  - Protobuf (3.11.2)
  - Reachability (3.2)
  - share (0.5.2):
    - Flutter
  - uni_links (0.0.1):
    - Flutter
  - url_launcher (0.0.1):
    - Flutter

DEPENDENCIES:
  - connectivity (from `.symlinks/plugins/connectivity/ios`)
  - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
  - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
  - firebase_dynamic_links (from `.symlinks/plugins/firebase_dynamic_links/ios`)
  - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
  - Flutter (from `Flutter`)
  - flutter_kakao_login (from `.symlinks/plugins/flutter_kakao_login/ios`)
  - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
  - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
  - flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
  - iamport_flutter (from `.symlinks/plugins/iamport_flutter/ios`)
  - path_provider (from `.symlinks/plugins/path_provider/ios`)
  - share (from `.symlinks/plugins/share/ios`)
  - uni_links (from `.symlinks/plugins/uni_links/ios`)
  - url_launcher (from `.symlinks/plugins/url_launcher/ios`)

SPEC REPOS:
  trunk:
    - Firebase
    - FirebaseAnalytics
    - FirebaseAnalyticsInterop
    - FirebaseCore
    - FirebaseCoreDiagnostics
    - FirebaseCoreDiagnosticsInterop
    - FirebaseDynamicLinks
    - FirebaseInstallations
    - FirebaseInstanceID
    - FirebaseMessaging
    - GoogleAppMeasurement
    - GoogleDataTransport
    - GoogleDataTransportCCTSupport
    - GoogleUtilities
    - KakaoOpenSDK
    - nanopb
    - PromisesObjC
    - Protobuf
    - Reachability

EXTERNAL SOURCES:
  connectivity:
    :path: ".symlinks/plugins/connectivity/ios"
  firebase_analytics:
    :path: ".symlinks/plugins/firebase_analytics/ios"
  firebase_core:
    :path: ".symlinks/plugins/firebase_core/ios"
  firebase_dynamic_links:
    :path: ".symlinks/plugins/firebase_dynamic_links/ios"
  firebase_messaging:
    :path: ".symlinks/plugins/firebase_messaging/ios"
  Flutter:
    :path: Flutter
  flutter_kakao_login:
    :path: ".symlinks/plugins/flutter_kakao_login/ios"
  flutter_keyboard_visibility:
    :path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
  flutter_secure_storage:
    :path: ".symlinks/plugins/flutter_secure_storage/ios"
  flutter_webview_plugin:
    :path: ".symlinks/plugins/flutter_webview_plugin/ios"
  iamport_flutter:
    :path: ".symlinks/plugins/iamport_flutter/ios"
  path_provider:
    :path: ".symlinks/plugins/path_provider/ios"
  share:
    :path: ".symlinks/plugins/share/ios"
  uni_links:
    :path: ".symlinks/plugins/uni_links/ios"
  url_launcher:
    :path: ".symlinks/plugins/url_launcher/ios"

SPEC CHECKSUMS:
  //Remove useless information...

PODFILE CHECKSUM: //Remove useless information...

COCOAPODS: 1.8.4
Salakar commented 3 years ago

As far as I'm aware this was fixed a while back so I'm going to close in favour of trying the latest plugin versions now and that if it's still a problem then could you raise a new up to date GitHub issue (as this one is so out of date).