A secondary window unexpectedly pops up on clicking notification (via OneSignal) in iOS - ios

Does anyone here have experience integrating push notifications on iOS on OneSignal with mobile apps built using Expo?
I have an app which opens a WebView and this WebView handles all the navigation (i.e. no app routes, instead web routes). The issue is that upon clicking a notification from OneSignal containing a launchURL (a web URL which is supposed to open in the WebView inside the app which I have handled programmatically), a bottom sheet (with a button "Done" on top-right) opens up instead.
You can view the video of the issue here.
My app.json:
{
"expo": {
"name": "Engage | Dev",
"scheme": "fudrengage",
"slug": "fudr-engage-app",
"version": "1.0.14",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "https://assets.fudr.in/assets/images/splash.png",
"resizeMode": "cover",
"backgroundColor": "#EB9658"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "in.fudr.devengage",
"associatedDomains": ["applinks:devengage.fudr.in"]
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "in.fudr.devengage",
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "devengage.fudr.in",
"pathPrefix": "/*"
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
]
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
[
"onesignal-expo-plugin",
{
"mode": "development",
"devTeam": "XXXXXX"
}
],
["./plugins/withAndroidVerifiedLinksWorkaround"]
],
"notification": {
"icon": "./assets/notification-icon.png",
"color": "#EB9658",
"androidMode": "default",
"androidCollapsedTitle": "Updates from Fudr",
"iosDisplayInForeground": true
},
"extra": {
"eas": {
"build": {
"experimental": {
"ios": {
"appExtensions": [
{
"targetName": "OneSignalNotificationServiceExtension",
"bundleIdentifier": "in.fudr.devengage.OneSignalNotificationServiceExtension",
"entitlements": {
"com.apple.security.application-groups": [
"group.in.fudr.devengage.onesignal"
]
}
}
]
}
}
},
"projectId": "xxxxxx"
}
}
}
}
Testing environment:
"react-native-onesignal": "4.4.1"
"onesignal-expo-plugin": "1.1.1"
"expo": "46.0.7"
iOS 16
"react-native": "0.69.5"

As per the OneSignal docs here, the launchURLs that trigger the browser in iOS as well as Android, can be suppressed by adding "OneSignal_suppress_launch_urls": true in the infoPlist key the ios section config in app.json
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.example.sub",
"associatedDomains": ["applinks:sub.example.com"],
"infoPlist": {
"OneSignal_suppress_launch_urls": true
}
},
My App.js was already handling launchURLs inside the WebView as shown below:
export default App = () => {
OneSignal.setAppId("xxxxxx");
const webviewRef = useRef(null);
const [webviewSourceURL, setWebviewSourceURL] = useState("");
useEffect(() => {
// Method for handling notifications opened
OneSignal.setNotificationOpenedHandler((notification) => {
const notificationId = notification?.notification?.notificationId ?? "";
const notificationLaunchUrl = notification?.notification?.launchURL;
const launchURL =
notificationId && notificationLaunchUrl
? `${notificationLaunchUrl}?notificationId=${notificationId}` // Append notificationId as a query parameter to generate a unique URL everytime a new notification is opened; this helps WebView know that it's a new visit
: "";
if (notificationId && launchURL) {
setWebviewSourceURL(launchURL);
}
});
}, []);
return() {
<WebView
ref={webviewRef}
originWhitelist={["*"]}
source={{
uri: webviewSourceURL || FALLBACK_URL,
}}
style={{ marginTop: 20, marginBottom: 5 }}
startInLoadingState={true}
renderLoading={LoadingIndicatorView}
onMessage={onMessage}
/>
}
}

Related

Create new tab from Firefox extension doesn't works

i'm trying to create a new tab from Firefox extension, but it doesn't works.
manifest.js:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"content_scripts": [
{
"matches": ["*://*.ebay.de/*"],
"js": ["background.js"]
}
],
"permissions": [
"tabs"
]
}
background.js:
createNewTab();
function onCreated(tab) {
console.log('Created new tab: ${tab.id}');
}
function onError(error) {
console.log('Error: ${error}');
}
function createNewTab()
{
let newTab = browser.tabs.create({
url:"https://www.ebay.de"
});
newTab.then(onCreated, onError);
};
What I'm doing wrong? (Everything works as expected in Chrome.)
Your background.js file is not actually a background script despite it's name, it's defined in your manifest.json as a content script.
Content scripts don't have access to the tabs API (see list of accessible APIs here).
To fix that, you need to move your background.js to be an actual background script:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs"
]
}

