<commit_before>import { ChangeDetectorRef, Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Events, NavController, NavParams } from 'ionic-angular';

// Pages
import { ScanPage } from '../../scan/scan';
import { WalletConnectRequestDetailsPage } from './wallet-connect-request-details/wallet-connect-request-details';

// Providers
import {
  ActionSheetProvider,
  AnalyticsProvider,
  ErrorsProvider,
  Logger,
  OnGoingProcessProvider,
  PersistenceProvider,
  PlatformProvider,
  PopupProvider,
  ProfileProvider,
  ReplaceParametersProvider,
  WalletConnectProvider
} from '../../../providers';

import * as _ from 'lodash';
import { animate, style, transition, trigger } from '@angular/animations';
@Component({
  selector: 'page-wallet-connect',
  templateUrl: 'wallet-connect.html',
  animations: [
    trigger('fadeUp', [
      transition(':enter', [
        style({
          transform: 'translateY(5px)',
          opacity: 0
        }),
        animate('300ms')
      ])
    ]),
    trigger('fadeOut', [
      transition(':leave', [
        animate('200ms', style({
          opacity: 0
        }),)
      ])
    ]),
  ]
})
export class WalletConnectPage {
  public uri: string = '';
  public fromWalletConnect: boolean;
  private wallets;
  public isCordova: boolean;
  public peerMeta: {
    description: string;
    url: string;
    icons: string[];
    name: string;
    ssl?: boolean;
  };
  public requests: any[] = [];
  public connected: boolean = false;
  public wallet;
  public address: string;
  public activeChainId: number = 1;
  public showDappInfo: boolean;
  public title: string;
  public sessionRequestLabel: string;
  public showWalletSelector: boolean = false;
  public dappImgSrc: string;
  public loading: boolean = false;
  public defaultImgSrc: string = 'assets/img/wallet-connect/icon-dapp.svg';
  private isEventLogged: boolean = false;
  private walletId: string;
  public exiting: boolean;

  constructor(
    private actionSheetProvider: ActionSheetProvider,
    private logger: Logger,
    private navParams: NavParams,
    private persistenceProvider: PersistenceProvider,
    private profileProvider: ProfileProvider,
    private translate: TranslateService,
    private walletConnectProvider: WalletConnectProvider,
    private errorsProvider: ErrorsProvider,
    private popupProvider: PopupProvider,
    private analyticsProvider: AnalyticsProvider,
    private navCtrl: NavController,
    private events: Events,
    private platformProvider: PlatformProvider,
    private replaceParametersProvider: ReplaceParametersProvider,
    private onGoingProcessProvider: OnGoingProcessProvider,
    private changeRef: ChangeDetectorRef
  ) {
    this.isCordova = this.platformProvider.isCordova;
    this.uri = this.navParams.data.uri;
    this.showDappInfo = this.uri ? true : false;
    this.walletId = this.navParams.data.walletId;
    if (!this.walletId) this.showWalletSelector = true;
    this.wallet = this.profileProvider.getWallet(this.walletId);
    this.fromWalletConnect = this.navParams.data.fromWalletConnect;
    this.events.subscribe('Local/UriScan', this.updateAddressHandler);
    this.events.subscribe('Update/ConnectionData', this.setConnectionData);
    this.events.subscribe('Update/Requests', this.setRequests);
    this.wallets = this.profileProvider.getWallets({
      coin: 'eth',
      onlyComplete: true,
      backedUp: true,
      m: 1,
      n: 1
    });
    this.uri &&
    !this.navParams.data.activePage &&
    !this.navParams.data.isDeepLink
      ? this.initWalletConnect()
      : this.initWallet();
  }

