Skip to content

Commit

Permalink
Build changed to simplify ionic/v4/FCM.js
Browse files Browse the repository at this point in the history
Upgraded version to 7.0.3
  • Loading branch information
andrehtissot committed Jul 7, 2020
1 parent 192f792 commit a54f002
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 63 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ After a lot of work, the first release of the plugin https://github.com/andrehti

## Changelog

### Version 7.0.3 (07/07/2020)

Simplified ionic/v4/FCM.js file by setting the FCM function in the global context.

### Version 7.0.2 (01/07/2020)

Simplified .d.ts files by removing the new "type" from imports and exports.
Expand Down
2 changes: 1 addition & 1 deletion cordova-plugin-fcm-with-dependecy-updated.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "cordova-plugin-fcm-with-dependecy-updated"
spec.version = "7.0.2"
spec.version = "7.0.3"
spec.summary = "Google FCM Push Notifications Cordova Plugin"

# This description is used to generate tags and improve search results.
Expand Down
2 changes: 1 addition & 1 deletion ionic/ngx/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down
2 changes: 1 addition & 1 deletion ionic/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down
105 changes: 55 additions & 50 deletions ionic/v4/FCM.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,63 @@
import { __decorate } from "tslib";
import { Injectable } from '@angular/core';
import { Plugin } from '@ionic-native/core';
import { Subject } from 'rxjs';
var FCM = (function () {
function FCM() {
import { __decorate } from 'tslib'
import { Injectable } from '@angular/core'
import { Plugin } from '@ionic-native/core'
import { Subject } from 'rxjs'

function FCM() {}
FCM.prototype.clearAllNotifications = function () {
return window.FCM.clearAllNotifications()
}
FCM.prototype.createNotificationChannel = function (channelConfig) {
return window.FCM.createNotificationChannel(channelConfig)
}
FCM.prototype.getAPNSToken = function () {
return window.FCM.getAPNSToken()
}
FCM.prototype.getInitialPushPayload = function () {
return window.FCM.getInitialPushPayload()
}
FCM.prototype.getToken = function () {
return window.FCM.getToken()
}
FCM.prototype.hasPermission = function () {
return window.FCM.hasPermission()
}
FCM.prototype.onNotification = function (options) {
var observable = new Subject()
var handler = function (payload) {
return observable.next(payload)
}
FCM.prototype.clearAllNotifications = function () {
return window.FCM.clearAllNotifications();
};
FCM.prototype.createNotificationChannel = function (channelConfig) {
return window.FCM.createNotificationChannel(channelConfig);
};
FCM.prototype.getAPNSToken = function () {
return window.FCM.getAPNSToken();
};
FCM.prototype.getInitialPushPayload = function () {
return window.FCM.getInitialPushPayload();
};
FCM.prototype.getToken = function () {
return window.FCM.getToken();
};
FCM.prototype.hasPermission = function () {
return window.FCM.hasPermission();
};
FCM.prototype.onNotification = function (options) {
var observable = new Subject();
var handler = function (payload) { return observable.next(payload); };
window.FCM.onNotification(handler, options);
return observable;
};
FCM.prototype.onTokenRefresh = function (options) {
var observable = new Subject();
window.FCM.onTokenRefresh(function (token) { return observable.next(token); }, options);
return observable;
};
FCM.prototype.requestPushPermission = function (options) {
return window.FCM.requestPushPermission(options);
};
FCM.prototype.subscribeToTopic = function (topic) {
return window.FCM.subscribeToTopic(topic);
};
FCM.prototype.unsubscribeFromTopic = function (topic) {
return window.FCM.unsubscribeFromTopic(topic);
};
FCM = __decorate([
window.FCM.onNotification(handler, options)
return observable
}
FCM.prototype.onTokenRefresh = function (options) {
var observable = new Subject()
window.FCM.onTokenRefresh(function (token) {
return observable.next(token)
}, options)
return observable
}
FCM.prototype.requestPushPermission = function (options) {
return window.FCM.requestPushPermission(options)
}
FCM.prototype.subscribeToTopic = function (topic) {
return window.FCM.subscribeToTopic(topic)
}
FCM.prototype.unsubscribeFromTopic = function (topic) {
return window.FCM.unsubscribeFromTopic(topic)
}
FCM = __decorate(
[
Plugin({
pluginName: 'FCM',
plugin: 'cordova-plugin-fcm-with-dependecy-updated',
pluginRef: 'FCM',
repo: 'https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated',
platforms: ['Android', 'iOS'],
platforms: ['Android', 'iOS']
}),
Injectable()
], FCM);
return FCM;
}());
export { FCM };
],
FCM
)

export { FCM }
2 changes: 1 addition & 1 deletion ionic/v4/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-fcm-with-dependecy-updated" version="7.0.2">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-fcm-with-dependecy-updated" version="7.0.3">
<name>Cordova FCM Push Plugin</name>
<description>Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated</description>
<license>MIT</license>
Expand Down
2 changes: 1 addition & 1 deletion src/ionic/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ionic/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand All @@ -11,7 +11,7 @@
"scripts": {
"build": "npm run build:before;npm run build:dts;npm run build:js;npm run build:after",
"build:before": "rm -rf ../../ionic;mkdir -p ../../ionic/ngx;mkdir -p ../../ionic/v4",
"build:js": "tsc -p . --declaration false --removeComments true;cd ../../ionic;mv ionic/*.js .;mv ionic/ngx/*.js ./ngx/;mv ionic/v4/*.js ./v4/",
"build:js": "./scripts/build.js.sh",
"build:dts": "./scripts/build.dts.sh",
"build:after": "cd ../../ionic;rm -rf ionic;rm -rf www",
"tsc": "npx tsc -p . --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion src/ionic/package.toCopy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down
15 changes: 15 additions & 0 deletions src/ionic/scripts/build.js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Build JS files
tsc -p . --declaration false --removeComments true

## Move files to the correct directories
cd ../../ionic
mv ionic/*.js .
mv ionic/ngx/*.js ./ngx/
mv ionic/v4/*.js ./v4/

## Simplify v4 build
sed 's/var FCM = (function () {//' v4/FCM.js > v4/FCM.js.tmp
sed 's/}());//' v4/FCM.js.tmp > v4/FCM.js
sed 's/return FCM;//' v4/FCM.js > v4/FCM.js.tmp
mv v4/FCM.js.tmp v4/FCM.js
npx prettier v4/FCM.js --write
2 changes: 1 addition & 1 deletion src/www/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/www/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.0.2",
"version": "7.0.3",
"name": "cordova-plugin-fcm-with-dependecy-updated",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
Expand Down

0 comments on commit a54f002

Please sign in to comment.