You've already forked AstralRinth
forked from didirus/AstralRinth
Misc settings (#137)
* Initial bug fixes * fix compile error on non-mac * Fix even more bugs * Fix more * fix more * fix build * fix build * Search fixes * Fix small instance ui * working basic * fix javaw issue * removed zip * working functions * merge fixes * fixed loadintg bar bug * menu fix * wait for settings to sync * safety expanded and for loading bars * swtiching to windows * minimize * default landing page * test link registry * url redirection * fix formatting * .mrpack windows * working mrpack reader * changed to one layer deep * working .mrpack + command handling for both opening and existing process * forge version numbers * working mac opening mrpack * reverted changes * prettier/fmt * missed debug statement * improvements + refactoring * renamed things to fit plugin * fixed bugs * removed println * overrides dont include mrpack * merge * fixes * fixes * fixed deletion * merge errors * force sync before export * removed testing * missed line * removed console log * mac error reverted * incoreclty named helper * additional fixes * added removed merges * fixed mislabled invokes * mac * added to new register method * comments, cleanup * mac clippy change * review changes * minor changes * moved create pack * removed playground compilation bug * fixed linux bug; other add ons * fixed review commets * cicd fix * mistaken import for prod * cicd fix --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -29,6 +29,10 @@ import mixpanel from 'mixpanel-browser'
|
||||
import { saveWindowState, StateFlags } from 'tauri-plugin-window-state-api'
|
||||
import OnboardingModal from '@/components/OnboardingModal.vue'
|
||||
import { getVersion } from '@tauri-apps/api/app'
|
||||
import { window } from '@tauri-apps/api'
|
||||
import { TauriEvent } from '@tauri-apps/api/event'
|
||||
import { await_sync, check_safe_loading_bars_complete } from './helpers/state'
|
||||
import { confirm } from '@tauri-apps/api/dialog'
|
||||
|
||||
const themeStore = useTheming()
|
||||
|
||||
@@ -69,6 +73,33 @@ defineExpose({
|
||||
},
|
||||
})
|
||||
|
||||
const confirmClose = async () => {
|
||||
const confirmed = await confirm(
|
||||
'An action is currently in progress. Are you sure you want to exit?',
|
||||
{
|
||||
title: 'Modrinth',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
return confirmed
|
||||
}
|
||||
|
||||
const handleClose = async () => {
|
||||
const isSafe = await check_safe_loading_bars_complete()
|
||||
if (!isSafe) {
|
||||
const response = await confirmClose()
|
||||
if (!response) {
|
||||
return
|
||||
}
|
||||
}
|
||||
await await_sync()
|
||||
window.getCurrent().close()
|
||||
}
|
||||
|
||||
window.getCurrent().listen(TauriEvent.WINDOW_CLOSE_REQUESTED, async () => {
|
||||
await handleClose()
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
router.afterEach((to, from, failure) => {
|
||||
if (mixpanel.__loaded) {
|
||||
@@ -220,7 +251,7 @@ const accounts = ref(null)
|
||||
@click="
|
||||
() => {
|
||||
saveWindowState(StateFlags.ALL)
|
||||
appWindow.close()
|
||||
handleClose()
|
||||
}
|
||||
"
|
||||
>
|
||||
|
||||
@@ -70,6 +70,19 @@ export async function profile_listener(callback) {
|
||||
return await listen('profile', (event) => callback(event.payload))
|
||||
}
|
||||
|
||||
/// Payload for the 'command' event
|
||||
/*
|
||||
CommandPayload {
|
||||
event: event type ("InstallMod", "InstallModpack", "InstallVersion"),
|
||||
id: string id of the mod/modpack/version to install
|
||||
}
|
||||
*/
|
||||
export async function command_listener(callback) {
|
||||
return await listen('command', (event) => {
|
||||
callback(event.payload)
|
||||
})
|
||||
}
|
||||
|
||||
/// Payload for the 'warning' event
|
||||
/*
|
||||
WarningPayload {
|
||||
|
||||
@@ -15,3 +15,21 @@ export async function initialize_state() {
|
||||
export async function progress_bars_list() {
|
||||
return await invoke('plugin:utils|progress_bars_list')
|
||||
}
|
||||
|
||||
// Check if any safe loading bars are active
|
||||
export async function check_safe_loading_bars_complete() {
|
||||
return await invoke('plugin:utils|safety_check_safe_loading_bars')
|
||||
}
|
||||
|
||||
// Get opening command
|
||||
// For example, if a user clicks on an .mrpack to open the app.
|
||||
// This should be called once and only when the app is done booting up and ready to receive a command
|
||||
// Returns a Command struct- see events.js
|
||||
export async function get_opening_command() {
|
||||
return await invoke('plugin:utils|get_opening_command')
|
||||
}
|
||||
|
||||
// Wait for settings to sync
|
||||
export async function await_sync() {
|
||||
return await invoke('plugin:utils|await_sync')
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import 'omorphia/dist/style.css'
|
||||
import '@/assets/stylesheets/global.scss'
|
||||
import 'floating-vue/dist/style.css'
|
||||
import FloatingVue from 'floating-vue'
|
||||
import { initialize_state } from '@/helpers/state'
|
||||
import { get_opening_command, initialize_state } from '@/helpers/state'
|
||||
import loadCssMixin from './mixins/macCssFix.js'
|
||||
import { get } from '@/helpers/settings'
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
@@ -20,7 +21,24 @@ app.mixin(loadCssMixin)
|
||||
const mountedApp = app.mount('#app')
|
||||
|
||||
initialize_state()
|
||||
.then(() => mountedApp.initialize())
|
||||
.then(() => {
|
||||
// First, redirect to other landing page if we have that setting
|
||||
get()
|
||||
.then((fetchSettings) => {
|
||||
if (fetchSettings?.default_page && fetchSettings?.default_page !== 'Home') {
|
||||
router.push({ name: fetchSettings?.default_page })
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
.finally(() => {
|
||||
mountedApp.initialize()
|
||||
get_opening_command().then((command) => {
|
||||
console.log(JSON.stringify(command)) // change me to use whatever FE command handler is made
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
@@ -7,6 +7,8 @@ import { get_max_memory } from '@/helpers/jre'
|
||||
import JavaSelector from '@/components/ui/JavaSelector.vue'
|
||||
import mixpanel from 'mixpanel-browser'
|
||||
|
||||
const pageOptions = ['Home', 'Library']
|
||||
|
||||
const themeStore = useTheming()
|
||||
|
||||
const fetchSettings = await get().catch(handleError)
|
||||
@@ -143,6 +145,43 @@ watch(
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="adjacent-input">
|
||||
<label for="minimize-launcher">
|
||||
<span class="label__title">Minimize launcher</span>
|
||||
<span class="label__description"
|
||||
>Minimize the launcher when a Minecraft process starts.</span
|
||||
>
|
||||
</label>
|
||||
<Toggle
|
||||
id="minimize-launcher"
|
||||
:model-value="settings.hide_on_process"
|
||||
:checked="settings.hide_on_process"
|
||||
@update:model-value="
|
||||
(e) => {
|
||||
settings.hide_on_process = e
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="opening-page">
|
||||
<label for="opening-page">
|
||||
<span class="label__title">Default landing page</span>
|
||||
<span class="label__description">Change the page to which the launcher opens on.</span>
|
||||
</label>
|
||||
<DropdownSelect
|
||||
id="opening-page"
|
||||
name="Opening page dropdown"
|
||||
:options="pageOptions"
|
||||
:default-value="settings.default_page"
|
||||
:model-value="settings.default_page"
|
||||
class="opening-page"
|
||||
@change="
|
||||
(e) => {
|
||||
settings.default_page = e.option
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
<Card>
|
||||
<div class="label">
|
||||
|
||||
Reference in New Issue
Block a user