@altcraft/react-native-sdk 0.0.2 → 0.0.4
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/LICENSE +20 -20
- package/README.md +119 -27
- package/Sdk.podspec +2 -2
- package/android/build.gradle +3 -4
- package/android/src/main/java/com/altcraft/sdk/SdkEventEmitter.kt +50 -0
- package/android/src/main/java/com/altcraft/sdk/SdkModule.kt +663 -480
- package/android/src/main/java/com/altcraft/sdk/SdkPackage.kt +16 -8
- package/android/src/main/java/com/altcraft/sdk/utilities/Converter.kt +164 -0
- package/android/src/main/java/com/altcraft/sdk/utilities/Extension.kt +72 -0
- package/ios/Converter.swift +485 -48
- package/ios/Sdk.mm +195 -270
- package/ios/SdkModule.swift +456 -507
- package/lib/module/NativeSdk.js +35 -0
- package/lib/module/NativeSdk.js.map +1 -1
- package/lib/module/Utilities.js +178 -0
- package/lib/module/Utilities.js.map +1 -0
- package/lib/module/index.js +335 -245
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeSdk.d.ts +125 -33
- package/lib/typescript/src/NativeSdk.d.ts.map +1 -1
- package/lib/typescript/src/Utilities.d.ts +47 -0
- package/lib/typescript/src/Utilities.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +218 -94
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeSdk.ts +169 -46
- package/src/Utilities.ts +180 -0
- package/src/index.tsx +410 -312
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnFCMProvider.kt +0 -26
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnHMSProvider.kt +0 -32
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnJWTProvider.kt +0 -21
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnRustoreProvider.kt +0 -53
- package/ios/protocols/RNAPNSProvider.swift +0 -15
- package/ios/protocols/RNFCMProvider.swift +0 -24
- package/ios/protocols/RNHMSProvider.swift +0 -24
- package/ios/protocols/RNJWTProvider.swift +0 -15
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
package com.altcraft.sdk.rn.providers
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.Keep
|
|
4
|
-
import com.altcraft.sdk.interfaces.FCMInterface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@Keep
|
|
8
|
-
object RnFCMProvider : FCMInterface {
|
|
9
|
-
@Volatile
|
|
10
|
-
private var token: String? = null
|
|
11
|
-
|
|
12
|
-
override suspend fun getToken(): String? = token
|
|
13
|
-
|
|
14
|
-
override suspend fun deleteToken(completion: (Boolean) -> Unit) {
|
|
15
|
-
token = null
|
|
16
|
-
completion(true)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
fun setToken(newToken: String?) {
|
|
20
|
-
token = newToken
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
fun clear() {
|
|
24
|
-
token = null
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package com.altcraft.sdk.rn.providers
|
|
2
|
-
|
|
3
|
-
// Created by Andrey Pogodin.
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2025 Altcraft. All rights reserved.
|
|
6
|
-
|
|
7
|
-
import android.content.Context
|
|
8
|
-
import androidx.annotation.Keep
|
|
9
|
-
import com.altcraft.sdk.interfaces.HMSInterface
|
|
10
|
-
|
|
11
|
-
@Keep
|
|
12
|
-
object RnHMSProvider : HMSInterface {
|
|
13
|
-
|
|
14
|
-
@Volatile
|
|
15
|
-
private var token: String? = null
|
|
16
|
-
|
|
17
|
-
override suspend fun getToken(context: Context): String? = token
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
override suspend fun deleteToken(context: Context, complete: (Boolean) -> Unit) {
|
|
21
|
-
token = null
|
|
22
|
-
complete(true)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
fun setToken(newToken: String?) {
|
|
26
|
-
token = newToken
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
fun clear() {
|
|
30
|
-
token = null
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package com.altcraft.sdk.rn.providers
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.Keep
|
|
4
|
-
import com.altcraft.sdk.interfaces.JWTInterface
|
|
5
|
-
|
|
6
|
-
@Keep
|
|
7
|
-
object RnJWTProvider : JWTInterface {
|
|
8
|
-
|
|
9
|
-
@Volatile
|
|
10
|
-
private var jwt: String? = null
|
|
11
|
-
|
|
12
|
-
override fun getJWT(): String? = jwt
|
|
13
|
-
|
|
14
|
-
fun setToken(newToken: String?) {
|
|
15
|
-
jwt = newToken
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
fun clear() {
|
|
19
|
-
jwt = null
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
package com.altcraft.sdk.rn.providers
|
|
2
|
-
|
|
3
|
-
// Created by Andrey Pogodin.
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2025 Altcraft. All rights reserved.
|
|
6
|
-
|
|
7
|
-
import androidx.annotation.Keep
|
|
8
|
-
import com.altcraft.sdk.interfaces.RustoreInterface
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* React Native RuStore token provider implementation.
|
|
12
|
-
*
|
|
13
|
-
* This provider acts as a bridge between the JavaScript side and the native SDK.
|
|
14
|
-
* React Native supplies the RuStore token manually, and the SDK retrieves it
|
|
15
|
-
* through this implementation of [RustoreInterface].
|
|
16
|
-
*
|
|
17
|
-
* Notes:
|
|
18
|
-
* - The token is stored in memory only. It is not persisted and will be lost
|
|
19
|
-
* when the process is killed.
|
|
20
|
-
*/
|
|
21
|
-
@Keep
|
|
22
|
-
object RnRuStoreProvider : RustoreInterface {
|
|
23
|
-
|
|
24
|
-
@Volatile
|
|
25
|
-
private var token: String? = null
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns the currently stored RuStore token or null.
|
|
29
|
-
*/
|
|
30
|
-
override suspend fun getToken(): String? = token
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Deletes the current RuStore token and invokes the completion callback.
|
|
34
|
-
*/
|
|
35
|
-
override suspend fun deleteToken(complete: (Boolean) -> Unit) {
|
|
36
|
-
token = null
|
|
37
|
-
complete(true)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Sets a new RuStore token.
|
|
42
|
-
*/
|
|
43
|
-
fun setToken(newToken: String?) {
|
|
44
|
-
token = newToken
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Clears the stored RuStore token.
|
|
49
|
-
*/
|
|
50
|
-
fun clear() {
|
|
51
|
-
token = null
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import Altcraft
|
|
3
|
-
|
|
4
|
-
@objcMembers
|
|
5
|
-
final class RNAPNSProvider: NSObject, APNSInterface {
|
|
6
|
-
private let get: (@escaping (String?) -> Void) -> Void
|
|
7
|
-
|
|
8
|
-
init(get: @escaping (@escaping (String?) -> Void) -> Void) {
|
|
9
|
-
self.get = get
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
func getToken(completion: @escaping (String?) -> Void) {
|
|
13
|
-
get(completion)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import Altcraft
|
|
3
|
-
|
|
4
|
-
@objcMembers
|
|
5
|
-
final class RNFCMProvider: NSObject, FCMInterface {
|
|
6
|
-
private let get: (@escaping (String?) -> Void) -> Void
|
|
7
|
-
private let del: (@escaping (Bool) -> Void) -> Void
|
|
8
|
-
|
|
9
|
-
init(
|
|
10
|
-
get: @escaping (@escaping (String?) -> Void) -> Void,
|
|
11
|
-
del: @escaping (@escaping (Bool) -> Void) -> Void
|
|
12
|
-
) {
|
|
13
|
-
self.get = get
|
|
14
|
-
self.del = del
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
func getToken(completion: @escaping (String?) -> Void) {
|
|
18
|
-
get(completion)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
func deleteToken(completion: @escaping (Bool) -> Void) {
|
|
22
|
-
del(completion)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import Altcraft
|
|
3
|
-
|
|
4
|
-
@objcMembers
|
|
5
|
-
final class RNHMSProvider: NSObject, HMSInterface {
|
|
6
|
-
private let get: (@escaping (String?) -> Void) -> Void
|
|
7
|
-
private let del: (@escaping (Bool) -> Void) -> Void
|
|
8
|
-
|
|
9
|
-
init(
|
|
10
|
-
get: @escaping (@escaping (String?) -> Void) -> Void,
|
|
11
|
-
del: @escaping (@escaping (Bool) -> Void) -> Void
|
|
12
|
-
) {
|
|
13
|
-
self.get = get
|
|
14
|
-
self.del = del
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
func getToken(completion: @escaping (String?) -> Void) {
|
|
18
|
-
get(completion)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
func deleteToken(completion: @escaping (Bool) -> Void) {
|
|
22
|
-
del(completion)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import Altcraft
|
|
3
|
-
|
|
4
|
-
@objcMembers
|
|
5
|
-
final class RNJWTProvider: NSObject, JWTInterface {
|
|
6
|
-
private let get: () -> String?
|
|
7
|
-
|
|
8
|
-
init(get: @escaping () -> String?) {
|
|
9
|
-
self.get = get
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
func getToken() -> String? {
|
|
13
|
-
get()
|
|
14
|
-
}
|
|
15
|
-
}
|