refactor(nav): remove unnecessary stuff from view-controller

This commit is contained in:
Dan Bucholtz
2018-02-23 14:37:30 -06:00
parent 282e4e3e79
commit c53d77da51

View File

@ -29,17 +29,6 @@ export class ViewController implements PublicViewController {
initializeNewViewController(this, data, fromExternalRouter, url);
}
/**
* Dismiss the current viewController
* @param {any} [data] Data that you want to return when the viewController is dismissed.
* @param {any} [role ]
* @param {NavOptions} navOptions Options for the dismiss navigation.
* @returns {any} data Returns the data passed in, if any.
*/
dismiss(data?: any, role?: string, navOptions: any = {}): Promise<any> {
this.dismissProxy = {};
return dismiss(this.nav, this.dismissProxy, data, role, navOptions);
}
willLeave(unload: boolean): void {
willLeaveImpl(unload, this);
@ -72,37 +61,12 @@ export class ViewController implements PublicViewController {
destroy(delegate?: FrameworkDelegate): Promise<any> {
return destroy(this, delegate);
}
getTransitionName(_direction: string): string {
// TODO
return '';
}
}
export function callLifecycle(instance: any, methodName: string) {
instance && instance[methodName] && instance[methodName]();
}
export function dismiss(navCtrl: any, dismissProxy: any, data?: any, role?: string, navOptions: any = {}): Promise<any> {
if (!navCtrl) {
assert(this._state === STATE_DESTROYED, 'ViewController does not have a valid _nav');
return Promise.resolve(false);
}
if (this.overlay && !navOptions.minClickBlockDuration) {
// This is a Modal being dismissed so we need
// to add the minClickBlockDuration option
// for UIWebView
navOptions.minClickBlockDuration = 400;
}
dismissProxy.data = data;
dismissProxy.role = role;
const options = Object.assign({}, this._leavingOpts, navOptions);
return navCtrl.removeView(this, options).then(() => data);
}
export function destroy(viewController: ViewController, delegate?: FrameworkDelegate): Promise<any> {
assert(viewController.state !== STATE_DESTROYED, 'view state must be attached');
return delegate ? delegate.removeViewFromDom(viewController.nav.element, viewController.element) : Promise.resolve().then(() => {