last minute changes

This commit is contained in:
Drew Ansbacher
2022-02-27 17:58:11 -07:00
committed by Aiden McClelland
parent a6e00449f6
commit df16943502
8 changed files with 108 additions and 61 deletions

View File

@@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core'
import { ModalController, IonicSafeString } from '@ionic/angular'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { getErrorMessage } from 'src/app/services/error-toast.service'
import { pauseFor } from '../../../../../shared/src/util/misc.util'
@Component({
selector: 'markdown',
@@ -25,6 +26,11 @@ export class MarkdownPage {
if (!this.content) {
this.content = await this.embassyApi.getStatic(this.contentUrl)
}
} catch (e) {
this.loadingError = getErrorMessage(e)
} finally {
this.loading = false
await pauseFor(50)
const links = document.links
for (let i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
@@ -33,10 +39,6 @@ export class MarkdownPage {
links[i].className += ' externalLink'
}
}
} catch (e) {
this.loadingError = getErrorMessage(e)
} finally {
this.loading = false
}
}

View File

@@ -108,8 +108,11 @@ export class AppShowStatusComponent {
async stop(): Promise<void> {
const { id, title, version } = this.pkg.manifest
const hasDependents = !!Object.keys(
this.pkg.installed['current-dependents'],
).filter(depId => depId !== this.pkg.manifest.id).length
if (isEmptyObject(this.pkg.installed['current-dependents'])) {
if (!hasDependents) {
const loader = await this.loadingCtrl.create({
message: `Stopping...`,
spinner: 'lines',

View File

@@ -90,7 +90,7 @@ export class MarketplacesPage {
async presentAction(id: string) {
// no need to view actions if is selected marketplace
if (id === this.patch.getData().ui.marketplace['selected-id']) return
if (id === this.patch.getData().ui.marketplace?.['selected-id']) return
const buttons: ActionSheetButton[] = [
{

View File

@@ -79,7 +79,9 @@
<!-- not loading -->
<ng-container *ngIf="!loading && wifi.country">
<ion-item-divider>Saved Networks</ion-item-divider>
<ion-item-divider *ngIf="!(wifi.ssids | empty)"
>Saved Networks</ion-item-divider
>
<ion-item
button
detail="false"
@@ -126,38 +128,40 @@
</ion-item>
<ion-item-divider>Available Networks</ion-item-divider>
<ion-item
button
detail="false"
*ngFor="let avWifi of wifi['available-wifi']"
(click)="presentModalAdd(avWifi.ssid, !!avWifi.security.length)"
>
<ion-label>{{ avWifi.ssid }}</ion-label>
<img
*ngIf="avWifi.strength < 5"
slot="end"
src="assets/img/icons/wifi-1.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 5 && avWifi.strength < 50"
slot="end"
src="assets/img/icons/wifi-1.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 50 && avWifi.strength < 90"
slot="end"
src="assets/img/icons/wifi-2.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 90"
slot="end"
src="assets/img/icons/wifi-3.png"
style="max-width: 32px"
/>
</ion-item>
<ng-container *ngFor="let avWifi of wifi['available-wifi']">
<ion-item
button
detail="false"
(click)="presentModalAdd(avWifi.ssid, !!avWifi.security.length)"
*ngIf="avWifi.ssid"
>
<ion-label>{{ avWifi.ssid }}</ion-label>
<img
*ngIf="avWifi.strength < 5"
slot="end"
src="assets/img/icons/wifi-1.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 5 && avWifi.strength < 50"
slot="end"
src="assets/img/icons/wifi-1.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 50 && avWifi.strength < 90"
slot="end"
src="assets/img/icons/wifi-2.png"
style="max-width: 32px"
/>
<img
*ngIf="avWifi.strength >= 90"
slot="end"
src="assets/img/icons/wifi-3.png"
style="max-width: 32px"
/>
</ion-item>
</ng-container>
<ion-item button detail="false" (click)="presentModalAdd()">
<ion-icon slot="start" name="add" size="large"></ion-icon>
<ion-label>Join other network</ion-label>

View File

@@ -40,8 +40,16 @@ export class WifiPage {
) {}
async ngOnInit() {
await this.getWifi()
}
async getWifi(timeout?: number): Promise<void> {
this.loading = true
try {
await this.getWifi()
this.wifi = await this.api.getWifi({}, timeout)
if (!this.wifi.country) {
await this.presentAlertCountry()
}
} catch (e) {
this.errToast.present(e)
} finally {
@@ -49,13 +57,6 @@ export class WifiPage {
}
}
async getWifi(timeout?: number): Promise<void> {
this.wifi = await this.api.getWifi({}, timeout)
if (!this.wifi.country) {
await this.presentAlertCountry()
}
}
async presentAlertCountry(): Promise<void> {
if (!this.config.isLan) {
const alert = await this.alertCtrl.create({

View File

@@ -1017,6 +1017,11 @@ export module Mock {
strength: 99,
security: ['1', '2', '3'],
},
{
ssid: '',
strength: 40,
security: [],
},
],
}