Skip to content

Commit

Permalink
Merge pull request #96 from MaaAssistantArknights/dev
Browse files Browse the repository at this point in the history
v2.0.0-beta.1
  • Loading branch information
ChingCdesu authored Apr 20, 2023
2 parents 8573bf9 + d6d2bb1 commit c07ef1e
Show file tree
Hide file tree
Showing 12 changed files with 6,053 additions and 4,724 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meo-assistant-arknights",
"version": "2.0.0-alpha.54",
"version": "2.0.0-beta.1",
"main": "dist/main/index.cjs",
"author": "_ChingC <[email protected]>",
"templateBy": "草鞋没号 <[email protected]>",
Expand All @@ -21,15 +21,15 @@
"@types/cron": "^1.7.3",
"@types/crypto-js": "^4.1.1",
"@types/ffi-napi": "^4.0.7",
"@types/node": "^18.15.5",
"@types/node": "^18.15.11",
"@types/ref-napi": "^3.0.7",
"@types/semver": "^7.3.13",
"@types/sortablejs": "^1.15.1",
"@types/source-map-support": "^0.5.6",
"@types/superagent": "^4.1.16",
"@types/unzipper": "^0.10.5",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@vicons/ionicons5": "^0.12.0",
"@vitejs/plugin-vue": "^2.3.4",
"@vue/eslint-config-typescript": "^10.0.0",
Expand All @@ -41,7 +41,7 @@
"electron": "^20.3.12",
"electron-builder": "^23.6.0",
"electron-devtools-installer": "^3.2.0",
"eslint": "^8.36.0",
"eslint": "^8.38.0",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -51,7 +51,7 @@
"less": "^4.1.3",
"lodash": "^4.17.21",
"naive-ui": "^2.34.3",
"pinia": "^2.0.33",
"pinia": "^2.0.34",
"source-map-support": "^0.5.21",
"tslib": "^2.5.0",
"typescript": "~4.4.4",
Expand Down
75 changes: 40 additions & 35 deletions packages/renderer/src/components/Device/DeviceCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, watch } from 'vue'
import { Ref, computed, ref } from 'vue'
import IconDisconnect from '@/assets/icons/disconnect.svg?component'
import DeviceDetailPopover from '@/components/Device/DeviceDetailPopover.vue'
import IconLink from '@/assets/icons/link.svg?component'
Expand All @@ -12,13 +12,14 @@ import {
useThemeVars,
MessageReactive
} from 'naive-ui'
import { whenever } from '@vueuse/core'
import useDeviceStore from '@/store/devices'
import router from '@/router'
import useTaskStore from '@/store/tasks'
import useSettingStore from '@/store/settings'
// import useTaskIdStore from '@/store/taskId'
import { showMessage } from '@/utils/message'
import logger from '@/hooks/caller/logger'
const props = defineProps<{
device: Device;
Expand All @@ -40,6 +41,8 @@ const routeUuid = computed(
)
const isCurrent = computed(() => routeUuid.value === props.device.uuid)
const currentStatus = computed(() => props.device.status ?? 'unknown')
const connectedStatus: Set<DeviceStatus> = new Set(['connected', 'tasking'])
const disconnectedStatus: Set<DeviceStatus> = new Set([
'available',
Expand All @@ -48,45 +51,46 @@ const disconnectedStatus: Set<DeviceStatus> = new Set([
'unknown'
])
let connectShow: MessageReactive | undefined
watch(() => props.device.status, (newStatus) => {
logger.info('device status changed', newStatus)
if (connectShow) connectShow.destroy()
connectShow = undefined
switch (newStatus) {
case 'connecting':
connectShow = showMessage(`${deviceDisplayName.value}正在连接...`, {
type: 'loading',
duration: 0
})
break
case 'waitingTask':
connectShow = showMessage(`${deviceDisplayName.value}正在连接并等待执行任务...`, {
type: 'loading',
duration: 0
})
break
case 'connected':
connectShow = showMessage(`${deviceDisplayName.value}已连接`, {
type: 'success',
duration: 3000
})
break
case 'disconnected':
connectShow = showMessage(`${deviceDisplayName.value}已断开连接`, {
type: 'info',
duration: 3000
})
break
}
}, { deep: true })
const connectMessage: Ref<MessageReactive | undefined> = ref()
whenever(() => currentStatus.value === 'connecting', () => {
if (connectMessage.value) connectMessage.value.destroy()
connectMessage.value = showMessage(`${deviceDisplayName.value}正在连接...`, {
type: 'loading',
duration: 0
})
}, { flush: 'sync' })
whenever(() => currentStatus.value === 'disconnected', () => {
if (connectMessage.value) connectMessage.value.destroy()
connectMessage.value = showMessage(`${deviceDisplayName.value}已断开连接`, {
type: 'info',
duration: 3000
})
}, { flush: 'sync' })
whenever(() => currentStatus.value === 'connected' || currentStatus.value === 'tasking', () => {
if (connectMessage.value) connectMessage.value.destroy()
connectMessage.value = showMessage(`${deviceDisplayName.value}已连接`, {
type: 'success',
duration: 3000
})
}, { flush: 'sync' })
// function disconnectDevice (uuid: string) {}
// function connectDevice (uuid: string) {}
function handleJumpToTask() {
// 未连接的设备也可以查看任务
// 2023.4.19: 先不做支持了,这会导致一些ui上的问题,比如正在连接的消息框无法关闭
// 理想方案是把正在连接的消息框变成全局唯一实例
// FIXME: feature要! 框的bug再修
// if (!connectedStatus.has(props.device.status)) {
// // TODO: 提示设备未连接
// return
// }
if (!taskStore.getCurrentTaskGroup(props.device.uuid)) {
taskStore.initDeviceTask(props.device.uuid)
}
Expand Down Expand Up @@ -235,13 +239,14 @@ async function handleDeviceConnect() {
align-items: center;
transition: background-color 0.3s var(--n-bezier);
justify-content: space-between;
padding: 0 12px;
}
.device-info {
flex: 1;
border-radius: inherit;
justify-content: flex-start;
padding: 12px 16px;
padding: 12px 0;
}
.device-status {
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/components/Setting/Advance/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const coreSettingsDisabled = inject('coreSettingsDisabled') as { nre: boolean }
label="强制替换ADB"
>
<NButton
type="warning"
type="error"
:disabled="coreSettingsDisabled.nre"
>
强制替换ADB
Expand All @@ -92,7 +92,7 @@ const coreSettingsDisabled = inject('coreSettingsDisabled') as { nre: boolean }
label="重置所有配置"
>
<NButton
type="warning"
type="error"
:disabled="coreSettingsDisabled.nre"
@click="removeAllConfigDialog"
>
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/components/Task/TaskCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ provide(
computed(() => {
const notEditableStatus: TaskStatus[] = ['exception', 'skipped', 'stopped', 'success', 'warning']
return {
// runtime editable
// 运行时可编辑任务用
re: notEditableStatus.includes(props.taskInfo.status),
// non runtime editable
// 运行时不可编辑任务用
nre: [...notEditableStatus, 'processing'].includes(props.taskInfo.status)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function handleUpdateConfiguration (key: string, value: any) {
:show-feedback="false"
>
<NSelect
:disabled="configurationDisabled.re"
:disabled="configurationDisabled.nre"
:value="props.configurations.client_type"
:options="serverOptions"
@update:value="(value) => handleUpdateConfiguration('client_type', value)"
Expand All @@ -55,7 +55,7 @@ function handleUpdateConfiguration (key: string, value: any) {
:show-feedback="false"
>
<NCheckbox
:disabled="configurationDisabled.re"
:disabled="configurationDisabled.nre"
:checked="props.configurations.start_game_enabled"
@update:checked="
(checked) => handleUpdateConfiguration('start_game_enabled', checked)
Expand Down
Loading

0 comments on commit c07ef1e

Please sign in to comment.