react-native-firework-sdk 2.2.1 → 2.2.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/FireworkVideoUI.xcframework/Info.plist +5 -5
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +1 -1
- package/lib/commonjs/FireworkSDK.js +15 -19
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +23 -17
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +39 -30
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/module/FireworkSDK.js +14 -19
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/StoryBlock.js +24 -17
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +39 -30
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +3 -6
- package/lib/typescript/components/VideoFeed.d.ts +4 -4
- package/package.json +1 -1
- package/src/FireworkSDK.ts +13 -22
- package/src/components/StoryBlock.tsx +26 -19
- package/src/components/VideoFeed.tsx +55 -39
package/src/FireworkSDK.ts
CHANGED
|
@@ -76,25 +76,18 @@ class FireworkSDK {
|
|
|
76
76
|
return this._shareBaseURL;
|
|
77
77
|
}
|
|
78
78
|
public set shareBaseURL(value: string | undefined) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
79
|
+
this.updateInternalShareBaseURL(value);
|
|
80
|
+
FireworkSDKModule.setShareBaseURL(value ?? '');
|
|
82
81
|
}
|
|
83
82
|
private _shareBaseURL: string | undefined;
|
|
84
83
|
|
|
85
84
|
/**
|
|
86
|
-
*
|
|
85
|
+
* The configuration for ad badges.
|
|
87
86
|
*/
|
|
88
|
-
public
|
|
87
|
+
public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {
|
|
89
88
|
return this._adBadgeConfiguration;
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
* Set the configuration for ad badges. Only supported on iOS.
|
|
93
|
-
*/
|
|
94
|
-
public async setAdBadgeConfiguration(
|
|
95
|
-
value: AdBadgeConfiguration | undefined
|
|
96
|
-
): Promise<void> {
|
|
97
|
-
await FireworkSDKModule.setAdBadgeConfiguration(value ?? {});
|
|
90
|
+
public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {
|
|
98
91
|
const valueHasChanged =
|
|
99
92
|
this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||
|
|
100
93
|
this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||
|
|
@@ -103,6 +96,7 @@ class FireworkSDK {
|
|
|
103
96
|
if (valueHasChanged) {
|
|
104
97
|
this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
|
|
105
98
|
}
|
|
99
|
+
FireworkSDKModule.setAdBadgeConfiguration(value ?? {});
|
|
106
100
|
}
|
|
107
101
|
private _adBadgeConfiguration: AdBadgeConfiguration | undefined;
|
|
108
102
|
|
|
@@ -230,15 +224,13 @@ class FireworkSDK {
|
|
|
230
224
|
*/
|
|
231
225
|
public async init(options?: SDKInitOptions): Promise<void> {
|
|
232
226
|
FWLoggerUtil.log('Call FireworkSDK init method');
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
this.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
});
|
|
227
|
+
const videoLaunchBehaviorUpdated =
|
|
228
|
+
this._videoLaunchBehavior !== options?.videoLaunchBehavior;
|
|
229
|
+
this._videoLaunchBehavior = options?.videoLaunchBehavior;
|
|
230
|
+
if (videoLaunchBehaviorUpdated) {
|
|
231
|
+
this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);
|
|
232
|
+
}
|
|
233
|
+
FireworkSDKModule.init(options);
|
|
242
234
|
ShoppingModule.init();
|
|
243
235
|
LiveStreamModule.init();
|
|
244
236
|
}
|
|
@@ -290,7 +282,6 @@ class FireworkSDK {
|
|
|
290
282
|
|
|
291
283
|
private updateInternalShareBaseURL(shareBaseURL?: string) {
|
|
292
284
|
const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;
|
|
293
|
-
console.log('updateInternalShareBaseURL shareBaseURL', shareBaseURL);
|
|
294
285
|
this._shareBaseURL = shareBaseURL;
|
|
295
286
|
if (shareBaseURLChanged) {
|
|
296
287
|
this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
|
|
@@ -153,7 +153,9 @@ const StoryBlock: ForwardRefRenderFunction<
|
|
|
153
153
|
FWEventName.AppLanguageUpdated,
|
|
154
154
|
() => {
|
|
155
155
|
FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');
|
|
156
|
-
|
|
156
|
+
if (Platform.OS === 'android') {
|
|
157
|
+
forceUpdate();
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
);
|
|
159
161
|
|
|
@@ -251,45 +253,50 @@ const StoryBlock: ForwardRefRenderFunction<
|
|
|
251
253
|
};
|
|
252
254
|
|
|
253
255
|
const generateKey = (): string => {
|
|
256
|
+
const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
|
|
257
|
+
const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';
|
|
258
|
+
const adBadgeConfiguration =
|
|
259
|
+
FireworkSDK.getInstance().adBadgeConfiguration ?? {};
|
|
260
|
+
const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
|
|
261
|
+
const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
|
|
262
|
+
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
263
|
+
const videoLaunchBehavior =
|
|
264
|
+
FireworkSDK.getInstance().videoLaunchBehavior ?? 'default';
|
|
265
|
+
|
|
254
266
|
const {
|
|
255
267
|
source,
|
|
256
268
|
channel = '',
|
|
257
269
|
playlist = '',
|
|
270
|
+
hashtagFilterExpression = '',
|
|
258
271
|
enablePictureInPicture = false,
|
|
259
272
|
adConfiguration,
|
|
260
|
-
hashtagFilterExpression = '',
|
|
261
273
|
} = props;
|
|
262
|
-
|
|
263
|
-
const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
|
|
264
|
-
const videoLaunchBehavior =
|
|
265
|
-
FireworkSDK.getInstance().videoLaunchBehavior ?? 'default';
|
|
266
|
-
const adBadgeConfiguration =
|
|
267
|
-
FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};
|
|
268
|
-
const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
|
|
269
|
-
const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
|
|
270
|
-
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
271
274
|
const dynamicContentParametersString =
|
|
272
275
|
generateDynamicContentParametersString();
|
|
273
|
-
|
|
276
|
+
|
|
274
277
|
const requiresAds = adConfiguration?.requiresAds ?? false;
|
|
275
278
|
const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
|
|
276
279
|
const vastAttributesString = generateVastAttributesString();
|
|
277
280
|
|
|
278
|
-
let key = `
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
281
|
+
let key = `gShareBaseURL:${gShareBaseURL}`;
|
|
282
|
+
if (Platform.OS === 'ios') {
|
|
283
|
+
key += `_appLanguage:${appLanguage}`;
|
|
284
|
+
}
|
|
283
285
|
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
284
286
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
285
287
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
288
|
+
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
289
|
+
|
|
290
|
+
key += `_source:${source}`;
|
|
291
|
+
key += `_channel:${channel}`;
|
|
292
|
+
key += `_playlist:${playlist}`;
|
|
286
293
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
294
|
+
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
287
295
|
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
288
|
-
|
|
296
|
+
|
|
289
297
|
key += `_requiresAds:${requiresAds}`;
|
|
290
298
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
291
299
|
key += `_vastAttributes:${vastAttributesString}`;
|
|
292
|
-
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
293
300
|
|
|
294
301
|
return key;
|
|
295
302
|
};
|
|
@@ -62,6 +62,10 @@ export interface IVideoFeedProps {
|
|
|
62
62
|
* One of three available display modes. Defaults to row.
|
|
63
63
|
*/
|
|
64
64
|
mode?: VideoFeedMode;
|
|
65
|
+
/**
|
|
66
|
+
* Specifies if Picture in Picture is enabled.
|
|
67
|
+
*/
|
|
68
|
+
enablePictureInPicture?: boolean;
|
|
65
69
|
/**
|
|
66
70
|
* Configuration of the feed.
|
|
67
71
|
*/
|
|
@@ -74,10 +78,6 @@ export interface IVideoFeedProps {
|
|
|
74
78
|
* Ad configuration of the feed. Only supported on iOS.
|
|
75
79
|
*/
|
|
76
80
|
adConfiguration?: AdConfiguration;
|
|
77
|
-
/**
|
|
78
|
-
* Specifies if Picture in Picture is enabled.
|
|
79
|
-
*/
|
|
80
|
-
enablePictureInPicture?: boolean;
|
|
81
81
|
/**
|
|
82
82
|
* The feed loading result callback. It means loading successfully when error equals to undefined. Only supported on iOS.
|
|
83
83
|
*/
|
|
@@ -177,15 +177,18 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
177
177
|
}
|
|
178
178
|
);
|
|
179
179
|
this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
180
|
+
|
|
181
|
+
if (Platform.OS === 'ios') {
|
|
182
|
+
const subscriptionOfAppLanguageUpdated =
|
|
183
|
+
FireworkSDKModuleEventEmitter.addListener(
|
|
184
|
+
FWEventName.AppLanguageUpdated,
|
|
185
|
+
() => {
|
|
186
|
+
FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');
|
|
187
|
+
this.setState({});
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
this._subscriptions.push(subscriptionOfAppLanguageUpdated);
|
|
191
|
+
}
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
/**
|
|
@@ -208,65 +211,78 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
208
211
|
*/
|
|
209
212
|
render() {
|
|
210
213
|
FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);
|
|
214
|
+
const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
|
|
215
|
+
const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';
|
|
216
|
+
const adBadgeConfiguration =
|
|
217
|
+
FireworkSDK.getInstance().adBadgeConfiguration ?? {};
|
|
218
|
+
const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
|
|
219
|
+
const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
|
|
220
|
+
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
221
|
+
const videoLaunchBehavior =
|
|
222
|
+
FireworkSDK.getInstance().videoLaunchBehavior ?? 'default';
|
|
211
223
|
|
|
212
224
|
const {
|
|
213
225
|
source,
|
|
214
226
|
channel = '',
|
|
215
227
|
playlist = '',
|
|
216
228
|
playlistGroup = '',
|
|
229
|
+
hashtagFilterExpression = '',
|
|
217
230
|
mode = 'row',
|
|
218
|
-
adConfiguration,
|
|
219
231
|
enablePictureInPicture = false,
|
|
220
|
-
|
|
232
|
+
adConfiguration,
|
|
233
|
+
videoPlayerConfiguration,
|
|
221
234
|
} = this.props;
|
|
235
|
+
const dynamicContentParametersString =
|
|
236
|
+
this._generateDynamicContentParametersString();
|
|
237
|
+
|
|
222
238
|
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
223
239
|
const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
|
|
224
240
|
const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';
|
|
225
|
-
const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
|
|
226
|
-
const adBadgeConfiguration =
|
|
227
|
-
FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};
|
|
228
|
-
const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
|
|
229
|
-
const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
|
|
230
|
-
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
231
|
-
const dynamicContentParametersString =
|
|
232
|
-
this._generateDynamicContentParametersString();
|
|
233
241
|
const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;
|
|
234
|
-
|
|
235
242
|
const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;
|
|
243
|
+
const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;
|
|
244
|
+
|
|
245
|
+
const shareBaseURL = videoPlayerConfiguration?.shareBaseURL ?? '';
|
|
246
|
+
|
|
236
247
|
const requiresAds = adConfiguration?.requiresAds ?? false;
|
|
237
248
|
const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
|
|
238
249
|
const vastAttributesString = this._generateVastAttributesString();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
|
|
251
|
+
let key = `gShareBaseURL:${gShareBaseURL}`;
|
|
252
|
+
if (Platform.OS === 'ios') {
|
|
253
|
+
key += `_appLanguage:${appLanguage}`;
|
|
254
|
+
}
|
|
255
|
+
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
256
|
+
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
257
|
+
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
258
|
+
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
259
|
+
|
|
260
|
+
key += `_source:${source}`;
|
|
244
261
|
key += `_channel:${channel}`;
|
|
245
262
|
key += `_playlist:${playlist}`;
|
|
246
263
|
key += `_playlistGroup:${playlistGroup}`;
|
|
264
|
+
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
265
|
+
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
247
266
|
key += `_mode:${mode}`;
|
|
267
|
+
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
268
|
+
|
|
248
269
|
key += `_titleHidden:${titleHidden}`;
|
|
249
270
|
key += `_titlePosition:${titlePosition}`;
|
|
250
|
-
key += `_gShareBaseURL:${gShareBaseURL}`;
|
|
251
|
-
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
252
|
-
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
253
|
-
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
254
|
-
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
255
271
|
key += `_enableAutoplay:${enableAutoplay}`;
|
|
256
|
-
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
257
272
|
key += `_gridColumns:${gridColumns}`;
|
|
273
|
+
key += `_showAdBadge:${showAdBadge}`;
|
|
274
|
+
|
|
275
|
+
key += `_shareBaseURL:${shareBaseURL}`;
|
|
276
|
+
|
|
258
277
|
key += `_requiresAds:${requiresAds}`;
|
|
259
278
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
260
279
|
key += `_vastAttributes:${vastAttributesString}`;
|
|
261
|
-
key += `_showAdBadge:${showAdBadge}`;
|
|
262
|
-
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
263
|
-
key += `_appLanguage:${appLanguage}`;
|
|
264
|
-
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
265
280
|
|
|
266
281
|
return (
|
|
267
282
|
<FWVideoFeed
|
|
268
283
|
key={key}
|
|
269
284
|
{...this.props}
|
|
285
|
+
videoFeedConfiguration={videoFeedConfiguration}
|
|
270
286
|
ref={this._nativeComponentRef}
|
|
271
287
|
onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}
|
|
272
288
|
mode={mode}
|