Pantrist-dev / capacitor-firebase-dynamic-links

Capacitor Plugin for Firebase Dynamic Links
MIT License
22 stars 13 forks source link

Dynamic Link on a desktop web browser #32

Open swapnaliDeveloper opened 1 year ago

swapnaliDeveloper commented 1 year ago

How to configure parameter for the desktop if deeplink get open on the browser to avoid following screen

image

As per the firebase documentation ofl parameter is required ? https://firebase.google.com/docs/dynamic-links/create-manually#parameters

image
swapnaliDeveloper commented 1 year ago

Hi , Tried out fallbackUrl ... But on the desktop it is not working...

NLueg commented 1 year ago

Hi there! Sorry for the late response. Can you clarify what exactly are you using as the config? Of course you can hide your concrete URLs. As I understand you should set the uri to make it work in the browser. This is the config that I use in my app:

        const configuration: LinkConfig = {
          domainUriPrefix: '<base-prefix>',
          uri: linkParameter ? `${uri}?${linkParameter}` : uri,
          androidParameters: {
            packageName: '...',
            fallbackUrl: '<base-url>',
          },
          iosParameters: {
            fallbackUrl: '<base-url>',
            bundleId: '...',
            appStoreId: '...',
            ipadBundleId: '...',
            ipadFallbackUrl: '<base-url>',
          },
          webApiKey: this.coreConfig.dynamicLinkApiKey,
          socialMeta,
        };

The uri is the base-url you want to have called in the Web. I also sometimes include additional queryParameter I attach with the linkParameter param.

swapnaliDeveloper commented 1 year ago

Hi sir , i m using following config

var uristring = "https://applnk.example.com?type1=" + type1 + "&type2=" + type2 ;
        const config: LinkConfig = {
          domainUriPrefix: 'https://applnk.example.com',
          uri: uristring,
          webApiKey : environment.firebase.apiKey,
          androidParameters: {
            packageName: "com.example.app",
            fallbackUrl: '<base-url>',
          },
          iosParameters: {
            bundleId: "com.example.app",
            fallbackUrl: '<base-url>',
            appStoreId: "...",
          }
        };
    FirebaseDynamicLinks.createDynamicShortLink(config).then(link => {
            console.log(link) 
          });
swapnaliDeveloper commented 1 year ago

Hi there! Sorry for the late response. Can you clarify what exactly are you using as the config? Of course you can hide your concrete URLs. As I understand you should set the uri to make it work in the browser. This is the config that I use in my app:

        const configuration: LinkConfig = {
          domainUriPrefix: '<base-prefix>',
          uri: linkParameter ? `${uri}?${linkParameter}` : uri,
          androidParameters: {
            packageName: '...',
            fallbackUrl: '<base-url>',
          },
          iosParameters: {
            fallbackUrl: '<base-url>',
            bundleId: '...',
            appStoreId: '...',
            ipadBundleId: '...',
            ipadFallbackUrl: '<base-url>',
          },
          webApiKey: this.coreConfig.dynamicLinkApiKey,
          socialMeta,
        };

The uri is the base-url you want to have called in the Web. I also sometimes include additional queryParameter I attach with the linkParameter param.

with given config also getting same output in browser as Invalid Dynamic Link

NLueg commented 1 year ago

Hm, hard to tell whats the issue. I can share a concrete concrete example with you: https://pantrist.page.link/MffBXeBdPQDNRqsB6

This is a link I created using this plugin with the parameter:

        const configuration: LinkConfig = {
          domainUriPrefix: 'https://pantrist.page.link',
          uri: `https://pantrist.app/receipts/receipt?uuid=1684583906794dsqcgwv8q`,
          androidParameters: { ... },
          iosParameters: { ... },
          webApiKey: this.coreConfig.dynamicLinkApiKey,
          socialMeta,
        };

Basically, the plugin only takes the prefix of your dynamic link and uses your uri to generate a Hash for the link like in the example.

Maybe the issue is that you use a concrete link as a domainUriPrefix? Like https://pantrist.page.link/sharing instead of https://pantrist.page.link

swapnaliDeveloper commented 1 year ago

Hello sir ... issue is solved :) "Maybe the issue is that you use a concrete link as a domainUriPrefix? Like https://pantrist.page.link/sharing instead of https://pantrist.page.link" This flow help me in rearranging configs ... and it works as required , applnk opens on the desktop browser with given web page and opens the app in mobile devices in android But in ios getting same issues as described in https://github.com/Pantrist-dev/capacitor-firebase-dynamic-links/issues/17