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

Connection manager replacement #573

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ describe('AppComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});
expect(shutdownSpy).toHaveBeenCalledTimes(1);
});
Expand Down
1 change: 0 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export class AppComponent implements OnInit, OnDestroy {
};
const dialog = this.dialog.open(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});

dialog
Expand Down
8 changes: 6 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ import { SetHeadersInterceptor } from './interceptors/set-headers.interceptor';
import { BalanceWithSymbolComponent } from './components/balance-with-symbol/balance-with-symbol.component';
import { AddressIdenticonComponent } from './components/address-identicon/address-identicon.component';
import { PaymentIdentifierInputComponent } from './components/payment-identifier-input/payment-identifier-input.component';
import { QuickConnectDialogComponent } from './components/quick-connect-dialog/quick-connect-dialog.component';
import { ConnectionSelectorComponent } from './components/quick-connect-dialog/connection-selector/connection-selector.component';

const appRoutes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
Expand Down Expand Up @@ -120,6 +122,8 @@ export function ConfigLoader(raidenConfig: RaidenConfig) {
BalanceWithSymbolComponent,
AddressIdenticonComponent,
PaymentIdentifierInputComponent,
QuickConnectDialogComponent,
ConnectionSelectorComponent,
],
imports: [
RouterModule.forRoot(appRoutes),
Expand All @@ -144,7 +148,7 @@ export function ConfigLoader(raidenConfig: RaidenConfig) {
{
provide: HTTP_INTERCEPTORS,
useClass: ErrorHandlingInterceptor,
deps: [NotificationService, RaidenService],
deps: [NotificationService, RaidenService, RaidenConfig],
multi: true,
},
{
Expand Down Expand Up @@ -174,7 +178,7 @@ export function ConfigLoader(raidenConfig: RaidenConfig) {
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: Object.assign(new MatDialogConfig(), <MatDialogConfig>{
maxWidth: '90vw',
width: '500px',
width: '360px',
autoFocus: false,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
</div>
</mat-autocomplete>

<div class="icon-box" *ngIf="displayIdenticon">
<div
fxFlex="0 1 80px"
fxLayoutAlign="center"
class="icon-box"
*ngIf="displayIdenticon"
>
<img
class="icon-box__identicon"
*ngIf="address; else placeholder"
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/address-input/address-input.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
line-height: 15px;
letter-spacing: 0.35px;
color: $black;
min-width: 0;

&:disabled {
color: $text-grey;
color: $dark-grey;
background: none;
border: 1px solid $dark-grey;
}
}
}

.icon-box {
height: 100%;
margin: 0 auto;

&__identicon {
border-radius: 50%;
Expand Down
10 changes: 4 additions & 6 deletions src/app/components/channel-list/channel-list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe('ChannelListComponent', () => {

const dialogSpy = spyOn(dialog, 'open').and.callThrough();
const dialogResult: OpenDialogResult = {
tokenAddress: token1.address,
token: token1,
partnerAddress: createAddress(),
balance: new BigNumber(1000),
settleTimeout: raidenConfig.config.settle_timeout,
Expand All @@ -226,18 +226,17 @@ describe('ChannelListComponent', () => {
clickElement(fixture.debugElement, '#open-channel');

const payload: OpenDialogPayload = {
tokenAddress: '',
token: undefined,
defaultSettleTimeout: raidenConfig.config.settle_timeout,
revealTimeout: raidenConfig.config.reveal_timeout,
};
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(OpenDialogComponent, {
data: payload,
width: '360px',
});
expect(openSpy).toHaveBeenCalledTimes(1);
expect(openSpy).toHaveBeenCalledWith(
dialogResult.tokenAddress,
dialogResult.token.address,
dialogResult.partnerAddress,
dialogResult.settleTimeout,
dialogResult.balance
Expand Down Expand Up @@ -273,14 +272,13 @@ describe('ChannelListComponent', () => {
clickElement(fixture.debugElement, '#open-channel');

const payload: OpenDialogPayload = {
tokenAddress: token1.address,
token: token1,
defaultSettleTimeout: raidenConfig.config.settle_timeout,
revealTimeout: raidenConfig.config.reveal_timeout,
};
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(OpenDialogComponent, {
data: payload,
width: '360px',
});
});
});
7 changes: 3 additions & 4 deletions src/app/components/channel-list/channel-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
AfterViewInit,
} from '@angular/core';
import { Channel } from '../../models/channel';
import { EMPTY, Subject, Observable, fromEvent } from 'rxjs';
import { EMPTY, Subject, fromEvent } from 'rxjs';
import { ChannelPollingService } from '../../services/channel-polling.service';
import { amountToDecimal } from '../../utils/amount.converter';
import { UserToken } from '../../models/usertoken';
Expand Down Expand Up @@ -120,14 +120,13 @@ export class ChannelListComponent implements OnInit, OnDestroy, AfterViewInit {
const rdnConfig = this.raidenConfig.config;

const payload: OpenDialogPayload = {
tokenAddress: this.selectedToken ? this.selectedToken.address : '',
token: this.selectedToken,
revealTimeout: rdnConfig.reveal_timeout,
defaultSettleTimeout: rdnConfig.settle_timeout,
};

const dialog = this.dialog.open(OpenDialogComponent, {
data: payload,
width: '360px',
});

dialog
Expand All @@ -139,7 +138,7 @@ export class ChannelListComponent implements OnInit, OnDestroy, AfterViewInit {
}

return this.raidenService.openChannel(
result.tokenAddress,
result.token.address,
result.partnerAddress,
result.settleTimeout,
result.balance
Expand Down
4 changes: 0 additions & 4 deletions src/app/components/channel/channel.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ describe('ChannelComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(DepositWithdrawDialogComponent, {
data: payload,
width: '360px',
});
expect(depositSpy).toHaveBeenCalledTimes(1);
expect(depositSpy).toHaveBeenCalledWith(
Expand Down Expand Up @@ -151,7 +150,6 @@ describe('ChannelComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(DepositWithdrawDialogComponent, {
data: payload,
width: '360px',
});
expect(depositSpy).toHaveBeenCalledTimes(1);
expect(depositSpy).toHaveBeenCalledWith(
Expand Down Expand Up @@ -195,7 +193,6 @@ describe('ChannelComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});
expect(closeSpy).toHaveBeenCalledTimes(1);
expect(closeSpy).toHaveBeenCalledWith(
Expand Down Expand Up @@ -235,7 +232,6 @@ describe('ChannelComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});
});
});
2 changes: 0 additions & 2 deletions src/app/components/channel/channel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class ChannelComponent implements OnInit {

const dialog = this.dialog.open(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});

dialog
Expand Down Expand Up @@ -91,7 +90,6 @@ export class ChannelComponent implements OnInit {

const dialog = this.dialog.open(DepositWithdrawDialogComponent, {
data: payload,
width: '360px',
});

dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ describe('ContactListComponent', () => {
AddEditContactDialogComponent,
{
data: payload,
width: '360px',
}
);
expect(saveSpy).toHaveBeenCalledTimes(1);
Expand Down
1 change: 0 additions & 1 deletion src/app/components/contact-list/contact-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class ContactListComponent implements OnInit, OnDestroy, AfterViewInit {
addContact() {
const dialog = this.dialog.open(AddEditContactDialogComponent, {
data: { address: '', label: '', edit: false },
width: '360px',
});

dialog.afterClosed().subscribe((result?: Contact) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('ContactActionsComponent', () => {
it('should open payment dialog', () => {
const dialogSpy = spyOn(dialog, 'open').and.callThrough();
const dialogResult: PaymentDialogPayload = {
tokenAddress: token.address,
token: token,
targetAddress: contact.address,
amount: new BigNumber(10),
paymentIdentifier: undefined,
Expand All @@ -126,18 +126,17 @@ describe('ContactActionsComponent', () => {
clickElement(fixture.debugElement, '#transfer');

const payload: PaymentDialogPayload = {
tokenAddress: '',
token: undefined,
targetAddress: contact.address,
amount: undefined,
};
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(PaymentDialogComponent, {
data: payload,
width: '360px',
});
expect(initiatePaymentSpy).toHaveBeenCalledTimes(1);
expect(initiatePaymentSpy).toHaveBeenCalledWith(
dialogResult.tokenAddress,
dialogResult.token.address,
dialogResult.targetAddress,
dialogResult.amount,
dialogResult.paymentIdentifier
Expand Down Expand Up @@ -173,14 +172,13 @@ describe('ContactActionsComponent', () => {
clickElement(fixture.debugElement, '#transfer');

const payload: PaymentDialogPayload = {
tokenAddress: connectedToken.address,
token: connectedToken,
targetAddress: contact.address,
amount: undefined,
};
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(PaymentDialogComponent, {
data: payload,
width: '360px',
});
});

Expand All @@ -204,7 +202,6 @@ describe('ContactActionsComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(AddEditContactDialogComponent, {
data: payload,
width: '360px',
});
expect(saveSpy).toHaveBeenCalledTimes(1);
expect(saveSpy).toHaveBeenCalledWith(dialogResult);
Expand All @@ -224,7 +221,6 @@ describe('ContactActionsComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});
expect(deleteSpy).toHaveBeenCalledTimes(1);
expect(deleteSpy).toHaveBeenCalledWith(contact);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,13 @@ export class ContactActionsComponent implements OnInit, OnDestroy {
this.actionClicked.emit(true);

const payload: PaymentDialogPayload = {
tokenAddress: this.selectedToken ? this.selectedToken.address : '',
token: this.selectedToken,
targetAddress: this.contact.address,
amount: undefined,
};

const dialog = this.dialog.open(PaymentDialogComponent, {
data: payload,
width: '360px',
});

dialog
Expand All @@ -112,7 +111,7 @@ export class ContactActionsComponent implements OnInit, OnDestroy {
}

return this.raidenService.initiatePayment(
result.tokenAddress,
result.token.address,
result.targetAddress,
result.amount,
result.paymentIdentifier
Expand All @@ -138,7 +137,6 @@ export class ContactActionsComponent implements OnInit, OnDestroy {

const dialog = this.dialog.open(AddEditContactDialogComponent, {
data: payload,
width: '360px',
});

dialog.afterClosed().subscribe((result?: Contact) => {
Expand All @@ -159,7 +157,6 @@ export class ContactActionsComponent implements OnInit, OnDestroy {

const dialog = this.dialog.open(ConfirmationDialogComponent, {
data: payload,
width: '360px',
});

dialog.afterClosed().subscribe((result) => {
Expand Down
1 change: 0 additions & 1 deletion src/app/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ describe('HeaderComponent', () => {
expect(dialogSpy).toHaveBeenCalledTimes(1);
expect(dialogSpy).toHaveBeenCalledWith(QrCodeComponent, {
data: payload,
width: '360px',
});
});

Expand Down
1 change: 0 additions & 1 deletion src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export class HeaderComponent implements OnInit, OnDestroy {
};
this.dialog.open(QrCodeComponent, {
data: payload,
width: '360px',
});
}

Expand Down
1 change: 0 additions & 1 deletion src/app/components/open-dialog/open-dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
>
<app-token-network-selector
formControlName="token"
(tokenChanged)="tokenNetworkSelected($event)"
[showOnChainBalance]="true"
>
</app-token-network-selector>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/open-dialog/open-dialog.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
letter-spacing: 0.35px;
color: $black;
width: 100%;
min-width: 0;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/components/open-dialog/open-dialog.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('OpenDialogComponent', () => {
beforeEach(
waitForAsync(() => {
const payload: OpenDialogPayload = {
tokenAddress: token.address,
token: token,
defaultSettleTimeout: defaultSettleTimeout,
revealTimeout: revealTimeout,
};
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('OpenDialogComponent', () => {

expect(closeSpy).toHaveBeenCalledTimes(1);
expect(closeSpy).toHaveBeenCalledWith({
tokenAddress: token.address,
token: token,
partnerAddress: addressInput,
settleTimeout: defaultSettleTimeout,
balance: new BigNumber(amountInput),
Expand Down
Loading