  ionViewWillLeave() {
    this.exiting = true;
    this.onGoingProcessProvider.clear();
  }
  ngOnDestroy() {
    this.events.unsubscribe('Local/UriScan', this.updateAddressHandler);
    this.events.unsubscribe('Update/ConnectionData', this.setConnectionData);
    this.events.unsubscribe('Update/Requests', this.setRequests);
  }
<commit_msg>if disconnected from client adding a navCtrl pop<commit_after>import { ChangeDetectorRef, Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Events, NavController, NavParams } from 'ionic-angular';

// Pages
import { ScanPage } from '../../scan/scan';
import { WalletConnectRequestDetailsPage } from './wallet-connect-request-details/wallet-connect-request-details';

// Providers
import {
  ActionSheetProvider,
  AnalyticsProvider,
  ErrorsProvider,
  Logger,
  OnGoingProcessProvider,
  PersistenceProvider,
  PlatformProvider,
  PopupProvider,
  ProfileProvider,
  ReplaceParametersProvider,
  WalletConnectProvider
} from '../../../providers';

import * as _ from 'lodash';
import { animate, style, transition, trigger } from '@angular/animations';
@Component({
  selector: 'page-wallet-connect',
  templateUrl: 'wallet-connect.html',
  animations: [
    trigger('fadeUp', [
      transition(':enter', [
        style({
          transform: 'translateY(5px)',
          opacity: 0
        }),
        animate('300ms')
      ])
    ]),
    trigger('fadeOut', [
      transition(':leave', [
        animate('200ms', style({
          opacity: 0
        }),)
      ])
    ]),
  ]
})
export class WalletConnectPage {
  public uri: string = '';
  public fromWalletConnect: boolean;
  private wallets;
  public isCordova: boolean;
  public peerMeta: {
    description: string;
    url: string;
    icons: string[];
    name: string;
    ssl?: boolean;
  };
  public requests: any[] = [];
  public connected: boolean = false;
  public wallet;
  public address: string;
  public activeChainId: number = 1;
  public showDappInfo: boolean;
  public title: string;
  public sessionRequestLabel: string;
  public showWalletSelector: boolean = false;
  public dappImgSrc: string;
  public loading: boolean = false;
  public defaultImgSrc: string = 'assets/img/wallet-connect/icon-dapp.svg';
  private isEventLogged: boolean = false;
  private walletId: string;
  public exiting: boolean;

  constructor(
    private actionSheetProvider: ActionSheetProvider,
    private logger: Logger,
    private navParams: NavParams,
    private persistenceProvider: PersistenceProvider,
    private profileProvider: ProfileProvider,
    private translate: TranslateService,
    private walletConnectProvider: WalletConnectProvider,
    private errorsProvider: ErrorsProvider,
    private popupProvider: PopupProvider,
    private analyticsProvider: AnalyticsProvider,
    private navCtrl: NavController,
    private events: Events,
    private platformProvider: PlatformProvider,
    private replaceParametersProvider: ReplaceParametersProvider,
    private onGoingProcessProvider: OnGoingProcessProvider,
    private changeRef: ChangeDetectorRef
  ) {
    this.isCordova = this.platformProvider.isCordova;
    this.uri = this.navParams.data.uri;
    this.showDappInfo = this.uri ? true : false;
    this.walletId = this.navParams.data.walletId;
    if (!this.walletId) this.showWalletSelector = true;
    this.wallet = this.profileProvider.getWallet(this.walletId);
    this.fromWalletConnect = this.navParams.data.fromWalletConnect;
    this.events.subscribe('Local/UriScan', this.updateAddressHandler);
    this.events.subscribe('Update/ConnectionData', this.setConnectionData);
    this.events.subscribe('Update/Requests', this.setRequests);
    this.events.subscribe('Update/WalletConnectDisconnected', () => this.navCtrl.pop());

    this.wallets = this.profileProvider.getWallets({
      coin: 'eth',
      onlyComplete: true,
      backedUp: true,
      m: 1,
      n: 1
    });
    this.uri &&
    !this.navParams.data.activePage &&
    !this.navParams.data.isDeepLink
      ? this.initWalletConnect()
      : this.initWallet();
  }

  ionViewWillLeave() {
    this.exiting = true;
    this.onGoingProcessProvider.clear();
  }
  ngOnDestroy() {
    this.events.unsubscribe('Local/UriScan', this.updateAddressHandler);
    this.events.unsubscribe('Update/ConnectionData', this.setConnectionData);
    this.events.unsubscribe('Update/Requests', this.setRequests);
  }

{'fraction_non_alphanumeric': 0.1127614803812353, 'fraction_numerical': 0.0029706646862235424, 'mean_word_length': 3.821002386634845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3015630', 'n_tokens_mistral': 2325, 'n_tokens_neox': 2305, 'n_words': 503}