@1selfworld/adchain-sdk-react-native 1.0.19 → 1.0.21

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/README.md CHANGED
@@ -224,6 +224,8 @@ npx expo run:ios
224
224
 
225
225
  | 패키지 버전 | Android SDK | iOS SDK | Swift | Expo SDK | 주요 변경사항 |
226
226
  |------------|-------------|---------|-------|----------|--------------|
227
+ | 1.0.21 | v1.0.32 | v1.0.47 | 5.5 | 50-53 | Android SDK v1.0.32 업데이트 (JitPack 빌드 안정화) |
228
+ | 1.0.20 | v1.0.31 | v1.0.47 | 5.5 | 50-53 | AdchainOfferwallView placementId 단순화 (네이티브 SDK에서 URL 처리) |
227
229
  | 1.0.19 | v1.0.30 | v1.0.46 | 5.5 | 50-53 | iOS 타입 오류 수정 (AdchainSdkConfig, AdchainSdkUser) |
228
230
  | 1.0.18 | v1.0.30 | v1.0.46 | 5.5 | 50-53 | 네이티브 SDK 버전 업데이트 |
229
231
  | 1.0.15 | v1.0.29 | v1.0.45 | 5.5 | 50-53 | 백버튼 이벤트, NestAds 지원 |
@@ -35,5 +35,5 @@ dependencies {
35
35
  implementation 'com.facebook.react:react-native:+'
36
36
  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.21"
37
37
  // AdChain Android SDK via JitPack
38
- implementation 'com.github.1selfworld-labs:adchain-sdk-android:v1.0.30'
38
+ implementation 'com.github.1selfworld-labs:adchain-sdk-android:v1.0.32'
39
39
  }
@@ -101,40 +101,9 @@ class AdchainOfferwallViewManager : SimpleViewManager<AdchainOfferwallView>() {
101
101
  }
102
102
 
