export const PROJECT_ID = '97a8e5b1-e6e8-45aa-ad95-f273b6c307ef'
export const APPNAME = 'popcore'
export const EXPO_PROJECT = 'popcore'
export const SCHEME = 'popcore'
export const EXPO_OWER = 'bowong'
export const ANDROID_ID = 'com.bowong.popcore'
export const IOS_ID = ANDROID_ID

// 原生版本，原生代码变更时需要更新此版本号
export const VERSION = '1.0.0'
// JavaScript版本，JS代码变更时需要更新此版本号
export const APP_VERSION = 'dev202601271200'

export default ({ config }) => {
  return {
    ...config,
    expo: {
      name: APPNAME,
      slug: EXPO_PROJECT,
      version: VERSION,
      orientation: 'portrait',
      icon: './assets/images/icon.png',
      scheme: SCHEME,
      userInterfaceStyle: 'automatic',
      owner: EXPO_OWER,
      newArchEnabled: true,

      ios: {
        supportsTablet: true,
        infoPlist: {
          NSBluetoothPeripheralUsageDescription:
            'This app uses Bluetooth to act as a peripheral device for testing and development purposes.',
          ITSAppUsesNonExemptEncryption: false,
        },
        bundleIdentifier: IOS_ID,
      },

      android: {
        adaptiveIcon: {
          backgroundColor: '#E6F4FE',
          foregroundImage: './assets/images/android-icon-foreground.png',
          backgroundImage: './assets/images/android-icon-background.png',
          monochromeImage: './assets/images/android-icon-monochrome.png',
        },
        edgeToEdgeEnabled: true,
        predictiveBackGestureEnabled: false,
        permissions: [
          'android.permission.BLUETOOTH',
          'android.permission.BLUETOOTH_ADMIN',
          'android.permission.BLUETOOTH_SCAN',
          'android.permission.BLUETOOTH_CONNECT',
          'android.permission.BLUETOOTH_ADVERTISE',
          'android.permission.ACCESS_FINE_LOCATION',
          'android.permission.READ_EXTERNAL_STORAGE',
          'android.permission.WRITE_EXTERNAL_STORAGE',
          'android.permission.READ_MEDIA_VISUAL_USER_SELECTED',
          'android.permission.ACCESS_MEDIA_LOCATION',
          'android.permission.READ_MEDIA_IMAGES',
          'android.permission.READ_MEDIA_VIDEO',
          'android.permission.READ_MEDIA_AUDIO',
          'android.permission.RECORD_AUDIO',
        ],
        package: ANDROID_ID,
      },

      web: {
        output: 'static',
        favicon: './assets/images/favicon.png',
        bundler: 'metro',
      },

      plugins: [
        'expo-router',
        [
          'react-native-ble-plx',
          {
            isBackgroundEnabled: true,
            modes: ['peripheral', 'central'],
            bluetoothAlwaysPermission: 'Allow $(PRODUCT_NAME) to connect to bluetooth devices',
          },
        ],
        [
          'expo-media-library',
          {
            photosPermission: 'Allow $(PRODUCT_NAME) to access your photos.',
            savePhotosPermission: 'Allow $(PRODUCT_NAME) to save photos.',
            isAccessMediaLocationEnabled: true,
          },
        ],
        [
          'expo-image-picker',
          {
            photosPermission: 'The app accesses your photos to let you upload your avatar or post images.',
          },
        ],
      ],

      experiments: {
        typedRoutes: true,
        reactCompiler: true,
      },

      extra: {
        router: {},
        eas: {
          projectId: PROJECT_ID,
        },
      },

      runtimeVersion: APP_VERSION,

      updates: {
        url: `https://u.expo.dev/${PROJECT_ID}`,
        fallbackToCacheTimeout: 0,
        checkAutomatically: 'NEVER',
      },
    },
  }
}
