Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
87 changes: 52 additions & 35 deletions DashWallet/DWTxDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ - (void)viewDidLoad
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

if (! self.txStatusObserver) {
self.txStatusObserver =
[[NSNotificationCenter defaultCenter] addObserverForName:DSChainPeerManagerTxStatusNotification object:nil
queue:nil usingBlock:^(NSNotification *note) {
DSTransaction *tx = [[DWEnvironment sharedInstance].currentAccount transactionForHash:self.transaction.txHash];

if (tx) self.transaction = tx;
[self.tableView reloadData];
}];
queue:nil usingBlock:^(NSNotification *note) {
DSTransaction *tx = [[DWEnvironment sharedInstance].currentAccount transactionForHash:self.transaction.txHash];
if (tx) self.transaction = tx;
[self.tableView reloadData];
}];
}
}

Expand Down Expand Up @@ -94,7 +94,7 @@ - (void)setTransaction:(DSTransaction *)transaction
[mutableInputAddresses addObject:inputAddress];
}
}

for (NSString *address in transaction.outputAddresses) {
NSData * script = transaction.outputScripts[outputAmountIndex];
uint64_t amt = [transaction.outputAmounts[outputAmountIndex++] unsignedLongLongValue];
Expand Down Expand Up @@ -125,24 +125,24 @@ - (void)setTransaction:(DSTransaction *)transaction
[detail addObject:NSLocalizedString(@"payment output", nil)];
[amount addObject:@(-amt)];
}

}
}
else if ([account containsAddress:address]) {
if (self.sent == 0 || self.received == self.sent) {
[text addObject:address];
if (![[DWEnvironment sharedInstance].currentChain isMainnet]) {
DSDerivationPath * derivationPath = [account derivationPathContainingAddress:address];
if ([derivationPath isBIP43Based] && [derivationPath purpose] == 44) {
[detail addObject:@"wallet address (BIP44)"];
} else if ([derivationPath isBIP32Only]) {
[detail addObject:@"wallet address (BIP32)"];
if (![[DWEnvironment sharedInstance].currentChain isMainnet]) {
DSDerivationPath * derivationPath = [account derivationPathContainingAddress:address];
if ([derivationPath isBIP43Based] && [derivationPath purpose] == 44) {
[detail addObject:@"wallet address (BIP44)"];
} else if ([derivationPath isBIP32Only]) {
[detail addObject:@"wallet address (BIP32)"];
} else {
[detail addObject:[NSString stringWithFormat:@"wallet address (%@)",[derivationPath stringRepresentation]]];
}
} else {
[detail addObject:[NSString stringWithFormat:@"wallet address (%@)",[derivationPath stringRepresentation]]];
[detail addObject:NSLocalizedString(@"wallet address", nil)];
}
} else {
[detail addObject:NSLocalizedString(@"wallet address", nil)];
}
[amount addObject:@(amt)];
[currencyIsBitcoinInstead addObject:@FALSE];
}
Expand All @@ -154,7 +154,7 @@ - (void)setTransaction:(DSTransaction *)transaction
[currencyIsBitcoinInstead addObject:@FALSE];
}
}

