Firebase Dynamic Link Android iosParameters setFallbackUrl ('ifl') doesn't set - firebase

I have just an Android app and no iOS app. So I was trying to set a fallback url (to our web content) when any iOS user clicks on the dynamic link.
I am constructing a firebase dynamic link using the dynamic-links-ktx apis like this:
Firebase.dynamicLinks.shortLinkAsync(ShortDynamicLink.Suffix.SHORT) {
androidParameters(BuildConfig.APPLICATION_ID) {
fallbackUrl = Uri.parse(webUrl)
}
iosParameters(BuildConfig.APPLICATION_ID) {
setFallbackUrl(Uri.parse(webUrl)) // Show web content. <- This doesn't work
}
link = Uri.parse(finalUrl)
domainUriPrefix = "https://prefix-url"
socialMetaTagParameters {
...
}
}.addOnSuccessListener { result ->
onSuccess(result.shortLink)
}.addOnFailureListener {
// Log error
}
So, this way I create the deep link. I don't have an ios app so obviously I cannot set ios bundle name etc so I am setting just setFallbackUrl in iosParameters.
Somehow this doesn't work. On viewing the deeplink flowchart, ios doesnt resolve to the fallback url. Am i missing something here?

You need to have ibi (iOS ID) set for the ifl (iOS fallback link) to work.
I think this is an oversight by the Firebase team, it makes sense to either use ofl or let us set ifl instead of the deeplink when the app doesn't exist on iOS, but it is what it is.

Related

ChromeOS kiosk limitations: bypass framekiller

I'm developing a ChromeOS kiosk application (website + chrome extension) which suppose to run in Kiosk Mode on managed Chromebook devices. Application displays external web content which I don't own, I'm using sandboxed iframes to display that web content. These external websites should not escape their iframes, that's why I sandbox them. The app is basically a simple web browser but instead of tabs I use iframes, and the top frame (window.top) is the wrapper around these iframes.
With all ChromeOS technical limitations I was able to bypass most of the iframe checks (x-frame-options, csp, blocked 302...) using the extension. However there is one I'm stuck with - framekillers. I can't properly display websites which do self !== top type of checks.
Is there a way to bypass it too somehow? I'm fine with refactoring my app completely or use something else instead of iframe. The app has to fulfil only one condition though - kiosk mode on a managed chromebook.
It's unfortunate that Chrome Apps with <webview> tag were deprecated and Android apps can't run in Kiosk mode anymore. This would solve all my issues easily by just using something else than iframes.
I've tried injecting the following buster <script> via a content script but it doesn't seem to work, websites seems to be doing something more advanced.
buster.ts
function buster() {
if (top !== self) {
(window.self as any) = window.top;
(window.parent as any) = window.top;
}
}
buster();
content-script.ts
const b = document.createElement('script');
b.src = chrome.runtime.getURL('buster.js');
const el = document.head || document.documentElement;
el.insertBefore(b, el.firstChild);
console.debug('buster is injected');
solution based on #wOxxOm comment (for MV3 extension):
background.ts
chrome.scripting.registerContentScripts([
{
allFrames: true,
id: 'some-id',
js: ['buster.js'],
matches: ['<all_urls>'],
runAt: 'document_start',
world: 'MAIN',
},
]);
buster.ts
function buster() {
if (top !== self) {
(window.self as any) = window.top;
}
}
buster();

How to display Cloudinary assets (integrated from Contentful) with Next.js 13?

I have been recently exploring Contentful CMS and I have been trying to display Cloudinary images/videos that I already placed in Contentful Content Model (JSON field with Cloudinary app applied) into Next.js 13 (I'm using their starter guide: https://www.contentful.com/nextjs-starter-guide/), but I'm pretty new to this so I get stuck lots of times. I have tried to watch their video on how to integrate Cloudinary from Contentful and Next.js but I get confused on how and where they got their GraphQL queries.
My code is basically the same with their example here: https://github.com/vercel/next.js/tree/canary/examples/cms-contentful. Its just a matter on how to connect a content JSON to display the Cloudinary app I installed in Contentful. I don't see lots of examples to display Cloudinary assets to Next.js, unless you can tell me otherwise...
If you have any resources or advice you can point me too, I would be happy to hear them out.
To fetch the data from the Cloudinary app, you will have to modify the GraphQL query. In my example, I added the Cloudinary app and connected it with the Cloudinary App JSON field as shown in the screenshot below.
Now, to fetch the data from that field, I just had to add cloudinaryApp in my GraphQL query. So now my query looks like:
const POST_GRAPHQL_FIELDS = `
slug
title
cloudinaryApp
date
author {
name
picture {
url
}
}
excerpt
content {
json
links {
assets {
block {
sys {
id
}
url
description
}
}
}
}
`
I hope this helps :)

Loading local file inside an iframe in Electron

