@altcraft/react-native-sdk 0.0.1
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 -0
- package/README.md +46 -0
- package/Sdk.podspec +48 -0
- package/android/build.gradle +78 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/altcraft/sdk/SdkModule.kt +1242 -0
- package/android/src/main/java/com/altcraft/sdk/SdkPackage.kt +33 -0
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnFCMProvider.kt +27 -0
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnHMSProvider.kt +32 -0
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnJWTProvider.kt +21 -0
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnRustoreProvider.kt +53 -0
- package/ios/Sdk.h +19 -0
- package/ios/Sdk.mm +1112 -0
- package/ios/SdkModule.swift +888 -0
- package/ios/protocols/RNAPNSProvider.swift +15 -0
- package/ios/protocols/RNFCMProvider.swift +24 -0
- package/ios/protocols/RNHMSProvider.swift +24 -0
- package/ios/protocols/RNJWTProvider.swift +15 -0
- package/lib/module/NativeSdk.js +13 -0
- package/lib/module/NativeSdk.js.map +1 -0
- package/lib/module/index.js +561 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeSdk.d.ts +114 -0
- package/lib/typescript/src/NativeSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +391 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +128 -0
- package/react-native.config.js +10 -0
- package/src/NativeSdk.ts +171 -0
- package/src/index.tsx +670 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# END-USER LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 Altcraft LLC. All rights reserved.
|
|
4
|
+
|
|
5
|
+
1. **GRANT OF LICENSE**: This document grants you certain rights to use the Altcraft Mobile SDK (hereinafter referred to as the "Software"). All rights not expressly granted are reserved by the copyright holder.
|
|
6
|
+
|
|
7
|
+
2. **USE**: You have the right to use and distribute the Software for both commercial and non-commercial purposes.
|
|
8
|
+
|
|
9
|
+
3. **MODIFICATION WITHOUT PUBLICATION**: You may modify the Software for your own use without the obligation to publish these modifications.
|
|
10
|
+
|
|
11
|
+
4. **MODIFICATION WITH PUBLICATION**: Any publication of modified Software requires prior written permission from the copyright holder.
|
|
12
|
+
|
|
13
|
+
5. **DISCLAIMER OF WARRANTY**: The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement.
|
|
14
|
+
|
|
15
|
+
6. **LIMITATION OF LIABILITY**: In no event shall the copyright holder be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this Software, even if advised of the possibility of such damage.
|
|
16
|
+
|
|
17
|
+
7. **DISTRIBUTION**: When distributing the Software, you must provide all recipients with a copy of this license agreement.
|
|
18
|
+
|
|
19
|
+
8. **COPYRIGHT NOTICE AND THIRD-PARTY COMPONENTS**:
|
|
20
|
+
This Software may include components released under other licenses. A complete list of these components and their respective licenses is provided below:
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Altcraft React Native SDK
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/altcraft-react-native-sdk)
|
|
6
|
+
[](https://www.npmjs.com/package/altcraft-react-native-sdk)
|
|
7
|
+
[](#)
|
|
8
|
+
[](#)
|
|
9
|
+
[](#)
|
|
10
|
+
|
|
11
|
+
Altcraft React Native SDK. It helps manage push subscriptions, tokens, SDK events, and sending mobile events to the Altcraft platform.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Push subscription management:
|
|
18
|
+
- `pushSubscribe`
|
|
19
|
+
- `pushSuspend`
|
|
20
|
+
- `pushUnSubscribe`
|
|
21
|
+
- `getStatus...` APIs
|
|
22
|
+
- Push token management:
|
|
23
|
+
- get current token (`getPushToken`)
|
|
24
|
+
- set/delete token, force update, provider priority list
|
|
25
|
+
- JWT support (`setJwt`)
|
|
26
|
+
- Mobile events (`mobileEvent`)
|
|
27
|
+
- SDK event stream from native to JS (`subscribeToEvents`)
|
|
28
|
+
- Push intake forwarding (`takePush`) to native SDK
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- React Native: depends on your RN version and New Architecture setup (TurboModules).
|
|
35
|
+
- Android:
|
|
36
|
+
- `minSdk` and `compileSdk` depend on your app configuration
|
|
37
|
+
- Push provider integrated in the host app (FCM / APNS/ HMS / RuStore)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
yarn add altcraft-react-native-sdk
|
|
45
|
+
# or
|
|
46
|
+
npm i altcraft-react-native-sdk
|
package/Sdk.podspec
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "Sdk"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platform = :ios, min_ios_version_supported
|
|
14
|
+
|
|
15
|
+
s.source = {
|
|
16
|
+
:git => "https://github.com/altcraft/react-native-sdk.git",
|
|
17
|
+
:tag => s.version.to_s
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# --- Sources ---
|
|
21
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
22
|
+
s.public_header_files = "ios/**/*.h"
|
|
23
|
+
|
|
24
|
+
# --- Swift / Module settings (critical for <Sdk/Sdk-Swift.h>) ---
|
|
25
|
+
s.swift_version = "5.0"
|
|
26
|
+
s.pod_target_xcconfig = {
|
|
27
|
+
"DEFINES_MODULE" => "YES",
|
|
28
|
+
"CLANG_ENABLE_MODULES" => "YES",
|
|
29
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "YES"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# --- Native dependency ---
|
|
33
|
+
s.dependency "Altcraft", "0.1.2"
|
|
34
|
+
|
|
35
|
+
# --- React Native module deps ---
|
|
36
|
+
install_modules_dependencies(s)
|
|
37
|
+
|
|
38
|
+
if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
|
|
39
|
+
s.dependency "React-Codegen"
|
|
40
|
+
s.dependency "RCT-Folly"
|
|
41
|
+
s.dependency "RCTRequired"
|
|
42
|
+
s.dependency "RCTTypeSafety"
|
|
43
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
44
|
+
s.dependency "React-RCTFabric"
|
|
45
|
+
s.dependency "React-NativeModulesApple"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Sdk_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Sdk_" + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
android {
|
|
29
|
+
namespace "com.sdk"
|
|
30
|
+
|
|
31
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
32
|
+
|
|
33
|
+
defaultConfig {
|
|
34
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
35
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildFeatures {
|
|
39
|
+
buildConfig true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
buildTypes {
|
|
43
|
+
release {
|
|
44
|
+
minifyEnabled false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
lintOptions {
|
|
49
|
+
disable "GradleCompatible"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
compileOptions {
|
|
53
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
54
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
sourceSets {
|
|
58
|
+
main {
|
|
59
|
+
java.srcDirs += [
|
|
60
|
+
"generated/java",
|
|
61
|
+
"generated/jni"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
repositories {
|
|
68
|
+
mavenCentral()
|
|
69
|
+
google()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
73
|
+
|
|
74
|
+
dependencies {
|
|
75
|
+
implementation "com.facebook.react:react-android"
|
|
76
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
+
implementation "com.altcraft:android-sdk:1.0.2"
|
|
78
|
+
}
|