Skip to content

Commit

Permalink
RMET-3070 H&F Plugin - Implement disableHealthConnect feature and Dep…
Browse files Browse the repository at this point in the history
…recate disableGoogleFit (#102)

* feat: implement disableHealthConnect and deprecate disableGoogleFit

* update to use view model instead of health store
  • Loading branch information
ItsChaceD authored and alexgerardojacinto committed Apr 9, 2024
1 parent 8f24133 commit e14d50b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ The changes documented here do not include those from the original repository.
- Re-implement `DeleteBackgroundJob` feature (https://outsystemsrd.atlassian.net/browse/RMET-3068).

## 2024-02-20
- Deprecated `DisableGoogleFit` feature and implemented `DisableHealthConnect` feature (https://outsystemsrd.atlassian.net/browse/RMET-3070).
- Re-implemented UpdateBackgroundJob feature (https://outsystemsrd.atlassian.net/browse/RMET-3067).
- Re-implemented SetBackgroundJob feature (https://outsystemsrd.atlassian.net/browse/RMET-3050).


## 2024-02-09
- Re-implemented AdvanceQuery feature (https://outsystemsrd.atlassian.net/browse/RMET-3047).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class OSHealthFitness : CordovaImplementation() {
"disconnectFromGoogleFit" -> {
disconnectFromGoogleFit()
}
"disconnectFromHealthConnect" -> {
disconnectFromHealthConnect()
}
"openHealthConnect" -> {
openHealthConnect()
}
Expand Down Expand Up @@ -291,6 +294,13 @@ class OSHealthFitness : CordovaImplementation() {
)
}

@Deprecated(
message = "The Google Fit Android API is deprecated. " +
"To fully disconnect from the legacy Google Fit integration, " +
"please visit your Google Account settings and " +
"revoke the OAuth token associated with the app.",
replaceWith = ReplaceWith("disconnectFromHealthConnect()")
)
private fun disconnectFromGoogleFit() {
healthStore?.disconnectFromGoogleFit(
{
Expand All @@ -302,6 +312,18 @@ class OSHealthFitness : CordovaImplementation() {
)
}

private fun disconnectFromHealthConnect() {
healthConnectViewModel.disconnectFromHealthConnect(
getActivity(),
{
sendPluginResult("success", null)
},
{
sendPluginResult(null, Pair(it.code.toString(), it.message))
}
)
}

private fun openHealthConnect() {
healthConnectViewModel.openHealthConnect(
getContext(),
Expand Down
4 changes: 4 additions & 0 deletions www/OSHealthFitness.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ exports.disconnectFromGoogleFit = function (success, error) {
exec(success, error, 'OSHealthFitness', 'disconnectFromGoogleFit');
};

exports.disconnectFromHealthConnect = function (success, error) {
exec(success, error, 'OSHealthFitness', 'disconnectFromHealthConnect');
};

exports.openHealthConnect = function (success, error) {
exec(success, error, 'OSHealthFitness', 'openHealthConnect');
};

0 comments on commit e14d50b

Please sign in to comment.