airbridge-react-native-sdk-restricted 2.8.7 → 2.8.9

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.
Files changed (139) hide show
  1. package/.github/actions/add-github-check/action.yml +78 -0
  2. package/.github/actions/add-github-comment/action.yml +48 -0
  3. package/.github/actions/add-slack-message/action.yml +32 -0
  4. package/.github/actions/edit-github-check/action.yml +59 -0
  5. package/.github/actions/edit-github-comment/action.yml +41 -0
  6. package/.github/pull_request_template.md +5 -0
  7. package/.github/readme.md +53 -0
  8. package/.github/workflows/build.yml +367 -0
  9. package/.github/workflows/gitflow.yml +20 -0
  10. package/.github/workflows/release-restricted.yml +35 -0
  11. package/.github/workflows/release.yml +32 -0
  12. package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
  13. package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeRN.java +19 -4
  14. package/android/src/main/java/co/ab180/airbridge/reactnative/ConfigReader.java +63 -40
  15. package/changelog.md +10 -0
  16. package/ios/AirbridgeRN/ARNConfigReader.h +1 -1
  17. package/ios/AirbridgeRN/ARNConfigReader.m +31 -30
  18. package/ios/AirbridgeRN/AirbridgeRN.m +26 -2
  19. package/ios/copy-config.rb +1 -1
  20. package/package.json +1 -1
  21. package/qa/.bundle/config +2 -0
  22. package/qa/.eslintrc.js +4 -0
  23. package/qa/.prettierrc.js +7 -0
  24. package/qa/.watchmanconfig +1 -0
  25. package/qa/Gemfile +9 -0
  26. package/qa/Gemfile.lock +105 -0
  27. package/qa/__tests__/App.test.tsx +17 -0
  28. package/qa/airbridge.json +7 -0
  29. package/qa/android/app/build.gradle +130 -0
  30. package/qa/android/app/debug.keystore +0 -0
  31. package/qa/android/app/google-services.json +29 -0
  32. package/qa/android/app/proguard-rules.pro +10 -0
  33. package/qa/android/app/src/debug/AndroidManifest.xml +9 -0
  34. package/qa/android/app/src/main/AndroidManifest.xml +65 -0
  35. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/ConfigurationLoader.kt +49 -0
  36. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainActivity.kt +35 -0
  37. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainApplication.kt +46 -0
  38. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoInteractor.kt +60 -0
  39. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoUtils.kt +115 -0
  40. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/IdentifiersInteractor.kt +83 -0
  41. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/InstallReferrerInteractor.kt +91 -0
  42. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/ModuleInjector.kt +22 -0
  43. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/PermissionInteractor.kt +55 -0
  44. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/UserInfoInteractor.kt +74 -0
  45. package/qa/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  46. package/qa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  47. package/qa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  48. package/qa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  49. package/qa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  50. package/qa/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  51. package/qa/android/app/src/main/res/values/strings.xml +3 -0
  52. package/qa/android/app/src/main/res/values/styles.xml +9 -0
  53. package/qa/android/build.gradle +28 -0
  54. package/qa/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  55. package/qa/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  56. package/qa/android/gradle.properties +41 -0
  57. package/qa/android/gradlew +249 -0
  58. package/qa/android/gradlew.bat +92 -0
  59. package/qa/android/settings.gradle +4 -0
  60. package/qa/app.json +4 -0
  61. package/qa/babel.config.js +3 -0
  62. package/qa/index.js +5 -0
  63. package/qa/ios/.xcode.env +11 -0
  64. package/qa/ios/AirbridgeQA/AirbridgeQA.entitlements +17 -0
  65. package/qa/ios/AirbridgeQA/AppDelegate.h +6 -0
  66. package/qa/ios/AirbridgeQA/AppDelegate.mm +123 -0
  67. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.m +14 -0
  68. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.swift +151 -0
  69. package/qa/ios/AirbridgeQA/IdentifiersInteractor.m +14 -0
  70. package/qa/ios/AirbridgeQA/IdentifiersInteractor.swift +40 -0
  71. package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  72. package/qa/ios/AirbridgeQA/Images.xcassets/Contents.json +6 -0
  73. package/qa/ios/AirbridgeQA/Info.plist +66 -0
  74. package/qa/ios/AirbridgeQA/LaunchScreen.storyboard +47 -0
  75. package/qa/ios/AirbridgeQA/PermissionInteractor.m +14 -0
  76. package/qa/ios/AirbridgeQA/PermissionInteractor.swift +19 -0
  77. package/qa/ios/AirbridgeQA/PrivacyInfo.xcprivacy +39 -0
  78. package/qa/ios/AirbridgeQA/UserInfoInteractor.m +57 -0
  79. package/qa/ios/AirbridgeQA/UserInfoInteractor.swift +49 -0
  80. package/qa/ios/AirbridgeQA/main.m +10 -0
  81. package/qa/ios/AirbridgeQA.xcodeproj/project.pbxproj +790 -0
  82. package/qa/ios/AirbridgeQA.xcodeproj/xcshareddata/xcschemes/AirbridgeQA.xcscheme +88 -0
  83. package/qa/ios/AirbridgeQA.xcworkspace/contents.xcworkspacedata +10 -0
  84. package/qa/ios/AirbridgeQA.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  85. package/qa/ios/AirbridgeQATests/AirbridgeQATests.m +66 -0
  86. package/qa/ios/AirbridgeQATests/Info.plist +24 -0
  87. package/qa/ios/GoogleService-Info.plist +30 -0
  88. package/qa/ios/Library/airbridge-ios-sdk-qa-library.podspec +26 -0
  89. package/qa/ios/Podfile +44 -0
  90. package/qa/ios/Podfile.lock +1634 -0
  91. package/qa/jest.config.js +3 -0
  92. package/qa/metro.config.js +67 -0
  93. package/qa/package-lock.json +14289 -0
  94. package/qa/package.json +47 -0
  95. package/qa/resource/arrow_back.png +0 -0
  96. package/qa/resource/home.png +0 -0
  97. package/qa/resource/info.png +0 -0
  98. package/qa/resource/link.png +0 -0
  99. package/qa/resource/refresh.png +0 -0
  100. package/qa/resource/token.png +0 -0
  101. package/qa/source/App.js +58 -0
  102. package/qa/source/common/Colors.js +20 -0
  103. package/qa/source/common/FCMService.js +94 -0
  104. package/qa/source/common/Native.ts +39 -0
  105. package/qa/source/common/Storage.js +13 -0
  106. package/qa/source/common/Styles.js +39 -0
  107. package/qa/source/component/AttributeEntryInputDialog.js +117 -0
  108. package/qa/source/component/AttributeTypeInputDialog.js +100 -0
  109. package/qa/source/component/ConfirmDialog.js +72 -0
  110. package/qa/source/component/CustomButton.js +50 -0
  111. package/qa/source/component/CustomEventParamsDialog.js +150 -0
  112. package/qa/source/component/CustomTextInput.js +40 -0
  113. package/qa/source/component/EntryInputDialog.js +89 -0
  114. package/qa/source/component/HorizontalPreference.js +46 -0
  115. package/qa/source/component/ImageButton.js +35 -0
  116. package/qa/source/component/InjectInputDialog.js +80 -0
  117. package/qa/source/component/MessageDialog.js +81 -0
  118. package/qa/source/component/UrlInputDialog.js +80 -0
  119. package/qa/source/component/ValueInputDialog.js +80 -0
  120. package/qa/source/component/VerticalPreference.js +42 -0
  121. package/qa/source/navigations/Stack.js +110 -0
  122. package/qa/source/pages/Browse.js +118 -0
  123. package/qa/source/pages/DeviceInfo.js +135 -0
  124. package/qa/source/pages/Event.js +171 -0
  125. package/qa/source/pages/Home.js +136 -0
  126. package/qa/source/pages/Identifiers.js +108 -0
  127. package/qa/source/pages/InstallReferrer.js +64 -0
  128. package/qa/source/pages/Placement.js +38 -0
  129. package/qa/source/pages/RequestPermissions.tsx +41 -0
  130. package/qa/source/pages/UserInfo.js +168 -0
  131. package/qa/source/pages/appInfo.js +22 -0
  132. package/qa/tsconfig.json +3 -0
  133. package/scripts/addiOSFramework.js +48 -0
  134. package/scripts/build-qa.sh +64 -0
  135. package/scripts/change_restricted.sh +21 -0
  136. package/scripts/update_native_version.sh +104 -0
  137. package/source/module/Attribution.ts +60 -0
  138. package/src/State.js +10 -2
  139. package/src/WebInterface.js +1 -1
