import { checkUpgrade, getConfigByEnv } from "./utils/index"

function share() {
  wx.onAppRoute(function(res) {
    const pages = getCurrentPages()
    const view = pages[pages.length - 1];
    if (view) {
      wx.showShareMenu()
      view.onShareAppMessage = () => {
        return {
          title: "",
          path: "/pages/home/index",
          imageUrl: "/assets/images/share.png"
        }
      }
    }

  })
}

App({
  onShow() {
    checkUpgrade();
  },
  onLaunch() {
    share()
    const { api } = getConfigByEnv();
    this.globalData = { ...this.globalData, api, }
  },
  globalData: {
    primaryColor: '#52c41a'
  }
})
