Open leribol opened 6 years ago
Hello, A lot of the plugin has been rewritten since the last commit in this repo, including URL shares. Hopefully, I'll update it during the next weekend. For now, I recommend to inspect the data you receive in the handler, it should contain page URL and title (when shared from Safari), and adjust the handler body to your needs.
Thank you your reply. However, we could not get any data from handler, ie; we got "init alert" but we could not get any alert.
We built our project on ionic framework. May it be a problem.
Would you suggest anything about app.component.ts (root/src/app/..) constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { platform.ready().then(() => { /////////////////////your suggestion ? }); }
How do ,inspect the data within the app? I am also not wether its receiving data or not. How to check?
We want to achieve that (on ios); A user that views a web page on any browser in ios, hit share button, see out app and click it. After that, our app receives the url of the web page that user views (without any alert window etc..)
Up to now ( to check your plugin) We have
Finally, we have seen the app when we hit share button on safari.
However, for an ionic project, how we should modify your code (in usage part you wrote). I think we can not manage handler part.
You may see our version about handler part. And we can not see any alerts.
// Define your file handler window['plugins'].openwith.addHandler(myHandler);
function myHandler(intent) { alert('intent received'); alert(' text: ' + intent.text); // description to the sharing, for instance title of the page when shared URL from Safari
for (var i = 0; i < intent.items.length; ++i) { var item = intent.items[i]; alert(' type: ' + item.uti); // UTI. possible values: public.url, public.text or public.image alert(' type: ' + item.type); // Mime type. For example: "image/jpeg" alert(' data: ' + item.data); // shared data. For URLs and text - actually the shared URL or text. For image - its base64 string representation. alert(' text: ' + item.text); // text to share alongside the item. as we don't allow user to enter text in native UI, in most cases this will be empty. However for sharing pages from Safari this might contain the title of the shared page. alert(' name: ' + item.name); // suggested name of the image. For instance: "IMG_0404.JPG" alert(' utis: ' + item.utis); // some optional additional info } // ... // Here, you probably want to do something useful with the data // ... }
Could you help us what we should do, or where we are making mistake.
Thank you.