Skip to content

Commit

Permalink
Merge pull request #1765 from RADAR-base/healthkit-capacitor
Browse files Browse the repository at this point in the history
Capacitor Healthkit fixes
  • Loading branch information
mpgxvii authored Jan 29, 2025
2 parents 6a26c24 + 722a083 commit fba8fba
Show file tree
Hide file tree
Showing 58 changed files with 2,162 additions and 1,278 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ $ANDROID_HOME/build-tools/27.0.2/zipalign -v 4 <your-project-path>/platforms/and

## Questionnaire Input Types

The questionnaire input types supported are `audio`, `checkbox`, `descriptive`, `info-screen`, `matrix-radio`, `radio`, `range-info`, `range-input`, `slider`, `text`, `date`, `time`, and `timed-test`.
The questionnaire input types supported are `audio`, `checkbox`, `descriptive`, `info-screen`, `matrix-radio`, `radio`, `range-info`, `range-input`, `slider`, `text`, `date`, `time`, `healthkit`, and `timed-test`.

### Descriptive Input Type

Expand Down Expand Up @@ -297,17 +297,30 @@ Here is the output:

<img src="/.github/etc/descriptive-2.png" width="200px"><img src="/.github/etc/descriptive-1.png" width="200px">

## Common Errors
## Healthkit Input Type

Here are some common errors you might find during installation.
Please see `/src/app/shared/models/health.ts` for a list of supported data types. In order to add support for new data types, follow the steps below:

### Error: cordova-custom-config
### Add the New Data Type to `HealthkitDataType`

When you are running `ionic cordova run ios`, you might encounter the problem, we solved this problem by refering this [issue](https://github.com/dpa99c/cordova-custom-config/issues/144) with `cordova-custom-config`.
Open the `health.ts` file and add the new data type to the `HealthkitDataType` enum. Use a descriptive key and a string value that matches the Healthkit data type.

We enter the following command at the root directory.

```
cd plugins/cordova-custom-config
npm install
```typescript
export enum HealthkitDataType {
...
VO2_MAX = 'vo2Max',
}
```

### Add a New Permission to HealthkitPermission
Add the corresponding permission to the `HealthkitPermission` enum. The permission should match the new data type.

### Map the Data Type to Its Permission
Update the `HealthkitPermissionMap` object to link the new `HealthkitDataType` to its `HealthkitPermission`.

### Add the Kafka Topic to HealthkitTopic
Add the corresponding topic to the `HealthkitTopic` enum. The topic should be a descriptive string representing the data type's usage in your system.

### Add to the Appropriate Data Type Sets (if applicable)
Depending on the data type (e.g., numeric or string), add the new data type to the relevant set: `HealthkitFloatDataTypes` or `HealthkitStringDataTypes`.

1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:hardwareAccelerated="true">

<meta-data
Expand Down
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
Expand Down
6 changes: 5 additions & 1 deletion capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const config: CapacitorConfig = {
appName: 'RADAR Active RMT',
webDir: 'www',
server: {
androidScheme: 'https'
androidScheme: 'https',
"cleartext": true
},
loggingBehavior: 'none',
plugins: {
Expand All @@ -26,6 +27,9 @@ const config: CapacitorConfig = {
},
FirebaseMessaging: {
presentationOptions: ['badge', 'sound', 'alert']
},
CapacitorHttp: {
enabled: true
}
},
cordova: {
Expand Down
5 changes: 5 additions & 0 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
Loading

0 comments on commit fba8fba

Please sign in to comment.