{
unzip.register(AsyncUnzipInflate)
unzip.push(data, true)
})
+
+ await unzipStream
+
+ // For some reason, Chromium doesn't transfer all files upon calling writable.close() at the desired time.
+ // This means that some files are imported incorrectly if we don't wait a bit.
+ // (Data would still be within .crswap files)
+ await wait(100)
}
/**
diff --git a/src/components/FileSystem/saveOrDownload.ts b/src/components/FileSystem/saveOrDownload.ts
index 189b4b119..5fb8c8d2f 100644
--- a/src/components/FileSystem/saveOrDownload.ts
+++ b/src/components/FileSystem/saveOrDownload.ts
@@ -30,12 +30,13 @@ export async function saveOrDownload(
const app = await App.getApp()
if (import.meta.env.VITE_IS_TAURI_APP) {
- const { join, appLocalDataDir } = await import(
- '@tauri-apps/api/path'
+ const { join } = await import('@tauri-apps/api/path')
+ const { getBridgeFolderPath } = await import(
+ '/@/utils/getBridgeFolderPath'
)
revealInFileExplorer(
- await join(await appLocalDataDir(), 'bridge', filePath)
+ await join(await getBridgeFolderPath(), filePath)
)
} else if (
app.project.isLocal ||
diff --git a/src/components/PackExplorer/HomeView/SetupHint.vue b/src/components/PackExplorer/HomeView/SetupHint.vue
new file mode 100644
index 000000000..d41eb9ac5
--- /dev/null
+++ b/src/components/PackExplorer/HomeView/SetupHint.vue
@@ -0,0 +1,14 @@
+
+
+
+ {{ t('general.setup') }}
+ mdi-arrow-right
+
+
+
+
+
diff --git a/src/components/PackExplorer/HomeView/SetupView.vue b/src/components/PackExplorer/HomeView/SetupView.vue
index e97dc713a..7855aba73 100644
--- a/src/components/PackExplorer/HomeView/SetupView.vue
+++ b/src/components/PackExplorer/HomeView/SetupView.vue
@@ -25,58 +25,32 @@
mdi-minecraft
{{ t('initialSetup.step.comMojang.description') }}
-
-
-
-
- mdi-pencil-outline
-
- {{ t('initialSetup.step.editorType.description') }}
-
+
+
-
-
-
-
- mdi-cog
- Setup Step: {{ !hasComMojangSetup ? 1 : 2 }} /
- 2
-
-
-
- mdi-chevron-right
-
-
+
+ mdi-pencil-outline
+
+ {{ t('initialSetup.step.editorType.description') }}
+
+
+
@@ -87,13 +61,12 @@ import BridgeSheet from '/@/components/UIElements/Sheet.vue'
import CreateProjectBtn from './CreateProjectBtn.vue'
import BridgeFolderBtn from './BridgeFolderBtn.vue'
import ImportOldProjects from './ImportOldProjects.vue'
-import { SimpleAction } from '/@/components/Actions/SimpleAction'
-import ActionViewer from '/@/components/Actions/ActionViewer.vue'
import { SettingsWindow } from '/@/components/Windows/Settings/SettingsWindow'
import { settingsState } from '/@/components/Windows/Settings/SettingsState'
import { get, set } from 'idb-keyval'
-import { comMojangKey } from '/@/components/OutputFolders/ComMojang/ComMojang'
import { isUsingFileSystemPolyfill } from '../../FileSystem/Polyfill'
+import { InformedChoiceWindow } from '../../Windows/InformedChoice/InformedChoice'
+import SetupHint from './SetupHint.vue'
export default {
mixins: [TranslationMixin],
@@ -101,27 +74,20 @@ export default {
BridgeSheet,
CreateProjectBtn,
BridgeFolderBtn,
- ActionViewer,
ImportOldProjects,
+ SetupHint,
},
setup() {
return {
+ downloadAppUrl: 'https://bridge-core.app/guide/download',
+ isTauriBuild: import.meta.env.VITE_IS_TAURI_APP,
isUsingFileSystemPolyfill,
}
},
async mounted() {
- this.hasComMojangSetup = (await get(comMojangKey)) !== undefined
this.didChooseEditorType = (await get('didChooseEditorType')) ?? false
- this.setupStepCount =
- Number(!this.hasComMojangSetup) + Number(!this.didChooseEditorType)
const app = await App.getApp()
- this.disposables.push(
- app.comMojang.setup.once(() => {
- console.log(this.hasComMojangSetup)
- this.hasComMojangSetup = true
- }, true)
- )
this.disposables.push(
App.installApp.isInstallable.once(
() => (this.showInstallAppButton = true),
@@ -140,51 +106,45 @@ export default {
},
data() {
return {
- hasComMojangSetup: true,
didChooseEditorType: false,
showInstallAppButton: false,
- setupStepCount: 0,
disposables: [],
- actions: [
- new SimpleAction({
+ actions: [],
+ }
+ },
+ methods: {
+ async chooseEditor() {
+ const editors = [
+ {
icon: 'mdi-text',
name: 'initialSetup.step.editorType.rawText.name',
description:
'initialSetup.step.editorType.rawText.description',
- onTrigger: async () => {
- if (this.isLoading) return
-
- this.isLoading = true
- await this.setJsonEditor('rawText')
- this.$emit('next')
+ onTrigger: () => {
+ this.setJsonEditor('rawText')
},
- }),
- new SimpleAction({
+ },
+ {
icon: 'mdi-file-tree',
name: 'initialSetup.step.editorType.treeEditor.name',
description:
'initialSetup.step.editorType.treeEditor.description',
- onTrigger: async () => {
- if (this.isLoading) return
-
- this.isLoading = true
- await this.setJsonEditor('treeEditor')
- this.$emit('next')
+ onTrigger: () => {
+ this.setJsonEditor('treeEditor')
},
- }),
- ],
- }
- },
- computed: {
- mayShowComMojangSetupPanel() {
- return (
- !import.meta.env.VITE_IS_TAURI_APP &&
- !this.hasComMojangSetup &&
- !this.isUsingFileSystemPolyfill
+ },
+ ]
+
+ const choiceWindow = new InformedChoiceWindow(
+ 'initialSetup.step.editorType.name'
)
+ editors.forEach((editor) =>
+ choiceWindow.actionManager.create(editor)
+ )
+
+ choiceWindow.open()
},
- },
- methods: {
+
async setJsonEditor(val) {
await SettingsWindow.loadSettings(App.instance)
if (!settingsState.editor) settingsState.editor = {}
@@ -197,6 +157,9 @@ export default {
installApp() {
App.installApp.prompt()
},
+ openDownloadPage() {
+ App.openUrl(this.downloadAppUrl)
+ },
},
}
diff --git a/src/components/Projects/Import/fromBrproject.ts b/src/components/Projects/Import/fromBrproject.ts
index 6afa2d8b5..9154c16e2 100644
--- a/src/components/Projects/Import/fromBrproject.ts
+++ b/src/components/Projects/Import/fromBrproject.ts
@@ -36,7 +36,10 @@ export async function importFromBrproject(
if (!(await fs.fileExists('import/config.json'))) {
// The .brproject file contains data/, projects/ & extensions/ folder
// We need to change the folder structure to process it correctly
- if (isUsingFileSystemPolyfill.value) {
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value
+ ) {
// Only load settings & extension if using the polyfill
try {
await fs.move('import/data', 'data')
@@ -61,7 +64,11 @@ export async function importFromBrproject(
}
// Ask user whether he wants to save the current project if we are going to delete it later in the import process
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects) {
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ ) {
const confirmWindow = new ConfirmationWindow({
description:
'windows.projectChooser.openNewProject.saveCurrentProject',
@@ -91,7 +98,11 @@ export async function importFromBrproject(
if (!app.hasNoProjects) currentProject = app.project
// Remove old project if browser is using fileSystem polyfill
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects)
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ )
await app.projectManager.removeProject(currentProject!)
// Add new project
diff --git a/src/components/Projects/Import/fromMcaddon.ts b/src/components/Projects/Import/fromMcaddon.ts
index 8754213bb..bb0fd8d19 100644
--- a/src/components/Projects/Import/fromMcaddon.ts
+++ b/src/components/Projects/Import/fromMcaddon.ts
@@ -11,7 +11,7 @@ import { CreateConfig } from '../CreateProject/Files/Config'
import { FileSystem } from '/@/components/FileSystem/FileSystem'
import { defaultPackPaths } from '../Project/Config'
import { InformationWindow } from '../../Windows/Common/Information/InformationWindow'
-import { basename } from '/@/utils/path'
+import { basename, join } from '/@/utils/path'
import { getPackId, IManifestModule } from '/@/utils/manifest/getPackId'
import { findSuitableFolderName } from '/@/utils/directory/findSuitableName'
@@ -41,7 +41,11 @@ export async function importFromMcaddon(
)
// Ask user whether they want to save the current project if we are going to delete it later in the import process
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects) {
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ ) {
const confirmWindow = new ConfirmationWindow({
description:
'windows.projectChooser.openNewProject.saveCurrentProject',
@@ -95,10 +99,11 @@ export async function importFromMcaddon(
packs.push(packId)
const packPath = defaultPackPaths[packId]
+
// Move the pack to the correct location
await fs.move(
`import/${pack.name}`,
- `projects/${projectName}/${packPath}`
+ join('projects', projectName, packPath)
)
}
}
@@ -126,7 +131,11 @@ export async function importFromMcaddon(
await fs.mkdir(`projects/${projectName}/.bridge/compiler`)
// Remove old project if browser is using fileSystem polyfill
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects)
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ )
await app.projectManager.removeProject(app.project)
// Add new project
diff --git a/src/components/Projects/Import/fromMcpack.ts b/src/components/Projects/Import/fromMcpack.ts
index ddcd68ab9..c38e898ce 100644
--- a/src/components/Projects/Import/fromMcpack.ts
+++ b/src/components/Projects/Import/fromMcpack.ts
@@ -13,6 +13,7 @@ import { defaultPackPaths } from '../Project/Config'
import { InformationWindow } from '../../Windows/Common/Information/InformationWindow'
import { getPackId, IManifestModule } from '/@/utils/manifest/getPackId'
import { findSuitableFolderName } from '/@/utils/directory/findSuitableName'
+import { join } from '/@/utils/path'
export async function importFromMcpack(
fileHandle: AnyFileHandle,
@@ -41,7 +42,11 @@ export async function importFromMcpack(
)
// Ask user whether they want to save the current project if we are going to delete it later in the import process
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects) {
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ ) {
const confirmWindow = new ConfirmationWindow({
description:
'windows.projectChooser.openNewProject.saveCurrentProject',
@@ -70,7 +75,7 @@ export async function importFromMcpack(
packs.push(packId)
const packPath = defaultPackPaths[packId]
// Move the pack to the correct location
- await fs.move(`import`, `projects/${projectName}/${packPath}`)
+ await fs.move(`import`, join('projects', projectName, packPath))
} else {
new InformationWindow({
description: 'fileDropper.mcaddon.missingManifests',
@@ -95,7 +100,11 @@ export async function importFromMcpack(
await fs.mkdir(`projects/${projectName}/.bridge/extensions`)
await fs.mkdir(`projects/${projectName}/.bridge/compiler`)
- if (isUsingFileSystemPolyfill.value && !app.hasNoProjects)
+ if (
+ !import.meta.env.VITE_IS_TAURI_APP &&
+ isUsingFileSystemPolyfill.value &&
+ !app.hasNoProjects
+ )
// Remove old project if browser is using fileSystem polyfill
await app.projectManager.removeProject(app.project)
diff --git a/src/components/TabSystem/WelcomeScreen.vue b/src/components/TabSystem/WelcomeScreen.vue
index 70b439b76..596bb9920 100644
--- a/src/components/TabSystem/WelcomeScreen.vue
+++ b/src/components/TabSystem/WelcomeScreen.vue
@@ -1,6 +1,10 @@
@@ -17,6 +21,15 @@
/>
+
+
+ mdi-download
+ {{ t('general.downloadNativeApp') }}
+
@@ -25,11 +38,26 @@
import Logo from '../UIElements/Logo.vue'
import WelcomeAlert from '../WelcomeAlert/Alert.vue'
import CommandBar from '../CommandBar/CommandBar.vue'
+import BridgeSheet from '/@/components/UIElements/Sheet.vue'
+import { App } from '/@/App'
+import { useTranslations } from '../Composables/useTranslations'
+import { computed } from 'vue'
+import { useSidebarState } from '../Composables/Sidebar/useSidebarState'
+
+const { t } = useTranslations()
+const { isContentVisible, isAttachedRight } = useSidebarState()
+
+const nativeBuildAvailable = computed(() => {
+ return !import.meta.env.VITE_IS_TAURI_APP && !App.instance.mobile.is.value
+})
defineProps({
- containerPadding: String,
height: Number,
})
+
+function openDownloadPage() {
+ App.openUrl('https://bridge-core.app/guide/download/')
+}