Bring back deep linking in appstore to install specific versions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<AppInstallDialog ref="appInstallDialog" />
|
||||
<AppInstallDialog ref="appInstallDialog" @close="onAppInstallDialogClose"/>
|
||||
|
||||
<div class="filter-bar">
|
||||
<div></div>
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
|
||||
<div v-if="!search">
|
||||
<h4>{{ $t('appstore.category.popular') }}</h4>
|
||||
<h4 v-show="filteredPopularApps.length">{{ $t('appstore.category.popular') }}</h4>
|
||||
<TransitionGroup name="grid-animation" tag="div" class="grid" v-show="ready">
|
||||
<div class="item" v-for="app in filteredPopularApps" :key="app.id" :ref="'item-' + app.id" @click="onInstall(app)">
|
||||
<img class="icon" :src="app.iconUrl" />
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</TransitionGroup>
|
||||
|
||||
<h4>{{ $t('appstore.category.all') }}</h4>
|
||||
<h4 v-show="filteredAllApps.length">{{ $t('appstore.category.all') }}</h4>
|
||||
<TransitionGroup name="grid-animation" tag="div" class="grid" v-show="ready">
|
||||
<div class="item" v-for="app in filteredAllApps" :key="app.id" :ref="'item-' + app.id" @click="onInstall(app)">
|
||||
<img class="icon" :src="app.iconUrl" />
|
||||
@@ -84,16 +84,35 @@ const filteredPopularApps = computed(() => {
|
||||
const appInstallDialog = useTemplateRef('appInstallDialog');
|
||||
const searchInput = useTemplateRef('searchInput');
|
||||
|
||||
function onAppInstallDialogClose() {
|
||||
window.location.href = '/#/appstore';
|
||||
}
|
||||
|
||||
function onInstall(app) {
|
||||
window.location.href = `/#/appstore/${app.manifest.id}?version=${app.manifest.version}`;
|
||||
appInstallDialog.value.open(app);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
apps.value = await appstoreModel.list();
|
||||
|
||||
ready.value = true;
|
||||
|
||||
setTimeout(() => searchInput.value.$el.focus(), 0);
|
||||
const query = window.location.hash.slice('#/appstore/'.length);
|
||||
if (query) {
|
||||
const appId = query.split('?')[0];
|
||||
const version = query.slice(query.indexOf('version=')+'version='.length);
|
||||
|
||||
console.log(appId, version)
|
||||
|
||||
const app = await appstoreModel.get(appId, version);
|
||||
if (app) {
|
||||
appInstallDialog.value.open(app);
|
||||
} else {
|
||||
console.error('No such version found');
|
||||
}
|
||||
} else {
|
||||
searchInput.value.$el.focus();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
|
||||
if (view === VIEWS.APPS) {
|
||||
that.view = VIEWS.APPS;
|
||||
} else if (view === VIEWS.APPSTORE) {
|
||||
} else if (view.indexOf(VIEWS.APPSTORE) === 0) {
|
||||
that.view = VIEWS.APPSTORE;
|
||||
} else if (view === VIEWS.SUPPORT) {
|
||||
that.view = VIEWS.SUPPORT;
|
||||
|
||||
Reference in New Issue
Block a user