feat(utils): work openFile in simulator (#8495)

* feat: open file in iOS simulator

* feat: added isRealDevice util

* feat: have in mind isRealDevice in utils.openFile

refactor to avoid some circular dependencies

Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
This commit is contained in:
tarunama
2020-04-04 01:44:47 +09:00
committed by GitHub
parent 50eb372929
commit bd9828a036
10 changed files with 87 additions and 43 deletions

View File

@@ -42,7 +42,7 @@
*/
touch
}
/**
* Defines an enum with supported gesture states.
*/
@@ -64,7 +64,7 @@
*/
ended
}
/**
* Defines an enum for swipe gesture direction.
*/
@@ -86,7 +86,7 @@
*/
down
}
/**
* Defines a touch action
*/
@@ -95,23 +95,23 @@
* Down action.
*/
export const down: string;
/**
* Up action.
*/
export const up: string;
/**
* Move action.
*/
export const move: string;
/**
* Cancel action.
*/
export const cancel: string;
}
/**
* Provides gesture event data.
*/
@@ -137,7 +137,7 @@
/**
* Provides gesture event data.
*/
export interface TapGestureEventData extends GestureEventData {
export interface TapGestureEventData extends GestureEventData {
/**
* Gets the number of pointers in the event.
*/
@@ -152,7 +152,7 @@
getY(): number;
}
/**
* Provides gesture event data.
*/
@@ -160,19 +160,19 @@
/**
* Gets action of the touch. Possible values: 'up', 'move', 'down', 'cancel'
*/
action: "up" | "move" | "down" | "cancel";
action: "up" | "move" | "down" | "cancel";
/**
* Gets the pointers that triggered the event.
* Note: In Android there is aways only one active pointer.
*/
getActivePointers(): Array<Pointer>;
/**
* Gets all pointers.
*/
getAllPointers(): Array<Pointer>;
}
/**
* Pointer is an object representing a finger (or other object) that is touching the screen.
*/
@@ -181,12 +181,12 @@
* The id of the pointer.
*/
android: any;
/**
* The UITouch object associated to the touch
*/
ios: any;
/**
* Gets the X coordinate of the pointer inside the view that triggered the event.
*/
@@ -221,31 +221,31 @@
*/
getYDIP(): number
}
/**
* Provides gesture event data.
*/
export interface GestureEventDataWithState extends GestureEventData {
state: number;
}
/**
* Provides gesture event data for pinch gesture.
*/
export interface PinchGestureEventData extends GestureEventDataWithState {
scale: number;
getFocusX(): number;
getFocusY(): number;
}
/**
* Provides gesture event data for swipe gesture.
*/
export interface SwipeGestureEventData extends GestureEventData {
direction: SwipeDirection;
}
/**
* Provides gesture event data for pan gesture.
*/
@@ -253,14 +253,14 @@
deltaX: number;
deltaY: number;
}
/**
* Provides gesture event data for rotation gesture.
*/
export interface RotationGestureEventData extends GestureEventDataWithState {
rotation: number;
}
/**
* Provides options for the GesturesObserver.
*/
@@ -272,39 +272,39 @@
* @param context - default this argument for the callbacks.
*/
constructor(target: View, callback: (args: GestureEventData) => void, context: any);
/**
* Registers a gesture observer to a view and gesture.
* @param type - Type of the gesture.
*/
observe(type: GestureTypes);
/**
* Disconnects the gesture observer.
*/
disconnect();
/**
* Gesture type attached to the observer.
*/
type: GestureTypes;
/**
* A function that will be executed when a gesture is received.
*/
callback: (args: GestureEventData) => void;
/**
* A context which will be used as `this` in callback execution.
*/
context: any;
/**
* An internal Android specific method used to pass the motion event to the correct gesture observer.
*/
androidOnTouchEvent: (motionEvent: any /* android.view.MotionEvent */) => void;
}
/**
* A short-hand function that is used to create a gesture observer for a view and gesture.
* @param target - View which will be watched for originating a specific gesture.
@@ -313,17 +313,16 @@
* @param context - this argument for the callback.
*/
export function observe(target: View, type: GestureTypes, callback: (args: GestureEventData) => void, context?: any): GesturesObserver;
/**
* Returns a string representation of a gesture type.
* @param type - Type of the gesture.
* @param separator(optional) - Text separator between gesture type strings.
*/
export function toString(type: GestureTypes, separator?: string): string;
/**
* Returns a gesture type enum value from a string (case insensitive).
* @param type - A string representation of a gesture type (e.g. Tap).
*/
export function fromString(type: string): GestureTypes;