Skip to content

Commit

Permalink
Prepare Release of Version 1.2.0 (#66)
Browse files Browse the repository at this point in the history
* chore: Add Unreleased Tag to CHANGELOG

* RMET-2036 :: Updated jcenter to mavenCentral (#40)

* RMET-2045 - Firebase Cloud Messaging Plugin - Use fixed versions (#39)

* fix: use fixed versions

References: https://outsystemsrd.atlassian.net/browse/RMET-2045

* chore: update changelog

* refactor: remove jcenter

References: https://outsystemsrd.atlassian.net/browse/RMET-2036

* chore: update changelog

* feat: iOS | Add Get APNs Token (#41)

Update iOS lib files in order to include the new Get APNs Token method.
Delegate the app's `application:didRegisterForRemoteNotificationWithDeviceToken:` to Cloud Messaging's delegate extension.

* RMET-2114 FB Cloud Messaging - Android - Fix click notification without deeplink (#42)

* tentativefix: added pending intent to every notification

* chore: update lib for testing

References: https://outsystemsrd.atlassian.net/browse/RMET-2114

* chore: update lib

* feat: update messaging library to version 1.0.1

References: https://outsystemsrd.atlassian.net/browse/RMET-2114

* refactor: remove new line

* chore: update changelog

Co-authored-by: Nelson Lopes Silva <5671236+nflsilva@users.noreply.github.com>

* Fix: Silent Notifications issue (#44)

The method `application:didReceiveRemoteNotification:fetchCompletionHandler:` is not being triggered by apps that use the plugin, so it's not possible to trigger silent notifications.
The same fix was applied for the `application:didRegisterForRemoteNotificationsWithDeviceToken:` as the method suffered from the same issue.

* fix: Replace iOS code for library (#45)

Remove the iOS code and replace it for the xcframework.

* RMET-2312 :: Empty silent notification crash fix (#46)

* chrore: bump patch version to 1.0.6. Changed lib version to new patch vesion 1.0.2

* chrore: bump patch version to 1.0.6

* feat: iOS | Use Local Notifications library (#48)

Update the iOS xcframework that already includes the Local Notifications library.
Add the local notifications library.
Remove unnecessary files introduced on conflict fix.

* RMET-2310 FB Cloud Messaging - Update FCM lib and add Local Notifications Lib (#49)

* feat: update osfirebasemessaging-android

References: https://outsystemsrd.atlassian.net/browse/RMET-2310

* fix: include local notifications lib in build.gradle

* chore: update changelog

* feat: React to "Push" Data Message (#51)

Update the OSFirebaseMessagingLib and OSLocalNotificationsLib in order to allow the trigger of Local Notifications when a Data Message with a Notification structure is received.

* RMET-2378 Cloud Messaging Plugin - Hook for sound files (#52)

* feat: first version of hook to copy sound files

References: https://outsystemsrd.atlassian.net/browse/RMET-2378

* chore: save current progress

* refactor: remove comment

* refactor: remove unnecessary code from hook

References: https://outsystemsrd.atlassian.net/browse/RMET-2378

* refactor: remove unnecessary functions

References: https://outsystemsrd.atlassian.net/browse/RMET-2378

* chore: update libs

References: https://outsystemsrd.atlassian.net/browse/RMET-2378

* chore: update changelog

* refactor: replace var with let

* refactor: replace var with let

* refactor: use let instead of var

* chore: update lib version

* RMET-2421 FCM Plugin  - Fix click notification crash (#53)

* chore: update lib version

* chore: update lib version

* chore: update lib

* chore: update changelog

* chore: update lib version

* chore: update lib versions

* feat: Add Actions to "Push" Data Messages (#55)

Update the OSFirebaseMessagingLib and OSLocalNotificationsLib to add reaction to a Push Data Message with Actions configured.

Co-authored-by: Marta Carlos <marta.carlos@outsystems.com>

* RMET-2387 FCM Plugin - Android - Add action buttons (#57)

* chore: update libs

* chore: update libs

* feat: handle action button clicks

References: https://outsystemsrd.atlassian.net/browse/RMET-2387

* chore: update changelog

* feat: iOS | Click on Notification Action (#56)

Update the OSFirebaseMessagingLib and OSLocalNotificationsLib to add reaction to a Notification Action click.

* Feat: iOS | React to the Internal Route Event (#58)

Update both OSFirebaseMessagingLib and OSLocalNotificationsLib to the latest versions.
Add "internalRouteActionClick" to the list of possible events can be triggered.

* RMET-2215 FCM Plugin - Fix on hook for sound files (#61)

* test: test build without hook

* test: include hook

* test: change hook name

* test: remove defer.promise

* chore: update changelog

* Feat: iOS | React to the Web Route Event (#60)

Update OSLocalNotificationLib.xcframework and OSFirebaseMessagingLib.xcframework to the latest versions so that it can deal with Actions defined with a web route event.

* current implementation (#62)

Add to plugin.xml a new hook that reads Extensibility Configurations' APPLICATION_SCHEMES preference value, and adds it to Info.plist's LSApplicationQueriesSchemes property.

* RMET-2391 FCM Plugin - Notification action buttons (#64)

* chore: update lib versions

* chore: update lib version

* chore: update lib version

* chore: update gradle dependency

* feat: iOS | React to the App Route Event (#63)

Update OSLocalNotificationLib.xcframework and OSFirebaseMessagingLib.xcframework to the latest versions so that it can deal with Actions defined with a app route event.

* RMET-2555 :: Update error codes (#65)

* feat: update error codes

* chore: update changelog

* chore: Set Tag and Update iOS libraries

Set tag on the `CHANGELOG.md` file.
Update `OSFirebaseMessagingLib.xcframework` and `OSLocalNotificationsLib.xcframework` to the latest versions.

* chore: set missing Tags

Set Tags to `package.json` and `plugin.xml` files.

* chore: use correct OSFirebaseMessagingLib.xcframework

* chore: update android libraries

---------

Co-authored-by: Alexandre Jacinto <alexandre.jacinto@outsystems.com>
Co-authored-by: Nelson Lopes Silva <5671236+nflsilva@users.noreply.github.com>
Co-authored-by: Marta Carlos <marta.carlos@outsystems.com>
Co-authored-by: Marta Carlos <101343976+OS-martacarlos@users.noreply.github.com>
  • Loading branch information
5 people authored May 26, 2023
1 parent b6a2af5 commit f3aeb18
Show file tree
Hide file tree
Showing 42 changed files with 1,448 additions and 367 deletions.
46 changes: 42 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

The changes documented here do not include those from the original repository.

## [Unreleased]
## [Version 1.2.0]

### 23-05-2023
- Feat: Update Error Codes Messages (https://outsystemsrd.atlassian.net/browse/RMET-2555).

### 10-05-2023
- Feat: [iOS] React to the App Route Event (https://outsystemsrd.atlassian.net/browse/RMET-2392).

### 08-05-2023
- Feat: [iOS] External App Authorisation (https://outsystemsrd.atlassian.net/browse/RMET-2390).
- Feat: [iOS] React to the Web Route Event (https://outsystemsrd.atlassian.net/browse/RMET-2394).
- Feat: [Android] Fix hook for sounds (https://outsystemsrd.atlassian.net/browse/RMET-2215).

### 03-05-2023
- Feat: [iOS] React to the Internal Route Event (https://outsystemsrd.atlassian.net/browse/RMET-2388).

### 02-05-2023
- Feat: [Android] Add action buttons (https://outsystemsrd.atlassian.net/browse/RMET-2387).

### 28-04-2023
- Feat: [ıOS] React to a notification action click (https://outsystemsrd.atlassian.net/browse/RMET-2383).

### 24-04-2023
- Feat: [iOS] React to a triggered notification with a custom action configured (https://outsystemsrd.atlassian.net/browse/RMET-2382).

### 06-04-2023
- Fix: [Android] Fix crash on notification click (https://outsystemsrd.atlassian.net/browse/RMET-2421).

### 04-04-2023
- Feat: [Android] Add hook to copy sound files (https://outsystemsrd.atlassian.net/browse/RMET-2378).

### 31-03-2023
- Feat: [iOS] React to a triggered notification with custom sound enabled (https://outsystemsrd.atlassian.net/browse/RMET-2381).

### 07-03-2023
- Feat: [Android] Use `OSLocalNotificationsLib` to trigger a local notification immediately (https://outsystemsrd.atlassian.net/browse/RMET-2310).

### 03-03-2023
- Feat: [iOS] Use `OSLocalNotificationsLib` to trigger a local notification immediately (https://outsystemsrd.atlassian.net/browse/RMET-2311).

## [Version 1.1.3]

## 10-04-2023
### 10-04-2023
- Fix: [Android] - Added POST_NOTIFICATION permission for Android >= 13. (https://outsystemsrd.atlassian.net/browse/RMET-2424)

## 29-03-2023
### 29-03-2023
- Fix: [Android] - Removed allowBackup property from android lib manifest. (https://outsystemsrd.atlassian.net/browse/RMET-2406)

## 23-02-2023
### 23-02-2023
- Fix: [Android] - Add a guard to deal with cases when there's no data in the extras map (https://outsystemsrd.atlassian.net/browse/RMET-2312)

### 10-02-2023
Expand Down
43 changes: 43 additions & 0 deletions hooks/android/sound/copySound.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use strict";

var path = require("path");
var utils = require("./utilities");

module.exports = function(context) {
let cordovaAbove8 = utils.isCordovaAbove(context, 8);
let defer;
if (cordovaAbove8) {
defer = require("q").defer();
} else {
defer = context.requireCordovaModule("q").defer();
}

let platform = context.opts.plugin.platform;
let platformConfig = utils.getPlatformConfigs(platform);
if (!platformConfig) {
utils.handleError("Invalid platform", defer);
}

let sourceFolderPath = platformConfig.getSoundSourceFolder()
let destFolderPath = platformConfig.getSoundDestinationFolder()

if(!utils.checkIfFolderExists(destFolderPath)) {
utils.createOrCheckIfFolderExists(destFolderPath)
}

let files = utils.getFilesFromPath(sourceFolderPath);
if (!files) {
utils.handleError("No directory found", defer);
}
else {
let filteredFiles = files.filter(function(file){
return file.endsWith(platformConfig.soundFileExtension) == true;
});

filteredFiles.forEach(function (f) {
let filePath = path.join(sourceFolderPath, f);
let destFilePath = path.join(destFolderPath, f);
utils.copyFromSourceToDestPath(defer, filePath, destFilePath);
});
}
}
77 changes: 77 additions & 0 deletions hooks/android/sound/utilities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"use strict"

var path = require("path");
var fs = require("fs");

var utils = require("./utils");

var constants = {
platforms: "platforms",
android: {
platform: "android",
wwwFolder: "assets/www",
soundFileExtension: ".wav",
getSoundDestinationFolder: function() {
return "platforms/android/app/src/main/res/raw";
},
getSoundSourceFolder: function() {
return "platforms/android/app/src/main/assets/www";
}
}
};

function handleError(errorMessage, defer) {
console.log(errorMessage);
defer.reject();
}

function checkIfFolderExists(path) {
return fs.existsSync(path);
}

function getFilesFromPath(path) {
return fs.readdirSync(path);
}

function createOrCheckIfFolderExists(path) {
if (!fs.existsSync(path)) {
fs.mkdirSync(path);
}
}

function getPlatformConfigs(platform) {
if (platform === constants.android.platform) {
return constants.android;
} else if (platform === constants.ios.platform) {
return constants.ios;
}
}

function isCordovaAbove(context, version) {
let cordovaVersion = context.opts.cordova.version;
console.log(cordovaVersion);
let sp = cordovaVersion.split('.');
return parseInt(sp[0]) >= version;
}


function copyFromSourceToDestPath(defer, sourcePath, destPath) {
fs.createReadStream(sourcePath).pipe(fs.createWriteStream(destPath))
.on("close", function (err) {
defer.resolve();
})
.on("error", function (err) {
console.log(err);
defer.reject();
});
}

module.exports = {
isCordovaAbove,
handleError,
getPlatformConfigs,
copyFromSourceToDestPath,
getFilesFromPath,
createOrCheckIfFolderExists,
checkIfFolderExists
};
7 changes: 7 additions & 0 deletions hooks/android/sound/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
getAppName: function (context) {
let ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
let config = new ConfigParser("config.xml");
return config.name();
}
};
36 changes: 36 additions & 0 deletions hooks/ios/iOSCopyPreferences.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const et = require('elementtree');
const path = require('path');
const fs = require('fs');
const plist = require('plist');
const child_process = require('child_process');
const { ConfigParser } = require('cordova-common');
const { Console } = require('console');

module.exports = function (context) {
var projectRoot = context.opts.cordova.project ? context.opts.cordova.project.root : context.opts.projectRoot;

let configPath = path.join(projectRoot, 'config.xml');
let configParser = new ConfigParser(configPath);

let appName = configParser.name();
let applicationSchemes = configParser.getPreference("APPLICATION_SCHEMES", "ios");

if (applicationSchemes != null && applicationSchemes !== "") {
let applicationQueriesSchemes = applicationSchemes.split(",");

let platformPath = path.join(projectRoot, 'platforms/ios');

//Change info.plist
let infoPlistPath = path.join(platformPath, appName + '/'+ appName +'-info.plist');
let infoPlistFile = fs.readFileSync(infoPlistPath, 'utf8');
var infoPlist = plist.parse(infoPlistFile);

let currentValue = infoPlist['LSApplicationQueriesSchemes'];
if (currentValue != null && currentValue.length > 0) {
applicationQueriesSchemes = currentValue.concat(applicationQueriesSchemes);
}
infoPlist['LSApplicationQueriesSchemes'] = applicationQueriesSchemes;

fs.writeFileSync(infoPlistPath, plist.build(infoPlist, { indent: '\t' }));
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.outsystems.firebase.cloudmessaging",
"version": "1.1.3",
"version": "1.2.0",
"description": "Outsystems plugin for Firebase Cloud Messaging",
"keywords": [
"ecosystem:cordova",
Expand Down
8 changes: 7 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<plugin id="com.outsystems.firebase.cloudmessaging" version="1.1.3" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<plugin id="com.outsystems.firebase.cloudmessaging" version="1.2.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>OSFirebaseCloudMessaging</name>
<description>Outsystems plugin for Firebase Cloud Messaging</description>
<author>OutSystems Inc</author>
Expand Down Expand Up @@ -39,9 +39,13 @@
<source-file src="src/ios/AppDelegate+OSFirebaseCloudMessaging.m" />

<framework src="src/ios/frameworks/OSFirebaseMessagingLib.xcframework" embed="true" custom="true" />
<framework src="src/ios/frameworks/OSLocalNotificationsLib.xcframework" embed="true" custom="true" />

<dependency id="cordova-plugin-add-swift-support" url="https://github.com/OutSystems/cordova-plugin-add-swift-support.git#2.0.3-OS1"/>

<!-- Hooks -->
<hook type="after_prepare" src="hooks/ios/iOSCopyPreferences.js" />

<podspec>
<config>
<source url="https://cdn.cocoapods.org/"/>
Expand All @@ -58,6 +62,8 @@

<hook type="after_prepare" src="hooks/android/androidCopyChannelInfo.js" />

<hook type="before_plugin_install" src="hooks/android/sound/copySound.js" />

<config-file parent="/*" target="res/xml/config.xml">
<feature name="OSFirebaseCloudMessaging">
<param name="android-package" value="com.outsystems.firebase.cloudmessaging.OSFirebaseCloudMessaging"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ class OSFirebaseCloudMessaging : CordovaImplementation() {
val extras = intent.extras
val extrasSize = extras?.size() ?: 0
if(extrasSize > 0) {
FirebaseMessagingOnClickActivity.notifyClickNotification(intent)
val scheme = extras?.getString(FirebaseMessagingOnActionClickActivity.ACTION_DEEP_LINK_SCHEME)
if (scheme.isNullOrEmpty()) {
FirebaseMessagingOnClickActivity.notifyClickNotification(intent)
}
else {
FirebaseMessagingOnActionClickActivity.notifyClickAction(intent)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ apply plugin: 'kotlin-kapt'
dependencies {
implementation("com.github.outsystems:oscore-android:1.2.0@aar")
implementation("com.github.outsystems:oscordova-android:1.2.0@aar")
implementation("com.github.outsystems:osfirebasemessaging-android:1.0.3@aar")
implementation("com.github.outsystems:osfirebasemessaging-android:1.1.0@aar")
implementation("com.github.outsystems:oslocalnotifications-android:1.0.0@aar")
implementation("com.github.outsystems:osnotificationpermissions-android:0.0.4@aar")

implementation("com.google.code.gson:gson:2.8.9")
Expand Down
8 changes: 0 additions & 8 deletions src/ios/AppDelegate+OSFirebaseCloudMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ + (void)load {
Method original = class_getInstanceMethod(self, @selector(application:didFinishLaunchingWithOptions:));
Method swizzled = class_getInstanceMethod(self, @selector(application:firebaseCloudMessagingPluginDidFinishLaunchingWithOptions:));
method_exchangeImplementations(original, swizzled);

original = class_getInstanceMethod(self, @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:));
swizzled = class_getInstanceMethod(self, @selector(application:firebaseCloudMessagingDidReceiveRemoteNotification:fetchCompletionHandler:));
method_exchangeImplementations(original, swizzled);

original = class_getInstanceMethod(self, @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:));
swizzled = class_getInstanceMethod(self, @selector(application:firebaseCloudMessagingdidRegisterForRemoteNotificationsWithDeviceToken:));
method_exchangeImplementations(original, swizzled);
}

- (BOOL)application:(UIApplication *)application firebaseCloudMessagingPluginDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Expand Down
Loading

0 comments on commit f3aeb18

Please sign in to comment.