@akylas/nativescript-app-utils 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +2 -2
- package/platforms/ios/src/ImageUtils.swift +37 -34
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.1.6](https://github.com/akylas/nativescript-app-utils/compare/v2.1.5...v2.1.6) (2024-11-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* regression fix ([88f15db](https://github.com/akylas/nativescript-app-utils/commit/88f15db1e7b5be77f398c659d650c8500f6436e6))
|
|
11
|
+
|
|
12
|
+
## [2.1.5](https://github.com/akylas/nativescript-app-utils/compare/v2.1.4...v2.1.5) (2024-11-08)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ios:** getImageSize fix ([fff82d7](https://github.com/akylas/nativescript-app-utils/commit/fff82d79420ecffac199934905bf00683c466913))
|
|
17
|
+
|
|
6
18
|
## [2.1.4](https://github.com/akylas/nativescript-app-utils/compare/v2.1.3...v2.1.4) (2024-10-20)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akylas/nativescript-app-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Provides API for changing the styles of SystemUI (StatusBar, NavigationBar...) on iOS.",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"bugs": {
|
|
64
64
|
"url": "https://github.com/akylas/nativescript-app-utils/issues"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f9d8fa107bd8ef7a0bba2b7cd091e8b53402368d"
|
|
67
67
|
}
|
|
@@ -2,18 +2,18 @@ import Foundation
|
|
|
2
2
|
import UIKit
|
|
3
3
|
|
|
4
4
|
extension UIImage.Orientation {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
5
|
+
init(_ cgOrientation: CGImagePropertyOrientation) {
|
|
6
|
+
switch cgOrientation {
|
|
7
|
+
case .up: self = .up
|
|
8
|
+
case .upMirrored: self = .upMirrored
|
|
9
|
+
case .down: self = .down
|
|
10
|
+
case .downMirrored: self = .downMirrored
|
|
11
|
+
case .left: self = .left
|
|
12
|
+
case .leftMirrored: self = .leftMirrored
|
|
13
|
+
case .right: self = .right
|
|
14
|
+
case .rightMirrored: self = .rightMirrored
|
|
16
15
|
}
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
@objcMembers
|
|
19
19
|
@objc(ImageUtils)
|
|
@@ -165,22 +165,25 @@ class ImageUtils : NSObject {
|
|
|
165
165
|
if (imageProperties != nil) {
|
|
166
166
|
let width = imageProperties![kCGImagePropertyPixelWidth] as! Double;
|
|
167
167
|
let height = imageProperties![kCGImagePropertyPixelHeight] as! Double;
|
|
168
|
-
let orientation = imageProperties![kCGImagePropertyOrientation] as! Int;
|
|
169
|
-
let uiOrientation = UIImage.Orientation.init(CGImagePropertyOrientation(rawValue: UInt32(orientation))!);
|
|
170
168
|
var degrees: Int = 0
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
let orientation = imageProperties![kCGImagePropertyOrientation];
|
|
170
|
+
if (orientation != nil) {
|
|
171
|
+
let uiOrientation = UIImage.Orientation.init(CGImagePropertyOrientation(rawValue: UInt32(orientation as! Int))!);
|
|
172
|
+
switch uiOrientation {
|
|
173
|
+
case .down, .downMirrored:
|
|
174
|
+
degrees = 180
|
|
175
|
+
break
|
|
176
|
+
case .right, .rightMirrored:
|
|
177
|
+
degrees = -90
|
|
178
|
+
break
|
|
179
|
+
case .left, .leftMirrored:
|
|
180
|
+
degrees = 90
|
|
181
|
+
break
|
|
182
|
+
default:
|
|
183
|
+
degrees = 0
|
|
184
|
+
}
|
|
183
185
|
}
|
|
186
|
+
|
|
184
187
|
result = ["width": width, "height": height, "rotation":degrees];
|
|
185
188
|
}
|
|
186
189
|
return result;
|
|
@@ -214,15 +217,15 @@ class ImageUtils : NSObject {
|
|
|
214
217
|
return readImageFromFileSync(src, options: options)
|
|
215
218
|
}
|
|
216
219
|
static func readImageFromFile(_ src: String, _ delegate: NCompletionDelegate?, _ stringOptions: String?) {
|
|
217
|
-
|
|
220
|
+
DispatchQueue.global(qos: .userInitiated).async {
|
|
218
221
|
let options = toJSON(stringOptions)
|
|
219
|
-
// do {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
// } catch {
|
|
223
|
-
// delegate?.onComplete(readImageFromFileSync(src, stringOptions) as NSObject?, error: error as NSError?)
|
|
224
|
-
//
|
|
225
|
-
// }
|
|
226
|
-
|
|
222
|
+
// do {
|
|
223
|
+
delegate?.onComplete(readImageFromFileSync(src, stringOptions) as NSObject?, error: nil)
|
|
224
|
+
|
|
225
|
+
// } catch {
|
|
226
|
+
// delegate?.onComplete(readImageFromFileSync(src, stringOptions) as NSObject?, error: error as NSError?)
|
|
227
|
+
//
|
|
228
|
+
// }
|
|
229
|
+
}
|
|
227
230
|
}
|
|
228
231
|
}
|