airbridge-react-native-sdk-restricted 2.8.8 → 4.1.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/.github/workflows/build.yml +249 -159
- package/.github/workflows/documentation.yml +76 -0
- package/.github/workflows/qa.yml +187 -0
- package/.github/workflows/release.yml +26 -0
- package/airbridge-react-native-sdk-restricted.podspec +10 -7
- package/airbridge_sdk.json +4 -0
- package/android/build.gradle +22 -5
- package/android/{copy-config.gradle → copy-airbridge-json.gradle} +2 -2
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeReactNative.kt +141 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/common/AirbridgeLifecycleIntegration.kt +7 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/extension/AirbridgeOptionBuilderApply.kt +79 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/extension/JSONConvert.kt +33 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/AttributionInteractor.kt +54 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/DeeplinkInteractor.kt +45 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/EventInteractor.kt +22 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/FetchInteractor.kt +51 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/PlacementInteractor.kt +56 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/RegisterInteractor.kt +108 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/SwitchInteractor.kt +43 -0
- package/android/src/main/java/co/ab180/airbridge/reactnative/module/WebInterfaceInteractor.kt +24 -0
- package/build/document/.nojekyll +1 -0
- package/build/document/assets/highlight.css +22 -0
- package/build/document/assets/icons.js +18 -0
- package/build/document/assets/icons.svg +1 -0
- package/build/document/assets/main.js +60 -0
- package/build/document/assets/navigation.js +1 -0
- package/build/document/assets/search.js +1 -0
- package/build/document/assets/style.css +1448 -0
- package/build/document/classes/Airbridge.html +113 -0
- package/build/document/classes/AirbridgeAttribute.html +49 -0
- package/build/document/classes/AirbridgeCategory.html +28 -0
- package/build/document/index.html +8 -0
- package/build/document/modules.html +4 -0
- package/build/source/Airbridge.d.ts +230 -0
- package/build/source/Airbridge.js +277 -0
- package/build/source/Airbridge.js.map +1 -0
- package/build/source/architecture/Interactor.d.ts +2 -0
- package/build/source/architecture/Interactor.js +7 -0
- package/build/source/architecture/Interactor.js.map +1 -0
- package/build/source/architecture/module.d.ts +1 -0
- package/build/source/architecture/module.js +2 -0
- package/build/source/architecture/module.js.map +1 -0
- package/build/source/constant/AirbridgeAttribute.d.ts +51 -0
- package/build/source/constant/AirbridgeAttribute.js +144 -0
- package/build/source/constant/AirbridgeAttribute.js.map +1 -0
- package/build/source/constant/AirbridgeCategory.d.ts +30 -0
- package/build/source/constant/AirbridgeCategory.js +81 -0
- package/build/source/constant/AirbridgeCategory.js.map +1 -0
- package/build/source/module/Attribution.d.ts +16 -0
- package/build/source/module/Attribution.js +39 -0
- package/build/source/module/Attribution.js.map +1 -0
- package/build/source/module/Deeplink.d.ts +17 -0
- package/build/source/module/Deeplink.js +40 -0
- package/build/source/module/Deeplink.js.map +1 -0
- package/build/source/module/Event.d.ts +14 -0
- package/build/source/module/Event.js +50 -0
- package/build/source/module/Event.js.map +1 -0
- package/build/source/module/Fetch.d.ts +19 -0
- package/build/source/module/Fetch.js +100 -0
- package/build/source/module/Fetch.js.map +1 -0
- package/build/source/module/Placement.d.ts +18 -0
- package/build/source/module/Placement.js +95 -0
- package/build/source/module/Placement.js.map +1 -0
- package/build/source/module/Register.d.ts +49 -0
- package/build/source/module/Register.js +138 -0
- package/build/source/module/Register.js.map +1 -0
- package/build/source/module/Switch.d.ts +24 -0
- package/build/source/module/Switch.js +39 -0
- package/build/source/module/Switch.js.map +1 -0
- package/build/source/module/WebInterface.d.ts +16 -0
- package/build/source/module/WebInterface.js +46 -0
- package/build/source/module/WebInterface.js.map +1 -0
- package/build/source/module.d.ts +3 -0
- package/build/source/module.js +4 -0
- package/build/source/module.js.map +1 -0
- package/build/source/utility/check.d.ts +13 -0
- package/build/source/utility/check.js +15 -0
- package/build/source/utility/check.js.map +1 -0
- package/build/source/utility/compute.d.ts +3 -0
- package/build/source/utility/compute.js +5 -0
- package/build/source/utility/compute.js.map +1 -0
- package/build/source/utility/create.d.ts +5 -0
- package/build/source/utility/create.js +12 -0
- package/build/source/utility/create.js.map +1 -0
- package/build/source/utility/extract.d.ts +3 -0
- package/build/source/utility/extract.js +4 -0
- package/build/source/utility/extract.js.map +1 -0
- package/build/source/utility/json.d.ts +11 -0
- package/build/source/utility/json.js +137 -0
- package/build/source/utility/json.js.map +1 -0
- package/build/source/utility/log.d.ts +4 -0
- package/build/source/utility/log.js +9 -0
- package/build/source/utility/log.js.map +1 -0
- package/changelog.md +7 -0
- package/ios/AirbridgeReactNative/AirbridgeReactNative.h +23 -0
- package/ios/AirbridgeReactNative/AirbridgeReactNative.m +36 -0
- package/ios/AirbridgeReactNative/AirbridgeReactNative.swift +95 -0
- package/ios/AirbridgeReactNative/Extension/AirbridgeOptionBuilderApply.swift +86 -0
- package/ios/AirbridgeReactNative/Extension/DataFromHex.swift +21 -0
- package/ios/AirbridgeReactNative/Extension/Logger.swift +62 -0
- package/ios/AirbridgeReactNative/Module/AirbridgeModuleExtern.m +133 -0
- package/ios/AirbridgeReactNative/Module/AttributionInteractor.swift +43 -0
- package/ios/AirbridgeReactNative/Module/DeeplinkInteractor.swift +49 -0
- package/ios/AirbridgeReactNative/Module/EventInteractor.swift +26 -0
- package/ios/AirbridgeReactNative/Module/FetchInteractor.swift +66 -0
- package/ios/AirbridgeReactNative/Module/PlacementInteractor.swift +72 -0
- package/ios/AirbridgeReactNative/Module/RegisterInteractor.swift +104 -0
- package/ios/AirbridgeReactNative/Module/SwitchInteractor.swift +48 -0
- package/ios/AirbridgeReactNative/Module/WebInterfaceInteractor.swift +30 -0
- package/ios/{copy-config.rb → copy-airbridge-json.rb} +1 -1
- package/package.json +18 -27
- package/qa/Gemfile +3 -4
- package/qa/Gemfile.lock +28 -17
- package/qa/airbridge_qa.json +6 -0
- package/qa/android/app/build.gradle +30 -26
- package/qa/android/app/src/main/AndroidManifest.xml +159 -7
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/ConfigurationLoader.kt +5 -5
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainActivity.kt +2 -2
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/IdentifiersInteractor.kt +8 -17
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/InstallReferrerInteractor.kt +13 -22
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/ModuleInjector.kt +1 -2
- package/qa/android/app/src/main/res/values/airbridge.xml +16 -0
- package/qa/android/build.gradle +4 -2
- package/qa/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/qa/android/gradle.properties +0 -2
- package/qa/android/gradlew +1 -1
- package/qa/android/settings.gradle +3 -1
- package/qa/ios/AirbridgeQA/AirbridgeQA.entitlements +11 -0
- package/qa/ios/AirbridgeQA/AppDelegate.mm +40 -30
- package/qa/ios/AirbridgeQA/DeviceInfoInteractor.swift +0 -1
- package/qa/ios/AirbridgeQA/IdentifiersInteractor.swift +4 -8
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-29.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon@3x.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/AppIcon~ipad.png +0 -0
- package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/Contents.json +113 -32
- package/qa/ios/AirbridgeQA.xcodeproj/project.pbxproj +47 -10
- package/qa/ios/InternalLibrary/airbridge-ios-sdk-qa-library.podspec +32 -0
- package/qa/ios/InternalLibrary/airbridge-ios-sdk-restricted.podspec +32 -0
- package/qa/ios/Library/airbridge-ios-sdk-qa-library.podspec +6 -1
- package/qa/ios/Podfile +13 -1
- package/qa/ios/Podfile.lock +678 -313
- package/qa/ios/Script/prepare-build-parameter.rb +23 -0
- package/qa/metro.config.js +5 -2
- package/qa/package-lock.json +3360 -1435
- package/qa/package.json +29 -30
- package/qa/source/App.js +11 -5
- package/qa/source/common/FCMService.js +39 -15
- package/qa/source/navigations/Stack.js +8 -1
- package/qa/source/pages/AppInfo.js +40 -0
- package/qa/source/pages/Browse.js +16 -19
- package/qa/source/pages/DeviceInfo.js +10 -4
- package/qa/source/pages/Event.js +70 -60
- package/qa/source/pages/Home.js +77 -17
- package/qa/source/pages/Identifiers.js +10 -6
- package/qa/source/pages/Placement.js +3 -3
- package/qa/source/pages/Skad.js +76 -0
- package/qa/source/pages/UserInfo.js +47 -28
- package/readme.md +6 -6
- package/script/BuildDocument.sh +10 -0
- package/{scripts/build-qa.sh → script/BuildQA.sh} +5 -4
- package/script/BuildSource.sh +14 -0
- package/script/ChangeInternalSDK.sh +22 -0
- package/script/ChangeProductionSDK.sh +37 -0
- package/script/ChangeRestricted.sh +34 -0
- package/script/PrepareBuildParameter.sh +28 -0
- package/source/Airbridge.ts +340 -0
- package/source/architecture/Interactor.ts +10 -0
- package/source/architecture/module.ts +1 -0
- package/source/constant/AirbridgeAttribute.ts +188 -0
- package/source/constant/AirbridgeCategory.ts +104 -0
- package/source/module/Attribution.ts +56 -0
- package/source/module/Deeplink.ts +59 -0
- package/source/module/Event.ts +71 -0
- package/source/module/Fetch.ts +137 -0
- package/source/module/Placement.ts +134 -0
- package/source/module/Register.ts +203 -0
- package/source/module/Switch.ts +61 -0
- package/source/module/WebInterface.ts +55 -0
- package/source/module.ts +3 -0
- package/source/tsconfig.json +14 -0
- package/source/utility/check.ts +46 -0
- package/source/utility/compute.ts +9 -0
- package/source/utility/create.ts +12 -0
- package/source/utility/extract.ts +5 -0
- package/source/utility/json.ts +180 -0
- package/source/utility/log.ts +14 -0
- package/test/jest.json +13 -0
- package/test/mock.ts +112 -0
- package/test/module/Deeplink.test.ts +29 -0
- package/test/tsconfig.json +8 -0
- package/.eslintrc.json +0 -44
- package/.gitattributes +0 -1
- package/.github/actions/add-github-check/action.yml +0 -78
- package/.github/actions/add-github-comment/action.yml +0 -48
- package/.github/actions/add-slack-message/action.yml +0 -32
- package/.github/actions/edit-github-check/action.yml +0 -59
- package/.github/actions/edit-github-comment/action.yml +0 -41
- package/.github/workflows/release-restricted.yml +0 -35
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeAttribution.java +0 -78
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeDeeplink.java +0 -97
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeEvent.java +0 -76
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeLifecycle.java +0 -31
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeLifecycleIntegration.java +0 -8
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgePlacement.java +0 -42
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeRN.java +0 -112
- package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeState.java +0 -174
- package/android/src/main/java/co/ab180/airbridge/reactnative/ConfigReader.java +0 -154
- package/android/src/main/java/co/ab180/airbridge/reactnative/Get.java +0 -84
- package/index.d.ts +0 -338
- package/index.js +0 -8
- package/ios/AirbridgeRN/ARNConfigReader.h +0 -19
- package/ios/AirbridgeRN/ARNConfigReader.m +0 -77
- package/ios/AirbridgeRN/ARNGet.h +0 -20
- package/ios/AirbridgeRN/ARNGet.m +0 -40
- package/ios/AirbridgeRN/ARNHex.h +0 -16
- package/ios/AirbridgeRN/ARNHex.m +0 -44
- package/ios/AirbridgeRN/AirbridgeAttribution.h +0 -19
- package/ios/AirbridgeRN/AirbridgeAttribution.m +0 -47
- package/ios/AirbridgeRN/AirbridgeDeeplink.h +0 -20
- package/ios/AirbridgeRN/AirbridgeDeeplink.m +0 -59
- package/ios/AirbridgeRN/AirbridgeEvent.h +0 -17
- package/ios/AirbridgeRN/AirbridgeEvent.m +0 -63
- package/ios/AirbridgeRN/AirbridgePlacement.h +0 -17
- package/ios/AirbridgeRN/AirbridgePlacement.m +0 -38
- package/ios/AirbridgeRN/AirbridgeRN.h +0 -71
- package/ios/AirbridgeRN/AirbridgeRN.m +0 -80
- package/ios/AirbridgeRN/AirbridgeState.h +0 -17
- package/ios/AirbridgeRN/AirbridgeState.m +0 -94
- package/ios/AirbridgeRN.xcodeproj/project.pbxproj +0 -417
- package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/UserInfoInteractor.kt +0 -74
- package/qa/ios/AirbridgeQA/UserInfoInteractor.m +0 -57
- package/qa/ios/AirbridgeQA/UserInfoInteractor.swift +0 -49
- package/qa/source/pages/appInfo.js +0 -22
- package/scripts/addiOSFramework.js +0 -48
- package/scripts/change_restricted.sh +0 -21
- package/scripts/update_native_version.sh +0 -104
- package/src/Airbridge.js +0 -82
- package/src/Deeplink.js +0 -75
- package/src/Event.js +0 -38
- package/src/Placement.js +0 -56
- package/src/State.js +0 -175
- package/src/WebInterface.js +0 -135
- package/src/tool/Log.js +0 -40
- package/src/tool/_.js +0 -56
- package/src/type/AirbridgeAttributes.js +0 -40
- package/src/type/AirbridgeCategory.js +0 -35
- package/src/type/AirbridgeProduct.js +0 -18
- package/src/typedef/EventOption.js +0 -9
- package/src/typedef/Product.js +0 -10
- package/src/typedef/User.js +0 -9
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
package co.ab180.airbridge.reactnative;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Promise;
|
|
4
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
7
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
-
|
|
9
|
-
import java.util.HashMap;
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
import javax.annotation.Nonnull;
|
|
13
|
-
import javax.annotation.Nullable;
|
|
14
|
-
|
|
15
|
-
import co.ab180.airbridge.Airbridge;
|
|
16
|
-
import co.ab180.airbridge.AirbridgeCallback;
|
|
17
|
-
|
|
18
|
-
public class AirbridgeState extends ReactContextBaseJavaModule {
|
|
19
|
-
public AirbridgeState(ReactApplicationContext reactContext) {
|
|
20
|
-
super(reactContext);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
// react native method
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
@ReactMethod
|
|
28
|
-
public void setUser(@Nullable ReadableMap user) {
|
|
29
|
-
HashMap userMap = null;
|
|
30
|
-
if (user != null) {
|
|
31
|
-
userMap = user.toHashMap();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
String id = Get.type(String.class, userMap, "ID");
|
|
35
|
-
String email = Get.type(String.class, userMap, "email");
|
|
36
|
-
String phone = Get.type(String.class, userMap, "phone");
|
|
37
|
-
Map<String, String> alias = Get.type(HashMap.class, userMap, "alias");
|
|
38
|
-
Map<String, ?> attributes = Get.type(HashMap.class, userMap, "attributes");
|
|
39
|
-
|
|
40
|
-
Airbridge.getCurrentUser().setId(id);
|
|
41
|
-
Airbridge.getCurrentUser().setEmail(email);
|
|
42
|
-
Airbridge.getCurrentUser().setPhone(phone);
|
|
43
|
-
|
|
44
|
-
if (alias != null) {
|
|
45
|
-
for (Map.Entry<String, String> entry : alias.entrySet()) {
|
|
46
|
-
Airbridge.getCurrentUser().setAlias(entry.getKey(), entry.getValue());
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
Airbridge.getCurrentUser().clearAlias();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (attributes != null) {
|
|
53
|
-
for (Map.Entry<String, ?> entry : attributes.entrySet()) {
|
|
54
|
-
String key = entry.getKey();
|
|
55
|
-
Object value = entry.getValue();
|
|
56
|
-
|
|
57
|
-
if (value instanceof String) {
|
|
58
|
-
Airbridge.getCurrentUser().setAttribute(key, (String) value);
|
|
59
|
-
} else if (value instanceof Long) {
|
|
60
|
-
Airbridge.getCurrentUser().setAttribute(key, (Long) value);
|
|
61
|
-
} else if (value instanceof Integer) {
|
|
62
|
-
Airbridge.getCurrentUser().setAttribute(key, (Integer) value);
|
|
63
|
-
} else if (value instanceof Double || value instanceof Float) {
|
|
64
|
-
Airbridge.getCurrentUser().setAttribute(key, ((Number) value).floatValue());
|
|
65
|
-
} else if (value instanceof Boolean) {
|
|
66
|
-
Airbridge.getCurrentUser().setAttribute(key, (Boolean) value);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
Airbridge.getCurrentUser().clearAttributes();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@ReactMethod
|
|
75
|
-
public void updateUser(@Nullable ReadableMap user) {
|
|
76
|
-
HashMap userMap = null;
|
|
77
|
-
if (user != null) {
|
|
78
|
-
userMap = user.toHashMap();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
String id = Get.type(String.class, userMap, "ID");
|
|
82
|
-
String email = Get.type(String.class, userMap, "email");
|
|
83
|
-
String phone = Get.type(String.class, userMap, "phone");
|
|
84
|
-
Map<String, String> alias = Get.type(HashMap.class, userMap, "alias");
|
|
85
|
-
Map<String, ?> attributes = Get.type(HashMap.class, userMap, "attributes");
|
|
86
|
-
|
|
87
|
-
if (id != null) {
|
|
88
|
-
Airbridge.getCurrentUser().setId(id);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (email != null) {
|
|
92
|
-
Airbridge.getCurrentUser().setEmail(email);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (phone != null) {
|
|
96
|
-
Airbridge.getCurrentUser().setPhone(phone);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (alias != null) {
|
|
100
|
-
for (Map.Entry<String, String> entry : alias.entrySet()) {
|
|
101
|
-
Airbridge.getCurrentUser().setAlias(entry.getKey(), entry.getValue());
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (attributes != null) {
|
|
106
|
-
for (Map.Entry<String, ?> entry : attributes.entrySet()) {
|
|
107
|
-
String key = entry.getKey();
|
|
108
|
-
Object value = entry.getValue();
|
|
109
|
-
|
|
110
|
-
if (value instanceof String) {
|
|
111
|
-
Airbridge.getCurrentUser().setAttribute(key, (String) value);
|
|
112
|
-
} else if (value instanceof Long) {
|
|
113
|
-
Airbridge.getCurrentUser().setAttribute(key, (Long) value);
|
|
114
|
-
} else if (value instanceof Integer) {
|
|
115
|
-
Airbridge.getCurrentUser().setAttribute(key, (Integer) value);
|
|
116
|
-
} else if (value instanceof Double || value instanceof Float) {
|
|
117
|
-
Airbridge.getCurrentUser().setAttribute(key, ((Number) value).floatValue());
|
|
118
|
-
} else if (value instanceof Boolean) {
|
|
119
|
-
Airbridge.getCurrentUser().setAttribute(key, (Boolean) value);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@ReactMethod
|
|
126
|
-
public void startTracking() {
|
|
127
|
-
Airbridge.startTracking();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
@ReactMethod
|
|
131
|
-
public void deviceUUID(final Promise promise) {
|
|
132
|
-
Airbridge.getDeviceInfo().getUUID(new AirbridgeCallback.SimpleCallback<String>() {
|
|
133
|
-
@Override
|
|
134
|
-
public void onSuccess(String uuid) {
|
|
135
|
-
promise.resolve(uuid);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@Override
|
|
139
|
-
public void onFailure(Throwable throwable) {
|
|
140
|
-
promise.reject(throwable);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@ReactMethod
|
|
146
|
-
public void setDeviceAlias(String key, String value) {
|
|
147
|
-
Airbridge.setDeviceAlias(key, value);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@ReactMethod
|
|
151
|
-
public void removeDeviceAlias(String key) {
|
|
152
|
-
Airbridge.removeDeviceAlias(key);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@ReactMethod
|
|
156
|
-
public void clearDeviceAlias() {
|
|
157
|
-
Airbridge.clearDeviceAlias();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
@ReactMethod
|
|
161
|
-
public void registerPushToken(String token) {
|
|
162
|
-
Airbridge.registerPushToken(token);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
//
|
|
166
|
-
// override
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
@Override
|
|
170
|
-
@Nonnull
|
|
171
|
-
public String getName() {
|
|
172
|
-
return "AirbridgeState";
|
|
173
|
-
}
|
|
174
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
package co.ab180.airbridge.reactnative;
|
|
2
|
-
|
|
3
|
-
import android.app.Activity;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
import android.content.res.AssetManager;
|
|
6
|
-
import android.util.Log;
|
|
7
|
-
|
|
8
|
-
import org.json.JSONException;
|
|
9
|
-
import org.json.JSONObject;
|
|
10
|
-
|
|
11
|
-
import java.io.BufferedReader;
|
|
12
|
-
import java.io.IOException;
|
|
13
|
-
import java.io.InputStreamReader;
|
|
14
|
-
import java.util.Map;
|
|
15
|
-
import java.util.HashMap;
|
|
16
|
-
|
|
17
|
-
import javax.annotation.Nonnull;
|
|
18
|
-
import javax.annotation.Nullable;
|
|
19
|
-
|
|
20
|
-
import co.ab180.airbridge.AirbridgeConfig;
|
|
21
|
-
import co.ab180.airbridge.OnAttributionResultReceiveListener;
|
|
22
|
-
|
|
23
|
-
class ConfigReader {
|
|
24
|
-
private ConfigReader() {
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static AirbridgeConfig build(
|
|
28
|
-
@Nonnull Context context,
|
|
29
|
-
@Nonnull String appName,
|
|
30
|
-
@Nonnull String appToken,
|
|
31
|
-
@Nullable Map<String, Object> airbridgeJSON
|
|
32
|
-
) {
|
|
33
|
-
AirbridgeConfig.Builder configBuilder = new AirbridgeConfig.Builder(appName, appToken);
|
|
34
|
-
|
|
35
|
-
setJsonObject(context, configBuilder, airbridgeJSON);
|
|
36
|
-
|
|
37
|
-
configBuilder.setPlatform("react_native");
|
|
38
|
-
|
|
39
|
-
configBuilder.setLifecycleIntegration(activity -> {
|
|
40
|
-
AirbridgeLifecycleIntegration callback = AirbridgeLifecycle.getLifecycleIntegration();
|
|
41
|
-
if (callback == null) {
|
|
42
|
-
return null;
|
|
43
|
-
} else {
|
|
44
|
-
return callback.getDataString(activity);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
configBuilder.setOnAttributionResultReceiveListener(AirbridgeAttribution::processAttribution);
|
|
49
|
-
|
|
50
|
-
return configBuilder.build();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private static void setJsonObject(
|
|
54
|
-
@Nonnull Context context,
|
|
55
|
-
AirbridgeConfig.Builder configBuilder,
|
|
56
|
-
@Nullable Map<String, Object> airbridgeJSON) {
|
|
57
|
-
|
|
58
|
-
JSONObject configObject;
|
|
59
|
-
if (airbridgeJSON == null) {
|
|
60
|
-
configObject = loadJsonAsset(context);
|
|
61
|
-
} else {
|
|
62
|
-
configObject = loadAirbridgeJSON(airbridgeJSON);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Number sessionTimeoutSeconds = Get.type(Number.class, configObject, "sessionTimeoutSeconds");
|
|
66
|
-
if (sessionTimeoutSeconds != null) {
|
|
67
|
-
configBuilder.setSessionTimeoutSeconds(sessionTimeoutSeconds.longValue());
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
Boolean autoStartTrackingEnabled = Get.type(Boolean.class, configObject, "autoStartTrackingEnabled");
|
|
71
|
-
if (autoStartTrackingEnabled != null) {
|
|
72
|
-
configBuilder.setAutoStartTrackingEnabled(autoStartTrackingEnabled);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Boolean userInfoHashEnabled = Get.type(Boolean.class, configObject, "userInfoHashEnabled");
|
|
76
|
-
if (userInfoHashEnabled != null) {
|
|
77
|
-
configBuilder.setUserInfoHashEnabled(userInfoHashEnabled);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
Boolean trackAirbridgeLinkOnly = Get.type(Boolean.class, configObject, "trackAirbridgeLinkOnly");
|
|
81
|
-
if (trackAirbridgeLinkOnly != null) {
|
|
82
|
-
configBuilder.setTrackAirbridgeLinkOnly(trackAirbridgeLinkOnly);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Boolean locationCollectionEnabled = Get.type(Boolean.class, configObject, "locationCollectionEnabled");
|
|
86
|
-
if (locationCollectionEnabled != null) {
|
|
87
|
-
configBuilder.setLocationCollectionEnabled(locationCollectionEnabled);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
Boolean facebookDeferredAppLinkEnabled = Get.type(Boolean.class, configObject, "facebookDeferredAppLinkEnabled");
|
|
91
|
-
if (facebookDeferredAppLinkEnabled != null) {
|
|
92
|
-
configBuilder.setFacebookDeferredAppLinkEnabled(facebookDeferredAppLinkEnabled);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// The two keys(facebookInstallReferrer, metaInstallReferrer) are mutually exclusive.
|
|
96
|
-
String facebookInstallReferrer = Get.type(String.class, configObject, "facebookInstallReferrer");
|
|
97
|
-
if (facebookInstallReferrer != null) {
|
|
98
|
-
configBuilder.setMetaInstallReferrer(facebookInstallReferrer);
|
|
99
|
-
}
|
|
100
|
-
String metaInstallReferrer = Get.type(String.class, configObject, "metaInstallReferrer");
|
|
101
|
-
if (metaInstallReferrer != null) {
|
|
102
|
-
configBuilder.setMetaInstallReferrer(metaInstallReferrer);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
String secretId = Get.type(String.class, configObject, "sdkSignatureSecretID");
|
|
106
|
-
String secretKey = Get.type(String.class, configObject, "sdkSignatureSecret");
|
|
107
|
-
if (secretId != null && secretKey != null) {
|
|
108
|
-
configBuilder.setSDKSignatureSecret(secretId, secretKey);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
String logLevel = Get.type(String.class, configObject, "logLevel");
|
|
112
|
-
Map<String, Integer> logLevelMap = new HashMap<String, Integer>() {{
|
|
113
|
-
put("debug", Log.VERBOSE);
|
|
114
|
-
put("info", Log.INFO);
|
|
115
|
-
put("warning", Log.WARN);
|
|
116
|
-
put("error", Log.ERROR);
|
|
117
|
-
put("fault", Log.ASSERT);
|
|
118
|
-
}};
|
|
119
|
-
Integer resultLogLevel = logLevelMap.get(logLevel != null ? logLevel.toLowerCase() : null);
|
|
120
|
-
resultLogLevel = resultLogLevel != null ? resultLogLevel : Log.WARN;
|
|
121
|
-
configBuilder.setLogLevel(resultLogLevel);
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private static JSONObject loadJsonAsset(@Nonnull Context context) {
|
|
126
|
-
JSONObject configObject = null;
|
|
127
|
-
AssetManager assetManager = context.getAssets();
|
|
128
|
-
try {
|
|
129
|
-
BufferedReader reader = new BufferedReader(
|
|
130
|
-
new InputStreamReader(assetManager.open("airbridge.json"))
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
StringBuilder builder = new StringBuilder();
|
|
134
|
-
|
|
135
|
-
String line = reader.readLine();
|
|
136
|
-
while (line != null) {
|
|
137
|
-
builder.append(line);
|
|
138
|
-
line = reader.readLine();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
configObject = new JSONObject(builder.toString());
|
|
142
|
-
} catch (IOException ignored) {
|
|
143
|
-
// when do not use airbridge.json file
|
|
144
|
-
} catch (JSONException e) {
|
|
145
|
-
Log.w("AirbridgeRN", "airbridge.json is not json format");
|
|
146
|
-
}
|
|
147
|
-
return configObject;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
private static JSONObject loadAirbridgeJSON(@Nonnull Map<String, Object> airbridgeJSON) {
|
|
151
|
-
return new JSONObject(airbridgeJSON);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
package co.ab180.airbridge.reactnative;
|
|
2
|
-
|
|
3
|
-
import org.json.JSONObject;
|
|
4
|
-
|
|
5
|
-
import java.util.ArrayList;
|
|
6
|
-
import java.util.HashMap;
|
|
7
|
-
|
|
8
|
-
public class Get {
|
|
9
|
-
static <T> T type(Class<T> type, Object object) {
|
|
10
|
-
if (object == null || type.isInstance(object)) {
|
|
11
|
-
return type.cast(object);
|
|
12
|
-
} else {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static <T> T type(Class<T> type, HashMap map, String key) {
|
|
18
|
-
if (map == null) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Object value = map.get(key);
|
|
23
|
-
|
|
24
|
-
return Get.type(type, value);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static <T> T type(Class<T> type, ArrayList array, int index) {
|
|
28
|
-
if (array == null || index < 0 || index > array.size()) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
Object object = array.get(index);
|
|
33
|
-
|
|
34
|
-
return Get.type(type, object);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static <T> T type(Class<T> type, JSONObject object, String key) {
|
|
38
|
-
if (object == null) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Object value = object.opt(key);
|
|
43
|
-
|
|
44
|
-
return Get.type(type, value);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static <T extends Number> T type(Class<T> type, Number number) {
|
|
48
|
-
if (number == null) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (type.isAssignableFrom(Number.class)) {
|
|
53
|
-
return type.cast(number);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if(type.isAssignableFrom(Byte.class)) {
|
|
57
|
-
|
|
58
|
-
return type.cast(number.byteValue());
|
|
59
|
-
|
|
60
|
-
} else if (type.isAssignableFrom(Short.class)) {
|
|
61
|
-
|
|
62
|
-
return type.cast(number.shortValue());
|
|
63
|
-
|
|
64
|
-
} else if (type.isAssignableFrom(Integer.class)) {
|
|
65
|
-
|
|
66
|
-
return type.cast(number.intValue());
|
|
67
|
-
|
|
68
|
-
} else if (type.isAssignableFrom(Long.class)) {
|
|
69
|
-
|
|
70
|
-
return type.cast(number.longValue());
|
|
71
|
-
|
|
72
|
-
} else if (type.isAssignableFrom(Float.class)) {
|
|
73
|
-
|
|
74
|
-
return type.cast(number.floatValue());
|
|
75
|
-
|
|
76
|
-
} else if (type.isAssignableFrom(Double.class)) {
|
|
77
|
-
|
|
78
|
-
return type.cast(number.doubleValue());
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}
|