ui: fix messaging for .local launches

This commit is contained in:
Aaron Greenspan
2021-01-12 14:30:07 -07:00
committed by Aiden McClelland
parent 1b1fd40e08
commit 4da4fd66a3
4 changed files with 24 additions and 11 deletions

View File

@@ -24,9 +24,9 @@
<ion-col *ngFor="let app of apps" sizeXs="4" sizeSm="3" sizeMd="2" sizeLg="2">
<ng-container *ngIf="{ tor: app.subject.torAddress | async, status: app.subject.status | async, ui: app.subject.ui | async, iconURL: app.subject.iconURL | async | iconParse, title: app.subject.title | async } as vars" >
<ion-button
*ngIf="vars.ui && !isConsulate && isTor"
[disabled]="vars.status !== AppStatus.RUNNING"
[class.launch-button-off]="vars.status !== AppStatus.RUNNING"
*ngIf="vars.ui && !isConsulate"
[disabled]="vars.status !== AppStatus.RUNNING || !isTor"
[class.launch-button-off]="vars.status !== AppStatus.RUNNING || !isTor"
class="launch-button-transparent"
(click)="launchUiTab(vars.tor)"
>

View File

@@ -100,7 +100,7 @@ export class AppInstalledListPage extends Cleanup {
}
async launchUiTab (address: string) {
console.log('launching', address)
address = address.startsWith('http') ? address : `http://${address}`
return window.open(address, '_blank')
}

View File

@@ -77,13 +77,13 @@
</ion-label>
</ion-item>
<ion-item class="no-cushion-item" *ngIf="vars.ui && !isConsulate && isTor" lines="none">
<ion-item class="no-cushion-item" *ngIf="vars.ui && !isConsulate" lines="none">
<ion-label style="margin-bottom: 10px; margin-top: 0px; display: flex; justify-content: left; align-items: center;" class="ion-text-wrap">
<ion-button fill="clear" size="small" class="launch-explanation-button" (click)="presentPopover(vars.status === 'RUNNING' ? launchDefinition() : launchOffDefinition(), $event)">
<ion-button fill="clear" size="small" class="launch-explanation-button" (click)="presentLaunchPopover(vars.status, $event)">
<ion-icon color="medium" name="information-circle-outline">
</ion-icon>
</ion-button>
<ion-button [disabled]="vars.status !== 'RUNNING'" class="launch-button" [class.launch-button-off]="vars.status !== 'RUNNING'" (click)="launchUiTab()">
<ion-button [disabled]="vars.status !== 'RUNNING' || !isTor" class="launch-button" [class.launch-button-off]="vars.status !== 'RUNNING' || !isTor" (click)="launchUiTab()">
<ion-icon style="position: absolute; z-index: 1; left: 0;" name="rocket-outline"></ion-icon>
<ion-text>LAUNCH</ion-text>
</ion-button>

View File

@@ -38,8 +38,9 @@ export class AppInstalledShowPage extends Cleanup {
isTor: boolean
dependencyDefintion = () => `<span style="font-style: italic">Dependencies</span> are other services which must be installed, configured appropriately, and started in order to start ${this.app.title.getValue()}`
launchDefinition = () => `<span style="font-style: italic">Launch A Service</span> <p>This button appears only for services that can be accessed inside the browser. If a service does not have this button, you must access it using another interface, such as a mobile app, desktop app, or another service on the Embassy. Please view the instructions for a service for details on how to use it.</p>`
launchOffDefinition = () => `<span style="font-style: italic">Launch A Service</span> <p>This button appears only for services that can be accessed inside the browser. Get your service running in order to launch!</p>`
launchDefinition = `<span style="font-style: italic">Launch A Service</span> <p>This button appears only for services that can be accessed inside the browser. If a service does not have this button, you must access it using another interface, such as a mobile app, desktop app, or another service on the Embassy. Please view the instructions for a service for details on how to use it.</p>`
launchOffDefinition = `<span style="font-style: italic">Launch A Service</span> <p>This button appears only for services that can be accessed inside the browser. Get your service running in order to launch!</p>`
launchLocalDefinition = `<span style="font-style: italic">Launch A Service</span> <p>This button appears only for services that can be accessed inside the browser. Visit your Embassy at its Tor address to launch this service!</p>`
@ViewChild(IonContent) content: IonContent
@@ -102,8 +103,8 @@ export class AppInstalledShowPage extends Cleanup {
}
async launchUiTab () {
const uiAddress = this.app.torAddress.getValue()
console.log('launching', uiAddress)
let uiAddress = this.app.torAddress.getValue()
uiAddress = uiAddress.startsWith('http') ? uiAddress : `http://${uiAddress}`
return window.open(uiAddress, '_blank')
}
@@ -273,6 +274,18 @@ export class AppInstalledShowPage extends Cleanup {
return this.navCtrl.navigateRoot('/services/installed')
}
async presentLaunchPopover (status: AppStatus, ev: any) {
let desc: string
if (!this.isTor) {
desc = this.launchLocalDefinition
} else if (status !== AppStatus.RUNNING) {
desc = this.launchOffDefinition
} else {
desc = this.launchDefinition
}
return this.presentPopover(desc, ev)
}
async presentPopover (information: string, ev: any) {
const popover = await this.popoverController.create({
component: InformationPopoverComponent,