diff --git a/CHANGELOG.md b/CHANGELOG.md index 79ef9dd0..116d57d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/src/android/com/outsystems/plugins/healthfitness/OSHealthFitness.kt b/src/android/com/outsystems/plugins/healthfitness/OSHealthFitness.kt index a2854b0a..80819e1d 100755 --- a/src/android/com/outsystems/plugins/healthfitness/OSHealthFitness.kt +++ b/src/android/com/outsystems/plugins/healthfitness/OSHealthFitness.kt @@ -86,6 +86,9 @@ class OSHealthFitness : CordovaImplementation() { "disconnectFromGoogleFit" -> { disconnectFromGoogleFit() } + "disconnectFromHealthConnect" -> { + disconnectFromHealthConnect() + } "openHealthConnect" -> { openHealthConnect() } @@ -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( { @@ -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(), diff --git a/www/OSHealthFitness.js b/www/OSHealthFitness.js index 5ce97931..692c1172 100644 --- a/www/OSHealthFitness.js +++ b/www/OSHealthFitness.js @@ -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'); };