fix duplicate patch updates, add scroll button to setup success (#1800)

* fix duplicate patch updates, add scroll button to setup success

* update path

* update patch

* update patch
This commit is contained in:
Matt Hill
2022-09-14 11:24:22 -06:00
committed by GitHub
parent 67743b37bb
commit 40d47c9f44
11 changed files with 86 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
<ion-content>
<ion-content [scrollEvents]="true" (ionScrollEnd)="checkBottom()">
<ion-grid>
<ion-row>
<ion-col>
@@ -147,8 +147,27 @@
</p>
</div>
</ion-card-content>
<div id="bottom-div"></div>
</ion-card>
<!-- scroll down -->
<div
[ngStyle]="{
position: 'fixed',
bottom: isOnBottom ? '-42px' : '24px',
transition: 'bottom 0.15s ease-out 0s',
right: '50%',
width: '120px',
'margin-right': '-60px',
'z-index': '1000'
}"
>
<ion-button color="warning" (click)="scrollToBottom()">
More
<ion-icon slot="end" name="chevron-down"></ion-icon>
</ion-button>
</div>
<!-- cert elem -->
<a hidden id="install-cert" download="embassy.crt"></a>

View File

@@ -1,6 +1,12 @@
import { DOCUMENT } from '@angular/common'
import { Component, EventEmitter, Inject, Output } from '@angular/core'
import { ToastController } from '@ionic/angular'
import {
Component,
EventEmitter,
Inject,
Output,
ViewChild,
} from '@angular/core'
import { IonContent, ToastController } from '@ionic/angular'
import {
copyToClipboard,
DownloadHTMLService,
@@ -15,8 +21,13 @@ import { StateService } from 'src/app/services/state.service'
providers: [DownloadHTMLService],
})
export class SuccessPage {
@ViewChild(IonContent)
private content?: IonContent
@Output() onDownload = new EventEmitter()
isOnBottom = true
constructor(
@Inject(DOCUMENT) private readonly document: Document,
private readonly toastCtrl: ToastController,
@@ -38,6 +49,8 @@ export class SuccessPage {
}
async ngAfterViewInit() {
setTimeout(() => this.checkBottom(), 42)
try {
await this.stateService.completeEmbassy()
this.document
@@ -88,4 +101,16 @@ export class SuccessPage {
let html = this.document.getElementById('downloadable')?.innerHTML || ''
this.downloadHtml.download('embassy-info.html', html)
}
checkBottom() {
const bottomDiv = document.getElementById('bottom-div')
console.error(bottomDiv)
this.isOnBottom =
!!bottomDiv &&
bottomDiv.getBoundingClientRect().top - 192 < window.innerHeight
}
scrollToBottom() {
this.content?.scrollToBottom(250)
}
}

View File

@@ -44,7 +44,7 @@ export class RPCEncryptedService {
.then(res => JSON.parse(res))
.catch(e => {
if (!e.status && !e.statusText) {
throw new EncryptionError()
throw new NetworkError()
} else {
throw new HttpError(e)
}
@@ -54,9 +54,10 @@ export class RPCEncryptedService {
}
}
class EncryptionError {
class NetworkError {
readonly code = null
readonly message = 'Invalid Key'
readonly message =
'Network Error. Please try refreshing the page or clearing your browser cache'
readonly details = null
}