import { watch } from 'vue'
import { postMessage } from '/src/helpers/native-message'
import SettingState from '/src/pages/detail/setting-state'

export const useCamera = () => {
  watch(
    () => SettingState.sett.camera,
    (val) => {
      if (val) {
        postMessage({
          api: 'openCamera',
        })
      } else {
        postMessage({
          api: 'closeCamera',
        })
      }
    },
    {
      immediate: true,
    }
  )
}
