UNPKG

@abl-solutions/wifi-connect

Version:

The WiFi Connect React Native SDK enables the use of WiFi WPA2-Enterprise networks on mobile devices that are managed and operated by abl solutions GmbH

61 lines (55 loc) 1.85 kB
import { NativeModules, Platform } from 'react-native'; import { CampaignOptions, CampaignService, CampaignServiceImpl, } from './campaign'; import { WifiConnectService, WifiConnectServiceImpl, WifiConnectOptions, } from './wifi-connect'; /** * Initializer factory that returns an instance of WifiConnectService. This service can be used * to perform any Wifi Connectivity related action (e.g. configuring the device's network settings). * @param options Options for the WifiConnectService instance. * @returns The new WifiConnectService instance. */ export const initWifiConnectService = ( options: WifiConnectOptions ): WifiConnectService => { const LINKING_ERROR = `The package '@abl-solutions/wifi-connect' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; const NativeWifiConnect = NativeModules.WifiConnect ? NativeModules.WifiConnect : new Proxy( {}, { get() { throw new Error(LINKING_ERROR); }, } ); return new WifiConnectServiceImpl(NativeWifiConnect, options); }; /** * Initializer factory that returns an instance of CampaignService. This service can be used to * perform any campaign related action. * @param options Options for the CampaignService instance. * @returns The new CampaignService instance. */ export const initCampaignService = ( options: CampaignOptions ): CampaignService => { return new CampaignServiceImpl(options); }; export { LegalTerms, WifiConnectService, WifiConnectOptions, } from './wifi-connect'; export { Campaign, CampaignOptions, CampaignService } from './campaign'; export { ErrorCode } from './error-code';