Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add qr code to insights->about->tor #2379

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IonicModule } from '@ionic/angular'
import { ServerSpecsPage } from './server-specs.page'
import { EmverPipesModule } from '@start9labs/shared'
import { TuiLetModule } from '@taiga-ui/cdk'
import { QRComponentModule } from 'src/app/components/qr/qr.component.module'

const routes: Routes = [
{
Expand All @@ -18,6 +19,7 @@ const routes: Routes = [
CommonModule,
IonicModule,
RouterModule.forChild(routes),
QRComponentModule,
EmverPipesModule,
TuiLetModule,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,27 @@ <h2>Git Hash</h2>
<h2>Tor</h2>
<p>{{ server['tor-address'] }}</p>
</ion-label>
<ion-button slot="end" fill="clear" (click)="copy(server['tor-address'])">
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
</ion-button>
<div slot="end">
<ion-button
fill="clear"
(click)="showQR(server['tor-address'])"
>
<ion-icon
slot="icon-only"
name="qr-code-outline"
size="small"
></ion-icon>
</ion-button>
<ion-button
fill="clear"
(click)="copy(server['tor-address'])">
<ion-icon
slot="icon-only"
name="copy-outline"
size="small"
></ion-icon>
</ion-button>
</div>
</ion-item>
<ion-item>
<ion-label class="break-all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'
import { ToastController } from '@ionic/angular'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { ToastController } from '@ionic/angular'
import { ModalController, ToastController } from '@ionic/angular'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot comment on the direct line, but you also need to add the following to the class constructor:

private readonly modalCtrl: ModalController,

so its finalized form should look like:

  constructor(
    private readonly toastCtrl: ToastController,
    private readonly modalCtrl: ModalController,
    private readonly patch: PatchDB<DataModel>,
    private readonly config: ConfigService,
  ) {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @elvece thank you for testing it so quickly! 🚀 Committed the fix.

import { PatchDB } from 'patch-db-client'
import { ConfigService } from 'src/app/services/config.service'
import { QRComponent } from 'src/app/components/qr/qr.component'
import { copyToClipboard } from '@start9labs/shared'
import { DataModel } from 'src/app/services/patch-db/data-model'

Expand Down Expand Up @@ -40,6 +41,17 @@ export class ServerSpecsPage {
await toast.present()
}

async showQR(text: string): Promise<void> {
const modal = await this.modalCtrl.create({
component: QRComponent,
componentProps: {
text,
},
cssClass: 'qr-modal',
})
await modal.present()
}

asIsOrder(a: any, b: any) {
return 0
}
Expand Down