I've tried different approaches but all are problematic.
So first of all I was using webview, but as per electron documentation, this tag is undergoing major architectural changes and it's recommended to use iframe or other alternatives. Furthermore, the webview tag gives me a warning while used alongside VueJS that the component is not registered. I understand this component doesn't exist within HTML standards and is something specific to electron, so I am not sure how to tell Vue to ignore or recognize it in the use case of an electron app.
Coming to the iframe problem, approach one of loading the file directly via src, gives me the obvious error Not allowed to load local resource:. Turning off webSecurity though allows the file to load but I read it's not recommended to turn it off. I am not sure if there are specific use case where it's safe to turn it off or shouldn't be at all.
I decided to try via file protocol as I already have it in place. The protocol code:
protocol.registerFileProtocol('downloads', (request, callback) => {
const url = request.url.substring('downloads:///'.length)
const location = path.normalize(paths.downloads(url))
callback({ path: location })
})
Though when I load the file this way, the renderer process crash without errors. Is there something in addition to the above which would help loading local files via iframe?
Edit 1
My use case is the following: I have a typical entry point to an index.html which contains code for a VueJS app.
if (app.isPackaged) {
window.loadFile(join(__dirname, '../renderer/index.html'))
} else {
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}`
window.loadURL(url)
window.webContents.openDevTools()
}
Inside that VueJS app, I require to list html files from a directory. I am able to achieve so via webview but I have tried to move away from it for the reason mentioned above. I tried using iframe but encountered issues as well. If there's a setting that doesn't turn off all security and allows me to load the file via iframe, that would be ideal.
This is kind of the reverse of this question where they're using an iframe, running into the "not allowed to load local resource" and being told to use a <webview> instead.
The <webview> docs list BrowserView as another alternative which is what I would recommend here. That should be much easier to work with than an iframe.
const { app, BrowserView, BrowserWindow } = require('electron')
app.whenReady().then(() => {
const win = new BrowserWindow()
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadFile('<yourFile>')
})
Even though it is not recommended to use webview tag, I decided to go forward as it's the only thing that works for me. The only issue then was this error where Vue does not recognize the tag. To work around that error/warning, I had to update my vite.js config:
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag === 'webview'
}
}
}),
// ...

How to Check Mobile/Web in HTML Meteor?

How to check Mobile/Web in HTML Meteor for loading UI? .
if mobile //here how to check if it is mobile or web
{
{{>template}}// mobile body
}
else
{
{{>template}}//web body
}
I am new to Meteor. So please suggest me what to do?
You can do that easily with device-detection package.
First, install it via:
meteor add mystor:device-detection
Then you can use the provided helper methods like Meteor.Device.isPhone(), or directly from Spacebars: {{#if isPhone}}Phone{{/if}}. See the readme on Github for details.
If you simply want to check whether the app is running on a mobile environment you can use:
if(Meteor.isCordova)
Check out the other functions as well
If someone is still looking for this, he can try this JS test:
if (/Mobi/.test(navigator.userAgent)) {
//on Mobile
}else{
//not on mobile
}

Open PDF in the PhoneGap App that is made in HTML and CSS

I have a strange problem with my iPad App in Phone Gap. The problem is that I have to open PDF document in my app through links and when I click the link which opens the PDF, it shows me the PDF document with no back link.
Hence, when I open the PDF document in my app through a link, it takes me to a dead end and there is no way I can go back to the main page of my app.
My question is that how can I have a Top-Bar, when I open a PDF which could take me back to my home page? Any internal element for the iPad may be?
Thanks a lot.
Try using the In App Browser plugin.
If you're using a later Phonegap / Cordova version (2.8.0, 2.9.0 etc) it should come with it - nothing else to install.
http://docs.phonegap.com/en/2.9.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser
It will allow you to open the PDF in the a new 'window' that overlays your app. It has a 'Done' button that users can use to close it and return to your app when they are finished.
You would open the PDF using the In-App Browser, using something like this:
window.open('http://whitelisted-url.com/pdftoopen.pdf', '_blank');
I.e. the _blank option triggers the In-App Browser plugin. If you were to use _system instead it might open it in iBooks (just guessing there - not 100% sure if it would use iBooks).
Try prefixing https://docs.google.com/viewer?url= in the URL
like, window.open('https://docs.google.com/viewer?url=http://www.example.com/example.pdf&embedded=true', '_blank', 'location=yes');
Try this to open any kind of documents from URL using following steps:
install this plugin : cordova plugin add https://github.com/ti8m/DocumentHandler
use this code :
handleDocumentWithURL(function() { console.log('success'); }, function(error) { console.log('failure'); if (error == 53) { console.log('No app that handles this file type.'); } }, 'http://www.example.com/path/to/document.pdf');
It works for me both on Android and IOS. I used it for open images and PDF files.
Android : It opens files using system apps if available, otherwise it give an error, which you can handle.
IOS : It opens files in popup like view with Done button and Option button.
It doesn't show your docs URL.
Source is available here : https://github.com/ti8m/DocumentHandler
Thanks asgeo1,
I solved it by using window.open().
<img src="images/samplens.jpg" border="0" />
Hope it helps.
I've ended up using WebIntent
as described here. The tricky part was to modify WebIntent.java to properly identify file type:
String type = obj.has("type") ? obj.getString("type") : null;
// New code starts
Uri uri = obj.has("url") ? Uri.parse(obj.getString("url")) : null;
String extension = MimeTypeMap.getFileExtensionFromUrl(obj.getString("url"));
if(extension != null){
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
type = mimeTypeMap.getMimeTypeFromExtension(extension);
}
// New code ends
JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;

Resources