UNPKG

@harnessio/ff-react-native-client-sdk

Version:

[![React version][react-badge]][reactjs] [![React Native version][react-native-badge]][reactnative] [![TypeScript version][ts-badge]][typescript-4-7] [![Node.js version][nodejs-badge]][nodejs] [![APLv2][license-badge]][license]

44 lines (43 loc) 1.45 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.processOptions = void 0; const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage")); const react_native_1 = require("react-native"); function processOptions(options) { return { ...processStreamingOptions(options), cache: processCacheOptions(options?.cache) }; } exports.processOptions = processOptions; function processStreamingOptions(options) { if ((typeof options?.streamEnabled === 'undefined' || options.streamEnabled) && react_native_1.Platform.OS === 'android') { const logger = options?.logger?.info ? options.logger : console; logger.info('SDKCODE:1007 Android React Native detected - streaming will be disabled and polling enabled'); return { ...options, streamEnabled: false, pollingEnabled: options?.pollingEnabled !== false }; } return options; } function processCacheOptions(cache) { if (!cache) return false; if (typeof cache === 'boolean') { return { storage: async_storage_1.default }; } if (!cache.storage) { return { ...cache, storage: async_storage_1.default }; } }