Skip to content

Commit

Permalink
Merge pull request #96 from OutSystems/development
Browse files Browse the repository at this point in the history
RMET-3347 :: prepare main for `2.2.0` release
  • Loading branch information
OS-martacarlos authored May 23, 2024
2 parents c3ca7d2 + 3f66cbb commit 3694ac8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 40 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ 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.

## 2.1.0
## [Version 2.2.0]

### 15-05-2024
- Feat: Update dependency to OSFirebaseMessagingLib-Android, making `FirebaseMessagingReceiveService` an open class so it can be extended (https://outsystemsrd.atlassian.net/browse/RMET-3407).

### 17-04-2024
- Fix: Properly serialize data objects with annotation (https://outsystemsrd.atlassian.net/browse/RMET-3109).

- Feat: Deal with `sounds` as a resource in ODC. (https://outsystemsrd.atlassian.net/browse/RMET-3315)

## [Version 2.1.0]

- Fix: Make `cleanUp` hook only run after all sound files are copied successfully. (https://outsystemsrd.atlassian.net/browse/RMET-3326)
- Chore: Update cordova hooks with new OutSystems specific errors. (https://outsystemsrd.atlassian.net/browse/RMET-3302)
Expand Down
31 changes: 10 additions & 21 deletions hooks/unzipSound.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,35 +62,24 @@ module.exports = function(context) {
let soundFolderPath = platformConfig.getSoundDestinationFolder();
soundFolderPath = path.join(context.opts.projectRoot, soundFolderPath);

let soundZipFile = path.join(sourcePath, constants.soundZipFile);
let zipFile = utils.getFileName(sourcePath, "sounds", ".zip");

let promises = [];
if(utils.checkIfFileOrFolderExists(soundZipFile)){
let zip = new AdmZip(soundZipFile);
zip.extractAllTo(sourcePath, true);

if(zipFile != ""){
let soundZipFilePath = path.join(sourcePath, zipFile);
let zip = new AdmZip(soundZipFilePath);
let zipFolder = sourcePath + "/sounds"
zip.extractAllTo(zipFolder, true);

let entriesNr = zip.getEntries().length;
console.log(`FCM_LOG: Sound zip file has ${entriesNr} entries`);
if(entriesNr == 0) {
throw new Error (`OUTSYSTEMS_PLUGIN_ERROR: Sound zip file is empty, either delete it or add one or more files.`)
}

let zipFolder = sourcePath + "/sounds"

if(!utils.checkIfFileOrFolderExists(zipFolder)){
console.log(`FCM_LOG: No new folder unzipping.`)
/**
* to deal with the following case:
* iOS + one file in zip + O11
**/
if(sourcePath != soundFolderPath){
console.log(`FCM_LOG: ${sourcePath} != ${soundFolderPath} so we need to copy files.`)
promises = copyWavFiles(platformConfig, sourcePath, soundFolderPath, defer)
} else {
console.log(`FCM_LOG: ${sourcePath} == ${soundFolderPath} so we don't need to copy files.`)
}
} else {
promises = copyWavFiles(platformConfig, zipFolder, soundFolderPath, defer)
}
promises = copyWavFiles(platformConfig, zipFolder, soundFolderPath, defer)

}
return promises.length > 0 ? q.all(promises) : defer.resolve();
}
28 changes: 12 additions & 16 deletions hooks/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var constants = {
return "platforms/android/app/src/main/res/raw";
},
getWWWFolder: function() {
return "www";
return "platforms/android/app/src/main/assets/www";
}
},
ios: {
Expand All @@ -33,6 +33,14 @@ function checkIfFileOrFolderExists(path) {
return fs.existsSync(path);
}


function getFileName(dir, searchString, withExtension){
const files = fs.readdirSync(dir);
const matchingFiles = files.filter(file => file.includes(searchString) && file.endsWith(withExtension));
// return true if there are matching files, false otherwise
return matchingFiles.length > 0 ?matchingFiles[0] : "";
}

function removeFile(path){
fs.unlinkSync(path)
}
Expand Down Expand Up @@ -61,20 +69,7 @@ function getPlatformConfigs(platform) {

function getPlatformSoundPath(context, platformConfig){
let projectRoot = context.opts.projectRoot;
let platformPath;

if(platformConfig === constants.android){
platformPath = path.join(projectRoot, `platforms/android/www`);
} else {
let appName = getAppName(context)
platformPath = path.join(projectRoot, `platforms/ios/${appName}/Resources/www`);
}

if(!fs.existsSync(platformPath)){
platformPath = path.join(projectRoot, platformConfig.getWWWFolder());
}

return platformPath
return path.join(projectRoot, platformConfig.getWWWFolder());
}

function isCordovaAbove(context, version) {
Expand Down Expand Up @@ -116,5 +111,6 @@ module.exports = {
removeFolder,
isAndroid,
getAppName,
getPlatformSoundPath
getPlatformSoundPath,
getFileName
};
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": "2.1.0",
"version": "2.2.0",
"description": "Outsystems plugin for Firebase Cloud Messaging",
"keywords": [
"ecosystem:cordova",
Expand Down
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<plugin id="com.outsystems.firebase.cloudmessaging" version="2.1.0" 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="2.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

0 comments on commit 3694ac8

Please sign in to comment.