@tyrads.com/tyrads-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +11 -0
- package/android/build.gradle +101 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +44 -0
- package/android/src/main/java/com/tyradssdk/TyradsSdkPackage.kt +17 -0
- package/ios/TyradsSdk-Bridging-Header.h +2 -0
- package/ios/TyradsSdk.mm +9 -0
- package/ios/TyradsSdk.swift +26 -0
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +187 -0
- package/readme.md +24 -0
- package/src/index.tsx +19 -0
- package/tyrads-sdk.podspec +41 -0
package/LICENSE
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Copyright 2024 TyrAds
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
4
|
+
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
6
|
+
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
10
|
+
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
@@ -0,0 +1,101 @@
|
|
1
|
+
buildscript {
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["TyradsSdk_kotlinVersion"]
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
google()
|
7
|
+
mavenCentral()
|
8
|
+
}
|
9
|
+
|
10
|
+
dependencies {
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
def reactNativeArchitectures() {
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
20
|
+
}
|
21
|
+
|
22
|
+
def isNewArchitectureEnabled() {
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
24
|
+
}
|
25
|
+
|
26
|
+
apply plugin: "com.android.library"
|
27
|
+
apply plugin: "kotlin-android"
|
28
|
+
|
29
|
+
if (isNewArchitectureEnabled()) {
|
30
|
+
apply plugin: "com.facebook.react"
|
31
|
+
}
|
32
|
+
|
33
|
+
def getExtOrDefault(name) {
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["TyradsSdk_" + name]
|
35
|
+
}
|
36
|
+
|
37
|
+
def getExtOrIntegerDefault(name) {
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["TyradsSdk_" + name]).toInteger()
|
39
|
+
}
|
40
|
+
|
41
|
+
def supportsNamespace() {
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
43
|
+
def major = parsed[0].toInteger()
|
44
|
+
def minor = parsed[1].toInteger()
|
45
|
+
|
46
|
+
// Namespace support was added in 7.3.0
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
48
|
+
}
|
49
|
+
|
50
|
+
android {
|
51
|
+
if (supportsNamespace()) {
|
52
|
+
namespace "com.tyradssdk"
|
53
|
+
|
54
|
+
sourceSets {
|
55
|
+
main {
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
62
|
+
|
63
|
+
defaultConfig {
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
buildTypes {
|
70
|
+
release {
|
71
|
+
minifyEnabled false
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
lintOptions {
|
76
|
+
disable "GradleCompatible"
|
77
|
+
}
|
78
|
+
|
79
|
+
compileOptions {
|
80
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
81
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
repositories {
|
86
|
+
mavenCentral()
|
87
|
+
google()
|
88
|
+
}
|
89
|
+
|
90
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
91
|
+
|
92
|
+
dependencies {
|
93
|
+
// For < 0.71, this will be from the local maven repo
|
94
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
95
|
+
//noinspection GradleDynamicVersion
|
96
|
+
implementation "com.facebook.react:react-native:+"
|
97
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
98
|
+
implementation ("com.github.tyrads-com:tyrads-sdk-android:rnp-1.1.0")
|
99
|
+
|
100
|
+
}
|
101
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
package com.tyradssdk
|
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.Promise
|
7
|
+
import com.tyrads.sdk.Tyrads
|
8
|
+
|
9
|
+
class TyradsSdkModule(reactContext: ReactApplicationContext) :
|
10
|
+
ReactContextBaseJavaModule(reactContext) {
|
11
|
+
|
12
|
+
override fun getName(): String {
|
13
|
+
return NAME
|
14
|
+
}
|
15
|
+
|
16
|
+
@ReactMethod
|
17
|
+
fun init(apiKey: String, apiSecret: String, promise: Promise) {
|
18
|
+
try {
|
19
|
+
Tyrads.getInstance().init(this.reactApplicationContext, apiKey, apiSecret)
|
20
|
+
promise.resolve(null)
|
21
|
+
} catch (e: Exception) {
|
22
|
+
promise.reject("INIT_ERROR", e.message)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
@ReactMethod
|
27
|
+
fun loginUser(userId: String, promise: Promise) {
|
28
|
+
try {
|
29
|
+
Tyrads.getInstance().loginUser(userId)
|
30
|
+
promise.resolve(null)
|
31
|
+
} catch (e: Exception) {
|
32
|
+
promise.reject("LOGIN_ERROR", e.message)
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@ReactMethod
|
37
|
+
fun showOffers() {
|
38
|
+
Tyrads.getInstance().showOffers()
|
39
|
+
}
|
40
|
+
|
41
|
+
companion object {
|
42
|
+
const val NAME = "TyradsSdk"
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package com.tyradssdk
|
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 TyradsSdkPackage : ReactPackage {
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
11
|
+
return listOf(TyradsSdkModule(reactContext))
|
12
|
+
}
|
13
|
+
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
15
|
+
return emptyList()
|
16
|
+
}
|
17
|
+
}
|
package/ios/TyradsSdk.mm
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import Foundation
|
2
|
+
import UIKit
|
3
|
+
|
4
|
+
|
5
|
+
@objc(TyradsSdk)
|
6
|
+
class TyradsSdk: NSObject {
|
7
|
+
|
8
|
+
@objc
|
9
|
+
func `init`(_ apiKey: String, secretKey: String) {
|
10
|
+
NSLog("TyradsModule: init called with apiKey: \(apiKey) and secretKey: \(secretKey)")
|
11
|
+
}
|
12
|
+
|
13
|
+
@objc
|
14
|
+
func loginUser(_ userId: String) {
|
15
|
+
NSLog("TyradsModule: loginUser called with userId: \(userId)")
|
16
|
+
// Implement your login logic here
|
17
|
+
}
|
18
|
+
|
19
|
+
@objc
|
20
|
+
func showOffers() {
|
21
|
+
NSLog("TyradsModule: showOffers called")
|
22
|
+
if let url = URL(string: "https://example.com") {
|
23
|
+
UIApplication.shared.open(url, options: [:], completionHandler: { _ in })
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
const LINKING_ERROR = `The package 'tyrads-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
9
|
+
ios: "- You have run 'pod install'\n",
|
10
|
+
default: ''
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
12
|
+
const Tyrads = _reactNative.NativeModules.TyradsSdk ? _reactNative.NativeModules.TyradsSdk : new Proxy({}, {
|
13
|
+
get() {
|
14
|
+
throw new Error(LINKING_ERROR);
|
15
|
+
}
|
16
|
+
});
|
17
|
+
var _default = exports.default = Tyrads;
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","Tyrads","NativeModules","TyradsSdk","Proxy","get","Error","_default","exports"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,qEAAqE,GACrEC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,SAAS,GAClCD,0BAAa,CAACC,SAAS,GACvB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAR,OAAA,GACSC,MAAM","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"commonjs"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
4
|
+
const LINKING_ERROR = `The package 'tyrads-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
5
|
+
ios: "- You have run 'pod install'\n",
|
6
|
+
default: ''
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
8
|
+
const Tyrads = NativeModules.TyradsSdk ? NativeModules.TyradsSdk : new Proxy({}, {
|
9
|
+
get() {
|
10
|
+
throw new Error(LINKING_ERROR);
|
11
|
+
}
|
12
|
+
});
|
13
|
+
export default Tyrads;
|
14
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Tyrads","TyradsSdk","Proxy","get","Error"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,qEAAqE,GACrED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGN,aAAa,CAACO,SAAS,GAClCP,aAAa,CAACO,SAAS,GACvB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AACL,eAAeI,MAAM","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"module"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"commonjs"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,MAAM,KASP,CAAC;AACN,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"module"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,MAAM,KASP,CAAC;AACN,eAAe,MAAM,CAAC"}
|
package/package.json
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
{
|
2
|
+
"name": "@tyrads.com/tyrads-sdk",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Tyrads SDK for React Native ",
|
5
|
+
"source": "./src/index.tsx",
|
6
|
+
"main": "./lib/commonjs/index.js",
|
7
|
+
"module": "./lib/module/index.js",
|
8
|
+
"exports": {
|
9
|
+
".": {
|
10
|
+
"import": {
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
12
|
+
"default": "./lib/module/index.js"
|
13
|
+
},
|
14
|
+
"require": {
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
16
|
+
"default": "./lib/commonjs/index.js"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"files": [
|
21
|
+
"src",
|
22
|
+
"lib",
|
23
|
+
"android",
|
24
|
+
"ios",
|
25
|
+
"cpp",
|
26
|
+
"*.podspec",
|
27
|
+
"!ios/build",
|
28
|
+
"!android/build",
|
29
|
+
"!android/gradle",
|
30
|
+
"!android/gradlew",
|
31
|
+
"!android/gradlew.bat",
|
32
|
+
"!android/local.properties",
|
33
|
+
"!**/__tests__",
|
34
|
+
"!**/__fixtures__",
|
35
|
+
"!**/__mocks__",
|
36
|
+
"!**/.*"
|
37
|
+
],
|
38
|
+
"scripts": {
|
39
|
+
"example": "yarn workspace tyrads-sdk-example",
|
40
|
+
"test": "jest",
|
41
|
+
"typecheck": "tsc",
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
43
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
44
|
+
"prepare": "bob build",
|
45
|
+
"release": "release-it"
|
46
|
+
},
|
47
|
+
"keywords": [
|
48
|
+
"react-native",
|
49
|
+
"ios",
|
50
|
+
"android"
|
51
|
+
],
|
52
|
+
"repository": {
|
53
|
+
"type": "git",
|
54
|
+
"url": "git+https://github.com/tyrads-com/tyrads-sdk-reactnative.git"
|
55
|
+
},
|
56
|
+
"author": "dev@acmo.in <dev@acmo.in> (https://tyrads.com)",
|
57
|
+
"license": " BSD-3-Clause",
|
58
|
+
"bugs": {
|
59
|
+
"url": "https://github.com/tyrads-com/tyrads-sdk-reactnative/issues"
|
60
|
+
},
|
61
|
+
"homepage": "https://github.com/tyrads-com/tyrads-sdk-reactnative#readme",
|
62
|
+
"publishConfig": {
|
63
|
+
"registry": "https://registry.npmjs.org/"
|
64
|
+
},
|
65
|
+
"devDependencies": {
|
66
|
+
"@commitlint/config-conventional": "^17.0.2",
|
67
|
+
"@evilmartians/lefthook": "^1.5.0",
|
68
|
+
"@react-native/eslint-config": "^0.73.1",
|
69
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
70
|
+
"@types/jest": "^29.5.5",
|
71
|
+
"@types/react": "^18.2.44",
|
72
|
+
"commitlint": "^17.0.2",
|
73
|
+
"del-cli": "^5.1.0",
|
74
|
+
"eslint": "^8.51.0",
|
75
|
+
"eslint-config-prettier": "^9.0.0",
|
76
|
+
"eslint-plugin-prettier": "^5.0.1",
|
77
|
+
"jest": "^29.7.0",
|
78
|
+
"prettier": "^3.0.3",
|
79
|
+
"react": "18.2.0",
|
80
|
+
"react-native": "0.74.5",
|
81
|
+
"react-native-builder-bob": "^0.29.0",
|
82
|
+
"release-it": "^15.0.0",
|
83
|
+
"turbo": "^1.10.7",
|
84
|
+
"typescript": "^5.2.2"
|
85
|
+
},
|
86
|
+
"resolutions": {
|
87
|
+
"@types/react": "^18.2.44"
|
88
|
+
},
|
89
|
+
"peerDependencies": {
|
90
|
+
"react": "*",
|
91
|
+
"react-native": "*"
|
92
|
+
},
|
93
|
+
"workspaces": [
|
94
|
+
"example"
|
95
|
+
],
|
96
|
+
"packageManager": "yarn@3.6.1",
|
97
|
+
"jest": {
|
98
|
+
"preset": "react-native",
|
99
|
+
"modulePathIgnorePatterns": [
|
100
|
+
"<rootDir>/example/node_modules",
|
101
|
+
"<rootDir>/lib/"
|
102
|
+
]
|
103
|
+
},
|
104
|
+
"commitlint": {
|
105
|
+
"extends": [
|
106
|
+
"@commitlint/config-conventional"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
"release-it": {
|
110
|
+
"git": {
|
111
|
+
"commitMessage": "chore: release ${version}",
|
112
|
+
"tagName": "v${version}"
|
113
|
+
},
|
114
|
+
"npm": {
|
115
|
+
"publish": true
|
116
|
+
},
|
117
|
+
"github": {
|
118
|
+
"release": true
|
119
|
+
},
|
120
|
+
"plugins": {
|
121
|
+
"@release-it/conventional-changelog": {
|
122
|
+
"preset": "angular"
|
123
|
+
}
|
124
|
+
}
|
125
|
+
},
|
126
|
+
"eslintConfig": {
|
127
|
+
"root": true,
|
128
|
+
"extends": [
|
129
|
+
"@react-native",
|
130
|
+
"prettier"
|
131
|
+
],
|
132
|
+
"rules": {
|
133
|
+
"react/react-in-jsx-scope": "off",
|
134
|
+
"prettier/prettier": [
|
135
|
+
"error",
|
136
|
+
{
|
137
|
+
"quoteProps": "consistent",
|
138
|
+
"singleQuote": true,
|
139
|
+
"tabWidth": 2,
|
140
|
+
"trailingComma": "es5",
|
141
|
+
"useTabs": false
|
142
|
+
}
|
143
|
+
]
|
144
|
+
}
|
145
|
+
},
|
146
|
+
"eslintIgnore": [
|
147
|
+
"node_modules/",
|
148
|
+
"lib/"
|
149
|
+
],
|
150
|
+
"prettier": {
|
151
|
+
"quoteProps": "consistent",
|
152
|
+
"singleQuote": true,
|
153
|
+
"tabWidth": 2,
|
154
|
+
"trailingComma": "es5",
|
155
|
+
"useTabs": false
|
156
|
+
},
|
157
|
+
"react-native-builder-bob": {
|
158
|
+
"source": "src",
|
159
|
+
"output": "lib",
|
160
|
+
"targets": [
|
161
|
+
[
|
162
|
+
"commonjs",
|
163
|
+
{
|
164
|
+
"esm": true
|
165
|
+
}
|
166
|
+
],
|
167
|
+
[
|
168
|
+
"module",
|
169
|
+
{
|
170
|
+
"esm": true
|
171
|
+
}
|
172
|
+
],
|
173
|
+
[
|
174
|
+
"typescript",
|
175
|
+
{
|
176
|
+
"project": "tsconfig.build.json",
|
177
|
+
"esm": true
|
178
|
+
}
|
179
|
+
]
|
180
|
+
]
|
181
|
+
},
|
182
|
+
"create-react-native-library": {
|
183
|
+
"type": "module-legacy",
|
184
|
+
"languages": "kotlin-swift",
|
185
|
+
"version": "0.40.0"
|
186
|
+
}
|
187
|
+
}
|
package/readme.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# tyrads-sdk
|
2
|
+
|
3
|
+
Tyrads SDK for React Native
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```sh
|
8
|
+
npm install @tyrads.com/tyrads-sdk
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
|
14
|
+
```js
|
15
|
+
import Tyrads from '@tyrads.com/tyrads-sdk';
|
16
|
+
|
17
|
+
// ...
|
18
|
+
|
19
|
+
|
20
|
+
Tyrads.init('', '');
|
21
|
+
Tyrads.loginUser('');
|
22
|
+
Tyrads.showOffers();
|
23
|
+
```
|
24
|
+
|
package/src/index.tsx
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
2
|
+
|
3
|
+
const LINKING_ERROR =
|
4
|
+
`The package 'tyrads-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
7
|
+
'- You are not using Expo Go\n';
|
8
|
+
|
9
|
+
const Tyrads = NativeModules.TyradsSdk
|
10
|
+
? NativeModules.TyradsSdk
|
11
|
+
: new Proxy(
|
12
|
+
{},
|
13
|
+
{
|
14
|
+
get() {
|
15
|
+
throw new Error(LINKING_ERROR);
|
16
|
+
},
|
17
|
+
}
|
18
|
+
);
|
19
|
+
export default Tyrads;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
5
|
+
|
6
|
+
Pod::Spec.new do |s|
|
7
|
+
s.name = "tyrads-sdk"
|
8
|
+
s.version = package["version"]
|
9
|
+
s.summary = package["description"]
|
10
|
+
s.homepage = package["homepage"]
|
11
|
+
s.license = package["license"]
|
12
|
+
s.authors = package["author"]
|
13
|
+
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
15
|
+
s.source = { :git => "https://github.com/tyrads-com/tyrads-sdk-reactnative.git", :tag => "#{s.version}" }
|
16
|
+
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
18
|
+
|
19
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
20
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
21
|
+
if respond_to?(:install_modules_dependencies, true)
|
22
|
+
install_modules_dependencies(s)
|
23
|
+
else
|
24
|
+
s.dependency "React-Core"
|
25
|
+
|
26
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
27
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
28
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
29
|
+
s.pod_target_xcconfig = {
|
30
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
31
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
32
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
33
|
+
}
|
34
|
+
s.dependency "React-Codegen"
|
35
|
+
s.dependency "RCT-Folly"
|
36
|
+
s.dependency "RCTRequired"
|
37
|
+
s.dependency "RCTTypeSafety"
|
38
|
+
s.dependency "ReactCommon/turbomodule/core"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|