Skip to content

Commit

Permalink
Merge branch 'feat/add-operation-support' into 'master'
Browse files Browse the repository at this point in the history
Feat/add operation support

See merge request papers/airgap/beacon-extension!5
  • Loading branch information
AndreasGassmann committed Feb 13, 2020
2 parents 96f2ee4 + 2f7d2f6 commit 2cb8f14
Show file tree
Hide file tree
Showing 50 changed files with 7,112 additions and 3,383 deletions.
8 changes: 2 additions & 6 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumError": "8mb"
}
]
},
Expand Down Expand Up @@ -127,11 +127,7 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"exclude": ["**/node_modules/**"]
}
},
Expand Down
8,695 changes: 5,597 additions & 3,098 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 22 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,50 @@
"prettier": "npx prettier --write 'src/**/*'",
"sonar-scanner": "sonar-scanner",
"extension:build": "ionic build && node ./scripts/copy-extension-files.js",
"extension:build:prod": "ionic build --prod && node ./scripts/copy-extension-files.js",
"extension:build:prod": "rm -rf node_modules/.cache/ && ionic build --prod && node ./scripts/copy-extension-files.js",
"prepare-prod-build": "npm run disable-pure-getters && npm run configure-mangle",
"disable-pure-getters": "replace 'pure_getters: buildOptions.buildOptimizer' 'pure_getters: false' ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js ",
"configure-mangle": "replace 'safari10: true' 'safari10: true, keep_fnames: true' ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js "
},
"private": true,
"dependencies": {
"@airgap/beacon-sdk": "0.0.1-beta.17",
"@angular/common": "^9.0.0-rc.6",
"@angular/core": "^9.0.0-rc.6",
"@angular/forms": "^9.0.0-rc.6",
"@angular/platform-browser": "^9.0.0-rc.6",
"@angular/platform-browser-dynamic": "^9.0.0-rc.6",
"@angular/router": "^9.0.0-rc.6",
"@airgap/beacon-sdk": "0.0.1-beta.18",
"@angular/common": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
"@angular/platform-browser": "^9.0.0",
"@angular/platform-browser-dynamic": "^9.0.0",
"@angular/router": "^9.0.0",
"@download/blockies": "^1.0.3",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "5.0.0-beta.2",
"airgap-coin-lib": "^0.6.2",
"@ionic/angular": "5.0.0",
"airgap-coin-lib": "0.7.3-beta.0",
"angular2-qrcode": "^2.0.3",
"bignumber.js": "^9.0.0",
"bip39": "^3.0.2",
"core-js": "^2.5.4",
"matrix-js-sdk": "^2.4.6",
"moment": "^2.24.0",
"myetherwallet-blockies": "^0.1.1",
"ngx-moment": "^3.5.0",
"qrcode-generator": "^1.4.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.4.1",
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "^9.0.0-rc.6",
"@angular-devkit/schematics": "^9.0.0-rc.6",
"@angular/cli": "^9.0.0-rc.6",
"@angular/compiler": "^9.0.0-rc.6",
"@angular/compiler-cli": "^9.0.0-rc.6",
"@angular/language-service": "^9.0.0-rc.6",
"@ionic/angular-toolkit": "^2.1.1",
"@angular-devkit/architect": "~0.900.1",
"@angular-devkit/build-angular": "~0.900.1",
"@angular-devkit/core": "^9.0.1",
"@angular-devkit/schematics": "^9.0.1",
"@angular/cli": "^9.0.1",
"@angular/compiler": "^9.0.0",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@ionic/angular-toolkit": "^2.1.2",
"@types/bip39": "^3.0.0",
"@types/chrome": "0.0.91",
"@types/jasmine": "~3.3.8",
Expand All @@ -81,7 +83,7 @@
"tslint-config-prettier": "^1.18.0",
"tslint-config-valorsoft": "^2.2.1",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "~3.6.4"
"typescript": "~3.7.5"
},
"description": "An Ionic project"
}
6 changes: 5 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router'
const routes: Routes = [
{
path: '',
redirectTo: 'pair',
redirectTo: 'home',
pathMatch: 'full'
},
{
Expand All @@ -27,6 +27,10 @@ const routes: Routes = [
{
path: 'beacon-request',
loadChildren: () => import('./pages/beacon-request/beacon-request.module').then(m => m.BeaconRequestPageModule)
},
{
path: 'home',
loadChildren: () => import('./pages/home/home.module').then(m => m.HomePageModule)
}
]

Expand Down
63 changes: 40 additions & 23 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { Serializer } from '@airgap/beacon-sdk/dist/client/Serializer'
import { BaseMessage } from '@airgap/beacon-sdk/dist/messages/Messages'
import { Component } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { SplashScreen } from '@ionic-native/splash-screen/ngx'
import { StatusBar } from '@ionic-native/status-bar/ngx'
import { ModalController, Platform } from '@ionic/angular'
import { ModalController } from '@ionic/angular'
import { map } from 'rxjs/operators'

import { BeaconRequestPage } from './pages/beacon-request/beacon-request.page'
import { SettingsService } from './services/settings.service'

export function isUnknownObject(x: unknown): x is { [key in PropertyKey]: unknown } {
return x !== null && typeof x === 'object'
Expand All @@ -20,40 +19,58 @@ export function isUnknownObject(x: unknown): x is { [key in PropertyKey]: unknow
})
export class AppComponent {
public appPages = [
{
title: 'Home',
url: '/home',
icon: 'home'
},
{
title: 'Pair',
url: '/pair',
icon: 'code-working'
},
{
title: 'Local Mnemonic',
url: '/local-mnemonic',
icon: 'list'
},
{
title: 'Settings',
url: '/settings',
icon: 'settings'
}

// {
// title: 'Settings',
// url: '/settings',
// icon: 'settings'
// }
]

constructor(
private readonly platform: Platform,
private readonly splashScreen: SplashScreen,
private readonly statusBar: StatusBar,
private readonly activatedRoute: ActivatedRoute,
private readonly modalController: ModalController
private readonly modalController: ModalController,
private readonly settingsService: SettingsService
) {
this.initializeApp()
}

public initializeApp() {
if (this.platform.is('cordova')) {
this.platform.ready().then(() => {
this.statusBar.styleDefault()
this.splashScreen.hide()
})
}
const menu = [
{
title: 'Home',
url: '/home',
icon: 'home'
}

// {
// title: 'Settings',
// url: '/settings',
// icon: 'settings'
// }
]

this.settingsService.getDevSettingsEnabled().subscribe(enabled => {
this.appPages = [...menu]

if (enabled) {
this.appPages.push({
title: 'Local Mnemonic',
url: '/local-mnemonic',
icon: 'list'
})
}
})

const data = this.activatedRoute.queryParamMap.pipe(map(params => params.get('d')))
data.subscribe(res => {
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { RouteReuseStrategy } from '@angular/router'
import { SplashScreen } from '@ionic-native/splash-screen/ngx'
import { StatusBar } from '@ionic-native/status-bar/ngx'
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'
import { MomentModule } from 'ngx-moment'

import { AppRoutingModule } from './app-routing.module'
import { AppComponent } from './app.component'
Expand All @@ -14,7 +15,7 @@ import { PipesModule } from './pipes/pipes.module'
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ComponentsModule, PipesModule],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ComponentsModule, PipesModule, MomentModule],
providers: [
StatusBar,
SplashScreen,
Expand Down
15 changes: 15 additions & 0 deletions src/app/components/address-row/address-row.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ion-row lines="none" class="ion-no-padding ion-align-items-center">
<ion-col size="3">
<ion-row class="ion-justify-content-center">
<ion-col class="ion-justify-content-center">
<ion-avatar class="ion-justify-content-center ion-align-items-center">
<identicon [address]="address"></identicon>
</ion-avatar>
</ion-col>
</ion-row>
</ion-col>
<ion-col size="9">
<ion-label position="stacked" *ngIf="label">{{ label }}</ion-label>
<p class="typography--mono ion-no-margin">{{ address }}</p>
</ion-col>
</ion-row>
7 changes: 7 additions & 0 deletions src/app/components/address-row/address-row.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
identicon {
width: 48px;
height: 48px;
}
.ion-justify-content-center {
display: flex;
}
24 changes: 24 additions & 0 deletions src/app/components/address-row/address-row.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { AddressRowComponent } from './address-row.component';

describe('AddressRowComponent', () => {
let component: AddressRowComponent;
let fixture: ComponentFixture<AddressRowComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddressRowComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(AddressRowComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
});
14 changes: 14 additions & 0 deletions src/app/components/address-row/address-row.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, Input } from '@angular/core'

@Component({
selector: 'address-row',
templateUrl: './address-row.component.html',
styleUrls: ['./address-row.component.scss']
})
export class AddressRowComponent {
@Input()
public label: string | undefined

@Input()
public address: string | undefined
}
11 changes: 8 additions & 3 deletions src/app/components/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { IonicModule } from '@ionic/angular'
import { MomentModule } from 'ngx-moment'

import { PipesModule } from '../pipes/pipes.module'

import { AddressRowComponent } from './address-row/address-row.component'
import { FromToComponent } from './from-to/from-to.component'
import { IdenticonComponent } from './identicon/identicon.component'

@NgModule({
declarations: [IdenticonComponent],
imports: [IonicModule, CommonModule, FormsModule, ReactiveFormsModule],
exports: [IdenticonComponent]
declarations: [IdenticonComponent, FromToComponent, AddressRowComponent],
imports: [IonicModule, CommonModule, FormsModule, ReactiveFormsModule, PipesModule, MomentModule],
exports: [IdenticonComponent, FromToComponent, AddressRowComponent]
})
export class ComponentsModule {}
58 changes: 58 additions & 0 deletions src/app/components/from-to/from-to.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<ng-container *ngIf="transaction">
<address-row *ngFor="let address of transaction.from" [address]="address" label="From"></address-row>

<ion-row class="ion-align-items-center">
<ion-col size="3" class="ion-no-padding">
<ion-row class="ion-justify-content-center"><div class="line"></div></ion-row>
</ion-col>
<ion-col size="9" class="ion-padding-bottom">
<ion-label position="stacked" class="ion-text-uppercase">AMOUNT</ion-label>
<div class="ion-padding-bottom">
<span class="typography--mono ion-padding-bottom">
{{
transaction.amount | amountConverter: { protocolIdentifier: transaction.protocolIdentifier, maxDigits: 10 }
}}
</span>
</div>

<ng-container *ngIf="transaction.fee">
<ion-label position="stacked" class="ion-text-uppercase">FEE</ion-label>
<div [ngClass]="transaction.timestamp || transaction.data ? 'ion-padding-bottom' : ''">
<span class="typography--mono">
{{ transaction.fee | feeConverter: { protocolIdentifier: transaction.protocolIdentifier } }}
</span>
</div>
</ng-container>

<ng-container *ngIf="transaction.timestamp">
<ion-label position="stacked" class="ion-text-uppercase">
Time
</ion-label>
<div [ngClass]="transaction.data ? 'ion-padding-bottom' : ''">
{{
transaction.timestamp | amFromUnix | amCalendar: { sameDay: '[Today at] HH:mm', sameElse: 'HH:mm [on] LL' }
}}
</div>
</ng-container>

<ng-container *ngIf="transaction.data">
<ion-label position="stacked" class="ion-text-uppercase">Data</ion-label>
<div>
{{ transaction.data }}
</div>
</ng-container>
</ion-col>
</ion-row>

<address-row *ngFor="let address of transaction.to" [address]="address" label="To"></address-row>

<ion-row class="rawdata--container" *ngIf="transaction.transactionDetails">
<ion-col class="ion-no-padding">
<ion-item class="ion-no-padding" lines="none">
<ion-label>Display extra transaction details</ion-label>
<ion-toggle [(ngModel)]="displayRawData" slot="end"></ion-toggle>
</ion-item>
<pre *ngIf="displayRawData" class="ion-no-margin">{{ transaction.transactionDetails | json }}</pre>
</ion-col>
</ion-row>
</ng-container>
16 changes: 16 additions & 0 deletions src/app/components/from-to/from-to.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.line {
border-left: 1px solid var(--ion-color-dark);
height: 96px;
}
.rawdata--container {
pre {
background-color: var(--ion-color-grayLight);
padding: 8px;
}
}
.rawdata--container.ios {
margin-bottom: 48px;
}
.rawdata--container.md {
margin-bottom: var(--margin-bottom);
}
Loading

0 comments on commit 2cb8f14

Please sign in to comment.