if (self.sent > 0 && fee > 0 && fee != UINT64_MAX) {
[text addObject:@""];
[detail addObject:NSLocalizedString(@"dash network fee", nil)];
Expand Down Expand Up @@ -187,11 +187,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
{
// Return the number of rows in the section.
switch (section) {
case 0: return self.transaction.associatedShapeshift?(([self.transaction.associatedShapeshift.shapeshiftStatus integerValue]| eShapeshiftAddressStatus_Finished)?5:4):3;
case 0: return self.transaction.associatedShapeshift?(([self.transaction.associatedShapeshift.shapeshiftStatus integerValue]| eShapeshiftAddressStatus_Finished)?6:5):4;
case 1: return (self.sent > 0) ? self.outputText.count : self.inputAddresses.count;
case 2: return (self.sent > 0) ? self.inputAddresses.count : self.outputText.count;
}

return 1;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if (indexPathRow > 0) indexPathRow += 1;
}
switch (indexPathRow) {

case 0:
cell = [tableView dequeueReusableCellWithIdentifier:@"IdCell" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
Expand All @@ -228,7 +228,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
[self setBackgroundForCell:cell indexPath:indexPath];
textLabel.text = NSLocalizedString(@"id:", nil);
s = [NSString hexWithData:[NSData dataWithBytes:self.transaction.txHash.u8
length:sizeof(UInt256)].reverse];
length:sizeof(UInt256)].reverse];
detailLabel.text = [NSString stringWithFormat:@"%@\n%@", [s substringToIndex:s.length/2],
[s substringFromIndex:s.length/2]];
detailLabel.copyableText = s;
Expand Down Expand Up @@ -286,11 +286,28 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
break;

case 4:
cell = [tableView dequeueReusableCellWithIdentifier:@"TitleCell" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
textLabel = (id)[cell viewWithTag:1];
detailLabel = (id)[cell viewWithTag:2];
subtitleLabel = (id)[cell viewWithTag:3];
[self setBackgroundForCell:cell indexPath:indexPath];
textLabel.text = NSLocalizedString(@"size:", nil);
uint64_t feeCostPerByte = self.transaction.feeCostPerByte;
if (feeCostPerByte != UINT64_MAX) { //otherwise it's being received and can't know.
subtitleLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%d duffs/byte",nil), feeCostPerByte];
} else {
subtitleLabel.text = nil;
}
detailLabel.text = [@(self.transaction.size) stringValue];
break;

case 5:
cell = [tableView dequeueReusableCellWithIdentifier:@"TransactionCell"];
[self setBackgroundForCell:cell indexPath:indexPath];
textLabel = (id)[cell viewWithTag:1];
localCurrencyLabel = (id)[cell viewWithTag:5];

if (self.sent > 0 && self.sent == self.received) {
textLabel.attributedText = [priceManager attributedStringForDashAmount:self.sent];
localCurrencyLabel.text = [NSString stringWithFormat:@"(%@)",
Expand Down Expand Up @@ -318,15 +335,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
}
else cell = [tableView dequeueReusableCellWithIdentifier:@"SubtitleCell" forIndexPath:indexPath];

detailLabel = (id)[cell viewWithTag:2];
subtitleLabel = (id)[cell viewWithTag:3];
amountLabel = (id)[cell viewWithTag:1];
localCurrencyLabel = (id)[cell viewWithTag:5];
detailLabel.text = self.outputText[indexPath.row];
subtitleLabel.text = self.outputDetail[indexPath.row];
amountLabel.textColor = (self.sent > 0) ? [UIColor colorWithRed:1.0 green:0.33 blue:0.33 alpha:1.0] :
[UIColor colorWithRed:0.0 green:0.75 blue:0.0 alpha:1.0];
[UIColor colorWithRed:0.0 green:0.75 blue:0.0 alpha:1.0];


long long outputAmount = [self.outputAmount[indexPath.row] longLongValue];
Expand All @@ -347,17 +364,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
amountLabel.textColor = [UIColor colorWithRed:0.0 green:0.75 blue:0.0 alpha:1.0];
localCurrencyLabel.text = [NSString stringWithFormat:@"(%@)",
[priceManager localCurrencyStringForBitcoinAmount:[self.outputAmount[indexPath.row]
longLongValue]]];
longLongValue]]];
} else {
amountLabel.attributedText = [priceManager attributedStringForDashAmount:[self.outputAmount[indexPath.row] longLongValue] withTintColor:amountLabel.textColor dashSymbolSize:CGSizeMake(9, 9)];
localCurrencyLabel.text = [NSString stringWithFormat:@"(%@)",
[priceManager localCurrencyStringForDashAmount:[self.outputAmount[indexPath.row]
longLongValue]]];
longLongValue]]];
}
localCurrencyLabel.textColor = amountLabel.textColor;

}

}
else if (self.inputAddresses[indexPath.row] != (id)[NSNull null]) {
cell = [tableView dequeueReusableCellWithIdentifier:@"DetailCell" forIndexPath:indexPath];
Expand Down Expand Up @@ -386,7 +403,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
amountLabel.text = nil;
localCurrencyLabel.text = nil;
}

[self setBackgroundForCell:cell indexPath:indexPath];
break;
}
Expand Down Expand Up @@ -426,18 +443,18 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
if (sectionTitle.length == 0) return 22.0;

CGRect textRect = [sectionTitle boundingRectWithSize:CGSizeMake(self.view.frame.size.width - 30.0, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightLight]} context:nil];
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightLight]} context:nil];

return textRect.size.height + 12.0;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerview = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width,
[self tableView:tableView heightForHeaderInSection:section])];
[self tableView:tableView heightForHeaderInSection:section])];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15.0, 10.0, headerview.frame.size.width - 30.0,
headerview.frame.size.height - 12.0)];
headerview.frame.size.height - 12.0)];

titleLabel.text = [self tableView:tableView titleForHeaderInSection:section];
titleLabel.backgroundColor = [UIColor clearColor];
Expand Down
6 changes: 6 additions & 0 deletions DashWallet/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%dالتأكيدات";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 تأكيدات";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "إظهار الجملة";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "الرسائل القصيرة غير متوفرة حاليا";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/bg.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d потвърждения";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 потвърждения";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "покажи фраза";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "sms не е наличен в момента";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d Bestätigungen";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 Bestätigungen";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "Wiederherstellungs-Wortfolge anzeigen";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "SMS aktuell nicht verfügbar";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/el.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d επιβεβαιώσεις";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 επιβεβαιώσεις";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "εμφάνιση φράσης";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "το sms δεν είναι διαθέσιμο επί του παρόντος";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d confirmations";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 confirmations";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "show phrase";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "sms not currently available";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d confirmaciones";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 confirmaciones";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "mostrar frase";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "sms actualmente no disponible";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d confirmations";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 confirmation";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "montrer la phrase";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "sms actuellement indisponible";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d conferme";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0 conferme";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "mostra frase";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "sms non disponibili al momento";

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* No comment provided by engineer. */
"%d confirmations" = "%d承認済み";

/* No comment provided by engineer. */
"%d duffs/byte" = "%d duffs/byte";

/* No comment provided by engineer. */
"0 confirmations" = "0承認済み";

Expand Down Expand Up @@ -464,6 +467,9 @@
/* No comment provided by engineer. */
"show phrase" = "フレーズを表示";

/* No comment provided by engineer. */
"size:" = "size:";

/* No comment provided by engineer. */
"sms not currently available" = "SMSは現在利用できません.";

Expand Down
Loading