mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added react-native-version-check (#35769)
* Added react-native-version-check * config problem (forget add extension to test file)
This commit is contained in:
parent
efc2561ca7
commit
369612c7c8
127
types/react-native-version-check/index.d.ts
vendored
Normal file
127
types/react-native-version-check/index.d.ts
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
// Type definitions for react-native-version-check 3.2
|
||||
// Project: https://github.com/kimxogus/react-native-version-check
|
||||
// Definitions by: DELACOURT Vincent <https://github.com/vdelacou>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { RequestInit } from 'node-fetch';
|
||||
|
||||
declare namespace VersionCheck {
|
||||
/**
|
||||
* Returns device's country code of 2 characters.
|
||||
*/
|
||||
function getCountry(): Promise<string>;
|
||||
/**
|
||||
* Returns package name of app.
|
||||
*/
|
||||
function getPackageName(): string;
|
||||
/**
|
||||
* Returns current app build number.
|
||||
*/
|
||||
function getCurrentBuildNumber(): number;
|
||||
/**
|
||||
* Returns url of Play Market or App Store of app.
|
||||
*/
|
||||
function getStoreUrl(option?: {
|
||||
/**
|
||||
* App ID
|
||||
*/
|
||||
appID?: string;
|
||||
appName?: string;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Returns url of App Store of app.
|
||||
*/
|
||||
function getAppStoreUrl(option?: {
|
||||
/**
|
||||
* App ID
|
||||
*/
|
||||
appID?: string;
|
||||
appName?: string;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Returns url of Play Store of app.
|
||||
*/
|
||||
function getPlayStoreUrl(option?: {
|
||||
/**
|
||||
* Package Name
|
||||
*/
|
||||
packageName?: string;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Returns current app version.
|
||||
*/
|
||||
function getCurrentVersion(): string;
|
||||
/**
|
||||
* Returns the latest app version parsed from url. Returns null when parsing error occurs.
|
||||
*/
|
||||
function getLatestVersion(option?: {
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
forceUpdate?: boolean;
|
||||
/**
|
||||
* provider name or function that returns promise or value of the latest version
|
||||
*/
|
||||
provider?: () => string | string;
|
||||
/**
|
||||
* isomorphic-fetch options (https://github.github.io/fetch/)
|
||||
*/
|
||||
fetchOptions?: RequestInit;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Returns an object contains with boolean value whether update needed, current version and latest version.
|
||||
* Current and the latest app versions are first split by delimiter, and check each split numbers into depth.
|
||||
*/
|
||||
function needUpdate(option?: {
|
||||
/**
|
||||
* app's current version from getCurrentVersion()
|
||||
*/
|
||||
currentVersion?: string;
|
||||
/**
|
||||
* app's latest version from getLatestVersion()
|
||||
*/
|
||||
latestVersion?: string;
|
||||
/**
|
||||
* @default Infinity
|
||||
*/
|
||||
depth?: number;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
forceUpdate?: boolean;
|
||||
/**
|
||||
* provider name or function that returns promise or value of the latest version
|
||||
*/
|
||||
provider?: () => string | string;
|
||||
/**
|
||||
* isomorphic-fetch options (https://github.github.io/fetch/)
|
||||
*/
|
||||
fetchOptions?: RequestInit;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
}): Promise<{
|
||||
isNeeded: boolean;
|
||||
currentVersion: string;
|
||||
latestVersion: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export default VersionCheck;
|
||||
@ -0,0 +1,31 @@
|
||||
import VersionCheck from "react-native-version-check";
|
||||
|
||||
VersionCheck.getCountry()
|
||||
.then((country: string) => {})
|
||||
.catch((error: any) => {});
|
||||
|
||||
VersionCheck.getPackageName();
|
||||
|
||||
VersionCheck.getCurrentBuildNumber();
|
||||
|
||||
VersionCheck.getStoreUrl()
|
||||
.then((storeUrl: string) => {})
|
||||
.catch((error: any) => {});
|
||||
|
||||
VersionCheck.getAppStoreUrl()
|
||||
.then((storeUrl: string) => {})
|
||||
.catch((error: any) => {});
|
||||
|
||||
VersionCheck.getPlayStoreUrl()
|
||||
.then((storeUrl: string) => {})
|
||||
.catch((error: any) => {});
|
||||
|
||||
VersionCheck.getCurrentVersion();
|
||||
|
||||
VersionCheck.getLatestVersion()
|
||||
.then((latestVersion: string) => {})
|
||||
.catch((error: any) => {});
|
||||
|
||||
VersionCheck.needUpdate()
|
||||
.then(({ isNeeded, currentVersion, latestVersion }) => {})
|
||||
.catch((error: any) => {});
|
||||
16
types/react-native-version-check/tsconfig.json
Normal file
16
types/react-native-version-check/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-native-version-check-tests.ts"]
|
||||
}
|
||||
1
types/react-native-version-check/tslint.json
Normal file
1
types/react-native-version-check/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user