mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore: removed deprecated APIs
This commit is contained in:

committed by
Adam Bradley

parent
a06bd69926
commit
35568ba85f
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<any> {
|
||||
// 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;
|
||||
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user