message: fix(app): deeplink not working on coldstart
diff: @@ -8,6 +8,24 @@ import { StartupChecksProvider } from '../providers/startup-checks/startup-check
  import { SchemeRoutingProvider } from '../providers/scheme-routing/scheme-routing'
  import { TranslateService } from '@ngx-translate/core'
  +interface FlatPromise<T> {
  + promise: Promise<T>
  + resolve: (value?: any | PromiseLike<void>) => void
  + reject: (reason?: any) => void
  +}
  +
  +function flatPromise<T>(): FlatPromise<T> {
  + let resolve, reject
  +
  + // tslint:disable-next-line:promise-must-complete
  + const promise = new Promise<T>((res, rej) => {
  + resolve = res
  + reject = rej
  + })
  +
  + return { promise, resolve, reject }
  +}
  +
  @Component({
  templateUrl: 'app.html'
  })
  @@ -16,6 +34,8 @@ export class MyApp {
  rootPage: any = null
  + isInitializedFlatPromise: FlatPromise<void> = flatPromise<void>()
  +
  constructor(
  private platform: Platform,
  private statusBar: StatusBar,
  @@ -63,31 +83,36 @@ export class MyApp {
  .initChecks()
  .then(() => {
  this.rootPage = TabsPage
  + this.isInitializedFlatPromise.resolve()
  })
  .catch(check => {
  check.consequence(this.initChecks.bind(this))
  + this.isInitializedFlatPromise.resolve()
  })
  }
  - ngAfterViewInit() {
  - this.platform.ready().then(() => {
  + async ngAfterViewInit() {
  + await this.platform.ready()
  this.deepLinks
  .route({
  '/': undefined
  })
  .subscribe(
  - match => {
  + async match => {
  // match.$route - the route we matched, which is the matched entry from the arguments to route()
  // match.$args - the args passed in the link
  // match.$link - the full link data
  - this.schemeRoutingProvider.handleNewSyncRequest(this.nav, match.$link.url)
  + this.isInitializedFlatPromise.promise
  + .then(() => {
  console.log('Successfully matched route', match)
  + this.schemeRoutingProvider.handleNewSyncRequest(this.nav, match.$link.url).catch(console.error)
  + })
  + .catch(console.error)
  },
  nomatch => {
  // nomatch.$link - the full link data
  console.error("Got a deeplink that didn't match", nomatch)
  }
  )
  - })
  }
  }
  