[react-native-incall-manager] New types definition (#37156)

* Add locales property

* Add member in definitions by

* reverse

* RN-incall-manager type definition

* Remove public

* Fix array declaration

* Add static

* Fix static, in test do a new

* reverse

* Class to instance of class
This commit is contained in:
Carlos Q 2019-07-26 22:46:37 +02:00 committed by Wesley Wigham
parent c428e33e5c
commit 8a1b68be3a
4 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,68 @@
// Type definitions for react-native-incall-manager 3.2
// Project: https://github.com/zxcpoiu/react-native-incall-manager#readme
// Definitions by: Carlos Quiroga <https://github.com/KarlosQ>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
export interface StartSetup {
media?: string;
auto?: boolean;
ringback?: string;
}
export interface StopSetup {
busytone?: string;
}
declare class InCallManager {
start(setup?: StartSetup): void;
stop(setup?: StopSetup): void;
turnScreenOff(): void;
turnScreenOn(): void;
getIsWiredHeadsetPluggedIn(): Promise<any>;
setFlashOn(enable?: boolean, brightness?: number): number;
setKeepScreenOn(enable?: boolean): void;
setSpeakerphoneOn(enable?: boolean): void;
setForceSpeakerphoneOn(_flag?: boolean): void;
setMicrophoneMute(enable?: boolean): void;
startRingtone(
ringtone?: string,
vibrate_pattern?: any[],
ios_category?: string,
seconds?: number
): void;
stopRingtone(): void;
startRingback(ringback?: string): void;
stopRingback(): void;
checkRecordPermission(): Promise<string>;
requestRecordPermission(): Promise<string>;
checkCameraPermission(): Promise<string>;
requestCameraPermission(): Promise<string>;
pokeScreen(_timeout?: number): void;
getAudioUri(audioType: string, fileType: string): any;
chooseAudioRoute(route: any): any;
}
declare const _default: InCallManager;
export default _default;

View File

@ -0,0 +1,43 @@
import InCallManager from "react-native-incall-manager";
InCallManager.start({ media: "video" });
InCallManager.start();
InCallManager.stop({ busytone: "video" });
InCallManager.stop();
InCallManager.turnScreenOn();
InCallManager.turnScreenOff();
InCallManager.setKeepScreenOn(true);
InCallManager.setKeepScreenOn();
InCallManager.setSpeakerphoneOn();
InCallManager.setSpeakerphoneOn(true);
InCallManager.setMicrophoneMute();
InCallManager.setMicrophoneMute(false);
InCallManager.checkRecordPermission();
InCallManager.requestRecordPermission();
InCallManager.getAudioUri("", "");
InCallManager.startRingtone();
InCallManager.startRingtone("", [], "", 0);
InCallManager.stopRingtone();
InCallManager.setFlashOn();
InCallManager.setFlashOn(true, 1);
InCallManager.getIsWiredHeadsetPluggedIn();

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-native-incall-manager-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }