UNPKG

@wscsports/blaze-rtn-sdk

Version:
82 lines (78 loc) 2.62 kB
import { NativeModules } from 'react-native'; import { BlazeGlobalDelegateHelper } from './classes/global-delegate'; import { BlazeEntryPointDelegateHelper } from './classes/entry-point-delegate'; const { RTNBlazeSdk } = NativeModules; const BlazeSDKNativeModule = RTNBlazeSdk; // This wrapper is hiding the internal interface that works with the native module, and serves as additional layer to add custom logic. class BlazeSdkWrapper { init(options) { this.setEntryPointDelegate(options.playerEntryPointDelegate); this.setGlobalDelegate(options.globalDelegate); return BlazeSDKNativeModule.init(options); } isInitialized() { return BlazeSDKNativeModule.isInitialized(); } playStory(options) { return BlazeSDKNativeModule.playStory(options); } prepareStories(options) { return BlazeSDKNativeModule.prepareStories(options); } playStories(options) { return BlazeSDKNativeModule.playStories(options); } playMoment(options) { return BlazeSDKNativeModule.playMoment(options); } prepareMoments(options) { return BlazeSDKNativeModule.prepareMoments(options); } playMoments(options) { return BlazeSDKNativeModule.playMoments(options); } dismissPlayer() { return BlazeSDKNativeModule.dismissPlayer(); } setExternalUserId(externalUserId) { return BlazeSDKNativeModule.setExternalUserId(externalUserId); } setDoNotTrack(doNotTrackUser) { return BlazeSDKNativeModule.setDoNotTrack(doNotTrackUser); } handleUniversalLink(link) { return BlazeSDKNativeModule.handleUniversalLink(link); } canHandleUniversalLink(link) { return BlazeSDKNativeModule.canHandleUniversalLink(link); } updateGeoRestriction(geoLocation) { return BlazeSDKNativeModule.updateGeoRestriction(geoLocation); } setGlobalDelegate(globalDelegate) { BlazeGlobalDelegateHelper.registerGlobalDelegate(globalDelegate); } setEntryPointDelegate(playerEntryPointDelegate) { BlazeEntryPointDelegateHelper.registerEntryPointDelegate(playerEntryPointDelegate); } canHandlePushNotification(payload) { return BlazeSDKNativeModule.canHandlePushNotification(payload); } handleNotificationPayload(payload) { return BlazeSDKNativeModule.handleNotificationPayload(payload); } // Singleton instance // Private constructor for singleton constructor() {} // Method to get singleton instance static getInstance() { if (!this.instance) { this.instance = new BlazeSdkWrapper(); } return this.instance; } } export const BlazeSDK = BlazeSdkWrapper.getInstance(); //# sourceMappingURL=NativeBlazeSdk.js.map