From 0e07a10d722988c36b60bbd30a9fd71ae73ff5e2 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 21 Nov 2024 10:06:56 +0000 Subject: [PATCH] RMET-3653 - Prepare to release version `4.2.0-OS51` (#140) * RMET-3653 - Add support for capacitor and add missing permissions (#139) * test: remove hook to test plugin * test: use edit-config instead of config-file * fix: replace config-file with edit-config and remove unnecessary hook References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * chore: remove unused hook References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * chore: remove the usage of kotlin-kapt plugin Context: It wasn't being used. References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * feat: update dependency to OSCameraLib-Android References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * test: use manifest as parent References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * chore: don't need to specify Manifest as parent References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * chore: update dependency to OSCameraLib-Android References: https://outsystemsrd.atlassian.net/browse/RMET-3653 * fix: add necessary permissions to AndroidManifest.xml Context: MABS 11 was updated with the latest version of the native shell, which removes this permissions, so plugins need to add them. References: https://outsystemsrd.atlassian.net/browse/RMET-3856 * chore(release): prepare to release version 4.2.0-OS51 References: https://outsystemsrd.atlassian.net/browse/RMET-3857 --- CHANGELOG.md | 14 +++++ hooks/AndroidManifestPatcher.js | 41 -------------- hooks/install_prerequisites.js | 19 ------- hooks/package.json | 9 ---- hooks/utils.js | 96 --------------------------------- libs/android/build.gradle | 2 - package.json | 2 +- plugin.xml | 14 ++--- 8 files changed, 22 insertions(+), 175 deletions(-) delete mode 100644 hooks/AndroidManifestPatcher.js delete mode 100644 hooks/install_prerequisites.js delete mode 100644 hooks/package.json delete mode 100644 hooks/utils.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 6072845d6..7f2bfec50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,20 @@ 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. +## 4.2.0-OS51 + +### Features + +- (android) Adds support for Capacitor builds. + +### Fixes + +- (android) Add missing permissions for camera and file access. + +### Chores + +- (android) Removes unnecessary kotlin-kapt plugin, as well as hook. + ## 4.2.0-OS50 ### Fixes diff --git a/hooks/AndroidManifestPatcher.js b/hooks/AndroidManifestPatcher.js deleted file mode 100644 index db745fe3b..000000000 --- a/hooks/AndroidManifestPatcher.js +++ /dev/null @@ -1,41 +0,0 @@ -var fs = require('fs'), path = require('path'); -var utils = require("./utils"); - -module.exports = function(context) { - - let platform = context.opts.plugin.platform; - - if(platform === "android") { - let platformVersion = utils.getPlatformVersion(context); - if (platformVersion >= "9") { - let configXML = path.join(context.opts.projectRoot, 'config.xml'); - - if (fs.existsSync(configXML)) { - fs.readFile(configXML, 'utf8', function (err,data) { - if (err) { - console.error(err); - throw new Error('OUTSYSTEMS_PLUGIN_ERROR: Error in Camera Plugin - Unable to read config.xml. Please check the logs for more information.'); - } - - if (!data.includes("android.media.action.IMAGE_CAPTURE")){ - let result = data.replace(//g, ''); - fs.writeFile(configXML, result, 'utf8', function (err) { - if (err) { - console.error(err); - throw new Error(`OUTSYSTEMS_PLUGIN_ERROR: Error in Camera Plugin - Unable to write into config.xml. Please check the logs for more information.`); - } - else { - console.log("Camera Plugin: config.xml patched for using MABS 7 successfuly!"); - }}) - } else { - console.log("WARNING(Camera Plugin): config.xml was already patched for using Android 11 SDK (Image Capture)"); - } - }); - } else { - throw new Error("OUTSYSTEMS_PLUGIN_ERROR: Error in Camera Plugin - config.xml was not found!"); - } - } else { - console.log("Camera Plugin: config.xml not patched for MABS 7. MABS 6.3 or below detected."); - } - } -} \ No newline at end of file diff --git a/hooks/install_prerequisites.js b/hooks/install_prerequisites.js deleted file mode 100644 index 4f4f04481..000000000 --- a/hooks/install_prerequisites.js +++ /dev/null @@ -1,19 +0,0 @@ - -console.log("Running hook to install plugin node libs requirements"); - -module.exports = function (context) { - var child_process = require('child_process'), - deferral = require('q').defer(); - - var output = child_process.exec('npm install', {cwd: __dirname}, function (error) { - if (error !== null) { - console.log('exec error: ' + error); - throw new Error(`OUTSYSTEMS_PLUGIN_ERROR: Error when installing Camera Plugin - npm installation failed`) - } - else { - deferral.resolve(); - } - }); - - return deferral.promise; -}; diff --git a/hooks/package.json b/hooks/package.json deleted file mode 100644 index 6b70af326..000000000 --- a/hooks/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "dependencies": { - "child_process": "^1.0.2", - "glob": "^7.1.3", - "q": "^1.5.1", - "semver": "^6.0.0", - "xcode": "^2.0.0" - } -} diff --git a/hooks/utils.js b/hooks/utils.js deleted file mode 100644 index 5865e76a1..000000000 --- a/hooks/utils.js +++ /dev/null @@ -1,96 +0,0 @@ -var path = require("path"); -var fs = require("fs"); -/** - * Get the platform version for the current execution - * @param {object} context - * @returns {string} platform version - */ -function getPlatformVersion(context) { - var projectRoot = context.opts.projectRoot; - - var packageJsonFile = path.join( - projectRoot, - "package.json" - ); - - var devDependencies = require(packageJsonFile).devDependencies; - - if(devDependencies !== undefined){ - //Probably MABS7 - var platform = devDependencies["cordova-android"]; - if (platform.includes('^')){ - var index = platform.indexOf('^'); - platform = platform.slice(0, index) + platform.slice(index+1); - } - return platform; - } else { - //Probably MABS6.X - var platformsJsonFile = path.join( - projectRoot, - "platforms", - "platforms.json" - ); - var platforms = require(platformsJsonFile); - var platform = context.opts.plugin.platform; - return platforms[platform]; - } -} - -function rmNonEmptyDir(dir_path) { - if (fs.existsSync(dir_path)) { - fs.readdirSync(dir_path).forEach(function(entry) { - var entry_path = path.join(dir_path, entry); - if (fs.lstatSync(entry_path).isDirectory()) { - rmNonEmptyDir(entry_path); - } else { - fs.unlinkSync(entry_path); - } - }); - fs.rmdirSync(dir_path); - } -} - - -/** - * Get the full path to the platform directory - * @param {object} context Cordova context - * @returns {string} absolute path to platforms directory - */ -function getPlatformPath(context) { - var projectRoot = context.opts.projectRoot; - var platform = context.opts.plugin.platform; - return path.join(projectRoot, "platforms", platform); -} - -/** - * Get absolute path to the www folder inside the platform - * and not the root www folder from the cordova project. - * Example: - * - Android: project_foo/platforms/android/app/src/main/assets/www - * - iOS: project_foo/platforms/ios/www - * @param {string} platform - */ -function getWwwPath(context) { - var platformPath = getPlatformPath(context); - var platform = context.opts.plugin.platform; - var wwwfolder; - if (platform === "android") { - var platformVersion = getPlatformVersion(context); - if (platformVersion >= "7") { - wwwfolder = "app/src/main/assets/www"; - } else { - wwwfolder = "assets/www"; - } - } else if (platform === "ios") { - wwwfolder = "www"; - } - return path.join(platformPath, wwwfolder); -} - - -module.exports = { - getPlatformVersion: getPlatformVersion, - rmNonEmptyDir: rmNonEmptyDir, - getPlatformPath: getPlatformPath, - getWwwPath: getWwwPath, -}; \ No newline at end of file diff --git a/libs/android/build.gradle b/libs/android/build.gradle index 484a52584..5b1a119f2 100644 --- a/libs/android/build.gradle +++ b/libs/android/build.gradle @@ -6,8 +6,6 @@ repositories { } } -apply plugin: 'kotlin-kapt' - dependencies { implementation("com.github.outsystems:oscamera-android:1.2.6@aar") } diff --git a/package.json b/package.json index 67dd83632..9e3d75fa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-camera", - "version": "4.2.0-OS50", + "version": "4.2.0-OS51", "description": "Cordova Camera Plugin", "types": "./types/index.d.ts", "cordova": { diff --git a/plugin.xml b/plugin.xml index a23301e2e..e344e57f3 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="4.2.0-OS51"> Camera Cordova Camera Plugin Apache 2.0 @@ -49,8 +49,6 @@ - - @@ -65,11 +63,13 @@ + + - + - + - + @@ -93,7 +93,7 @@ - +