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 })
      }
    }
  })
}

/** Check if dev mode is enabled */
function isDevMode() {
  var config = require('../config/env')
  return config.__DEV__ || false
}

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