@log-drop/react-native 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/.eslintignore ADDED
@@ -0,0 +1,6 @@
1
+ /example/.eslintrc.js
2
+ /example/__tests__/App-test.js
3
+ /example/babel.config.js
4
+ /example/index.js
5
+ /example/jest.config.js
6
+ /example/metro.config.js
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.pbxproj -text
@@ -0,0 +1,45 @@
1
+ name: Publish Package to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Use Node.js
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: 20
23
+ registry-url: 'https://registry.npmjs.org/'
24
+
25
+ - name: Install dependencies
26
+ run: yarn install --frozen-lockfile
27
+
28
+ - name: Extract version from tag
29
+ id: version
30
+ run: |
31
+ TAG_NAME=${GITHUB_REF#refs/tags/}
32
+ VERSION=${TAG_NAME#v}
33
+ echo "Detected version: $VERSION"
34
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
35
+
36
+ - name: Update package.json version
37
+ run: |
38
+ yarn version --new-version $VERSION --no-git-tag-version
39
+ cat package.json
40
+
41
+ - name: Publish to npm
42
+ env:
43
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44
+ run: |
45
+ yarn publish --non-interactive --access public
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/LogDrop-React-Native-SDK.iml" filepath="$PROJECT_DIR$/.idea/LogDrop-React-Native-SDK.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ </component>
6
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ # Ignore .github:
2
+ .github/
3
+
4
+ # Ignore all iOS files:
5
+ ios/
6
+
7
+ # Ignore all Android files:
8
+ android/
@@ -0,0 +1,23 @@
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 = "LogDropReactNative"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.description = <<-DESC
10
+ LogDropReactNative
11
+ DESC
12
+ s.homepage = "https://github.com/author/LogDropReactNative.git"
13
+ s.license = "MIT"
14
+ s.author = { "author" => "author@domain.cn" }
15
+ s.platforms = { :ios => "9.0" }
16
+ s.source = { :git => "https://github.com/author/LogDropReactNative.git", :tag => "master" }
17
+ s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
18
+ s.requires_arc = true
19
+
20
+ s.dependency 'React'
21
+ s.dependency 'LogDrop', '1.0.0-beta21'
22
+ end
23
+
@@ -0,0 +1,71 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['LogdropReactNative_' + name]
4
+ }
5
+ }
6
+
7
+
8
+ apply plugin: "com.android.library"
9
+ apply plugin: "kotlin-android"
10
+
11
+
12
+ def getExtOrIntegerDefault(name) {
13
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["LogdropReactNative_" + name]).toInteger()
14
+ }
15
+
16
+ def supportsNamespace() {
17
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
18
+ def major = parsed[0].toInteger()
19
+ def minor = parsed[1].toInteger()
20
+
21
+ // Namespace support was added in 7.3.0
22
+ return (major == 7 && minor >= 3) || major >= 8
23
+ }
24
+
25
+ android {
26
+ if (supportsNamespace()) {
27
+ namespace "com.logdropreactnative"
28
+
29
+ sourceSets {
30
+ main {
31
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
32
+ }
33
+ }
34
+ }
35
+
36
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
37
+
38
+ defaultConfig {
39
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
40
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
41
+ }
42
+
43
+ buildTypes {
44
+ release {
45
+ minifyEnabled false
46
+ }
47
+ }
48
+
49
+ lintOptions {
50
+ disable "GradleCompatible"
51
+ }
52
+
53
+ compileOptions {
54
+ sourceCompatibility JavaVersion.VERSION_1_8
55
+ targetCompatibility JavaVersion.VERSION_1_8
56
+ }
57
+ }
58
+
59
+ repositories {
60
+ mavenCentral()
61
+ google()
62
+ }
63
+
64
+ def kotlin_version = getExtOrDefault("kotlinVersion")
65
+
66
+ dependencies {
67
+ implementation "com.facebook.react:react-android"
68
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
69
+ implementation "io.logdrop:sdk:1.0.0-beta13.test"
70
+ }
71
+
@@ -0,0 +1,5 @@
1
+ LogdropReactNative_kotlinVersion=2.0.21
2
+ LogdropReactNative_minSdkVersion=24
3
+ LogdropReactNative_targetSdkVersion=34
4
+ LogdropReactNative_compileSdkVersion=35
5
+ LogdropReactNative_ndkVersion=27.1.12297006
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.logdropreactnative">
3
+ </manifest>
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,21 @@
1
+ package com.logdropreactnative
2
+
3
+ import com.facebook.react.bridge.ReadableMap
4
+ import com.facebook.react.bridge.ReadableType
5
+
6
+ fun ReadableMap.toStringMap(): Map<String, String> {
7
+ val result = mutableMapOf<String, String>()
8
+ val iterator = this.keySetIterator()
9
+ while (iterator.hasNextKey()) {
10
+ val key = iterator.nextKey()
11
+ if (!this.isNull(key)) {
12
+ val value = this.getDynamic(key)
13
+ if (value.type == ReadableType.String) {
14
+ result[key] = value.asString()
15
+ } else {
16
+ result[key] = value.toString()
17
+ }
18
+ }
19
+ }
20
+ return result
21
+ }
@@ -0,0 +1,16 @@
1
+ package com.logdropreactnative
2
+
3
+ import io.logdrop.sdk.LogDrop
4
+ import io.logdrop.sdk.LogDropConfig
5
+
6
+ object LogDropReactNative {
7
+ fun initLogDrop(config: LogDropReactNativeConfig) {
8
+ LogDrop.init(config.context, LogDropConfig.Builder().apply {
9
+ config.apiKey?.let { apiKey(it) }
10
+ config.baseUrl?.let { baseUrl(it) }
11
+ config.isLoggingEnabled?.let { logcatEnabled(it) }
12
+ config.initialIsSDKDisabledValue?.let { initialIsSDKDisabledValue(it) }
13
+ config.sensitiveInfoFilter?.let { sensitiveInfoFilter(it) }
14
+ }.build())
15
+ }
16
+ }
@@ -0,0 +1,40 @@
1
+ package com.logdropreactnative
2
+
3
+ import android.content.Context
4
+
5
+ class LogDropReactNativeConfig private constructor(
6
+ val apiKey: String?,
7
+ val baseUrl: String?,
8
+ val isLoggingEnabled: Boolean?,
9
+ val initialIsSDKDisabledValue: Boolean?,
10
+ val sensitiveInfoFilter: List<Regex>?,
11
+ val context: Context
12
+ ) {
13
+ class Builder(private val context: Context) {
14
+ private var apiKey: String? = null
15
+ private var baseUrl: String? = null
16
+ private var isLoggingEnabled: Boolean? = null
17
+ private var initialIsSDKDisabledValue: Boolean? = null
18
+ private var sensitiveInfoFilter: List<Regex>? = null
19
+
20
+ fun apiKey(apiKey: String) = apply { this.apiKey = apiKey }
21
+ fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
22
+ fun logcatEnabled(isLoggingEnabled: Boolean) = apply { this.isLoggingEnabled = isLoggingEnabled }
23
+ fun initialIsSDKDisabledValue(initialIsSDKDisabledValue: Boolean) = apply { this.initialIsSDKDisabledValue = initialIsSDKDisabledValue }
24
+ fun sensitiveInfoFilter(sensitiveInfoFilter: List<Regex>) = apply { this.sensitiveInfoFilter = sensitiveInfoFilter }
25
+
26
+ fun build(): LogDropReactNativeConfig {
27
+ return LogDropReactNativeConfig(
28
+ apiKey,
29
+ baseUrl,
30
+ isLoggingEnabled,
31
+ initialIsSDKDisabledValue,
32
+ sensitiveInfoFilter,
33
+ context
34
+ )
35
+ }
36
+ }
37
+ }
38
+
39
+
40
+
@@ -0,0 +1,73 @@
1
+ package com.logdropreactnative
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
5
+ import com.facebook.react.bridge.ReactMethod
6
+ import com.facebook.react.bridge.ReadableMap
7
+
8
+ import io.logdrop.sdk.LogDrop
9
+
10
+ class LogDropReactNativeModule(private val reactContext: ReactApplicationContext) :
11
+ ReactContextBaseJavaModule(reactContext) {
12
+
13
+ companion object {
14
+ const val NAME = "LogDropReactNative"
15
+ }
16
+
17
+ override fun getName(): String {
18
+ return NAME
19
+ }
20
+
21
+ @ReactMethod
22
+ fun onRemoteMessageReceived(readableMap: ReadableMap) {
23
+ val data = readableMap.toHashMap()
24
+ .mapValues { it.value.toString() }
25
+ .toMutableMap()
26
+ LogDrop.onRemoteMessageReceived(data)
27
+ }
28
+
29
+ @ReactMethod
30
+ fun onNewFcmPushToken(token: String) {
31
+ LogDrop.onNewFcmPushToken(token)
32
+ }
33
+
34
+ @ReactMethod
35
+ fun onNewHmsPushToken(token: String) {
36
+ LogDrop.onNewHmsPushToken(token)
37
+ }
38
+
39
+ @ReactMethod
40
+ fun sendLogs() {
41
+ LogDrop.sendLogs()
42
+ }
43
+
44
+ @ReactMethod
45
+ fun userUpdate(userId: String) {
46
+ LogDrop.userUpdate(userId)
47
+ }
48
+
49
+ @ReactMethod
50
+ fun e(tag: String, message: String, logFlow: ReadableMap?) {
51
+ val logFlowObject = readableMapToLogFlow(logFlow)
52
+ LogDrop.e(tag, message, logFlowObject)
53
+ }
54
+
55
+ @ReactMethod
56
+ fun d(tag: String, message: String, logFlow: ReadableMap?) {
57
+ val logFlowObject = readableMapToLogFlow(logFlow)
58
+ LogDrop.d(tag, message, logFlowObject)
59
+ }
60
+
61
+ @ReactMethod
62
+ fun i(tag: String, message: String, logFlow: ReadableMap?) {
63
+ val logFlowObject = readableMapToLogFlow(logFlow)
64
+ LogDrop.i(tag, message, logFlowObject)
65
+ }
66
+
67
+ @ReactMethod
68
+ fun w(tag: String, message: String, logFlow: ReadableMap?) {
69
+ val logFlowObject = readableMapToLogFlow(logFlow)
70
+ LogDrop.w(tag, message, logFlowObject)
71
+ }
72
+
73
+ }
@@ -0,0 +1,17 @@
1
+ package com.logdropreactnative
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+
9
+ class LogDropReactNativePackage : ReactPackage {
10
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11
+ return listOf(LogDropReactNativeModule(reactContext))
12
+ }
13
+
14
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
15
+ return emptyList()
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ package com.logdropreactnative
2
+
3
+ import com.facebook.react.bridge.ReadableMap
4
+
5
+ import io.logdrop.sdk.LogFlow
6
+
7
+ fun readableMapToLogFlow(logFlowMap: ReadableMap?): LogFlow {
8
+ val name = logFlowMap?.takeIf { it.hasKey("name") && !it.isNull("name") }?.getString("name") ?: ""
9
+ val id = logFlowMap?.takeIf { it.hasKey("id") && !it.isNull("id") }?.getString("id") ?: ""
10
+
11
+ val customAttributes: Map<String, String>? = logFlowMap
12
+ ?.takeIf { it.hasKey("customAttributes") && !it.isNull("customAttributes") }
13
+ ?.getMap("customAttributes")
14
+ ?.toStringMap()
15
+
16
+ return LogFlow(name = name, id = id, customAttributes = customAttributes)
17
+ }
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import LogDrop from "./src/LogDrop"
2
+ import LogFlow from "./src/LogFlow"
3
+ import { LogDropConfig, LogDropConfigBuilder } from "./src/LogDropConfig";
4
+
5
+ export { LogDrop, LogDropConfigBuilder, LogFlow }; export type { LogDropConfig };
6
+
@@ -0,0 +1,2 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,18 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(LogDropReactNative, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(initLogDrop:(NSDictionary *)config)
6
+ RCT_EXTERN_METHOD(e:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
7
+ RCT_EXTERN_METHOD(i:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
8
+ RCT_EXTERN_METHOD(d:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
9
+ RCT_EXTERN_METHOD(w:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
10
+ RCT_EXTERN_METHOD(userUpdate:(NSString *)userUuid)
11
+ RCT_EXTERN_METHOD(sendLogs)
12
+
13
+ + (BOOL)requiresMainQueueSetup
14
+ {
15
+ return NO;
16
+ }
17
+
18
+ @end
@@ -0,0 +1,70 @@
1
+ import LogDropSDK
2
+
3
+ @objc(LogDropReactNative)
4
+ class LogDropReactNative: NSObject {
5
+
6
+ @objc
7
+ func initLogDrop(_ config: NSDictionary) {
8
+ let builder = LogDropConfig.Builder()
9
+
10
+ if let apiKey = config["apiKey"] as? String {
11
+ builder.setApiKey(apiKey)
12
+ }
13
+
14
+ if let baseUrl = config["baseUrl"] as? String {
15
+ builder.setBaseUrl(baseUrl)
16
+ }
17
+
18
+ if let defaultSDKDisabled = config["defaultSDKDisabled"] as? Bool {
19
+ builder.setDefaultSDKDisabledValue(defaultSDKDisabled)
20
+ }
21
+
22
+ if let isLoggingEnabled = config["isLoggingEnabled"] as? Bool {
23
+ builder.setLoggingEnabled(isLoggingEnabled)
24
+ }
25
+
26
+ if let sensitiveInfoFilter = config["sensitiveInfoFilter"] as? [String] {
27
+ let regexList = sensitiveInfoFilter.compactMap { try? NSRegularExpression(pattern: $0) }
28
+ builder.setSensitiveInfoFilter(sensitiveInfoFilter: regexList)
29
+ }
30
+
31
+ let logDropConfig = builder.build()
32
+ LogDrop.initialize(with: logDropConfig)
33
+ }
34
+
35
+ @objc
36
+ func i(_ tag: String, message: String, logFlow: NSDictionary?) {
37
+ let parsedFlow = LogFlowParser.from(dict: logFlow)
38
+ LogDrop.i(message, logFlow: parsedFlow, file: tag)
39
+ }
40
+
41
+ @objc
42
+ func d(_ tag: String, message: String, logFlow: NSDictionary?) {
43
+ let parsedFlow = LogFlowParser.from(dict: logFlow)
44
+ LogDrop.d(message, logFlow: parsedFlow, file: tag)
45
+ }
46
+
47
+ @objc
48
+ func w(_ tag: String, message: String, logFlow: NSDictionary?) {
49
+ let parsedFlow = LogFlowParser.from(dict: logFlow)
50
+ LogDrop.w(message, logFlow: parsedFlow, file: tag)
51
+ }
52
+
53
+ @objc
54
+ func e(_ tag: String, message: String, logFlow: NSDictionary?) {
55
+ let parsedFlow = LogFlowParser.from(dict: logFlow)
56
+ LogDrop.e(message, logFlow: parsedFlow, file: tag)
57
+ }
58
+
59
+
60
+ @objc
61
+ func userUpdate(_ userUuid: String) {
62
+ LogDrop.updateUser(userUuid: userUuid)
63
+ }
64
+
65
+ @objc
66
+ func sendLogs() {
67
+ LogDrop.sendLogs()
68
+ }
69
+
70
+ }
@@ -0,0 +1,24 @@
1
+ //
2
+ // LogFlowParser.swift
3
+ // Pods
4
+ //
5
+ // Created by Initial Code
6
+ //
7
+
8
+ import Foundation
9
+ import LogDropSDK
10
+
11
+ struct LogFlowParser {
12
+ static func from(dict: NSDictionary?) -> LogFlow? {
13
+ guard
14
+ let dict = dict as? [String: Any],
15
+ let name = dict["name"] as? String,
16
+ let id = dict["id"] as? String
17
+ else {
18
+ return nil
19
+ }
20
+
21
+ let customAttributes = dict["customAttributes"] as? [String: String]
22
+ return LogFlow(name: name, id: id, customAttributes: customAttributes)
23
+ }
24
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@log-drop/react-native",
3
+ "version": "1.0.0",
4
+ "description": "LogDrop React Native SDK",
5
+ "main": "index.ts",
6
+ "author": "InitialCode",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "rebuild": "scripts/yarn_rebuild.sh"
10
+ },
11
+ "keywords": [
12
+ "react-native",
13
+ "ios",
14
+ "android",
15
+ "logdrop"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "license": "",
22
+ "devDependencies": {
23
+ "@tsconfig/react-native": "^2.0.3",
24
+ "@types/jest": "^29.5.0",
25
+ "@types/react": "^18.0.30",
26
+ "@types/react-native": "^0.71.5",
27
+ "@types/react-test-renderer": "^18.0.0",
28
+ "eslint": "^8.39.0",
29
+ "prettier": "^2.8.7",
30
+ "typescript": "^5.0.2"
31
+ }
32
+ }
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ echo "Removing node_modules..."
4
+ rm -rf node_modules
5
+
6
+ echo "Running yarn install..."
7
+ yarn install
8
+
9
+ echo "Navigating to example directory..."
10
+ cd example
11
+
12
+ echo "Removing node_modules in example directory..."
13
+ rm -rf node_modules
14
+
15
+ echo "Running yarn install in example directory..."
16
+ yarn install
17
+
18
+ echo "Navigating to ios directory..."
19
+ cd ios
20
+
21
+ echo "Removing Pods and Podfile.lock..."
22
+ rm -rf Pods
23
+ rm -f Podfile.lock
24
+
25
+ echo "Running pod install..."
26
+ pod install
27
+
28
+ echo "Navigating back to example directory..."
29
+ cd ../..
30
+
31
+ echo "Rebuild process completed successfully!"
package/src/LogDrop.ts ADDED
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (c) 2025 Initial Code
3
+ */
4
+
5
+ import {
6
+ NativeModules,
7
+ NativeModulesStatic, Platform,
8
+ } from "react-native";
9
+ import {LogDropConfig} from "./LogDropConfig";
10
+ import LogFlow from "./LogFlow";
11
+
12
+ const { LogDropReactNative }: NativeModulesStatic = NativeModules;
13
+
14
+ export default class LogDrop {
15
+ static init = (config: LogDropConfig): void => {
16
+ if (Platform.OS === 'ios') {
17
+ LogDropReactNative.initLogDrop(config)
18
+ }
19
+ }
20
+
21
+ static onRemoteMessageReceived = (message: { [key: string]: string }): void => {
22
+ if (Platform.OS === 'android') {
23
+ LogDropReactNative.onRemoteMessageReceived(message)
24
+ }
25
+ }
26
+
27
+ static onNewFcmPushToken = (token: string): void => {
28
+ if (Platform.OS === 'android') {
29
+ LogDropReactNative.onNewFcmPushToken(token)
30
+ }
31
+ }
32
+
33
+ static onNewHmsPushToken = (token: string): void => {
34
+ if (Platform.OS === 'android') {
35
+ LogDropReactNative.onNewHmsPushToken(token)
36
+ }
37
+ }
38
+
39
+ static sendLogs = (): void => {
40
+ LogDropReactNative.sendLogs()
41
+ }
42
+
43
+ static userUpdate = (userId: string): void => {
44
+ LogDropReactNative.userUpdate(userId)
45
+ }
46
+
47
+ static e = (tag: string, message: string, logFlow?: LogFlow): void => {
48
+ LogDropReactNative.e(tag, message, logFlow)
49
+ }
50
+
51
+ static d = (tag: string, message: string, logFlow?: LogFlow): void => {
52
+ LogDropReactNative.d(tag, message, logFlow)
53
+ }
54
+
55
+ static i = (tag: string, message: string, logFlow?: LogFlow): void => {
56
+ LogDropReactNative.i(tag, message, logFlow)
57
+ }
58
+
59
+ static w = (tag: string, message: string, logFlow?: LogFlow): void => {
60
+ LogDropReactNative.w(tag, message, logFlow)
61
+ }
62
+ }
@@ -0,0 +1,50 @@
1
+ export interface LogDropConfig {
2
+ apiKey: string;
3
+ baseUrl: string;
4
+ isLoggingEnabled: boolean;
5
+ defaultSDKDisabled: boolean;
6
+ sensitiveInfoFilter: string[];
7
+ }
8
+
9
+ export class LogDropConfigBuilder {
10
+ private apiKey: string = '';
11
+ private baseUrl: string = '';
12
+ private isLoggingEnabled: boolean = false;
13
+ private defaultSDKDisabled: boolean = false;
14
+ private sensitiveInfoFilter: string[] = [];
15
+
16
+ setApiKey(apiKey: string): this {
17
+ this.apiKey = apiKey;
18
+ return this;
19
+ }
20
+
21
+ setBaseUrl(baseUrl: string): this {
22
+ this.baseUrl = baseUrl;
23
+ return this;
24
+ }
25
+
26
+ setLoggingEnabled(isLoggingEnabled: boolean): this {
27
+ this.isLoggingEnabled = isLoggingEnabled;
28
+ return this;
29
+ }
30
+
31
+ setDefaultSDKDisabledValue(defaultSDKDisabled: boolean): this {
32
+ this.defaultSDKDisabled = defaultSDKDisabled;
33
+ return this;
34
+ }
35
+
36
+ setSensitiveInfoFilter(sensitiveInfoFilter: string[]): this {
37
+ this.sensitiveInfoFilter = sensitiveInfoFilter;
38
+ return this;
39
+ }
40
+
41
+ build(): LogDropConfig {
42
+ return {
43
+ apiKey: this.apiKey,
44
+ baseUrl: this.baseUrl,
45
+ isLoggingEnabled: this.isLoggingEnabled,
46
+ defaultSDKDisabled: this.defaultSDKDisabled,
47
+ sensitiveInfoFilter: this.sensitiveInfoFilter,
48
+ };
49
+ }
50
+ }
package/src/LogFlow.ts ADDED
@@ -0,0 +1,15 @@
1
+ export default class LogFlow {
2
+ name: string;
3
+ id: string;
4
+ customAttributes?: Map<string, string>;
5
+
6
+ constructor(
7
+ name: string,
8
+ id: string,
9
+ customAttributes?: Map<string, string>
10
+ ) {
11
+ this.name = name;
12
+ this.id = id;
13
+ this.customAttributes = customAttributes;
14
+ }
15
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@tsconfig/react-native/tsconfig.json"
3
+ }