@react-native-firebase/remote-config
Version:
React Native Firebase - React Native Firebase provides native integration with Remote Config, allowing you to change the appearance and/or functionality of your app without requiring an app update.
95 lines • 4.05 kB
TypeScript
import type { ConfigUpdateObserver, FetchStatus, RemoteConfig, RemoteConfigSettings, Unsubscribe, Value, ValueSource } from './remote-config';
export type ConfigValueSourceInternal = ValueSource;
export type LastFetchStatusInternal = FetchStatus;
export type OnConfigUpdatedListenerCallback = (event?: {
updatedKeys: string[];
}, error?: RemoteConfigUpdateErrorInternal) => void;
export type CallbackOrObserver<T extends (...args: any[]) => any> = T | {
next: T;
};
export interface ConfigSettingsStateInternal {
fetchTimeoutMillis: number;
minimumFetchIntervalMillis: number;
}
export interface StoredConfigValueInternal {
value: string | number | boolean;
source: ConfigValueSourceInternal;
}
export interface NativeRemoteConfigConstants {
fetchTimeout?: number;
minimumFetchInterval?: number;
lastFetchTime?: number;
lastFetchStatus?: LastFetchStatusInternal;
values?: Record<string, StoredConfigValueInternal>;
}
export interface NativeRemoteConfigResult<T> {
result: T;
constants: NativeRemoteConfigConstants;
}
export interface RemoteConfigUpdateErrorInternal {
code?: string;
message?: string;
nativeErrorMessage?: string;
}
export interface RemoteConfigUpdateSuccessEventInternal {
resultType: 'success';
updatedKeys: string[];
}
export interface RemoteConfigUpdateErrorEventInternal extends RemoteConfigUpdateErrorInternal {
resultType?: string;
}
export interface RNFBConfigModule {
getConstants(): NativeRemoteConfigConstants;
activate(): Promise<NativeRemoteConfigResult<boolean>>;
setConfigSettings(settings: {
fetchTimeout: number;
minimumFetchInterval: number;
}): Promise<NativeRemoteConfigResult<void>>;
fetch(expirationDurationSeconds: number): Promise<NativeRemoteConfigResult<void>>;
fetchAndActivate(): Promise<NativeRemoteConfigResult<boolean>>;
ensureInitialized(): Promise<NativeRemoteConfigResult<void>>;
setDefaults(defaults: Record<string, string | number | boolean>): Promise<NativeRemoteConfigResult<null>>;
setDefaultsFromResource(resourceName: string): Promise<NativeRemoteConfigResult<null>>;
reset(): Promise<NativeRemoteConfigResult<void>>;
onConfigUpdated(): void;
removeConfigUpdateRegistration(): void;
setCustomSignals(customSignals: Record<string, string | number | null>): Promise<NativeRemoteConfigResult<void>>;
}
export interface RemoteConfigInternal extends RemoteConfig {
settings: RemoteConfigSettings & {
fetchTimeMillis: number;
};
defaultConfig: {
[key: string]: string | number | boolean;
};
activate(): Promise<boolean>;
ensureInitialized(): Promise<void>;
fetchAndActivate(): Promise<boolean>;
fetch(expirationDurationSeconds?: number): Promise<void>;
getAll(): Record<string, Value>;
getBoolean(key: string): boolean;
getNumber(key: string): number;
getString(key: string): string;
getValue(key: string): Value;
reset(): Promise<void>;
setConfigSettings(settings: RemoteConfigSettings | {
minimumFetchIntervalMillis?: number;
fetchTimeMillis?: number;
fetchTimeoutMillis?: number;
}, fromSettingsSetter?: boolean): Promise<void>;
setDefaults(defaults: {
[key: string]: string | number | boolean;
}, fromDefaultConfigSetter?: boolean): Promise<null>;
setDefaultsFromResource(resourceName: string): Promise<null>;
onConfigUpdate(observer: ConfigUpdateObserver): Unsubscribe;
onConfigUpdated(listenerOrObserver: CallbackOrObserver<OnConfigUpdatedListenerCallback>): Unsubscribe;
readonly native: RNFBConfigModule;
_promiseWithConstants(promise: Promise<NativeRemoteConfigResult<void>>): Promise<void>;
_promiseWithConstants<T>(promise: Promise<NativeRemoteConfigResult<T>>): Promise<T>;
}
declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
interface ReactNativeFirebaseNativeModules {
NativeRNFBTurboConfig: RNFBConfigModule;
}
}
//# sourceMappingURL=internal.d.ts.map