react-native-firework-sdk 1.1.0 → 1.2.0-beta.2
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/android/build.gradle +1 -1
- package/android/gradlew +0 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/{reactnative/FireworkSDKPackage.kt → FireworkSDKPackage.kt} +4 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWInitializationProvider.kt +99 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +74 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +6 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +7 -6
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +54 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
- package/android/src/main/res/layout/fw_bridge_fragment_container.xml +8 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +202 -18
- package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +40 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +71 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +4 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +2 -28
- package/lib/commonjs/FWNavigator.js +72 -0
- package/lib/commonjs/FWNavigator.js.map +1 -0
- package/lib/commonjs/FireworkSDK.js +21 -3
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/NavigationContainer.js +40 -0
- package/lib/commonjs/components/NavigationContainer.js.map +1 -0
- package/lib/commonjs/index.js +14 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +37 -0
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
- package/lib/module/FWNavigator.js +55 -0
- package/lib/module/FWNavigator.js.map +1 -0
- package/lib/module/FireworkSDK.js +18 -3
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/NavigationContainer.js +23 -0
- package/lib/module/components/NavigationContainer.js.map +1 -0
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/modules/FWNavigatorModule.js +13 -0
- package/lib/module/modules/FWNavigatorModule.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +28 -0
- package/lib/module/utils/FWLoggerUtil.js.map +1 -0
- package/lib/typescript/FWNavigator.d.ts +23 -0
- package/lib/typescript/FireworkSDK.d.ts +6 -3
- package/lib/typescript/components/NavigationContainer.d.ts +6 -0
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/modules/FWNavigatorModule.d.ts +9 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -3
- package/lib/typescript/utils/FWLoggerUtil.d.ts +5 -0
- package/package.json +1 -1
- package/src/FWNavigator.tsx +47 -0
- package/src/FireworkSDK.ts +21 -5
- package/src/components/NavigationContainer.tsx +24 -0
- package/src/index.tsx +9 -4
- package/src/models/FWEventName.ts +1 -0
- package/src/modules/FWNavigatorModule.ts +22 -0
- package/src/modules/FireworkSDKModule.ts +2 -3
- package/src/utils/FWLoggerUtil.ts +35 -0
- package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
- package/lib/commonjs/models/AdConfig.js +0 -2
- package/lib/commonjs/models/AdConfig.js.map +0 -1
- package/lib/module/models/AdConfig.js +0 -2
- package/lib/module/models/AdConfig.js.map +0 -1
- package/lib/typescript/models/AdConfig.d.ts +0 -10
- package/src/models/AdConfig.ts +0 -10
package/android/build.gradle
CHANGED
|
@@ -168,7 +168,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
168
168
|
dependencies {
|
|
169
169
|
|
|
170
170
|
// optional 1: firework sdk release verison
|
|
171
|
-
def firework_sdk_version = 'v5.11.
|
|
171
|
+
def firework_sdk_version = 'v5.11.4'
|
|
172
172
|
implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
|
|
173
173
|
|
|
174
174
|
// optional 2: firework sdk local version,
|
package/android/gradlew
CHANGED
|
File without changes
|
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
android:name="com.fireworksdk.bridge.reactnative.pages.FWVideoShoppingCartActivity"
|
|
12
12
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
13
13
|
/>
|
|
14
|
+
<activity
|
|
15
|
+
android:name="com.fireworksdk.bridge.reactnative.pages.FWContainerActivity"
|
|
16
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
17
|
+
/>
|
|
18
|
+
<provider
|
|
19
|
+
android:authorities="com.fireworksdk.bridge.reactnative"
|
|
20
|
+
android:name=".reactnative.FWInitializationProvider"
|
|
21
|
+
android:exported="false"
|
|
22
|
+
/>
|
|
14
23
|
<meta-data
|
|
15
24
|
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
|
|
16
25
|
android:value="true" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.fireworksdk.bridge
|
|
1
|
+
package com.fireworksdk.bridge
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.ReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
import com.fireworksdk.bridge.reactnative.manager.FWVideoFeedManager
|
|
8
8
|
import com.fireworksdk.bridge.reactnative.module.FWLiveStreamModule
|
|
9
|
+
import com.fireworksdk.bridge.reactnative.module.FWNavigatorModule
|
|
9
10
|
import com.fireworksdk.bridge.reactnative.module.FWVideoShoppingModule
|
|
10
11
|
import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
|
|
11
12
|
|
|
@@ -15,7 +16,8 @@ class FireworkSDKPackage : ReactPackage {
|
|
|
15
16
|
return listOf(
|
|
16
17
|
FireworkSDKModule(reactContext),
|
|
17
18
|
FWVideoShoppingModule(reactContext),
|
|
18
|
-
FWLiveStreamModule(reactContext)
|
|
19
|
+
FWLiveStreamModule(reactContext),
|
|
20
|
+
FWNavigatorModule(reactContext)
|
|
19
21
|
)
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.app.Application
|
|
5
|
+
import android.content.ContentProvider
|
|
6
|
+
import android.content.ContentValues
|
|
7
|
+
import android.database.Cursor
|
|
8
|
+
import android.net.Uri
|
|
9
|
+
import android.os.Bundle
|
|
10
|
+
import com.fireworksdk.bridge.models.weakProperty
|
|
11
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
12
|
+
|
|
13
|
+
class FWInitializationProvider: ContentProvider() {
|
|
14
|
+
|
|
15
|
+
var application: Application? = null
|
|
16
|
+
var resumedActivity by weakProperty<Activity?>()
|
|
17
|
+
|
|
18
|
+
override fun onCreate(): Boolean {
|
|
19
|
+
sInstance = this
|
|
20
|
+
val context = context
|
|
21
|
+
if (context != null) {
|
|
22
|
+
// Many Initializer's expect the `applicationContext` to be non-null. This
|
|
23
|
+
// typically happens when `android:sharedUid` is used. In such cases, we postpone
|
|
24
|
+
// initialization altogether, and rely on lazy init.
|
|
25
|
+
// More context: b/196959015
|
|
26
|
+
val applicationContext = context.applicationContext as Application?
|
|
27
|
+
application = applicationContext
|
|
28
|
+
|
|
29
|
+
if (applicationContext != null) {
|
|
30
|
+
applicationContext.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
|
|
31
|
+
override fun onActivityCreated(activity: Activity, bundle: Bundle?) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun onActivityStarted(activity: Activity) {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun onActivityResumed(activity: Activity) {
|
|
38
|
+
resumedActivity = activity
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onActivityPaused(activity: Activity) {
|
|
42
|
+
if (resumedActivity == activity) {
|
|
43
|
+
resumedActivity = null
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun onActivityStopped(activity: Activity) {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun onActivityDestroyed(activity: Activity) {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
} else {
|
|
59
|
+
FWLogUtils.w {"Deferring initialization because `applicationContext` is null."}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
throw Exception("Context cannot be null")
|
|
63
|
+
}
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override fun query(
|
|
68
|
+
p0: Uri,
|
|
69
|
+
p1: Array<out String>?,
|
|
70
|
+
p2: String?,
|
|
71
|
+
p3: Array<out String>?,
|
|
72
|
+
p4: String?
|
|
73
|
+
): Cursor? {
|
|
74
|
+
throw IllegalStateException("Not allowed.")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
override fun getType(p0: Uri): String? {
|
|
78
|
+
throw IllegalStateException("Not allowed.")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun insert(p0: Uri, p1: ContentValues?): Uri? {
|
|
82
|
+
throw IllegalStateException("Not allowed.")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun delete(p0: Uri, p1: String?, p2: Array<out String>?): Int {
|
|
86
|
+
throw IllegalStateException("Not allowed.")
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override fun update(p0: Uri, p1: ContentValues?, p2: String?, p3: Array<out String>?): Int {
|
|
90
|
+
throw IllegalStateException("Not allowed.")
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
companion object {
|
|
94
|
+
private lateinit var sInstance: FWInitializationProvider
|
|
95
|
+
|
|
96
|
+
val INSTANCE: FWInitializationProvider
|
|
97
|
+
get() = sInstance
|
|
98
|
+
}
|
|
99
|
+
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt
CHANGED
|
@@ -5,7 +5,7 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
5
5
|
|
|
6
6
|
interface FireworkSDKInterface {
|
|
7
7
|
|
|
8
|
-
fun init(userId: String
|
|
8
|
+
fun init(userId: String?)
|
|
9
9
|
fun openVideoPlayer(url: String, config: ReadableMap?)
|
|
10
10
|
fun setShareBaseURL(url: String?, promise: Promise)
|
|
11
11
|
fun setAdBadgeConfiguration(config: ReadableMap?, promise: Promise)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative.module
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
5
|
+
import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
|
|
6
|
+
import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
|
|
7
|
+
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
8
|
+
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
9
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
10
|
+
import java.util.*
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FWNavigatorModule(
|
|
14
|
+
reactContext: ReactApplicationContext
|
|
15
|
+
) : ReactContextBaseJavaModule(reactContext), FWNavigatorInterface {
|
|
16
|
+
|
|
17
|
+
@ReactMethod
|
|
18
|
+
override fun pushNativeContainer(callbackId: String?, promise: Promise) {
|
|
19
|
+
FWLogUtils.d { "FWNavigatorModule pushNativeContainer: $callbackId" }
|
|
20
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
21
|
+
|
|
22
|
+
if (activity == null) {
|
|
23
|
+
promise.resolve(false)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Enter pushNativeContainer ${FWDateUtils.getDateString(Date())}")
|
|
28
|
+
|
|
29
|
+
UiThreadUtil.runOnUiThread {
|
|
30
|
+
|
|
31
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Before Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
32
|
+
|
|
33
|
+
activity.startActivity(FWContainerActivity.createIntent(activity, callbackId))
|
|
34
|
+
|
|
35
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] After Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
36
|
+
}
|
|
37
|
+
promise.resolve(true)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@ReactMethod
|
|
41
|
+
override fun popNativeContainer(promise: Promise) {
|
|
42
|
+
FWLogUtils.d { "FWNavigatorModule popNativeContainer" }
|
|
43
|
+
|
|
44
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
45
|
+
if (activity == null) {
|
|
46
|
+
promise.resolve(false)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
UiThreadUtil.runOnUiThread {
|
|
51
|
+
activity.finish()
|
|
52
|
+
}
|
|
53
|
+
promise.resolve(true)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@ReactMethod
|
|
57
|
+
fun addListener(eventName: String?, promise: Promise) {
|
|
58
|
+
// Set up any upstream listeners or background tasks as necessary
|
|
59
|
+
FWLogUtils.d { "addListener: $eventName" }
|
|
60
|
+
promise.resolve(Arguments.createMap())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@ReactMethod
|
|
64
|
+
fun removeListeners(count: Int?, promise: Promise) {
|
|
65
|
+
// Remove upstream listeners, stop unnecessary background tasks
|
|
66
|
+
FWLogUtils.d { "removeListeners: $count" }
|
|
67
|
+
promise.resolve(Arguments.createMap())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun getName(): String {
|
|
71
|
+
return "FWNavigatorModule"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt
CHANGED
|
@@ -3,6 +3,7 @@ package com.fireworksdk.bridge.reactnative.module
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
5
|
import com.fasterxml.jackson.core.type.TypeReference
|
|
6
|
+
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
6
7
|
import com.loopnow.fireworklibrary.baya.Baya
|
|
7
8
|
import com.loopnow.fireworklibrary.baya.UpdateCartStatus
|
|
8
9
|
import com.fireworksdk.bridge.reactnative.models.FWVideoShoppingInterface
|
|
@@ -116,7 +117,7 @@ class FWVideoShoppingModule(
|
|
|
116
117
|
if (callbackId == null || cartClickHandler?.first != callbackId) {
|
|
117
118
|
return
|
|
118
119
|
}
|
|
119
|
-
val activity =
|
|
120
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity ?: return
|
|
120
121
|
|
|
121
122
|
UiThreadUtil.runOnUiThread {
|
|
122
123
|
activity.startActivity(FWVideoShoppingCartActivity.createIntent(activity))
|
|
@@ -125,8 +126,11 @@ class FWVideoShoppingModule(
|
|
|
125
126
|
|
|
126
127
|
@ReactMethod
|
|
127
128
|
override fun exitCartPage() {
|
|
129
|
+
|
|
130
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity ?: return
|
|
131
|
+
|
|
128
132
|
UiThreadUtil.runOnUiThread {
|
|
129
|
-
|
|
133
|
+
activity.finish()
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt
CHANGED
|
@@ -14,6 +14,7 @@ import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
|
14
14
|
import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
|
|
15
15
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
16
16
|
import com.loopnow.fireworklibrary.*
|
|
17
|
+
import java.util.*
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class FireworkSDKModule(
|
|
@@ -35,8 +36,8 @@ class FireworkSDKModule(
|
|
|
35
36
|
* If id passed is not unique, it will affect the quality of content recommended to the user.
|
|
36
37
|
*/
|
|
37
38
|
@ReactMethod
|
|
38
|
-
override fun init(userId: String
|
|
39
|
-
|
|
39
|
+
override fun init(userId: String?) {
|
|
40
|
+
initSdk(userId)
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -106,7 +107,7 @@ class FireworkSDKModule(
|
|
|
106
107
|
handleVideoPlaybackEvent()
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
private fun
|
|
110
|
+
private fun initSdk(userId: String?) {
|
|
110
111
|
val clientId = getAppid()
|
|
111
112
|
if (clientId.isNullOrBlank()) {
|
|
112
113
|
val errorMsg = "The appid is invalid"
|
|
@@ -163,12 +164,12 @@ class FireworkSDKModule(
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
private fun handleCustomCTAClick() {
|
|
166
|
-
if (!FWVideoPlayerUtils.customCTAClickEnabled) {
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
167
|
FwSDK.ctaClickHandler = object: FwSDK.CtaClickHandler {
|
|
170
168
|
override fun ctaClicked(label: String, actionUrl: String?): Boolean {
|
|
171
169
|
FWLogUtils.d { "ctaClicked" }
|
|
170
|
+
|
|
171
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(Date())}")
|
|
172
|
+
|
|
172
173
|
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, actionUrl)
|
|
173
174
|
return FWVideoPlayerUtils.customCTAClickEnabled
|
|
174
175
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative.pages
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import android.os.Bundle
|
|
6
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
7
|
+
import androidx.fragment.app.Fragment
|
|
8
|
+
import com.facebook.react.ReactFragment
|
|
9
|
+
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
|
10
|
+
import com.fireworksdk.bridge.R
|
|
11
|
+
|
|
12
|
+
class FWContainerActivity : AppCompatActivity(), DefaultHardwareBackBtnHandler {
|
|
13
|
+
|
|
14
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
15
|
+
super.onCreate(savedInstanceState)
|
|
16
|
+
setContentView(R.layout.fw_bridge_fragment_container)
|
|
17
|
+
|
|
18
|
+
val callbackId = intent.getStringExtra(KEY_CALLBACK_ID)
|
|
19
|
+
|
|
20
|
+
val reactNativeFragment: Fragment = ReactFragment.Builder()
|
|
21
|
+
.setComponentName(COMPONENT_NAME)
|
|
22
|
+
.setLaunchOptions(getLaunchOptions(callbackId))
|
|
23
|
+
.build()
|
|
24
|
+
|
|
25
|
+
supportFragmentManager
|
|
26
|
+
.beginTransaction()
|
|
27
|
+
.add(R.id.fw_bridge_container, reactNativeFragment)
|
|
28
|
+
.commit()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private fun getLaunchOptions(callbackId: String?) = Bundle().apply {
|
|
32
|
+
if (!callbackId.isNullOrEmpty()) {
|
|
33
|
+
putString(KEY_CALLBACK_ID, callbackId)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
companion object {
|
|
38
|
+
|
|
39
|
+
private const val KEY_CALLBACK_ID = "callbackId"
|
|
40
|
+
private const val COMPONENT_NAME = "FWNavigationContainer"
|
|
41
|
+
|
|
42
|
+
fun createIntent(activity: Activity, callbackId: String?): Intent {
|
|
43
|
+
val intent = Intent(activity, FWContainerActivity::class.java)
|
|
44
|
+
intent.putExtra(KEY_CALLBACK_ID, callbackId)
|
|
45
|
+
intent.flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
46
|
+
activity.overridePendingTransition(0, 0)
|
|
47
|
+
return intent
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override fun invokeDefaultOnBackPressed() {
|
|
52
|
+
super.onBackPressed();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.WritableMap
|
|
|
6
6
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
7
7
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
8
8
|
import com.fireworksdk.bridge.models.*
|
|
9
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
9
10
|
import com.loopnow.fireworklibrary.data.Product
|
|
10
11
|
|
|
11
12
|
object FWEventUtils {
|
|
@@ -109,6 +110,14 @@ object FWEventUtils {
|
|
|
109
110
|
.emit(eventName, params)
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
fun sendLogMessageEvent(reactContext: ReactContext, message: String?) {
|
|
114
|
+
FWLogUtils.d { message }
|
|
115
|
+
|
|
116
|
+
val eventMap = Arguments.createMap()
|
|
117
|
+
eventMap.putString("message", message)
|
|
118
|
+
sendEvent(reactContext, FWEventName.LogMessage.rawValue, eventMap)
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
113
122
|
receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, null)
|
|
114
123
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
import org.jetbrains.annotations.NotNull
|
|
4
|
+
import java.text.DateFormat
|
|
5
|
+
import java.text.SimpleDateFormat
|
|
6
|
+
import java.util.*
|
|
7
|
+
|
|
8
|
+
object FWDateUtils {
|
|
9
|
+
|
|
10
|
+
fun getDateString(@NotNull date: Date): String {
|
|
11
|
+
val dateFormat: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())
|
|
12
|
+
dateFormat.timeZone = TimeZone.getDefault()
|
|
13
|
+
return dateFormat.format(date)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
|
+
android:id="@+id/fw_bridge_container"
|
|
5
|
+
android:layout_width="match_parent"
|
|
6
|
+
android:layout_height="match_parent">
|
|
7
|
+
|
|
8
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|