-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remplace the key 'keys' to 'key' for keympapping tap et swipe
- Loading branch information
Showing
3 changed files
with
126 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,157 +1,165 @@ | ||
type KeyEffectDistance = { | ||
distanceX: number; | ||
distanceY: number; | ||
distanceX: number; | ||
distanceY: number; | ||
}; | ||
|
||
interface KeyEffect { | ||
initialX: number; | ||
initialY: number; | ||
name?: string; | ||
description?: string; | ||
initialX: number; | ||
initialY: number; | ||
name?: string; | ||
description?: string; | ||
} | ||
|
||
interface KeyMap<E> { | ||
keys: Record<string, E>; | ||
name?: string; | ||
description?: string; | ||
interface KeysMap<E> { | ||
keys: Record<string, E>; | ||
name?: string; | ||
description?: string; | ||
} | ||
|
||
interface Key<E> { | ||
key: string; | ||
effect: E; | ||
name?: string; | ||
description?: string; | ||
} | ||
|
||
interface KeyMappingConfig { | ||
dpad?: KeyMap<KeyEffect & KeyEffectDistance>[]; | ||
tap?: KeyMap<KeyEffect>[]; | ||
swipe?: KeyMap<KeyEffect & KeyEffectDistance>[]; | ||
dpad?: KeysMap<KeyEffect & KeyEffectDistance>[]; | ||
tap?: Key<KeyEffect>[]; | ||
swipe?: Key<KeyEffect & KeyEffectDistance>[]; | ||
} | ||
|
||
type DeviceRendererKeyMapping = { | ||
enable(isEnable: boolean): void; | ||
setConfig(config: KeyMappingConfig): void; | ||
activeKeyMappingDebug(isTraceActivate?: boolean, isGridActivate?: boolean): void; | ||
enable(isEnable: boolean): void; | ||
setConfig(config: KeyMappingConfig): void; | ||
activeKeyMappingDebug(isTraceActivate?: boolean, isGridActivate?: boolean): void; | ||
}; | ||
|
||
type VmEvent = | ||
| 'ANDROID_ID' | ||
| 'baseband' | ||
| 'BATTERY_LEVEL' | ||
| 'BATTERY_STATUS' | ||
| 'battery' | ||
| 'beforeunload' | ||
| 'BLK' | ||
| 'CLIPBOARD' | ||
| 'diskio' | ||
| 'fingerprint' | ||
| 'framework' | ||
| 'gps' | ||
| 'IMEI' | ||
| 'network_profile' | ||
| 'NETWORK' | ||
| 'settings' | ||
| 'SYSTEM_PATCHER_LAST_RESULT' | ||
| 'SYSTEM_PATCHER_STATUS' | ||
| 'systempatcher' | ||
| 'vinput' | ||
| string // This list is not exhaustive and should be completed | ||
| 'ANDROID_ID' | ||
| 'baseband' | ||
| 'BATTERY_LEVEL' | ||
| 'BATTERY_STATUS' | ||
| 'battery' | ||
| 'beforeunload' | ||
| 'BLK' | ||
| 'CLIPBOARD' | ||
| 'diskio' | ||
| 'fingerprint' | ||
| 'framework' | ||
| 'gps' | ||
| 'IMEI' | ||
| 'network_profile' | ||
| 'NETWORK' | ||
| 'settings' | ||
| 'SYSTEM_PATCHER_LAST_RESULT' | ||
| 'SYSTEM_PATCHER_STATUS' | ||
| 'systempatcher' | ||
| 'vinput' | ||
| string; // This list is not exhaustive and should be completed | ||
|
||
type VmCommunication = { | ||
disconnect(): void; | ||
addEventListener(event: VmEvent, callback: (msg: string) => void): void; | ||
sendData(data: { channel: string; messages: string[] }): void; | ||
disconnect(): void; | ||
addEventListener(event: VmEvent, callback: (msg: string) => void): void; | ||
sendData(data: {channel: string; messages: string[]}): void; | ||
}; | ||
|
||
type RegisteredFunctionDoc = { | ||
apiName: string, | ||
apiDescription: string, | ||
} | ||
apiName: string; | ||
apiDescription: string; | ||
}; | ||
|
||
type Utils = { | ||
getRegisteredFunctions(): RegisteredFunctionDoc[]; | ||
getRegisteredFunctions(): RegisteredFunctionDoc[]; | ||
}; | ||
|
||
type Media = { | ||
mute(): void; | ||
unmute(): void; | ||
mute(): void; | ||
unmute(): void; | ||
}; | ||
|
||
type Video = { | ||
fullscreen: () => void; | ||
fullscreen: () => void; | ||
}; | ||
|
||
type Template = 'bootstrap' | ||
| 'fullscreen' | ||
| 'fullwindow' | ||
| 'renderer' | ||
| 'renderer_minimal' | ||
| 'renderer_no_toolbar' | ||
| 'renderer_partial'; | ||
type Template = | ||
| 'bootstrap' | ||
| 'fullscreen' | ||
| 'fullwindow' | ||
| 'renderer' | ||
| 'renderer_minimal' | ||
| 'renderer_no_toolbar' | ||
| 'renderer_partial'; | ||
|
||
interface RendererSetupOptions { | ||
baseband?: boolean; // Default: false | ||
battery?: boolean; // Default: true | ||
biometrics?: boolean; // Default: true | ||
camera?: boolean; // Default: true | ||
capture?: boolean; // Default: true | ||
clipboard?: boolean; // Default: true | ||
connectionFailedURL?: string; | ||
diskIO?: boolean; // Default: true | ||
fileUpload?: boolean; // Default: true | ||
fileUploadUrl?: string; | ||
fullscreen?: boolean; // Default: true | ||
gamepad?: boolean; // Default: true | ||
giveFeedbackLink?: string; | ||
gps?: boolean; // Default: true | ||
gpsSpeedSupport?: boolean; // Default: false | ||
i18n?: Record<string, string>; | ||
identifiers?: boolean; // Default: true | ||
keyboard?: boolean; // Default: true | ||
keyboardMapping?: boolean; // Default: true | ||
microphone?: boolean; // Default: false | ||
mobilethrottling?: boolean; // Default: false | ||
mouse?: boolean; // Default: true | ||
navbar?: boolean; // Default: true | ||
network?: boolean; // Default: true | ||
phone?: boolean; // Default: true | ||
power?: boolean; // Default: true | ||
rotation?: boolean; // Default: true | ||
streamBitrate?: boolean; // Default: false | ||
streamResolution?: boolean; // Default: true | ||
stun?: { urls?: string[] }; | ||
template?: Template; // Default: 'renderer' | ||
token?: string; | ||
touch?: boolean; // Default: true | ||
translateHomeKey?: boolean; // Default: false | ||
turn?: { | ||
urls?: string[]; | ||
username?: string; | ||
credential?: string; | ||
default?: boolean; // Default: false | ||
}; | ||
volume?: boolean; // Default: true | ||
baseband?: boolean; // Default: false | ||
battery?: boolean; // Default: true | ||
biometrics?: boolean; // Default: true | ||
camera?: boolean; // Default: true | ||
capture?: boolean; // Default: true | ||
clipboard?: boolean; // Default: true | ||
connectionFailedURL?: string; | ||
diskIO?: boolean; // Default: true | ||
fileUpload?: boolean; // Default: true | ||
fileUploadUrl?: string; | ||
fullscreen?: boolean; // Default: true | ||
gamepad?: boolean; // Default: true | ||
giveFeedbackLink?: string; | ||
gps?: boolean; // Default: true | ||
gpsSpeedSupport?: boolean; // Default: false | ||
i18n?: Record<string, string>; | ||
identifiers?: boolean; // Default: true | ||
keyboard?: boolean; // Default: true | ||
keyboardMapping?: boolean; // Default: true | ||
microphone?: boolean; // Default: false | ||
mobilethrottling?: boolean; // Default: false | ||
mouse?: boolean; // Default: true | ||
navbar?: boolean; // Default: true | ||
network?: boolean; // Default: true | ||
phone?: boolean; // Default: true | ||
power?: boolean; // Default: true | ||
rotation?: boolean; // Default: true | ||
streamBitrate?: boolean; // Default: false | ||
streamResolution?: boolean; // Default: true | ||
stun?: {urls?: string[]}; | ||
template?: Template; // Default: 'renderer' | ||
token?: string; | ||
touch?: boolean; // Default: true | ||
translateHomeKey?: boolean; // Default: false | ||
turn?: { | ||
urls?: string[]; | ||
username?: string; | ||
credential?: string; | ||
default?: boolean; // Default: false | ||
}; | ||
volume?: boolean; // Default: true | ||
} | ||
|
||
type DefaultTrue<B, T> = B extends void | ||
? T // Key is not present | ||
: B extends true | undefined | ||
? T // Key is true or undefined | ||
: B extends false | ||
? undefined // Key is false | ||
: T | undefined; // Key is true, false or undefined (we cannot infer anything) | ||
? T // Key is not present | ||
: B extends true | undefined | ||
? T // Key is true or undefined | ||
: B extends false | ||
? undefined // Key is false | ||
: T | undefined; // Key is true, false or undefined (we cannot infer anything) | ||
|
||
type ExtractKey<O, K extends keyof O> = O extends { [P in K]: infer T } ? T : void; | ||
type ExtractKey<O, K extends keyof O> = O extends {[P in K]: infer T} ? T : void; | ||
|
||
type DeviceRendererApi<O extends RendererSetupOptions = RendererSetupOptions> = { | ||
keyMapping: DefaultTrue<ExtractKey<O, 'keyboardMapping'>, DeviceRendererKeyMapping>; | ||
media: Media; | ||
utils: Utils; | ||
video?: Video; // Available if any plugin (e.g. fullscreen) using it is enabled. | ||
VM_communication: VmCommunication; | ||
keyMapping: DefaultTrue<ExtractKey<O, 'keyboardMapping'>, DeviceRendererKeyMapping>; | ||
media: Media; | ||
utils: Utils; | ||
video?: Video; // Available if any plugin (e.g. fullscreen) using it is enabled. | ||
VM_communication: VmCommunication; | ||
}; | ||
|
||
declare class DeviceRendererFactory { | ||
constructor(); | ||
setupRenderer<O extends RendererSetupOptions>( | ||
targetElement: HTMLDivElement, | ||
webrtcAddress: string, | ||
options?: O, | ||
): DeviceRendererApi<O>; | ||
constructor(); | ||
setupRenderer<O extends RendererSetupOptions>( | ||
targetElement: HTMLDivElement, | ||
webrtcAddress: string, | ||
options?: O, | ||
): DeviceRendererApi<O>; | ||
} | ||
|
||
export { DeviceRendererApi, DeviceRendererFactory, RendererSetupOptions, KeyMappingConfig } | ||
export {DeviceRendererApi, DeviceRendererFactory, RendererSetupOptions, KeyMappingConfig}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters