EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

Is it possible to use this plugin with the share plugin? #288

Open mMarcos208 opened 5 years ago

mMarcos208 commented 5 years ago

Código Share:

share: function (produto) {
      const msg = 'Vi esse produto no App das Lojas REDE e acho que você vai curtir:'
      var url = `<a href='lojasrede.mobile://${produto.productId}'>Veja no APP</a>` //  api.redirecionaApp(produto.productId)
      var options = {
        message: msg, // not supported on some apps (Facebook, Instagram)
        subject: 'Promoções Lojas REDE', // fi. for email
        url: url
      }
      // var str = 'Veja no App!'
      // var url = 'myapp.mobile://' //  api.redirecionaApp(produto.productId)
      window.plugins.socialsharing.shareWithOptions(options, this.onSuccess, this.onError)
    },
    onSuccess (result) {
      alert('Share completed? ' + result.completed) // On Android apps mostly return false even while it's true
      alert('Shared to app:  ' + result.app) // On Android result.app since plugin version 5.4.0 this is no longer empty. On iOS it's empty when sharing is cancelled (result.completed=false)
    },
    onError (msg) {
      alert('Sharing failed with message: ' + msg)
    },

Problem

The sharing plugin does not understand that my schema that opens the app (myapp.mobile) is a link, even though it wraps it inside an html tag, <a href = 'myapp.mobile: //' > Click </a>. Rendering is done as text rather than as HTML.

How can I make myapp.mobile: be understood as a link? Any suggestion?

I even created an API that does the redirection that even works but it did not go down.