not able to notarize electron app using forge

hello I am building electron app for the mac platform and having trouble notarize the app using Forge and getting this error:
Packaging ApplicationWARNING: Code sign failed; please retry manually. Error: Command failed: spctl --assess --type execute --verbose --ignore-cache --no-cache /var/folders/q7//T/electron-packager/darwin-arm64/Integration-darwin-arm64/Integration.app
/var/folders/q7/*/T/electron-packager/darwin-arm64/Integration-darwin-arm64/Integration.app: rejected
source=Unnotarized Developer ID
my forge config
"forge": {
"packagerConfig": {
"appBundleId": "com.anyfolder.integrations",
"osxSign": {
"identity": "Developer ID Application: ****** (****)",
"hardened-runtime": true,
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"signature-flags": "library"
},
"osxNotarize": {
"appleId": "myid#id.com",
"appleIdPassword": "my-password"
},
"protocols": [
{
"name": "Any Folder",
"schemes": [
"electron-****"
]
}
],
"icon": "public/images/icon.ico"
},
"publishers": [
{
"name": "#electron-forge/publisher-s3",
"config": {
"bucket": "*******",
"folder": "integrations",
"public": true
}
},
{
"name": "#electron-forge/publisher-github",
"config": {
"repository": {
"owner": "****",
"name": "****"
},
"draft": false,
"prerelease": false
}
}
],
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"name": "integrations"
}
},
{
"name": "#electron-forge/maker-dmg",
"config": {
"icon": "public/images/icon.icns",
"format": "ULFO",
"name": "Name",
"overwrite": true,
"debug": true
}
}
],
"plugins": [
[
"#electron-forge/plugin-webpack",
{
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"html": "./src/render/imageEditor/index.html",
"js": "./src/render/imageEditor/index.tsx",
"name": "capture_window",
"preload": {
"js": "./src/render/imageEditor/preload.ts"
}
},
{
"name": "main_window",
"html": "./src/index.html",
"js": "./src/render/main/index.tsx",
"preload": {
"js": "./src/render/main/preload.ts"
}
},
{
"name": "integrations_menu",
"html": "./src/index.html",
"js": "./src/render/integrations/index.tsx",
"preload": {
"js": "./src/render/integrations/preload.ts"
}
}
]
}
}
]
]
}

Error with facebook login, react-native ios expo

I have a problem with my mobile app
The problems is with the facebook login, but only in IOS
It already works in android (even in production)
Instead in IOS does not work in production, it only works in the XCODE emulator
My app.json looks like this:
{
"expo": {
"name": "MyUniqueName",
"facebookScheme":"fbMyFbAppId",
"facebookAppId":"MyFbAppId",
"facebookDisplayName":"MyUniqueName",
"description": "This project is really great.",
"slug": "MyUniqueName",
"privacy": "public",
"sdkVersion": "30.0.0",
"platforms": ["ios", "android"],
"version": "1.0.1",
"orientation": "portrait",
"icon": "./assets/favicon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover",
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.myCompany.myCompany",
"infoPlist": {
"LSApplicationQueriesSchemes": [
"fbapi","fb-messenger-share-api","fbauth2","fbshareextension"
]
}
},
"android": {
"versionCode": 2,
"package": "com.myCompany.myCompany"
},
}
}
My facebook console:
console facebook
I printed the error but only I get this:
app screenshot
I hope you are using Facebook.logInWithReadPermissionsAsync. If so,
Add behavior: 'web' as below.
It worked for me in Expo client and production as well.
Facebook.logInWithReadPermissionsAsync(Config.loginSetup.facebookID,
{
permissions: ['public_profile','email'],
behavior: 'web'
})

OData don't connect with SAP Web IDE (local installation)

I used automatical OData connection with SAP Web IDE. Unfortunately, Data don't connect and Layout Editor says that Data Set "not defined". I have tried to connect by coding, for example <Table items={/Stats}>, but it doesn't work either. When I use project template (Master-Detail or Worklist), there are no problems with connection and Data is automatically connecting, but when I want to make my project and make a connection, there are always some problems.
Component.js
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"Statusverwaltung/model/models"
], function(UIComponent, Device, models) {
"use strict";
return UIComponent.extend("Statusverwaltung.Component", {
metadata: {
manifest: "json"
},
config : {
"resourceBundle" : "i18n/i18n.properties",
"titleResource" : "SHELL_TITLE",
"serviceConfig" : {
name: "UI5STAT1_SRV",
serviceUrl: "/sap/opu/odata/kernc/UI5STAT1_SRV/"
}
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* #public
* #override
*/
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
// set the device model
this.setModel(models.createDeviceModel(), "device");
}
});
});
Manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "Statusverwaltung",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"sourceTemplate": {
"id": "servicecatalog.connectivityComponent",
"version": "0.0.0"
},
"dataSources": {
"UI5STAT1_SRV": {
"uri": "/sap/opu/odata/kernc/UI5STAT1_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "webapp/localService/UI5STAT1_SRV/metadata.xml"
}
}
}
},
"sap.ui": {
"_version": "1.1.0",
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone#2": "",
"tablet": "",
"tablet#2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_hcb", "sap_bluecrystal"]
},
"sap.ui5": {
"_version": "1.1.0",
"rootView": {
"viewName": "Statusverwaltung.view.View",
"type": "XML"
},
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Statusverwaltung.i18n.i18n"
}
}
},
"resources": {
"css": [{
"uri": "css/style.css"
}]
},
"routing": {
"targets": {
"View": {
"viewType": "XML",
"transition": "slide",
"clearAggregation": true,
"viewName": "View",
"viewId": "View"
}
}
}
}
}
neo-app.json
{
"welcomeFile": "/webapp/index.html",
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
},
{
"path": "/sap/opu/odata",
"target": {
"type": "destination",
"name": "v01",
"entryPath": "/sap/opu/odata"
},
"description": "V01 description"
}
],
"sendWelcomeFileRedirect": true
}
.project.json
{
"projectType": [
"sap.watt.uitools.ide.fiori",
"sap.watt.uitools.ide.web",
"sap.watt.saptoolsets.fiori.project.ui5template.smartProject",
"sap.watt.saptoolsets.fiori.project.uiadaptation"
],
"build": {
"targetFolder": "dist",
"sourceFolder": "webapp"
},
"generation": [
{
"templateId": "ui5template.basicSAPUI5ApplicationProject",
"templateVersion": "1.32.0",
"dateTimeStamp": "Mon, 17 Oct 2016 08:28:52 GMT"
},
{
"templateId": "servicecatalog.connectivityComponent",
"templateVersion": "0.0.0",
"dateTimeStamp": "Mon, 17 Oct 2016 10:10:52 GMT"
},
{
"templateId": "uiadaptation.changespreviewjs",
"templateVersion": "0.0.0",
"dateTimeStamp": "Tue, 18 Oct 2016 08:08:06 GMT"
}
],
"translation": {
"translationDomain": "",
"supportedLanguages": "en,fr,de",
"defaultLanguage": "en",
"defaultI18NPropertyFile": "i18n.properties",
"resourceModelName": "i18n"
},
"basevalidator": {
"services": {
"xml": "fioriXmlAnalysis",
"js": "fioriJsValidator"
}
},
"codeCheckingTriggers": {
"notifyBeforePush": true,
"notifyBeforePushLevel": "Error",
"blockPush": false,
"blockPushLevel": "Error"
},
"mockpreview": {
"mockUri": "/sap/opu/odata/kernc/UI5STAT1_SRV/",
"metadataFilePath": "webapp/localService/UI5STAT1_SRV/metadata.xml",
"loadJSONFiles": false,
"loadCustomRequests": false,
"mockRequestsFilePath": ""
}
}
It seems like you are never instantiating a model.
You can do that in the manifest.json
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Statusverwaltung.i18n.i18n"
}
},
"": {
"dataSource":"UI5STAT1_SRV"
}
},
"" defines the default model so you can use Bindingpaths like {/Stats}.

From Google Chrome Extension to Firefox Extension

I have the following chrome extension codes and i want to know how to convert it in firefox extension
here are the code files.
manifest.json
{
"name": "iFB invite your friends in Facebook Events",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"activeTab"
],
"browser_action": {
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"]
}
}
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(tab.id, {
allFrames: true,
file: "content_script.js"
}, function() {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
}
});
});
content_script.js
var x=document.querySelectorAll("._1v30.clearfix ._1v34");
y=1;
for(var i in x)
{if(y<5000){x[i].click();
y++;}
else{break;}
}
any ideas or any usefull converter???

Resources