This commit is contained in:
Eudes Inácio
2021-11-21 19:52:19 +01:00
parent 7121030ab1
commit 0130e4fac9
5 changed files with 44 additions and 9 deletions
+26 -8
View File
@@ -1,11 +1,29 @@
if ('serviceWorker' in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.register('./firebase-messaging-sw.js') navigator.serviceWorker
.then(function(registration) { .register("./firebase-messaging-sw.js")
console.log('Registration successful, scope is:', registration.scope); .then(function(registration) {
}).catch(function(err) { console.log("Registration successful, scope is:", registration.scope);
console.log('Service worker registration failed, error:', err); messaging.getToken({vapidKey: 'BEuyzkUKcx4FSs-6GaIz_si2oV5Ut7e5ZEtcrVvr5L_tMVWZtS1NTqdtQkih5QCt2FZKuRUxZIaLm5GaxI6nJEw', serviceWorkerRegistration : registration })
}); .then((currentToken) => {
} if (currentToken) {
console.log('current token for client: ', currentToken);
// Track the token -> client mapping, by sending to backend server
// show on the UI that permission is secured
} else {
console.log('No registration token available. Request permission to generate one.');
// shows on the UI that permission is required
}
}).catch((err) => {
console.log('An error occurred while retrieving token. ', err);
// catch error while creating client token
});
})
.catch(function(err) {
console.log("Service worker registration failed, error:" , err );
});
}
// Scripts for firebase and firebase messaging // Scripts for firebase and firebase messaging
+4
View File
@@ -6,6 +6,10 @@
<param name="ios-package" value="sqlDB"/> <param name="ios-package" value="sqlDB"/>
</feature> </feature>
<feature name="CDVOrientation">
<param name="ios-package" value="CDVOrientation"/>
</feature>
<feature name="SQLitePlugin"> <feature name="SQLitePlugin">
<param name="ios-package" value="SQLitePlugin"/> <param name="ios-package" value="SQLitePlugin"/>
</feature> </feature>
+2 -1
View File
@@ -10,11 +10,12 @@ def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app' pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app'
pod 'CapacitorBrowser', :path => '..\..\node_modules\@capacitor\browser'
pod 'CapacitorCamera', :path => '..\..\node_modules\@capacitor\camera' pod 'CapacitorCamera', :path => '..\..\node_modules\@capacitor\camera'
pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem'
pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics' pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics'
pod 'CapacitorKeyboard', :path => '..\..\node_modules\@capacitor\keyboard' pod 'CapacitorKeyboard', :path => '..\..\node_modules\@capacitor\keyboard'
pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network' pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network'
pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem'
pod 'CapacitorPushNotifications', :path => '..\..\node_modules\@capacitor\push-notifications' pod 'CapacitorPushNotifications', :path => '..\..\node_modules\@capacitor\push-notifications'
pod 'CapacitorVoiceRecorder', :path => '..\..\node_modules\capacitor-voice-recorder' pod 'CapacitorVoiceRecorder', :path => '..\..\node_modules\capacitor-voice-recorder'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
+10
View File
@@ -2040,6 +2040,11 @@
"resolved": "https://registry.npmjs.org/@capacitor/app/-/app-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@capacitor/app/-/app-1.0.5.tgz",
"integrity": "sha512-U0dAw1CAjKyguSRxKDabszsQ4dj679RnxaUZrSHDR5Jnt5x308oQuKXFP++wnMBbw72D02iqjG0a+/Ujye7C9g==" "integrity": "sha512-U0dAw1CAjKyguSRxKDabszsQ4dj679RnxaUZrSHDR5Jnt5x308oQuKXFP++wnMBbw72D02iqjG0a+/Ujye7C9g=="
}, },
"@capacitor/browser": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@capacitor/browser/-/browser-1.0.6.tgz",
"integrity": "sha512-ZDx+HNPRQZKHpWxbYEyDz34Ge4fwhiiGg2UEnA+ol+pmdvHyYxw/c8HafCEVRJutHrXcVdSNoBNAeEPkQeabrQ=="
},
"@capacitor/camera": { "@capacitor/camera": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@capacitor/camera/-/camera-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@capacitor/camera/-/camera-1.2.0.tgz",
@@ -7894,6 +7899,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz",
"integrity": "sha1-6GT2C//zQqHZJHeugvckmqYIXIA=" "integrity": "sha1-6GT2C//zQqHZJHeugvckmqYIXIA="
}, },
"cordova-plugin-screen-orientation": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg=="
},
"cordova-plugin-splashscreen": { "cordova-plugin-splashscreen": {
"version": "5.0.4", "version": "5.0.4",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.4.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.4.tgz",
+2
View File
@@ -33,6 +33,7 @@
"@angular/router": "~12.1.2", "@angular/router": "~12.1.2",
"@capacitor/android": "3.3.1", "@capacitor/android": "3.3.1",
"@capacitor/app": "^1.0.5", "@capacitor/app": "^1.0.5",
"@capacitor/browser": "1.0.6",
"@capacitor/camera": "^1.2.0", "@capacitor/camera": "^1.2.0",
"@capacitor/core": "^3.3.0", "@capacitor/core": "^3.3.0",
"@capacitor/filesystem": "^1.0.6", "@capacitor/filesystem": "^1.0.6",
@@ -93,6 +94,7 @@
"cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git", "cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git",
"cordova-plugin-filepath": "^1.5.8", "cordova-plugin-filepath": "^1.5.8",
"cordova-plugin-okhttp": "^2.0.0", "cordova-plugin-okhttp": "^2.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-res": "^0.15.3", "cordova-res": "^0.15.3",
"cordova-sqlite-storage": "^5.1.0", "cordova-sqlite-storage": "^5.1.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",