Skip to content

Commit

Permalink
fix: Treat DataPoint on AdvancedQuery method (#76)
Browse files Browse the repository at this point in the history
Update lib and update bridge in order to deal with the new AdvancedQueryResultType parameter and structure.
  • Loading branch information
OS-ricardomoreirasilva authored Jul 25, 2022
1 parent c1c96ae commit 8e6fcf6
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The changes documented here do not include those from the original repository.
## [Version 1.2.7]

- Fix: Apply Date Range filter while processing Advanced Query Results, so that data blocks that don't belong to the requested dates can be omitted (https://outsystemsrd.atlassian.net/browse/RMET-1718).
- Fix: Create AdvancedQueryDataPoint structure and AdvancedQueryResultType parameter so that we can control what to output on the native side (https://outsystemsrd.atlassian.net/browse/RMET-1724).

## [Version 1.2.6]

Expand Down
2 changes: 2 additions & 0 deletions src/ios/OSHealthFitness.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class OSHealthFitness: CordovaImplementation {
let operationType = params.operationType ?? ""
let timeUnitLength = params.timeUnitLength ?? 1
let onlyFilledBlocks = params.advancedQueryReturnType == AdvancedQueryReturnTypeEnum.removeEmptyDataBlocks.rawValue
let resultType = AdvancedQueryResultType.get(with: params.advancedQueryResultType ?? "")

self.plugin?.advancedQuery(
variable: variable,
Expand All @@ -210,6 +211,7 @@ class OSHealthFitness: CordovaImplementation {
operationType: operationType,
mostRecent: false,
onlyFilledBlocks: onlyFilledBlocks,
resultType: resultType,
timeUnitLength: timeUnitLength
) { [weak self] success, result, error in
guard let self = self else { return }
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</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>
<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>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ SWIFT_CLASS("_TtC18OSHealthFitnessLib13BackgroundJob")




SWIFT_CLASS("_TtC18OSHealthFitnessLib12Notification")
@interface Notification : NSManagedObject
- (nonnull instancetype)initWithEntity:(NSEntityDescription * _Nonnull)entity insertIntoManagedObjectContext:(NSManagedObjectContext * _Nullable)context OBJC_DESIGNATED_INITIALIZER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ open class HealthFitnessPlugin {
public func requestPermissions(customPermissions: Swift.String, variable: OSHealthFitnessLib.VariableStruct, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func setBackgroundJob(variable: Swift.String, timeUnit: (name: Swift.String, grouping: Swift.Int), notificationFrequency: (name: Swift.String, grouping: Swift.Int), jobFrequency: Swift.String, condition: Swift.String, value: Swift.Double, notificationText: (header: Swift.String, body: Swift.String), completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func updateBackgroundJob(id: Swift.Int64?, notificationFrequency: (name: Swift.String?, grouping: Swift.Int?), condition: Swift.String?, value: Swift.Double?, notificationText: (header: Swift.String?, body: Swift.String?), isActive: Swift.Bool?, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, resultType: OSHealthFitnessLib.AdvancedQueryResultType = .allType, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
@objc deinit
}
extension Foundation.Date {
Expand Down Expand Up @@ -88,19 +88,34 @@ public class BackgroundJobParameters : Swift.Codable {
required public init(from decoder: Swift.Decoder) throws
}
public enum AdvancedQueryReturnTypeEnum : Swift.String {
case allData, removeEmptyDataBlocks
case allData
case removeEmptyDataBlocks
public init?(rawValue: Swift.String)
public typealias RawValue = Swift.String
public var rawValue: Swift.String {
get
}
}
public struct AdvancedQueryResultType : Swift.OptionSet {
public typealias RawValue = Swift.Int
public var rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue
public init(rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue)
public static let rawDataType: OSHealthFitnessLib.AdvancedQueryResultType
public static let dataPointType: OSHealthFitnessLib.AdvancedQueryResultType
public static let allType: OSHealthFitnessLib.AdvancedQueryResultType
public typealias ArrayLiteralElement = OSHealthFitnessLib.AdvancedQueryResultType
public typealias Element = OSHealthFitnessLib.AdvancedQueryResultType
}
extension OSHealthFitnessLib.AdvancedQueryResultType {
public static func get(with description: Swift.String) -> OSHealthFitnessLib.AdvancedQueryResultType
}
@_hasMissingDesignatedInitializers public class QueryParameters : Swift.Codable {
final public let variable: Swift.String?
final public let startDate: Swift.String?, endDate: Swift.String?
final public let timeUnit: Swift.String?, operationType: Swift.String?
final public let timeUnitLength: Swift.Int?
final public let advancedQueryReturnType: Swift.String?
final public let advancedQueryResultType: Swift.String?
@objc deinit
public func encode(to encoder: Swift.Encoder) throws
required public init(from decoder: Swift.Decoder) throws
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ SWIFT_CLASS("_TtC18OSHealthFitnessLib13BackgroundJob")




SWIFT_CLASS("_TtC18OSHealthFitnessLib12Notification")
@interface Notification : NSManagedObject
- (nonnull instancetype)initWithEntity:(NSEntityDescription * _Nonnull)entity insertIntoManagedObjectContext:(NSManagedObjectContext * _Nullable)context OBJC_DESIGNATED_INITIALIZER;
Expand Down Expand Up @@ -508,6 +509,7 @@ SWIFT_CLASS("_TtC18OSHealthFitnessLib13BackgroundJob")




SWIFT_CLASS("_TtC18OSHealthFitnessLib12Notification")
@interface Notification : NSManagedObject
- (nonnull instancetype)initWithEntity:(NSEntityDescription * _Nonnull)entity insertIntoManagedObjectContext:(NSManagedObjectContext * _Nullable)context OBJC_DESIGNATED_INITIALIZER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ open class HealthFitnessPlugin {
public func requestPermissions(customPermissions: Swift.String, variable: OSHealthFitnessLib.VariableStruct, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func setBackgroundJob(variable: Swift.String, timeUnit: (name: Swift.String, grouping: Swift.Int), notificationFrequency: (name: Swift.String, grouping: Swift.Int), jobFrequency: Swift.String, condition: Swift.String, value: Swift.Double, notificationText: (header: Swift.String, body: Swift.String), completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func updateBackgroundJob(id: Swift.Int64?, notificationFrequency: (name: Swift.String?, grouping: Swift.Int?), condition: Swift.String?, value: Swift.Double?, notificationText: (header: Swift.String?, body: Swift.String?), isActive: Swift.Bool?, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, resultType: OSHealthFitnessLib.AdvancedQueryResultType = .allType, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
@objc deinit
}
extension Foundation.Date {
Expand Down Expand Up @@ -88,19 +88,34 @@ public class BackgroundJobParameters : Swift.Codable {
required public init(from decoder: Swift.Decoder) throws
}
public enum AdvancedQueryReturnTypeEnum : Swift.String {
case allData, removeEmptyDataBlocks
case allData
case removeEmptyDataBlocks
public init?(rawValue: Swift.String)
public typealias RawValue = Swift.String
public var rawValue: Swift.String {
get
}
}
public struct AdvancedQueryResultType : Swift.OptionSet {
public typealias RawValue = Swift.Int
public var rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue
public init(rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue)
public static let rawDataType: OSHealthFitnessLib.AdvancedQueryResultType
public static let dataPointType: OSHealthFitnessLib.AdvancedQueryResultType
public static let allType: OSHealthFitnessLib.AdvancedQueryResultType
public typealias ArrayLiteralElement = OSHealthFitnessLib.AdvancedQueryResultType
public typealias Element = OSHealthFitnessLib.AdvancedQueryResultType
}
extension OSHealthFitnessLib.AdvancedQueryResultType {
public static func get(with description: Swift.String) -> OSHealthFitnessLib.AdvancedQueryResultType
}
@_hasMissingDesignatedInitializers public class QueryParameters : Swift.Codable {
final public let variable: Swift.String?
final public let startDate: Swift.String?, endDate: Swift.String?
final public let timeUnit: Swift.String?, operationType: Swift.String?
final public let timeUnitLength: Swift.Int?
final public let advancedQueryReturnType: Swift.String?
final public let advancedQueryResultType: Swift.String?
@objc deinit
public func encode(to encoder: Swift.Encoder) throws
required public init(from decoder: Swift.Decoder) throws
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ open class HealthFitnessPlugin {
public func requestPermissions(customPermissions: Swift.String, variable: OSHealthFitnessLib.VariableStruct, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func setBackgroundJob(variable: Swift.String, timeUnit: (name: Swift.String, grouping: Swift.Int), notificationFrequency: (name: Swift.String, grouping: Swift.Int), jobFrequency: Swift.String, condition: Swift.String, value: Swift.Double, notificationText: (header: Swift.String, body: Swift.String), completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func updateBackgroundJob(id: Swift.Int64?, notificationFrequency: (name: Swift.String?, grouping: Swift.Int?), condition: Swift.String?, value: Swift.Double?, notificationText: (header: Swift.String?, body: Swift.String?), isActive: Swift.Bool?, completion: @escaping (Swift.Bool, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
public func advancedQuery(variable: Swift.String, date: (start: Foundation.Date, end: Foundation.Date), timeUnit: Swift.String, operationType: Swift.String, mostRecent: Swift.Bool, onlyFilledBlocks: Swift.Bool, resultType: OSHealthFitnessLib.AdvancedQueryResultType = .allType, timeUnitLength: Swift.Int, completion: @escaping (Swift.Bool, Swift.String?, Foundation.NSError?) -> Swift.Void)
@objc deinit
}
extension Foundation.Date {
Expand Down Expand Up @@ -88,19 +88,34 @@ public class BackgroundJobParameters : Swift.Codable {
required public init(from decoder: Swift.Decoder) throws
}
public enum AdvancedQueryReturnTypeEnum : Swift.String {
case allData, removeEmptyDataBlocks
case allData
case removeEmptyDataBlocks
public init?(rawValue: Swift.String)
public typealias RawValue = Swift.String
public var rawValue: Swift.String {
get
}
}
public struct AdvancedQueryResultType : Swift.OptionSet {
public typealias RawValue = Swift.Int
public var rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue
public init(rawValue: OSHealthFitnessLib.AdvancedQueryResultType.RawValue)
public static let rawDataType: OSHealthFitnessLib.AdvancedQueryResultType
public static let dataPointType: OSHealthFitnessLib.AdvancedQueryResultType
public static let allType: OSHealthFitnessLib.AdvancedQueryResultType
public typealias ArrayLiteralElement = OSHealthFitnessLib.AdvancedQueryResultType
public typealias Element = OSHealthFitnessLib.AdvancedQueryResultType
}
extension OSHealthFitnessLib.AdvancedQueryResultType {
public static func get(with description: Swift.String) -> OSHealthFitnessLib.AdvancedQueryResultType
}
@_hasMissingDesignatedInitializers public class QueryParameters : Swift.Codable {
final public let variable: Swift.String?
final public let startDate: Swift.String?, endDate: Swift.String?
final public let timeUnit: Swift.String?, operationType: Swift.String?
final public let timeUnitLength: Swift.Int?
final public let advancedQueryReturnType: Swift.String?
final public let advancedQueryResultType: Swift.String?
@objc deinit
public func encode(to encoder: Swift.Encoder) throws
required public init(from decoder: Swift.Decoder) throws
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</data>
<key>Headers/OSHealthFitnessLib-Swift.h</key>
<data>
e1QfrrDPwOr+FwuHE3ipwzfGZtc=
lN1ZPeHtM4Dc8Jgkq9Kvli7qvok=
</data>
<key>Headers/OSHealthFitnessLib.h</key>
<data>
Expand All @@ -38,23 +38,23 @@
</data>
<key>Modules/OSHealthFitnessLib.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
<data>
DPIupSggVhuq1mADRi+etWEvXXk=
Qz4ITJTltXNcCjy4BAcyRblLDrg=
</data>
<key>Modules/OSHealthFitnessLib.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
<data>
B0G2M7GLq0th9Z4B2twliPux2zQ=
H9KhlOqqlzO1Oi1oabY0Qq17ie0=
</data>
<key>Modules/OSHealthFitnessLib.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
<data>
Z/nr4l2D4fg6McFuK8IPAj+nvsI=
</data>
<key>Modules/OSHealthFitnessLib.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
<data>
wMTWNRmZvQUHwbxID6wOJTgR0RA=
Y/C8GSUtA+L97U4TDbrYZiLwL/M=
</data>
<key>Modules/OSHealthFitnessLib.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<data>
SjSFQ37owe0LVwqQXBmcffdZVuM=
u5nbtHmNdAy+9lzwHvn3fxhJcr4=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down Expand Up @@ -95,7 +95,7 @@
<dict>
<key>hash2</key>
<data>
tiEN76XSeMI87hvkiDg5BrV/R2ep6tKPae58374xUF4=
YEBTwnCfOBwsO8w9eK/xlVHqS4tc5VihjhBYPN3bIMA=
</data>
</dict>
<key>Headers/OSHealthFitnessLib.h</key>
Expand All @@ -116,14 +116,14 @@
<dict>
<key>hash2</key>
<data>
CW2BmxGS0n1KbhEphR50Lp9t8zsiQDzdw24iFfJr1xU=
waYSq1M8WkIiC2uH1GRAYfA/RkIqCb3CEgmLP0dOfcc=
</data>
</dict>
<key>Modules/OSHealthFitnessLib.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
<dict>
<key>hash2</key>
<data>
uHCJ+LjPRpOA2Sl1DECF2FBrmk+uxDivwYSKp4xoxNo=
p4fCys9xoFxTtpiKpY9+uZGOx/8QmzA+XspRB1aFg3g=
</data>
</dict>
<key>Modules/OSHealthFitnessLib.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
Expand All @@ -137,14 +137,14 @@
<dict>
<key>hash2</key>
<data>
FeJnsK5v43iqE8dq6fsbVGVvJRc97P9zFZx0Mac8wZ4=
uQRQYt3R/IN9Yxo6AGGxJRtdhuLk9FKsmxV6qchEIts=
</data>
</dict>
<key>Modules/OSHealthFitnessLib.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<dict>
<key>hash2</key>
<data>
GuiRDREBkdYlAsBi8xjjfxftMUvmitr4+Q8dVkapimk=
l4+9loqTLm3Yf9U83DH45XkFX5JABOF+pHkE9puJVps=
</data>
</dict>
<key>Modules/module.modulemap</key>
Expand Down

0 comments on commit 8e6fcf6

Please sign in to comment.