From 0a0945f3b34ce93206b5d721bbc36171a668757c Mon Sep 17 00:00:00 2001 From: Khoroshikh Arkadiy Date: Fri, 17 Jul 2020 15:20:36 +0300 Subject: [PATCH] TypeScript. Added types. --- index.d.ts | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..2706d3d --- /dev/null +++ b/index.d.ts @@ -0,0 +1,70 @@ +declare module 'react-native-appmetrica' { + type AppMetricaConfig = { + apiKey: string; + appVersion?: string; + crashReporting?: boolean; + firstActivationAsUpdate?: boolean; + location?: Location; + locationTracking?: boolean; + logs?: boolean; + sessionTimeout?: number; + statisticsSending?: boolean; + preloadInfo?: PreloadInfo; + // Only Android + installedAppCollecting?: boolean; + maxReportsInDatabaseCount?: number; + nativeCrashReporting?: boolean; + // Only iOS + activationAsSessionStart?: boolean; + sessionsAutoTracking?: boolean; + }; + + type PreloadInfo = { + trackingId: string; + additionalInfo?: Object; + }; + + type Location = { + latitude: number; + longitude: number; + altitude?: number; + accuracy?: number; + course?: number; + speed?: number; + timestamp?: number; + }; + + type AppMetricaDeviceIdReason = 'UNKNOWN' | 'NETWORK' | 'INVALID_RESPONSE'; + + function activate(config: AppMetricaConfig): void; + + // Android + function getLibraryApiLevel(): Promise; + + function getLibraryVersion(): Promise; + + function pauseSession(): void; + + function reportAppOpen(deeplink?: string): void; + + function reportError(error: string, reason: Object): void; + + function reportEvent(eventName: string, attributes?: Object): void; + + function reportReferralUrl(referralUrl: string): void; + + function requestAppMetricaDeviceID(listener: (deviceId?: String, reason?: AppMetricaDeviceIdReason) => void): void; + + function resumeSession(): void; + + function sendEventsBuffer(): void; + + function setLocation(location?: Location): void; + + function setLocationTracking(enabled: boolean): void; + + function setStatisticsSending(enabled: boolean): any; + + function setUserProfileID(userProfileID?: string): void; + } + \ No newline at end of file