Skip to content

Commit

Permalink
chore: Replace OSCore by OSCommonPluginLib (#86)
Browse files Browse the repository at this point in the history
Remove the older OSCore framework and replace it by the new OSCommonPluginLib pod.
Raise iOS minimum version to 13.
  • Loading branch information
OS-ricardomoreirasilva committed Nov 9, 2022
1 parent a1fa084 commit 188d35c
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 1,194 deletions.
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
- Fix: [iOS] Replace the old `OSCore` framework for the new `OSCommonPluginLib` pod.

## [Version 1.2.10]
- Fix: [Android] Add safe call to avoid build error. (https://outsystemsrd.atlassian.net/browse/RMET-2041)
Expand Down
17 changes: 0 additions & 17 deletions hooks/add_cordova_implementation_ios.js

This file was deleted.

15 changes: 9 additions & 6 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@
<feature name="OSHealthFitness">
<param name="ios-package" value="OSHealthFitness" />
</feature>
<preference name="deployment-target" value="12" />
<preference name="deployment-target" value="13" />
<preference name="UseSwiftLanguageVersion" value="5" />
</config-file>

<!-- Hooks -->
<hook type="before_plugin_install" src="hooks/add_cordova_implementation_ios.js"/>

<!-- iOS Permissions -->
<preference name="HEALTH_SHARE_DESCRIPTION" default="App needs to shared health data" />
<config-file target="*-Info.plist" parent="NSHealthShareUsageDescription">
Expand Down Expand Up @@ -108,12 +105,18 @@

<!-- iOS Source Files -->
<source-file src="src/ios/OSHealthFitness.swift" />
<source-file src="src/ios/CordovaImplementation.swift" />
<framework src="src/ios/frameworks/OSHealthFitnessLib.xcframework" embed="true" custom="true" />
<framework src="src/ios/frameworks/OSCore.xcframework" embed="true" custom="true" />

<dependency id="cordova-plugin-add-swift-support" url="https://github.com/OutSystems/cordova-plugin-add-swift-support.git#2.0.3-OS1"/>

<podspec>
<config>
<source url="https://cdn.cocoapods.org/"/>
</config>
<pods use-frameworks="true">
<pod name="OSCommonPluginLib" spec="1.0.0" />
</pods>
</podspec>
</platform>

</plugin>
27 changes: 26 additions & 1 deletion src/ios/OSHealthFitness.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import OSCommonPluginLib
import OSHealthFitnessLib

@objc(OSHealthFitness)
class OSHealthFitness: CordovaImplementation {
class OSHealthFitness: CDVPlugin {
var plugin: HealthFitnessPlugin?
var callbackId:String=""

Expand Down Expand Up @@ -226,3 +227,27 @@ class OSHealthFitness: CordovaImplementation {
}
}
}

// MARK: - OSCommonPluginLib's PlatformProtocol Methods
extension OSHealthFitness: PlatformProtocol {
func sendResult(result: String?, error: NSError?, callBackID: String) {
var pluginResult = CDVPluginResult (status: CDVCommandStatus_ERROR);

if let error = error {
if !error.localizedDescription.isEmpty {
let errorCode = String(error.code)
let errorMessage = error.localizedDescription
let errorDict = ["code": errorCode, "message": errorMessage]
pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errorDict);
}
} else if let result = result {
if result.isEmpty {
pluginResult = CDVPluginResult(status: CDVCommandStatus_OK)
} else {
pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result)
}
}

self.commandDelegate!.send(pluginResult, callbackId: callBackID);
}
}
40 changes: 0 additions & 40 deletions src/ios/frameworks/OSCore.xcframework/Info.plist

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Loading

0 comments on commit 188d35c

Please sign in to comment.