<commit_before>//
//  TxListViewModel.swift
//  breadwallet
//
//  Created by <NAME> on 2018-01-13.
//  Copyright © 2018 breadwallet LLC. All rights reserved.
//

import UIKit

/// View model of a transaction in list view
struct TxListViewModel: TxViewModel {
    
    // MARK: - Properties
    
    let tx: Transaction
    
    var shortDescription: String {
        let isComplete = tx.status == .complete
        
        if let comment = comment, comment.count > 0, isComplete {
            return comment
        } else {
            var format: String
            switch tx.direction {
            case .sent, .moved:
                format = isComplete ? S.Transaction.sentTo : S.Transaction.sendingTo
            case .received:
                format = isComplete ? S.Transaction.receivedVia : S.Transaction.receivingVia
            }
            return String(format: format, tx.toAddress)
        }
    }

    func amount(isBtcSwapped: Bool, rate: Rate) -> NSAttributedString {
        guard let tx = tx as? BtcTransaction else { return NSAttributedString(string: "") }
        let text = DisplayAmount(amount: Satoshis(rawValue: tx.amount),<commit_msg>omit bitcoincash: address prefix in the tx list, fixes IOS-518<commit_after>//
//  TxListViewModel.swift
//  breadwallet
//
//  Created by <NAME> on 2018-01-13.
//  Copyright © 2018 breadwallet LLC. All rights reserved.
//

import UIKit

/// View model of a transaction in list view
struct TxListViewModel: TxViewModel {
    
    // MARK: - Properties
    
    let tx: Transaction
    
    var shortDescription: String {
        let isComplete = tx.status == .complete
        
        if let comment = comment, comment.count > 0, isComplete {
            return comment
        } else {
            var format: String
            switch tx.direction {
            case .sent, .moved:
                format = isComplete ? S.Transaction.sentTo : S.Transaction.sendingTo
            case .received:
                format = isComplete ? S.Transaction.receivedVia : S.Transaction.receivingVia
            }
            var address = tx.toAddress
            if currency.matches(Currencies.bch) {
                address = address.replacingOccurrences(of: "\(Currencies.bch.urlScheme!):", with: "")
            }
            return String(format: format, address)
        }
    }

    func amount(isBtcSwapped: Bool, rate: Rate) -> NSAttributedString {
        guard let tx = tx as? BtcTransaction else { return NSAttributedString(string: "") }
        let text = DisplayAmount(amount: Satoshis(rawValue: tx.amount),
{'fraction_non_alphanumeric': 0.09390764454792394, 'fraction_numerical': 0.011253395421032208, 'mean_word_length': 2.015204678362573, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4222370', 'n_tokens_mistral': 758, 'n_tokens_neox': 700, 'n_words': 203}