@tyrads.com/tyrads-sdk 1.1.1 → 1.1.6-beta.2

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE CHANGED
@@ -1,11 +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.
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.
@@ -1,101 +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.5")
99
-
100
- }
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:02acdcda61")
99
+
100
+ }
101
+
@@ -1,5 +1,5 @@
1
- TyradsSdk_kotlinVersion=1.7.0
2
- TyradsSdk_minSdkVersion=24
3
- TyradsSdk_targetSdkVersion=31
4
- TyradsSdk_compileSdkVersion=31
5
- TyradsSdk_ndkversion=21.4.7075529
1
+ TyradsSdk_kotlinVersion=1.7.0
2
+ TyradsSdk_minSdkVersion=24
3
+ TyradsSdk_targetSdkVersion=31
4
+ TyradsSdk_compileSdkVersion=31
5
+ TyradsSdk_ndkversion=21.4.7075529
@@ -1,3 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.tyradssdk">
3
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.tyradssdk">
3
+ </manifest>
@@ -1,2 +1,2 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -1,44 +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
- }
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
+ }
@@ -1,17 +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
- }
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
+ }
@@ -1,31 +1,31 @@
1
- //
2
- // AcmoConfig.swift
3
- // TyradsSdk
4
- //
5
- // Created by ibnShamas on 8/13/24.
6
- //
7
-
8
- import Foundation
9
- import UIKit
10
-
11
- struct AcmoConfig {
12
- static let API_VERSION = "1.1"
13
- static let BUILD_VERSION = "2"
14
- static let SDK_VERSION = "\(API_VERSION).\(BUILD_VERSION)"
15
- static let SDK_PLATFORM = "React Native"
16
- static let BASE_URL = "https://api.tyrads.com/v\(API_VERSION)/"
17
- static let TAG = "TyrAds SDK"
18
-
19
- static let PRIMARY_COLOR = UIColor(red: 0/255, green: 36/255, blue: 51/255, alpha: 1)
20
- static let PRIMARY_COLOR_LIGHT = UIColor(red: 153/255, green: 145/255, blue: 145/255, alpha: 1)
21
- static let PRIMARY_COLOR_DARK = UIColor.black
22
-
23
- static let SECONDARY_COLOR = UIColor(red: 44/255, green: 179/255, blue: 136/255, alpha: 1)
24
- static let SECONDARY_COLOR_LIGHT = UIColor(red: 203/255, green: 235/255, blue: 207/255, alpha: 1)
25
- static let SIDEBAR_BACKGROUND_COLOR_LIGHT = UIColor(white: 1, alpha: 0.54)
26
- static let SIDEBAR_BACKGROUND_COLOR_DARK = UIColor(red: 17/255, green: 45/255, blue: 30/255, alpha: 1)
27
- static let APPBAR_BG = UIColor(red: 0/255, green: 33/255, blue: 48/255, alpha: 1)
28
-
29
- // Note: ThemeMode.light doesn't have a direct equivalent in iOS
30
- // You would typically handle this in your app's theme configuration
31
- }
1
+ //
2
+ // AcmoConfig.swift
3
+ // TyradsSdk
4
+ //
5
+ // Created by ibnShamas on 8/13/24.
6
+ //
7
+
8
+ import Foundation
9
+ import UIKit
10
+
11
+ struct AcmoConfig {
12
+ static let API_VERSION = "1.1"
13
+ static let BUILD_VERSION = "2"
14
+ static let SDK_VERSION = "\(API_VERSION).\(BUILD_VERSION)"
15
+ static let SDK_PLATFORM = "React Native"
16
+ static let BASE_URL = "https://api.tyrads.com/v\(API_VERSION)/"
17
+ static let TAG = "TyrAds SDK"
18
+
19
+ static let PRIMARY_COLOR = UIColor(red: 0/255, green: 36/255, blue: 51/255, alpha: 1)
20
+ static let PRIMARY_COLOR_LIGHT = UIColor(red: 153/255, green: 145/255, blue: 145/255, alpha: 1)
21
+ static let PRIMARY_COLOR_DARK = UIColor.black
22
+
23
+ static let SECONDARY_COLOR = UIColor(red: 44/255, green: 179/255, blue: 136/255, alpha: 1)
24
+ static let SECONDARY_COLOR_LIGHT = UIColor(red: 203/255, green: 235/255, blue: 207/255, alpha: 1)
25
+ static let SIDEBAR_BACKGROUND_COLOR_LIGHT = UIColor(white: 1, alpha: 0.54)
26
+ static let SIDEBAR_BACKGROUND_COLOR_DARK = UIColor(red: 17/255, green: 45/255, blue: 30/255, alpha: 1)
27
+ static let APPBAR_BG = UIColor(red: 0/255, green: 33/255, blue: 48/255, alpha: 1)
28
+
29
+ // Note: ThemeMode.light doesn't have a direct equivalent in iOS
30
+ // You would typically handle this in your app's theme configuration
31
+ }
@@ -1,46 +1,46 @@
1
- //
2
- // InitModel.swift
3
- // TyradsSdk
4
- //
5
- // Created by ibnShamas on 8/13/24.
6
- //
7
-
8
- import Foundation
9
-
10
- struct AcmoInitModel: Codable {
11
- let data: Data
12
- }
13
-
14
- struct Data: Codable {
15
- let newRegisteredUser: Bool
16
- let user: User
17
- let publisherApp: PublisherApp
18
-
19
- enum CodingKeys: String, CodingKey {
20
- case newRegisteredUser = "newRegisteredUser"
21
- case user
22
- case publisherApp
23
- }
24
-
25
- init(from decoder: Decoder) throws {
26
- let container = try decoder.container(keyedBy: CodingKeys.self)
27
- newRegisteredUser = try container.decodeIfPresent(Bool.self, forKey: .newRegisteredUser) ?? false
28
- user = try container.decode(User.self, forKey: .user)
29
- publisherApp = try container.decode(PublisherApp.self, forKey: .publisherApp)
30
- }
31
- }
32
-
33
- struct User: Codable {
34
- let publisherUserId: String
35
- }
36
-
37
- struct PublisherApp: Codable {
38
- let headerColor: String
39
- let mainColor: String
40
-
41
- init(from decoder: Decoder) throws {
42
- let container = try decoder.container(keyedBy: CodingKeys.self)
43
- headerColor = try container.decodeIfPresent(String.self, forKey: .headerColor) ?? ""
44
- mainColor = try container.decodeIfPresent(String.self, forKey: .mainColor) ?? ""
45
- }
46
- }
1
+ //
2
+ // InitModel.swift
3
+ // TyradsSdk
4
+ //
5
+ // Created by ibnShamas on 8/13/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ struct AcmoInitModel: Codable {
11
+ let data: Data
12
+ }
13
+
14
+ struct Data: Codable {
15
+ let newRegisteredUser: Bool
16
+ let user: User
17
+ let publisherApp: PublisherApp
18
+
19
+ enum CodingKeys: String, CodingKey {
20
+ case newRegisteredUser = "newRegisteredUser"
21
+ case user
22
+ case publisherApp
23
+ }
24
+
25
+ init(from decoder: Decoder) throws {
26
+ let container = try decoder.container(keyedBy: CodingKeys.self)
27
+ newRegisteredUser = try container.decodeIfPresent(Bool.self, forKey: .newRegisteredUser) ?? false
28
+ user = try container.decode(User.self, forKey: .user)
29
+ publisherApp = try container.decode(PublisherApp.self, forKey: .publisherApp)
30
+ }
31
+ }
32
+
33
+ struct User: Codable {
34
+ let publisherUserId: String
35
+ }
36
+
37
+ struct PublisherApp: Codable {
38
+ let headerColor: String
39
+ let mainColor: String
40
+
41
+ init(from decoder: Decoder) throws {
42
+ let container = try decoder.container(keyedBy: CodingKeys.self)
43
+ headerColor = try container.decodeIfPresent(String.self, forKey: .headerColor) ?? ""
44
+ mainColor = try container.decodeIfPresent(String.self, forKey: .mainColor) ?? ""
45
+ }
46
+ }