Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

release: hotfix 1.7.1 #494

Merged
merged 12 commits into from
Feb 20, 2020
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ark.wallet.mobile" version="1.7.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.ark.wallet.mobile" version="1.7.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Ark Mobile</name>
<description>ARK</description>
<author email="[email protected]" href="http://ark.io/">Ark Ecosystem</author>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ark-mobile",
"version": "1.7.0",
"version": "1.7.1",
"author": "Ark Ecosystem <[email protected]>",
"homepage": "https://github.com/ArkEcosystem/mobile-wallet#readme",
"scripts": {
Expand Down
9 changes: 8 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ const routes: Routes = [
{
path: "network-status",
loadChildren: () =>
import("./pages/network-status/network-status.module").then(
import("./pages/network/network-status/network-status.module").then(
m => m.NetworkStatusPageModule,
),
},
{
path: "network-overview",
loadChildren: () =>
import(
"./pages/network/network-overview/network-overview.module"
).then(m => m.NetworkOverviewPageModule),
},
{
path: "login",
loadChildren: () =>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/address-list/address-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h3 class="item-title">{{ item.key }}</h3>
color="medium"
fill="clear"
class="more disable-hover"
*ngIf="icon"
*ngIf="icon && item.hasMore"
(click)="onMore(item.index)"
>
<ion-icon slot="icon-only" [name]="icon"></ion-icon>
Expand Down
50 changes: 0 additions & 50 deletions src/app/components/amount/amount.html

This file was deleted.

4 changes: 0 additions & 4 deletions src/app/components/amount/amount.model.ts

This file was deleted.

111 changes: 0 additions & 111 deletions src/app/components/amount/amount.ts

This file was deleted.

33 changes: 33 additions & 0 deletions src/app/components/input-amount/input-amount.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<ion-row>
<ion-col>
<ion-grid no-padding class="amount-container">
<ion-row>
<ion-col class="pl-0">
<ion-item>
<ion-label position="stacked">{{
currentNetwork?.token
}}</ion-label>
<input-currency
name="amount"
formControlName="amount"
[fractionDigits]="tokenFractionDigits"
placeholder="0"
></input-currency>
</ion-item>
</ion-col>
<ion-col class="ml-1 pr-0" appMarketNetOnly>
<ion-item>
<ion-label position="stacked">{{
marketCurrency?.code | uppercase
}}</ion-label>
<input-currency
name="amountEquivalent"
formControlName="amountEquivalent"
[fractionDigits]="fiatFractionDigits"
></input-currency>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</ion-col>
</ion-row>
83 changes: 83 additions & 0 deletions src/app/components/input-amount/input-amount.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import * as constants from "@/app/app.constants";
import { MarketCurrency } from "@/models/model";
import { MarketDataProvider } from "@/services/market-data/market-data";
import { SettingsDataProvider } from "@/services/settings-data/settings-data";
import { UserDataProvider } from "@/services/user-data/user-data";
import BigNumber, { SafeBigNumber } from "@/utils/bignumber";
import { Component, OnInit } from "@angular/core";
import {
ControlContainer,
FormControl,
FormGroupDirective,
} from "@angular/forms";
import { Network } from "ark-ts/model";

@Component({
selector: "input-amount",
templateUrl: "input-amount.component.html",
styleUrls: ["input-amount.component.scss"],
viewProviders: [
{
provide: ControlContainer,
useExisting: FormGroupDirective,
},
],
})
export class InputAmountComponent implements OnInit {
public tokenFractionDigits = constants.ARKTOSHI_DP;
public fiatFractionDigits = 2;
public marketCurrency: MarketCurrency;
public currentNetwork: Network;

public constructor(
private userDataProvider: UserDataProvider,
private marketDataProvider: MarketDataProvider,
private settingsDataProvider: SettingsDataProvider,
private parentForm: FormGroupDirective,
) {
this.currentNetwork = this.userDataProvider.currentNetwork;
}

public ngOnInit() {
this.parentForm.form.addControl("amount", new FormControl("amount"));
this.parentForm.form.addControl(
"amountEquivalent",
new FormControl("amountEquivalent"),
);

this.parentForm.form.controls.amount.valueChanges.subscribe(value =>
this.onInputToken(value),
);
this.parentForm.form.controls.amountEquivalent.valueChanges.subscribe(
value => this.onInputFiat(value),
);

this.marketDataProvider.ticker.subscribe(ticker => {
this.settingsDataProvider.settings.subscribe(settings => {
this.marketCurrency = ticker.getCurrency({
code: settings.currency,
});
this.fiatFractionDigits =
this.marketCurrency.code === "btc" ? 8 : 3;
});
});
}

public onInputToken(currency: string | BigNumber) {
const fiatAmount = new SafeBigNumber(currency).multipliedBy(
this.marketCurrency.price,
);
this.parentForm.form.controls.amountEquivalent.setValue(fiatAmount, {
emitEvent: false,
});
}

public onInputFiat(currency: string | BigNumber) {
const tokenAmount = new SafeBigNumber(currency).dividedBy(
this.marketCurrency.price,
);
this.parentForm.form.controls.amount.setValue(tokenAmount, {
emitEvent: false,
});
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { AmountComponent } from "@/components/amount/amount";
import { InputAmountComponent } from "@/components/input-amount/input-amount.component";
import { DirectivesModule } from "@/directives/directives.module";
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { IonicModule } from "@ionic/angular";
import { InputCurrencyComponentModule } from "../input-currency/input-currency.module";

@NgModule({
declarations: [AmountComponent],
declarations: [InputAmountComponent],
imports: [
IonicModule,
FormsModule,
CommonModule,
InputCurrencyComponentModule,
ReactiveFormsModule,
DirectivesModule,
CommonModule,
],
exports: [AmountComponent],
exports: [InputAmountComponent],
})
export class AmountComponentModule {}
export class InputAmountComponentModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ion-input
[formControl]="formControl"
[name]="name"
[placeholder]="placeholder"
[disabled]="isDisabled"
(ionBlur)="onTouched()"
inputmode="decimal"
>
</ion-input>
Loading