Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMET-3246 H&F Plugin - Fix hook for ODC #113

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading