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-2128 ::: iOS ::: Workouts Feature #88

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
The changes documented here do not include those from the original repository.

## [Unreleased]
- Feat: [iOS] Add a method to retrieve workouts raw data from HealthKit (https://outsystemsrd.atlassian.net/browse/RMET-2128).

## [Version 1.2.11]
- Fix: [iOS] Replace the old `OSCore` framework for the new `OSCommonPluginLib` pod.
Expand Down
27 changes: 24 additions & 3 deletions src/ios/OSHealthFitness.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class OSHealthFitness: CDVPlugin {
let fitnessVariables = command.arguments[2] as? String ?? ""
let healthVariables = command.arguments[3] as? String ?? ""
let profileVariables = command.arguments[4] as? String ?? ""
let summaryVariables = command.arguments[5] as? String ?? ""
let variable = VariableStruct(allVariables: allVariables, fitnessVariables: fitnessVariables, healthVariables: healthVariables, profileVariables: profileVariables, summaryVariables: summaryVariables)
let workoutVariables = command.argument(at: 6) as? String ?? ""
let variable = VariableStruct(allVariables: allVariables, fitnessVariables: fitnessVariables, healthVariables: healthVariables, profileVariables: profileVariables, workoutVariables: workoutVariables)

self.plugin?.requestPermissions(customPermissions:customPermissions, variable: variable) { [weak self] authorized, error in
guard let self = self else { return }
Expand Down Expand Up @@ -195,7 +195,7 @@ class OSHealthFitness: CDVPlugin {
self.callbackId = command.callbackId

let queryParameters = command.arguments[0] as? String ?? ""
if let params = queryParameters.decode() as QueryParameters? {
if let params = queryParameters.decode() as AdvancedQueryParameters? {

let variable = params.variable ?? ""
let startDate = params.startDate ?? ""
Expand Down Expand Up @@ -226,6 +226,27 @@ class OSHealthFitness: CDVPlugin {
}
}
}

@objc(getWorkoutData:)
func getWorkoutData(command: CDVInvokedUrlCommand) {
self.callbackId = command.callbackId

guard let arg = command.argument(at: 0) as? String, let queryParameters = arg.decode() as WorkoutAdvancedQueryParameters? else { return }
let workoutTypeVariableDictionary = queryParameters.workoutTypeVariableDictionary
let startDate = Date(queryParameters.startDate ?? "")
let endDate = Date(queryParameters.endDate ?? "")

self.plugin?.workoutAdvancedQuery(workoutTypeVariableDictionary: workoutTypeVariableDictionary, date: (startDate, endDate), completion: { [weak self] success, result, error in
guard let self = self else { return }

if success {
self.sendResult(result: result, error: nil, callBackID: self.callbackId)
} else {
self.sendResult(result: nil, error: error, callBackID: self.callbackId)
}
})

}
}

// MARK: - OSCommonPluginLib's PlatformProtocol Methods
Expand Down
10 changes: 5 additions & 5 deletions src/ios/frameworks/OSHealthFitnessLib.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>OSHealthFitnessLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>OSHealthFitnessLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ SWIFT_CLASS("_TtC18OSHealthFitnessLib13BackgroundJob")
- (nonnull instancetype)initWithEntity:(NSEntityDescription * _Nonnull)entity insertIntoManagedObjectContext:(NSManagedObjectContext * _Nullable)context OBJC_DESIGNATED_INITIALIZER;
@end


@class NSString;
@class NSDate;
@class Notification;
Expand Down Expand Up @@ -249,6 +250,7 @@ SWIFT_CLASS("_TtC18OSHealthFitnessLib12Notification")
@end



@interface Notification (SWIFT_EXTENSION(OSHealthFitnessLib))
@property (nonatomic, copy) NSString * _Nullable body;
@property (nonatomic) int64_t id;
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading