My code to create a dynamic link is as follows:
Future<Uri?> createDynamicLinkForThisSite(String userUID, String? siteUID) async {
if (siteUID == null || siteUID.isEmpty) return null;
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://s--**-er.page.link', // This should also be updated in Android Manifest.com under intent filters
link: Uri.parse('https://sna***per.com/?ownerID=$userUID&siteID=$siteUID'),
androidParameters: AndroidParameters(
fallbackUrl: Uri.parse('https://sna***per.com'),
packageName: 'uk.co.e*l**a.sna**er',
minimumVersion: 1,
),
iosParameters: IOSParameters(
bundleId: 'uk.co.e--n.sn--er',
fallbackUrl: Uri.parse('https://sn--er.com'),
ipadFallbackUrl: Uri.parse('https://sn--er.com'),
ipadBundleId: 'uk.co.ee--an.sn--er',
minimumVersion: '0',
appStoreId: '14--66',
),
navigationInfoParameters: const NavigationInfoParameters(
forcedRedirectEnabled: false,
),
//dynamicLinkParametersOptions: DynamicLinkParametersOptions(
// shortDynamicLinkPathLength: ShortDynamicLinkPathLength.short,
//),
);
var dynamicLinks = FirebaseDynamicLinks.instance;
return (await dynamicLinks.buildShortLink(parameters)).shortUrl;
}
I have 'Associated Dynamic Links active in developer account and also in Xcode.
When I click on the dynamic link on an iOS device I get the following screen:
The clicking on the button gives me the fallback url:
This works fine on android. What am I doing wrong here please?
Related
So I have already configured 2 sub domains in Firebase hosting and I have a Flutter web version app it's running on these domains but I also want to use dynamic links and I linked one of these sub domains to it and to my Flutter app but whenever I generate a dynamic link it navigates me to the web version
This is my firebase.json file
{
"hosting": {
"public": "build/web",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
},
{ "source": "/**", "dynamicLinks": true },
{
"source": "/links/**",
"dynamicLinks": true
}
]
}
}
EDIT:
I tried to move the last part /links/ before the destination part but when generating the long url in the app I get the same error page wasn't found
this is my code :
FirebaseDynamicLinks dynamicLinks = FirebaseDynamicLinks.instance;
Future<String> builDynamicLinks(String? id, {bool isFamily = false}) async {
final DynamicLinkParameters parameters = DynamicLinkParameters(
// The Dynamic Link URI domain. You can view created URIs on your Firebase console
uriPrefix: 'https://links.nanny-finder.app/links',
// The deep Link passed to your application which you can use to affect change
link: Uri.parse(
'https://links.nanny-finder.app/links/${isFamily ? "families" : "nannies"}?id=$id'),
// Android application details needed for opening correct app on device/Play Store
androidParameters: AndroidParameters(
packageName: 'com.mickaelrobin.nannyfinderuae',
fallbackUrl: playStore),
// iOS application details needed for opening correct app on device/App Store
iosParameters: IOSParameters(
bundleId: 'com.mickaelrobin.nannyfinderuae', fallbackUrl: appStore),
);
final Uri uri = await dynamicLinks.buildLink(parameters);
print(uri);
return uri.toString();
}
and this is firebase console
I have created a method that generates a dynamic link, which can be shared with other people.
When the person I shared the link to, clicks the link and it happens that he has my app installed on his device, I want to redirect him to a particular screen. Right now it just opens the app and redirects the user to the home page.
So my question is this, How can I redirect the user to a screen of my choice inside my app, when he clicks the dynamic link?
buildDynamicLink() {
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: url,
link: Uri.parse('$url/$docId'),
androidParameters: AndroidParameters(
packageName: "package name",
minimumVersion: 0,
fallbackUrl: Uri.parse('some-url'),
),
iosParameters: IOSParameters(
bundleId: "package name",
minimumVersion: 0,
fallbackUrl: Uri.parse('some-url'),
),
socialMetaTagParameters: SocialMetaTagParameters(
description: '',
imageUrl: Uri.parse(imageUrl!),
title: title,
),
);
final dynamicLink = await FirebaseDynamicLinks.instance.buildShortLink(parameters);
final Uri shortUrl = dynamicLink.shortUrl;
await Share.share(some_parameters);
I am trying to open the Facebook app on a company page in Flutter but it keeps opening it in the web browser instead.
It's just a simple widget that outputs a row of social media icons from a list:
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class SocialMediaLinks extends StatelessWidget {
SocialMediaLinks({Key? key}) : super(key: key);
final List<Map<dynamic, dynamic>> icons = [
{
'name': 'twitter',
'launchUrl': 'twitter://PAGENAME',
'backupUrl': 'https://twitter.com/PAGENAME',
},
{
'name': 'facebook',
'launchUrl': 'fb://page/PAGEID',
'backupUrl': 'https://www.facebook.com/PAGENAME',
},
{
'name': 'instagram',
'launchUrl': 'instagram://PAGENAME',
'backupUrl': 'https://www.instagram.com/PAGENAME',
}
];
#override
Widget build(BuildContext context) {
return Row(
children: [
for (Map i in icons)
IconButton(
onPressed: () async {
await canLaunch(i['launchUrl'])
? launch(
i['launchUrl'],
forceSafariVC: false,
forceWebView: false,
)
: launch(
i['backupUrl'],
forceSafariVC: false,
forceWebView: false,
);
},
splashRadius: 30.0,
iconSize: 38.0,
icon: Image.asset(
"assets/images/icons/${i['name']}.png",
color: Colors.white,
),
),
],
);
}
}
Twitter and Instagram work and open in their apps but Facebook still only opens in the web browser. I've tried tonnes of solutions on stackoverflow but to no avail. Am I missing something?
Thanks.
I've observed a limitation with the supported URLs configured in the Facebook app. In Android at least, while the Facebook app has support for facebook.com, I noticed that the Facebook app opens when it's a link to a specific post i.e. https://www.facebook.com/$profileId/posts/$postId
However, the Facebook app seems to be unable to handle direct links to the profile or page i.e. https://www.facebook.com/$profileId
If you're linking to a profile/page in Facebook, you can pin a post in the profile/page and share the link of the Facebook post as a workaround. This should successfully open the Facebook app installed on the device.
I'm trying to get a simple audio stream playing in a Google Action cloud function. It won't deploy as it says there are errors in the code, but it's not saying where. Here's my code (note the alternatives in *** comments - confusing as I'm not sure which I should be using, having seen both!
const { conversation } = require('#assistant/conversation');
const functions = require('firebase-functions');
const { MediaObject, SimpleResponse } = require('actions-on-google');
const app = actionssdk() // *** or 'const app = conversation()' ?
app.handle("playStream", conv => { // *** or 'app.intent(...' ?
conv.ask(new SimpleResponse("Playing stream"));
conv.ask(new MediaObject({
name: 'My stream',
url: 'https://stream.redacted.url',
description: 'The stream',
icon: new Image({
url: 'https://image.redacted.url', alt: 'Media icon',
}),
}));
});
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);
You seem to be using a mix of actions-on-google and #assistant/conversation libraries. You should only be using one or the other, depending on what platform you are using.
If you are using the original Actions SDK, you should use actions-on-google. If you are using the new Actions SDK or Actions Builder, you should use #assistant/conversation.
The distinctions are different but will result in problems. actionssdk has an intent method but not a handle method, and vice versa for conversation. This can result in a syntax error. Also make sure you've imported everything, including Image.
const functions = require('firebase-functions')
const {
conversation,
Media,
Image,
} = require('#assistant/conversation')
const app = conversation()
app.handle("playStream", conv => {
conv.add("Playing stream");
conv.add(new Media({
mediaObjects: [{
name: 'Media name',
description: 'Media description',
url: 'https://actions.google.com/sounds/v1/cartoon/cartoon_boing.ogg',
image: {
large: new Image({
url: 'https://image.redacted.url',
alt: 'Media icon',
}),
}
}],
mediaType: 'AUDIO',
optionalMediaControls: ['PAUSED', 'STOPPED']
}));
})
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app)
If this still doesn't work, you should add what errors you're seeing in trying to deploy.
After I register a user a sweet alert comes out saying whether i was successful or not. I am not able to assert the same using protractor.
I've tried the answers in the related older posts, searched for documentations, found none.
My spec is:
it('should go to login page, navigate to register page and register new user', async () => {
const loginButton = element(by.id('loginButton'));
await loginButton.click();
const registerUserButton = element(by.id('registerUserButton'));
await registerUserButton.click();
// register page
const name = element(by.id('usersName'));
const password = element(by.id('password'));
const confirmPassword = element(by.id('confirmPassword'));
const email = element(by.id('email'));
const number = element(by.id('number'));
const gender = element(by.id('gender'));
const submitButton = element(by.id('submitButton'));
// giving values to form data input fields
await name.sendKeys('testUser');
await password.sendKeys('testUser123');
await confirmPassword.sendKeys('testUser123');
await email.sendKeys(new Date().toDateString().split(' ').join('') + new Date().getTime() + '#gmail.com');
await number.sendKeys('9712312323');
await gender.sendKeys('male');
await submitButton.click();
// checking alert
const alertDialog = await browser.driver.switchTo().alert();
expect(await alertDialog.getText()).toEqual('Success!! You\'ve successfully registered');
});
the sweetalert code is :
Swal.fire({
type: 'success',
title: 'Success!! You\'ve successfully registered',
text: 'You\'re provided with 50 free loyalty points. Welcome to Star Hotel',
timer: 50000,
confirmButtonText: 'Cool'
});
Error:
- Failed: no such alert
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64)
But the automation takes place fine and the user gets registered and an alert does pop out with the given successful message.
I didn't find any material regarding using locators for sweet alerts, but i am assuming at the core it is still javascript alert.