From 35568ba85fbda54becbc6a30fc1005d76ebc2892 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Thu, 13 Oct 2016 18:02:45 +0200 Subject: [PATCH] chore: removed deprecated APIs --- src/components/action-sheet/action-sheet.ts | 9 --- src/components/alert/alert.ts | 9 --- src/components/loading/loading.ts | 9 --- src/components/modal/modal.ts | 8 --- src/components/picker/picker.ts | 9 --- src/components/popover/popover.ts | 9 --- src/components/tabs/tab-button.ts | 5 -- src/components/tabs/tabs.ts | 52 ---------------- src/components/toast/toast.ts | 9 --- src/navigation/nav-controller-base.ts | 25 +------- src/navigation/view-controller.ts | 68 ++++++--------------- 11 files changed, 22 insertions(+), 190 deletions(-) diff --git a/src/components/action-sheet/action-sheet.ts b/src/components/action-sheet/action-sheet.ts index 2173955186..4fd9a043a0 100644 --- a/src/components/action-sheet/action-sheet.ts +++ b/src/components/action-sheet/action-sheet.ts @@ -61,15 +61,6 @@ export class ActionSheet extends ViewController { return this._app.present(this, navOptions); } - /** - * @private - * DEPRECATED: Please inject ActionSheetController instead - */ - static create(opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('ActionSheet.create(..) has been deprecated. Please inject ActionSheetController instead'); - } - } diff --git a/src/components/alert/alert.ts b/src/components/alert/alert.ts index 05a03b13e8..d57b2eef07 100644 --- a/src/components/alert/alert.ts +++ b/src/components/alert/alert.ts @@ -84,15 +84,6 @@ export class Alert extends ViewController { return this._app.present(this, navOptions); } - /** - * @private - * DEPRECATED: Please inject AlertController instead - */ - static create(opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Alert.create(..) has been deprecated. Please inject AlertController instead'); - } - } diff --git a/src/components/loading/loading.ts b/src/components/loading/loading.ts index 8c6bddcb7d..10de595a47 100644 --- a/src/components/loading/loading.ts +++ b/src/components/loading/loading.ts @@ -55,15 +55,6 @@ export class Loading extends ViewController { this._nav && this._nav.popAll(); } - /** - * @private - * DEPRECATED: Please inject LoadingController instead - */ - static create(opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Loading.create(..) has been deprecated. Please inject LoadingController instead'); - } - } diff --git a/src/components/modal/modal.ts b/src/components/modal/modal.ts index c3e7a621db..686f661744 100644 --- a/src/components/modal/modal.ts +++ b/src/components/modal/modal.ts @@ -44,14 +44,6 @@ export class Modal extends ViewController { return this._app.present(this, navOptions, AppPortal.MODAL); } - /** - * @private - * DEPRECATED: Please inject ModalController instead - */ - static create(cmp: any, opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Modal.create(..) has been deprecated. Please inject ModalController instead'); - } } diff --git a/src/components/picker/picker.ts b/src/components/picker/picker.ts index 52d6cf423b..95c01209b5 100644 --- a/src/components/picker/picker.ts +++ b/src/components/picker/picker.ts @@ -74,15 +74,6 @@ export class Picker extends ViewController { return this._app.present(this, navOptions); } - /** - * @private - * DEPRECATED: Please inject PickerController instead - */ - static create(opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Picker.create(..) has been deprecated. Please inject PickerController instead'); - } - } diff --git a/src/components/popover/popover.ts b/src/components/popover/popover.ts index 88be1b8668..8903ef7c35 100644 --- a/src/components/popover/popover.ts +++ b/src/components/popover/popover.ts @@ -43,15 +43,6 @@ export class Popover extends ViewController { return this._app.present(this, navOptions); } - /** - * @private - * DEPRECATED: Please inject PopoverController instead - */ - static create(component: any, data = {}, opts: PopoverOptions = {}) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Popover.create(..) has been deprecated. Please inject PopoverController instead'); - } - } diff --git a/src/components/tabs/tab-button.ts b/src/components/tabs/tab-button.ts index 57a17b9a05..7ef63750f6 100644 --- a/src/components/tabs/tab-button.ts +++ b/src/components/tabs/tab-button.ts @@ -39,11 +39,6 @@ export class TabButton extends Ion implements OnInit { this.disHover = (config.get('hoverCSS') === false); this.layout = config.get('tabsLayout'); - - // TODO deprecated 07-07-2016 beta.11 - if (config.get('tabbarLayout') !== undefined) { - this.layout = config.get('tabbarLayout'); - } } ngOnInit() { diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index d8d099f02b..cfa3543372 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -192,21 +192,11 @@ export class Tabs extends Ion implements AfterViewInit { */ @Input() selectedIndex: number; - /** - * @internal DEPRECATED. Please use `tabsLayout` instead. - */ - @Input() private tabbarLayout: string; - /** * @input {string} Set the tabbar layout: `icon-top`, `icon-left`, `icon-right`, `icon-bottom`, `icon-hide`, `title-hide`. */ @Input() tabsLayout: string; - /** - * @internal DEPRECATED. Please use `tabsPlacement` instead. - */ - @Input() private tabbarPlacement: string; - /** * @input {string} Set position of the tabbar: `top`, `bottom`. */ @@ -261,18 +251,6 @@ export class Tabs extends Ion implements AfterViewInit { this._subPages = config.getBoolean('tabsHideOnSubPages'); this.tabsHighlight = config.getBoolean('tabsHighlight'); - // TODO deprecated 07-07-2016 beta.11 - if (config.get('tabSubPages') !== null) { - console.warn('Config option "tabSubPages" has been deprecated. Please use "tabsHideOnSubPages" instead.'); - this._subPages = config.getBoolean('tabSubPages'); - } - - // TODO deprecated 07-07-2016 beta.11 - if (config.get('tabbarHighlight') !== null) { - console.warn('Config option "tabbarHighlight" has been deprecated. Please use "tabsHighlight" instead.'); - this.tabsHighlight = config.getBoolean('tabbarHighlight'); - } - if (this.parent) { // this Tabs has a parent Nav this.parent.registerChildNav(this); @@ -308,36 +286,6 @@ export class Tabs extends Ion implements AfterViewInit { this._setConfig('tabsLayout', 'icon-top'); this._setConfig('tabsHighlight', this.tabsHighlight); - // TODO deprecated 07-07-2016 beta.11 - this._setConfig('tabbarPlacement', 'bottom'); - this._setConfig('tabbarLayout', 'icon-top'); - - // TODO deprecated 07-07-2016 beta.11 - if (this.tabbarPlacement !== undefined) { - console.warn('Input "tabbarPlacement" has been deprecated. Please use "tabsPlacement" instead.'); - this.setElementAttribute('tabsPlacement', this.tabbarPlacement); - this.tabsPlacement = this.tabbarPlacement; - } - - // TODO deprecated 07-07-2016 beta.11 - if (this._config.get('tabbarPlacement') !== null) { - console.warn('Config option "tabbarPlacement" has been deprecated. Please use "tabsPlacement" instead.'); - this.setElementAttribute('tabsPlacement', this._config.get('tabbarPlacement')); - } - - // TODO deprecated 07-07-2016 beta.11 - if (this.tabbarLayout !== undefined) { - console.warn('Input "tabbarLayout" has been deprecated. Please use "tabsLayout" instead.'); - this.setElementAttribute('tabsLayout', this.tabbarLayout); - this.tabsLayout = this.tabbarLayout; - } - - // TODO deprecated 07-07-2016 beta.11 - if (this._config.get('tabbarLayout') !== null) { - console.warn('Config option "tabbarLayout" has been deprecated. Please use "tabsLayout" instead.'); - this.setElementAttribute('tabsLayout', this._config.get('tabsLayout')); - } - if (this.tabsHighlight) { this._platform.onResize(() => { this._highlight.select(this.getSelected()); diff --git a/src/components/toast/toast.ts b/src/components/toast/toast.ts index afeb5955a5..e13c8483d5 100644 --- a/src/components/toast/toast.ts +++ b/src/components/toast/toast.ts @@ -66,15 +66,6 @@ export class Toast extends ViewController { this._nav && this._nav.popAll(); } - /** - * @private - * DEPRECATED: Please inject ToastController instead - */ - static create(opt: any) { - // deprecated warning: added beta.11 2016-06-27 - console.warn('Toast.create(..) has been deprecated. Please inject ToastController instead'); - } - } diff --git a/src/navigation/nav-controller-base.ts b/src/navigation/nav-controller-base.ts index 4671f8cf22..69c82903f4 100644 --- a/src/navigation/nav-controller-base.ts +++ b/src/navigation/nav-controller-base.ts @@ -883,6 +883,9 @@ export class NavControllerBase extends Ion implements NavController { } isTransitioning(): boolean { + if (this._trnsTm === 0) { + return false; + } // using a timestamp instead of boolean incase something goes wrong return (this._trnsTm > Date.now()); } @@ -954,28 +957,6 @@ export class NavControllerBase extends Ion implements NavController { this._viewport = val; } - - /** - * @private - * DEPRECATED: Please use app.getRootNav() instead - */ - get rootNav(): NavController { - // deprecated 07-14-2016 beta.11 - console.warn('nav.rootNav() has been deprecated, please use app.getRootNav() instead'); - return this._app.getRootNav(); - } - - /** - * @private - * DEPRECATED: Please use inject the overlays controller and use the present method on the instance instead. - */ - present(): Promise { - // deprecated warning: added beta.11 2016-06-27 - console.warn('nav.present() has been deprecated.\n' + - 'Please inject the overlay\'s controller and use the present method on the instance instead.'); - return Promise.resolve(); - } - } let ctrlIds = -1; diff --git a/src/navigation/view-controller.ts b/src/navigation/view-controller.ts index 5d4941050b..ae7cd0f0f7 100644 --- a/src/navigation/view-controller.ts +++ b/src/navigation/view-controller.ts @@ -147,16 +147,6 @@ export class ViewController { this._emitter.emit(data); } - /** - * @private - * onDismiss(..) has been deprecated. Please use onDidDismiss(..) instead - */ - onDismiss(callback: Function) { - // deprecated warning: added beta.11 2016-06-30 - console.warn('onDismiss(..) has been deprecated. Please use onDidDismiss(..) instead'); - this.onDidDismiss(callback); - } - /** * Called when the current viewController has be successfully dismissed */ @@ -412,7 +402,7 @@ export class ViewController { * @private */ _willLoad() { - ctrlFn(this, 'WillLoad'); + this._lifecycle('WillLoad'); } /** @@ -424,17 +414,7 @@ export class ViewController { * recommended method to use when a view becomes active. */ _didLoad() { - // deprecated warning: added 2016-08-14, beta.12 - if (this.instance && this.instance.ionViewLoaded) { - try { - console.warn('ionViewLoaded() has been deprecated. Please rename to ionViewDidLoad()'); - this.instance.ionViewLoaded(); - } catch (e) { - console.error(this.name + ' iionViewLoaded: ' + e.message); - } - } - - ctrlFn(this, 'DidLoad'); + this._lifecycle('DidLoad'); } /** @@ -449,7 +429,7 @@ export class ViewController { } this.willEnter.emit(null); - ctrlFn(this, 'WillEnter'); + this._lifecycle('WillEnter'); } /** @@ -460,7 +440,7 @@ export class ViewController { _didEnter() { this._nb && this._nb.didEnter(); this.didEnter.emit(null); - ctrlFn(this, 'DidEnter'); + this._lifecycle('DidEnter'); } /** @@ -469,7 +449,7 @@ export class ViewController { */ _willLeave() { this.willLeave.emit(null); - ctrlFn(this, 'WillLeave'); + this._lifecycle('WillLeave'); } /** @@ -479,7 +459,7 @@ export class ViewController { */ _didLeave() { this.didLeave.emit(null); - ctrlFn(this, 'DidLeave'); + this._lifecycle('DidLeave'); // when this is not the active page // we no longer need to detect changes @@ -494,17 +474,7 @@ export class ViewController { */ _willUnload() { this.willUnload.emit(null); - ctrlFn(this, 'WillUnload'); - - // deprecated warning: added 2016-08-14, beta.12 - if (this.instance && this.instance.ionViewDidUnload) { - console.warn('ionViewDidUnload() has been deprecated. Please use ionViewWillUnload() instead'); - try { - this.instance.ionViewDidUnload(); - } catch (e) { - console.error(this.name + ' ionViewDidUnload: ' + e.message); - } - } + this._lifecycle('WillUnload'); } /** @@ -516,8 +486,9 @@ export class ViewController { if (renderer) { // ensure the element is cleaned up for when the view pool reuses this element // ******** DOM WRITE **************** - renderer.setElementAttribute(this._cmp.location.nativeElement, 'class', null); - renderer.setElementAttribute(this._cmp.location.nativeElement, 'style', null); + const cmpEle = this._cmp.location.nativeElement; + renderer.setElementAttribute(cmpEle, 'class', null); + renderer.setElementAttribute(cmpEle, 'style', null); } // completely destroy this component. boom. @@ -546,27 +517,26 @@ export class ViewController { return instance[methodName](); } catch (e) { - console.error(`${this.name} ionViewCan${lifecycle} error: ${e}`); + console.error(`${this.name} ${methodName} error: ${e.message}`); return false; } } return true; } -} - - -function ctrlFn(viewCtrl: ViewController, fnName: string) { - if (viewCtrl.instance) { - // fire off ionView lifecycle instance method - if (viewCtrl.instance['ionView' + fnName]) { + _lifecycle(lifecycle: string) { + let instance = this.instance; + let methodName = 'ionView' + lifecycle; + if (instance && instance[methodName]) { try { - viewCtrl.instance['ionView' + fnName](); + instance[methodName](); + } catch (e) { - console.error(viewCtrl.name + ' ionView' + fnName + ': ' + e.message); + console.error(`${this.name} ${methodName} error: ${e.message}`); } } } + }