103
103
  try {
104
- // Get SDK config and user
105
- val config = AdchainSdk.getConfig()
106
- val user = AdchainSdk.getCurrentUser()
107
-
108
- Log.d(TAG, "SDK state - config: ${config != null}, user: ${user != null}")
109
-
110
- if (config == null) {
111
- Log.e(TAG, "SDK not initialized")
112
- sendErrorEvent(view, "SDK not initialized")
113
- return
114
- }
115
-
116
- if (user == null) {
117
- Log.e(TAG, "User not logged in")
118
- sendErrorEvent(view, "User not logged in")
119
- return
120
- }
121
-
122
- // Fetch placement URL from server (like openOfferwallNestAds does)
123
- Log.d(TAG, "Fetching placement URL from server for placementId: $placementId")
124
- coroutineScope.launch {
125
- val result = withContext(Dispatchers.IO) {
126
- NetworkManager.getPlacementUrl(placementId)
127
- }
128
-
129
- if (result.isSuccess) {
130
- val baseUrl = result.getOrNull()!!
131
- Log.d(TAG, "Successfully fetched placement URL: $baseUrl")
132
- Log.d(TAG, "About to call view.loadOfferwall()")
133
- Log.d(TAG, "Parameters - baseUrl: $baseUrl, userId: ${user.userId}, appKey: ${config.appKey}, placementId: $placementId")
134
-
135
- // Set callback for offerwall events
136
- Log.d(TAG, "Setting callback...")
137
- view.setCallback(object : OfferwallCallback {
104
+ // Set callback for offerwall events
105
+ Log.d(TAG, "Setting callback...")
106
+ view.setCallback(object : OfferwallCallback {
138
107
  override fun onOpened() {
139
108
  sendEvent(view, "onOfferwallOpened", Arguments.createMap())
140
109
  }
@@ -213,23 +182,11 @@ class AdchainOfferwallViewManager : SimpleViewManager<AdchainOfferwallView>() {
213
182
  }
214
183
  })
215
184
 
216
- // Load offerwall with fetched URL
217
- Log.d(TAG, "Calling view.loadOfferwall()...")
218
- view.loadOfferwall(
219
- baseUrl = baseUrl,
220
- userId = user.userId,
221
- appKey = config.appKey,
222
- placementId = placementId
223
- )
224
- Log.d(TAG, "view.loadOfferwall() call completed")
225
- } else {
226
- // Failed to fetch placement URL
227
- val error = result.exceptionOrNull()
228
- val errorMessage = "Failed to fetch placement URL: ${error?.message ?: "Unknown error"}"
229
- Log.e(TAG, errorMessage)
230
- sendErrorEvent(view, errorMessage)
231
- }
232
- }
185
+ // Simply call the native method with placementId
186
+ // Native SDK handles URL fetching internally
187
+ Log.d(TAG, "Calling view.loadOfferwall(placementId)...")
188
+ view.loadOfferwall(placementId)
189
+ Log.d(TAG, "view.loadOfferwall() call completed")
233
190
 
234
191
  } catch (e: Exception) {
235
192
  Log.e(TAG, "Exception in loadOfferwall", e)
@@ -77,34 +77,6 @@ class AdchainOfferwallRNView: UIView {
77
77
  return
78
78
  }
79
79
 
80
- guard let config = AdchainSdk.shared.getConfig(),
81
- let user = AdchainSdk.shared.getCurrentUser() else {
82
- if AdchainSdk.shared.getConfig() == nil {
83
- sendErrorEvent(error: "SDK not initialized")
84
- } else if AdchainSdk.shared.getCurrentUser() == nil {
85
- sendErrorEvent(error: "User not logged in")
86
- }
87
- return
88
- }
89
-
90
- // Fetch placement URL from server (like openOfferwallNestAds does)
91
- Task {
92
- do {
93
- let baseUrl = try await NetworkManager.shared.getPlacementUrl(placementId: placementId)
94
-
95
- await MainActor.run {
96
- self.loadOfferwallWithUrl(view: view, baseUrl: baseUrl, config: config, user: user, placementId: placementId)
97
- }
98
- } catch {
99
- await MainActor.run {
100
- let errorMessage = "Failed to fetch placement URL: \(error.localizedDescription)"
101
- self.sendErrorEvent(error: errorMessage)
102
- }
103
- }
104
- }
105
- }
106
-
107
- private func loadOfferwallWithUrl(view: AdchainOfferwallView, baseUrl: String, config: AdchainSdkConfig, user: AdchainSdkUser, placementId: String) {
108
80
  // Set callback for offerwall events
109
81
  view.setCallback(RNOfferwallCallback(
110
82
  onOpened: { [weak self] in
@@ -155,12 +127,9 @@ class AdchainOfferwallRNView: UIView {
155
127
  ))
156
128
 
157
129
  // Load offerwall with fetched URL
158
- view.loadOfferwall(
159
- baseUrl: baseUrl,
160
- userId: user.userId,
161
- appKey: config.appKey,
162
- placementId: placementId
163
- )
130
+ // Simply call the native method with placementId
131
+ // Native SDK handles URL fetching internally
132
+ view.loadOfferwall(placementId: placementId)
164
133
 
165
134
  // Clear pending
166
135
  pendingPlacementId = nil
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1selfworld/adchain-sdk-react-native",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "AdChain SDK for React Native with Expo support",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -28,10 +28,10 @@ function withAdchainIOS(config) {
28
28
  if (targetMatch) {
29
29
  const targetName = targetMatch[1];
30
30
  const podDeclaration = `
31
- # AdChain SDK (Git Pod) - v1.0.46
31
+ # AdChain SDK (Git Pod) - v1.0.47
32
32
  # CocoaPods Trunk에 없으므로 Git 방식 사용
33
33
  # Swift 5.5 (5.9 optional 파라미터 버그 회피)
34
- pod 'AdChainSDK', :git => 'https://github.com/1selfworld-labs/adchain-sdk-ios-release.git', :tag => 'v1.0.46'
34
+ pod 'AdChainSDK', :git => 'https://github.com/1selfworld-labs/adchain-sdk-ios-release.git', :tag => 'v1.0.47'
35
35
  `;
36
36
 
37
37
  podfile = podfile.replace(
@@ -41,8 +41,8 @@ function withAdchainIOS(config) {
41
41
  } else {
42
42
  // Fallback
43
43
  const podDeclaration = `
44
- # AdChain SDK (Git Pod) - v1.0.46
45
- pod 'AdChainSDK', :git => 'https://github.com/1selfworld-labs/adchain-sdk-ios-release.git', :tag => 'v1.0.46'
44
+ # AdChain SDK (Git Pod) - v1.0.47
45
+ pod 'AdChainSDK', :git => 'https://github.com/1selfworld-labs/adchain-sdk-ios-release.git', :tag => 'v1.0.47'
46
46
  `;
47
47
 
48
48
  podfile = podfile.replace(