Skip to content

Commit

Permalink
RMET-3246 H&F Plugin - Fix hook for ODC (#113)
Browse files Browse the repository at this point in the history
* test: check if file name contains string

* chore: update dependency to H&F Android Lib

* refactor: remove console logs

* chore: update changelog
  • Loading branch information
alexgerardojacinto committed Mar 22, 2024
1 parent 9012e2c commit 82e0cc7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ The changes documented here do not include those from the original repository.

## [Unreleased]

## 2024-03-22
- Fixed hook for ODC (https://outsystemsrd.atlassian.net/browse/RMET-3191).

## 2024-03-18
- Implemented the usage of the Activity Transition Recognition API for background jobs (https://outsystemsrd.atlassian.net/browse/RMET-3191).
- Implemented the usage of the Activity Transition Recognition API for background jobs (https://outsystemsrd.atlassian.net/browse/RMET-3246).

## 2024-03-14
- Implemented the usage of exact alarms for background jobs (https://outsystemsrd.atlassian.net/browse/RMET-3190).
Expand Down
17 changes: 16 additions & 1 deletion hooks/androidCopyPrivacyUrlEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async function (context) {
const projectRoot = context.opts.cordova.project ? context.opts.cordova.project.root : context.opts.projectRoot;
const platformPath = path.join(projectRoot, `platforms/android/app/src/main/assets/www/${fileNamePrivacyPolicy}`);

if (fileExists(platformPath)) {
if (fileExists(platformPath) || policyFileExists()) {
const configXML = path.join(projectRoot, 'config.xml');
const configParser = new ConfigParser(configXML);

Expand Down Expand Up @@ -43,3 +43,18 @@ function setPrivacyPolicyUrl(configParser, projectRoot) {
throw new Error("Error getting the environment variables.");
}
}

function policyFileExists() {
const directoryPath = 'platforms/android/app/src/main/assets/www';
const searchString = 'HealthConnect_PrivacyPolicy';
try {
const files = fs.readdirSync(directoryPath);
const matchingFiles = files.filter(fileName => fileName.includes(searchString));

// return true if there are matching files, false otherwise
return matchingFiles.length > 0;
} catch (error) {
console.error('An error occurred:', error);
return false;
}
}
2 changes: 1 addition & 1 deletion src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies{

implementation("com.github.outsystems:oscore-android:1.2.0@aar")
implementation("com.github.outsystems:oscordova-android:2.0.1@aar")
implementation("com.github.outsystems:oshealthfitness-android:1.2.0.26@aar")
implementation("com.github.outsystems:oshealthfitness-android:1.2.0.27@aar")
implementation("com.github.outsystems:osnotificationpermissions-android:0.0.4@aar")

// activity
Expand Down

0 comments on commit 82e0cc7

Please sign in to comment.