3

I'm currently incorporating Firebase Dynamic Links in Flutter to allow users to send training plans to one another. I shorten the URL before sending and the flow works as expected on most apps/messaging. However, on iMessage specifically, the sent message is pasting additional text. Would love any help on getting to the root of this problem!

final DynamicLinkParameters parameters = DynamicLinkParameters(
  // This should match firebase but without the username query param
  uriPrefix: 'https://trainsolosoccer.page.link',
  // This can be whatever you want for the uri, https://yourapp.com/groupinvite?username=$userName
  link: Uri.parse(
      'https://trainsolotest.page.link/planId?planId=$planId&userId=$userId&planName=$planName'),
  androidParameters: AndroidParameters(
    packageName: 'com.trainsolo',
    minimumVersion: 1,
  ),
  iosParameters: IosParameters(
    bundleId: 'com.trainsolo',
    minimumVersion: '1',
    appStoreId: appStoreId,
  ),
  socialMetaTagParameters: SocialMetaTagParameters(
      title: '${username} has shared a training plan with you!',
      description:
          "Please download the Trainsolo app to access ${username}'s plan along with hundreds of other drills ...",
      imageUrl: Uri.parse(
          "https://static.wixstatic.com/media/30d704_86712894e6964d56a397977a37080252~mv2.jpg")),
);
final ShortDynamicLink shortDynamicLink = await parameters.buildShortLink();
final Uri link = shortDynamicLink.shortUrl;
// Flutter package: https://pub.dev/packages/share
Share.share(link)

enter image description here

greysongy
  • 73
  • 4
  • Did you ever find a solution to this problem? I am having the exact same issue. The link works perfectly if copy/pasted into iMessage, but if the user shares to iMessage directly it only sends an ugly url that isn't clickable. – Dennis Ashford May 19 '22 at 11:43
  • Very interested for the solution. Having the same issue – fvisticot Aug 04 '22 at 06:59

1 Answers1

0

Not sure but searching in different places gave me some suggestions. Wring it here so you can try them.

Option 1. Try FirebaseDynamicLinks's build short link

final unguessableDynamicLink = await FirebaseDynamicLinks.instance.buildShortLink(
    dynamicLinkParams,
    shortLinkType: ShortDynamicLinkType.unguessable,
);

Option 2. Add a space Or some prefix text before the link and share that string.

Kaushik Chandru
  • 15,510
  • 2
  • 12
  • 30