@@ -0,0 +1,92 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%"=="" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%"=="" set DIRNAME=.
29
+ @rem This is normally unused
30
+ set APP_BASE_NAME=%~n0
31
+ set APP_HOME=%DIRNAME%
32
+
33
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35
+
36
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38
+
39
+ @rem Find java.exe
40
+ if defined JAVA_HOME goto findJavaFromJavaHome
41
+
42
+ set JAVA_EXE=java.exe
43
+ %JAVA_EXE% -version >NUL 2>&1
44
+ if %ERRORLEVEL% equ 0 goto execute
45
+
46
+ echo. 1>&2
47
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48
+ echo. 1>&2
49
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50
+ echo location of your Java installation. 1>&2
51
+
52
+ goto fail
53
+
54
+ :findJavaFromJavaHome
55
+ set JAVA_HOME=%JAVA_HOME:"=%
56
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57
+
58
+ if exist "%JAVA_EXE%" goto execute
59
+
60
+ echo. 1>&2
61
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62
+ echo. 1>&2
63
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64
+ echo location of your Java installation. 1>&2
65
+
66
+ goto fail
67
+
68
+ :execute
69
+ @rem Setup the command line
70
+
71
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72
+
73
+
74
+ @rem Execute Gradle
75
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76
+
77
+ :end
78
+ @rem End local scope for the variables with windows NT shell
79
+ if %ERRORLEVEL% equ 0 goto mainEnd
80
+
81
+ :fail
82
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+ rem the _cmd.exe /c_ return code!
84
+ set EXIT_CODE=%ERRORLEVEL%
85
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
86
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87
+ exit /b %EXIT_CODE%
88
+
89
+ :mainEnd
90
+ if "%OS%"=="Windows_NT" endlocal
91
+
92
+ :omega
@@ -0,0 +1,4 @@
1
+ rootProject.name = 'co.ab180.airbridge.qa.application'
2
+ apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3
+ include ':app'
4
+ includeBuild('../node_modules/@react-native/gradle-plugin')
package/qa/app.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "AirbridgeQA",
3
+ "displayName": "AirbridgeQA"
4
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['module:@react-native/babel-preset'],
3
+ };
package/qa/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { AppRegistry } from 'react-native'
2
+ import App from './source/App'
3
+ import { name } from './app.json'
4
+
5
+ AppRegistry.registerComponent(name, () => App);
@@ -0,0 +1,11 @@
1
+ # This `.xcode.env` file is versioned and is used to source the environment
2
+ # used when running script phases inside Xcode.
3
+ # To customize your local environment, you can create an `.xcode.env.local`
4
+ # file that is not versioned.
5
+
6
+ # NODE_BINARY variable contains the PATH to the node executable.
7
+ #
8
+ # Customize the NODE_BINARY variable here.
9
+ # For example, to use nvm with brew, add the following line
10
+ # . "$(brew --prefix nvm)/nvm.sh" --no-use
11
+ export NODE_BINARY=$(command -v node)
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>aps-environment</key>
6
+ <string>production</string>
7
+ <key>com.apple.developer.associated-domains</key>
8
+ <array>
9
+ <string>applinks:qaabr.abr.ge</string>
10
+ <string>applinks:qaabr.airbridge.io</string>
11
+ </array>
12
+ <key>com.apple.security.application-groups</key>
13
+ <array>
14
+ <string>group.co.ab180.airbridge.qa</string>
15
+ </array>
16
+ </dict>
17
+ </plist>
@@ -0,0 +1,6 @@
1
+ #import <RCTAppDelegate.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ @interface AppDelegate : RCTAppDelegate
5
+
6
+ @end
@@ -0,0 +1,123 @@
1
+ #import "AppDelegate.h"
2
+
3
+ #import <React/RCTBundleURLProvider.h>
4
+
5
+ #import <Firebase/Firebase.h>
6
+ #import <objc/runtime.h>
7
+
8
+ #import <AirBridge/AirBridge.h>
9
+ #import <AirbridgeRN/AirbridgeRN.h>
10
+ #import <AirbridgeQALibrary/AirbridgeQALibrary.h>
11
+
12
+ #import <AppTrackingTransparency/AppTrackingTransparency.h>
13
+
14
+ @interface AirbridgeRN ()
15
+
16
+ + (AirbridgeRN*)getInstance:(NSString*)appToken
17
+ appName:(NSString*)appName
18
+ withAirbridgeJSON:(nullable NSDictionary*)airbridgeJSON
19
+ withLaunchOptions:(nullable NSDictionary*)launchOptions;
20
+
21
+ @end
22
+
23
+ @implementation AppDelegate
24
+
25
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
26
+ {
27
+ self.moduleName = @"AirbridgeQA";
28
+ // You can add your custom initial props in the dictionary below.
29
+ // They will be passed down to the ViewController used by React Native.
30
+ self.initialProps = @{};
31
+
32
+ [FIRApp configure];
33
+ [self swizzleWebViewAlert];
34
+
35
+ SDKConfiguration* configuration = [SDKConfigurationManager.shared load];
36
+ if (configuration == nil) {
37
+ [SDKConfigurationManager.shared resetAndReturnError:nil];
38
+ configuration = SDKConfigurationManager.shared.configuration;
39
+ }
40
+ [AirBridge setPaginateLogEnabled:true];
41
+ [AirbridgeRN getInstance:@"fe67302f822445d98591566d5fae1293"
42
+ appName:@"qaabr"
43
+ withAirbridgeJSON:[self airbridgeJSON:configuration]
44
+ withLaunchOptions:launchOptions];
45
+
46
+ return [super application:application didFinishLaunchingWithOptions:launchOptions];
47
+ }
48
+
49
+ - (void)swizzleWebViewAlert {
50
+ SEL selector = NSSelectorFromString(@"webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:");
51
+ Method method = class_getInstanceMethod(NSClassFromString(@"RNCWebViewImpl"), selector);
52
+ Method newMethod = class_getInstanceMethod(self.class, selector);
53
+ IMP newImplmentation = method_getImplementation(newMethod);
54
+ method_setImplementation(method, newImplmentation);
55
+ }
56
+
57
+ - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *))completionHandler{
58
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:prompt preferredStyle:UIAlertControllerStyleAlert];
59
+ [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
60
+ textField.accessibilityIdentifier = @"textField";
61
+ textField.text = defaultText;
62
+ }];
63
+ UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
64
+ completionHandler([[alert.textFields lastObject] text]);
65
+ }];
66
+ okAction.accessibilityIdentifier = @"ok";
67
+ [alert addAction:okAction];
68
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
69
+ completionHandler(nil);
70
+ }];
71
+ cancelAction.accessibilityIdentifier = @"cancel";
72
+ [alert addAction:cancelAction];
73
+ alert.preferredAction = okAction;
74
+ [RCTPresentedViewController() presentViewController:alert animated:YES completion:NULL];
75
+ }
76
+
77
+ - (NSDictionary*)airbridgeJSON:(SDKConfiguration*)configuration {
78
+ NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
79
+ dictionary[@"sessionTimeoutSeconds"] = @(configuration.sessionTimeoutSecond);
80
+ dictionary[@"autoStartTrackingEnabled"] = @(configuration.isAutoStartTrackingEnabled);
81
+ dictionary[@"userInfoHashEnabled"] = @(configuration.isHashUserInformationEnabled);
82
+ dictionary[@"trackAirbridgeLinkOnly"] = @(configuration.isTrackAirbridgeDeeplinkOnlyEnabled);
83
+ dictionary[@"facebookDeferredAppLinkEnabled"] = @(configuration.isTrackMetaDeferredAppLinkEnabled);
84
+ dictionary[@"trackingAuthorizeTimeoutSeconds"] = @(configuration.autoDetermineTrackingAuthorizationTimeoutSecond);
85
+ if (configuration.isSDKSignatureEnabled) {
86
+ dictionary[@"sdkSignatureSecretID"] = configuration.sdkSignatureSecretID;
87
+ dictionary[@"sdkSignatureSecret"] = configuration.sdkSignatureSecretKey;
88
+ }
89
+ dictionary[@"logLevel"] = @"debug";
90
+ return dictionary;
91
+ }
92
+
93
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
94
+ {
95
+ return [self bundleURL];
96
+ }
97
+
98
+ - (NSURL *)bundleURL
99
+ {
100
+ #if DEBUG
101
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
102
+ #else
103
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
104
+ #endif
105
+ }
106
+
107
+ - (BOOL)application:(UIApplication *)application
108
+ openURL:(NSURL *)url
109
+ options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
110
+ {
111
+ [AirbridgeRN.deeplink handleURLSchemeDeeplink:url];
112
+ return YES;
113
+ }
114
+
115
+ - (BOOL)application:(UIApplication *)application
116
+ continueUserActivity:(NSUserActivity *)userActivity
117
+ restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
118
+ {
119
+ [AirbridgeRN.deeplink handleUserActivity:userActivity];
120
+ return YES;
121
+ }
122
+
123
+ @end
@@ -0,0 +1,14 @@
1
+ //
2
+ // DeviceInfoInteractor.m
3
+ // AirbridgeQA
4
+ //
5
+ // Created by WOF on 6/24/24.
6
+ //
7
+
8
+ #import <React/RCTBridgeModule.h>
9
+
10
+ @interface RCT_EXTERN_MODULE(DeviceInfoInteractor, NSObject)
11
+
12
+ RCT_EXTERN_METHOD(deviceInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
13
+
14
+ @end
@@ -0,0 +1,151 @@
1
+ //
2
+ // DeviceInfoInteractor.swift
3
+ // AirbridgeQA
4
+ //
5
+ // Created by WOF on 6/24/24.
6
+ //
7
+
8
+ import React
9
+ import AirBridge
10
+ import CoreTelephony
11
+ import SystemConfiguration
12
+
13
+ @objc(DeviceInfoInteractor)
14
+ class DeviceInfoInteractor: NSObject {
15
+ @objc(deviceInfo:reject:)
16
+ func deviceInfo(
17
+ resolve: @escaping RCTPromiseResolveBlock,
18
+ reject: @escaping RCTPromiseRejectBlock
19
+ ) {
20
+ let response: [AnyHashable: Any] = [
21
+ "responseCode": 200,
22
+ "data": fetch()
23
+ ]
24
+ resolve(String(
25
+ data: try! JSONSerialization.data(withJSONObject: response),
26
+ encoding: .utf8
27
+ ))
28
+ }
29
+
30
+ func fetch() -> [String: Any?] {
31
+ return [
32
+ "deviceModel": UIDevice.current.localizedModel,
33
+ "deviceManufacturer": "Apple",
34
+ "osVersion": UIDevice.current.systemVersion,
35
+ "locale": getSystemLocale(),
36
+ "timezone": TimeZone.current.description,
37
+ "orientation": {
38
+ if UIDevice.current.orientation.isLandscape {
39
+ return "landscape"
40
+ } else {
41
+ return "portrait"
42
+ }
43
+ }(),
44
+ "screenSize": "\(width)x\(height) \(density)DPI",
45
+ "networkCarrier": {
46
+ let info = CTTelephonyNetworkInfo()
47
+
48
+ if #available(iOS 12.1, *) {
49
+ let providers = info.serviceSubscriberCellularProviders
50
+ return providers?.values.first?.carrierName
51
+ } else {
52
+ let provider = info.subscriberCellularProvider
53
+ return provider?.carrierName
54
+ }
55
+ }(),
56
+ "cellularStatus": isCellular(),
57
+ "wifiStatus": isWifi(),
58
+ ]
59
+ }
60
+ }
61
+
62
+ extension DeviceInfoInteractor {
63
+ func getSystemLocale() -> String? {
64
+ guard let language = getSystemLanguage() else { return nil }
65
+ guard let country = getSystemCountry() else { return nil }
66
+
67
+ return "\(language)-\(country)"
68
+ }
69
+
70
+ func getSystemLanguage() -> String? {
71
+ let languages = Locale.preferredLanguages
72
+
73
+ if languages.count < 1 {
74
+ return nil
75
+ }
76
+
77
+ let languageSource = languages[0]
78
+
79
+ guard let barIndex = languageSource.range(of: "-") else {
80
+ return languageSource
81
+ }
82
+
83
+ return String(languageSource[..<barIndex.lowerBound])
84
+ }
85
+
86
+ func getSystemCountry() -> String? {
87
+ return Locale.autoupdatingCurrent.regionCode
88
+ }
89
+ }
90
+
91
+ extension DeviceInfoInteractor {
92
+ var width: String {
93
+ String(format: "%.f", UIScreen.main.bounds.size.width)
94
+ }
95
+
96
+ var height: String {
97
+ String(format: "%.f", UIScreen.main.bounds.size.width)
98
+ }
99
+
100
+ var density: String {
101
+ String(format: "%.f", UIScreen.main.bounds.size.width)
102
+ }
103
+ }
104
+
105
+ extension DeviceInfoInteractor {
106
+ func isCellular() -> Bool {
107
+ return getNetworkInfo() == .cellular
108
+ }
109
+
110
+ func isWifi() -> Bool {
111
+ return getNetworkInfo() == .wifi
112
+ }
113
+
114
+ enum Network {
115
+ case wifi
116
+ case cellular
117
+ case none
118
+ }
119
+
120
+ func getNetworkInfo() -> Network {
121
+ var zeroAddress = sockaddr()
122
+ bzero(&zeroAddress, MemoryLayout.size(ofValue: zeroAddress))
123
+ zeroAddress.sa_len = __uint8_t(MemoryLayout.size(ofValue: zeroAddress))
124
+ zeroAddress.sa_family = sa_family_t(AF_INET)
125
+
126
+ guard let reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, &zeroAddress) else {
127
+ return .none
128
+ }
129
+
130
+ var flags = SCNetworkReachabilityFlags()
131
+ if !SCNetworkReachabilityGetFlags(reachability, &flags) {
132
+ return .none
133
+ }
134
+
135
+ if !flags.contains(.reachable) {
136
+ return .none
137
+ }
138
+
139
+ if flags.contains(.connectionRequired)
140
+ && !((flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic))
141
+ && !flags.contains(.interventionRequired)) {
142
+ return .none
143
+ }
144
+
145
+ if flags.contains(.isWWAN) {
146
+ return .cellular
147
+ } else {
148
+ return .wifi
149
+ }
150
+ }
151
+ }
@@ -0,0 +1,14 @@
1
+ //
2
+ // IdentifiersInteractor.m
3
+ // AirbridgeQA
4
+ //
5
+ // Created by WOF on 6/24/24.
6
+ //
7
+
8
+ #import <React/RCTBridgeModule.h>
9
+
10
+ @interface RCT_EXTERN_MODULE(IdentifiersInteractor, NSObject)
11
+
12
+ RCT_EXTERN_METHOD(identifiers:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
13
+
14
+ @end
@@ -0,0 +1,40 @@
1
+ //
2
+ // IdentifiersInteractor.swift
3
+ // AirbridgeQA
4
+ //
5
+ // Created by WOF on 6/24/24.
6
+ //
7
+
8
+ import React
9
+ import AirBridge
10
+ import AdSupport
11
+
12
+ @objc(IdentifiersInteractor)
13
+ class IdentifiersInteractor: NSObject {
14
+ @objc(identifiers:reject:)
15
+ func identifiers(
16
+ resolve: @escaping RCTPromiseResolveBlock,
17
+ reject: @escaping RCTPromiseRejectBlock
18
+ ) {
19
+ fetch { data in
20
+ let response: [AnyHashable: Any] = [
21
+ "responseCode": 200,
22
+ "data": data
23
+ ]
24
+ resolve(String(
25
+ data: try! JSONSerialization.data(withJSONObject: response),
26
+ encoding: .utf8
27
+ ))
28
+ }
29
+ }
30
+
31
+ func fetch(onSuccess: @escaping ([String: String?]) -> Void) {
32
+ AirBridge.fetchAirbridgeGeneratedUUID { generatedDeviceUUID in
33
+ onSuccess([
34
+ "idfa": ASIdentifierManager.shared().advertisingIdentifier.uuidString,
35
+ "idfv": UIDevice.current.identifierForVendor?.uuidString,
36
+ "generatedDeviceUUID": generatedDeviceUUID
37
+ ])
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "iphone",
5
+ "scale" : "2x",
6
+ "size" : "20x20"
7
+ },
8
+ {
9
+ "idiom" : "iphone",
10
+ "scale" : "3x",
11
+ "size" : "20x20"
12
+ },
13
+ {
14
+ "idiom" : "iphone",
15
+ "scale" : "2x",
16
+ "size" : "29x29"
17
+ },
18
+ {
19
+ "idiom" : "iphone",
20
+ "scale" : "3x",
21
+ "size" : "29x29"
22
+ },
23
+ {
24
+ "idiom" : "iphone",
25
+ "scale" : "2x",
26
+ "size" : "40x40"
27
+ },
28
+ {
29
+ "idiom" : "iphone",
30
+ "scale" : "3x",
31
+ "size" : "40x40"
32
+ },
33
+ {
34
+ "idiom" : "iphone",
35
+ "scale" : "2x",
36
+ "size" : "60x60"
37
+ },
38
+ {
39
+ "idiom" : "iphone",
40
+ "scale" : "3x",
41
+ "size" : "60x60"
42
+ },
43
+ {
44
+ "idiom" : "ios-marketing",
45
+ "scale" : "1x",
46
+ "size" : "1024x1024"
47
+ }
48
+ ],
49
+ "info" : {
50
+ "author" : "xcode",
51
+ "version" : 1
52
+ }
53
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "info" : {
3
+ "version" : 1,
4
+ "author" : "xcode"
5
+ }
6
+ }
@@ -0,0 +1,66 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>AirbridgeQA</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>$(EXECUTABLE_NAME)</string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>$(PRODUCT_NAME)</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>APPL</string>
19
+ <key>CFBundleShortVersionString</key>
20
+ <string>$(MARKETING_VERSION)</string>
21
+ <key>CFBundleSignature</key>
22
+ <string>????</string>
23
+ <key>CFBundleURLTypes</key>
24
+ <array>
25
+ <dict>
26
+ <key>CFBundleTypeRole</key>
27
+ <string>Editor</string>
28
+ <key>CFBundleURLSchemes</key>
29
+ <array>
30
+ <string>qaabr</string>
31
+ </array>
32
+ </dict>
33
+ </array>
34
+ <key>CFBundleVersion</key>
35
+ <string>$(CURRENT_PROJECT_VERSION)</string>
36
+ <key>LSRequiresIPhoneOS</key>
37
+ <true/>
38
+ <key>NSAppTransportSecurity</key>
39
+ <dict>
40
+ <key>NSAllowsLocalNetworking</key>
41
+ <true/>
42
+ </dict>
43
+ <key>NSLocationWhenInUseUsageDescription</key>
44
+ <string></string>
45
+ <key>NSUserTrackingUsageDescription</key>
46
+ <string>Please authorize the permissions to ensure a better experience.</string>
47
+ <key>UIBackgroundModes</key>
48
+ <array>
49
+ <string>remote-notification</string>
50
+ </array>
51
+ <key>UILaunchStoryboardName</key>
52
+ <string>LaunchScreen</string>
53
+ <key>UIRequiredDeviceCapabilities</key>
54
+ <array>
55
+ <string>arm64</string>
56
+ </array>
57
+ <key>UISupportedInterfaceOrientations</key>
58
+ <array>
59
+ <string>UIInterfaceOrientationPortrait</string>
60
+ <string>UIInterfaceOrientationLandscapeLeft</string>
61
+ <string>UIInterfaceOrientationLandscapeRight</string>
62
+ </array>
63
+ <key>UIViewControllerBasedStatusBarAppearance</key>
64
+ <false/>
65
+ </dict>
66
+ </plist>
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3
+ <device id="retina4_7" orientation="portrait" appearance="light"/>
4
+ <dependencies>
5
+ <deployment identifier="iOS"/>
6
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
7
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9
+ </dependencies>
10
+ <scenes>
11
+ <!--View Controller-->
12
+ <scene sceneID="EHf-IW-A2E">
13
+ <objects>
14
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
15
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
17
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18
+ <subviews>
19
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="AirbridgeQA" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
20
+ <rect key="frame" x="0.0" y="202" width="375" height="43"/>
21
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
22
+ <nil key="highlightedColor"/>
23
+ </label>
24
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="MN2-I3-ftu">
25
+ <rect key="frame" x="0.0" y="626" width="375" height="21"/>
26
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
27
+ <nil key="highlightedColor"/>
28
+ </label>
29
+ </subviews>
30
+ <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
31
+ <constraints>
32
+ <constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="MN2-I3-ftu" secondAttribute="bottom" constant="20" id="OZV-Vh-mqD"/>
33
+ <constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
34
+ <constraint firstItem="MN2-I3-ftu" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="akx-eg-2ui"/>
35
+ <constraint firstItem="MN2-I3-ftu" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="i1E-0Y-4RG"/>
36
+ <constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
37
+ <constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
38
+ </constraints>
39
+ <viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
40
+ </view>
41
+ </viewController>
42
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
43
+ </objects>
44
+ <point key="canvasLocation" x="52.173913043478265" y="375"/>
45
+ </scene>
46
+ </scenes>
47
+ </document>