Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getView(): any {
if (!frameModule.topmost()) {
const root = this.topViewController;
if (!root) {
throw new Error('There is no topmost');
}
return root.view.window;
} else {
// if the user provided an iOSOpts.anchorView then we're going to use it as the anchor when making the toast
if (this._iOSOpts && this._anchorView) {
return this._anchorView;
} else {
// if no anchorView requested we'll use the viewController view (might look into using the .window of the main VC later)
let viewController = frameModule.topmost()
.viewController as UIViewController;
if (viewController.presentedViewController) {
// on iPad, we don't want to show the toast in the modal, but on iPhone we do
if (device.deviceType !== DeviceType.Tablet) {
protected navigateToExample(exampleFullPath: string) {
try {
frame.topmost().navigate(exampleFullPath);
} catch (error) {
console.log("EXAMPLE LOAD FAILED:" + error);
alert("Error loading example: " + exampleFullPath + " \nerror: " + error && error.message);
}
}
export function onTap(args) {
var navigationEntry = {
moduleName: "ui-tests-app/transitions/page1",
animated: true,
transition: {
name: args.object.tag,
duration: 380,
curve: "easeIn"
}
};
frame.topmost().navigate(navigationEntry);
}
export function navigate(args) {
console.log("---> [LANDSCAPE] navigate");
topmost().navigate("other/other-page");
}
doFindMe() {
const page = topmost().currentPage;
let mymap = page.getViewById('mymap');
getCurrentLocation({
desiredAccuracy: 3,
updateDistance: 10,
maximumAge: 20000,
timeout: 20000
}).then(
function(loc) {
if (loc) {
//console.log('Current location is: ' + loc);
mymap.setCenter({
lat: loc.latitude,
lng: loc.longitude,
animated: true
});
function share(thingsToShare) {
const activityController = UIActivityViewController.alloc()
.initWithActivityItemsApplicationActivities(thingsToShare, null);
const presentViewController = activityController.popoverPresentationController;
if (presentViewController) {
const page = topmost().currentPage;
if (page && page.ios.navigationItem.rightBarButtonItems &&
page.ios.navigationItem.rightBarButtonItems.count > 0) {
presentViewController.barButtonItem = page.ios.navigationItem.rightBarButtonItems[0];
} else {
presentViewController.sourceView = page.ios.view;
}
}
topmost().ios.controller
.presentViewControllerAnimatedCompletion(activityController, true, null);
}
webContentViewer() {
frame.topmost().navigate('webcontent');
}
secondViewer() {
export function carousel1() {
topmost().navigate({
moduleName: 'carousel1'
});
}
this.socketIO.on('call:incoming', data => {
frame.topmost().navigate({
moduleName: 'call-page',
context: {
to: data.to,
from: data.from,
sdp: data.sdp,
type: data.type
}
});
});
public removeScrollVerticalBars(args) {
const scrollV = topmost().getViewById("scrollV") as ScrollView;
SwissArmyKnife.removeVerticalScrollBars(scrollV);
}