mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
Disable view in marketplace button when side-loaded (#1471)
Disble view in marketplace button when side-loaded
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
button
|
button
|
||||||
detail
|
detail
|
||||||
(click)="button.action()"
|
(click)="button.action()"
|
||||||
|
[disabled]="button.disabled"
|
||||||
>
|
>
|
||||||
<ion-icon slot="start" [name]="button.icon"></ion-icon>
|
<ion-icon slot="start" [name]="button.icon"></ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface Button {
|
|||||||
description: string
|
description: string
|
||||||
icon: string
|
icon: string
|
||||||
action: Function
|
action: Function
|
||||||
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
@@ -86,13 +87,8 @@ export class ToButtonsPipe implements PipeTransform {
|
|||||||
icon: 'receipt-outline',
|
icon: 'receipt-outline',
|
||||||
},
|
},
|
||||||
// view in marketplace
|
// view in marketplace
|
||||||
{
|
this.viewInMarketplaceButton(pkg),
|
||||||
action: () =>
|
// donate
|
||||||
this.navCtrl.navigateForward([`marketplace/${pkg.manifest.id}`]),
|
|
||||||
title: 'Marketplace',
|
|
||||||
description: 'View service in marketplace',
|
|
||||||
icon: 'storefront-outline',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
action: () => this.donate(pkg),
|
action: () => this.donate(pkg),
|
||||||
title: 'Donate',
|
title: 'Donate',
|
||||||
@@ -116,6 +112,25 @@ export class ToButtonsPipe implements PipeTransform {
|
|||||||
await modal.present()
|
await modal.present()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private viewInMarketplaceButton(pkg: PackageDataEntry): Button {
|
||||||
|
return pkg.installed?.['marketplace-url']
|
||||||
|
? {
|
||||||
|
action: () =>
|
||||||
|
this.navCtrl.navigateForward([`marketplace/${pkg.manifest.id}`]),
|
||||||
|
title: 'Marketplace',
|
||||||
|
description: 'View service in marketplace',
|
||||||
|
icon: 'storefront-outline',
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
disabled: true,
|
||||||
|
action: () => {},
|
||||||
|
title: 'Marketplace',
|
||||||
|
description:
|
||||||
|
'This package has been side-loaded and is not available in the Start9 Marketplace',
|
||||||
|
icon: 'storefront-outline',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async donate({ manifest }: PackageDataEntry): Promise<void> {
|
private async donate({ manifest }: PackageDataEntry): Promise<void> {
|
||||||
const url = manifest['donation-url']
|
const url = manifest['donation-url']
|
||||||
if (url) {
|
if (url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user