@akylas/nativescript-app-utils 1.0.0
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 +8 -0
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/index-common.d.ts +0 -0
- package/index-common.js +1 -0
- package/index.android.d.ts +14 -0
- package/index.android.js +59 -0
- package/index.d.ts +1 -0
- package/index.ios.d.ts +14 -0
- package/index.ios.js +31 -0
- package/package.json +67 -0
- package/platforms/android/app_utils.aar +0 -0
- package/platforms/android/include.gradle +12 -0
- package/platforms/android/java/com/nativescript/apputils/Utils.kt +111 -0
- package/platforms/android/java/com/nativescript/apputils/WorkersContext.kt +20 -0
- package/platforms/android/native-api-usage.json +9 -0
- package/platforms/ios/iso639_2.bundle/iso639_1_to_iso639_2.plist +1346 -0
- package/platforms/ios/src/NSLocale+ISO639_2.swift +31 -0
- package/platforms/ios/src/NWorkerContext.swift +19 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NSLocale+ISO639_2.swift
|
|
3
|
+
// nsdocumentscanner
|
|
4
|
+
//
|
|
5
|
+
// Created by Martin Guillon on 03/01/2024.
|
|
6
|
+
// Copyright © 2024 NativeScript. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@objc(NSLocale)
|
|
13
|
+
extension NSLocale {
|
|
14
|
+
static let sISO639_2Dictionary: NSDictionary? = {
|
|
15
|
+
let bundleURL:URL! = Bundle.main.url(forResource:"iso639_2", withExtension:"bundle")
|
|
16
|
+
let bundle:Bundle! = Bundle(url: bundleURL)
|
|
17
|
+
let plistPath:String! = bundle.path(forResource: "iso639_1_to_iso639_2", ofType:"plist")
|
|
18
|
+
return NSDictionary(contentsOfFile: plistPath)
|
|
19
|
+
}()
|
|
20
|
+
class func ISO639_2Dictionary() -> NSDictionary! {
|
|
21
|
+
return sISO639_2Dictionary;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@objc
|
|
25
|
+
func ISO639_2LanguageCode() -> String! {
|
|
26
|
+
let ISO639_1LanguageCode:String! = self.object(forKey: NSLocale.Key.languageCode) as? String
|
|
27
|
+
let ISO639_2LanguageCode:String? = NSLocale.ISO639_2Dictionary().object(forKey: ISO639_1LanguageCode!) as? String
|
|
28
|
+
if (ISO639_2LanguageCode == nil) {return ISO639_1LanguageCode}
|
|
29
|
+
return ISO639_2LanguageCode
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
@objcMembers
|
|
5
|
+
@objc(NWorkerContext)
|
|
6
|
+
class NWorkerContext : NSObject {
|
|
7
|
+
private static var container: [String: Any] = [:]
|
|
8
|
+
static func setValue(_ key: String, _ value: Any?) {
|
|
9
|
+
if (value == nil) {
|
|
10
|
+
container.removeValue(forKey: key)
|
|
11
|
+
} else {
|
|
12
|
+
container[key] = value
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
static func getValue(_ key: String) -> Any? {
|
|
16
|
+
return container[key]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|