Which syntax is replaced for this.app.getActiveNavs()[0] and this.app._appRoot._getPortal() in ionic 5

I migrated code from ionic 3 to ionic 5, this was in ionic 3

import { App } from ‘ionic-angular’;

private app: App

let nav = this.app.getActiveNavs()[0];
let portal = this.app._appRoot._getPortal();

but in ionic 5 look like ‘App’ was moved to NavController method ‘navigateRoot’ (i’m not sure, how to use it ?). and _getPortal() i don’t know what was it moved to ? how to get portal length ?

this was original code from ionic3

import { App } from ‘ionic-angular’;

this.platform.registerBackButtonAction(() => {
let nav = this.app.getActiveNavs()[0];
const portal = this.app._appRoot._getPortal();

  if (portal.length() == 0) {
    if (nav.canGoBack()){
      this.app.navPop();
    } else {
        this.showExitingConfirm();
    }
  } else {
    this.app.navPop();
  }
});