var app = getApp()

/** Get status bar height for custom navigation pages */
function getStatusBarHeight() {
  return app.globalData.statusBarHeight || 44
}

/** Standard back navigation with fallback */
function navigateBack(fallbackUrl) {
  wx.navigateBack({
    fail: function () {
      if (fallbackUrl) {
        wx.reLaunch({ url: fallbackUrl })
      }
    }
  })
}

module.exports = { getStatusBarHeight: getStatusBarHeight, navigateBack: navigateBack }
