Skip to content

Commit

Permalink
about view
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Voisine committed Aug 22, 2013
1 parent 5ed3397 commit df22bab
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 30 deletions.
2 changes: 0 additions & 2 deletions ZincWallet/ZNAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

//XXX need to have a network status indicator perferrably tied to websocket status

//XXX change all file headers to MIT license

//XXX figure what to do about bluetooth
// this will notify user if bluetooth is disabled (on 4S and newer devices that support BTLE)
//CBCentralManager *cbManager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()];
Expand Down
3 changes: 2 additions & 1 deletion ZincWallet/ZNBIP32Sequence.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ - (NSString *)privateKey:(NSUInteger)n internal:(BOOL)internal fromSeed:(NSData

- (NSArray *)privateKeys:(NSArray *)n internal:(BOOL)internal fromSeed:(NSData *)seed
{
if (! seed || ! n.count) return @[];
if (! seed || ! n) return nil;
if (! n.count) return @[];

NSMutableArray *a = [NSMutableArray arrayWithCapacity:n.count];
NSMutableData *I = CFBridgingRelease(CFDataCreateMutable(SecureAllocator(), CC_SHA512_DIGEST_LENGTH));
Expand Down
3 changes: 2 additions & 1 deletion ZincWallet/ZNElectrumSequence.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ - (NSString *)privateKey:(NSUInteger)n internal:(BOOL)internal fromSeed:(NSData

- (NSArray *)privateKeys:(NSArray *)n internal:(BOOL)internal fromSeed:(NSData *)seed
{
if (! seed || ! n.count) return @[];
if (! seed || ! n) return nil;
if (! n.count) return @[];

NSMutableArray *a = [NSMutableArray arrayWithCapacity:n.count];
NSData *secexp = [self stretchKey:seed];
Expand Down
2 changes: 1 addition & 1 deletion ZincWallet/ZNKeySequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#define SEED_LENGTH (128/8)
#define GAP_LIMIT_EXTERNAL 10
#define GAP_LIMIT_INTERNAL 3
#define GAP_LIMIT_INTERNAL 10

@protocol ZNKeySequence <NSObject>
@required
Expand Down
1 change: 1 addition & 0 deletions ZincWallet/ZNRestoreViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ @interface ZNRestoreViewController ()

@implementation ZNRestoreViewController

// TODO: create secure versions of keyboard and UILabel and use in place of UITextView
- (void)viewDidLoad
{
[super viewDidLoad];
Expand Down
27 changes: 15 additions & 12 deletions ZincWallet/ZNSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
// Return the number of rows in the section.
switch (section) {
case 0: return self.transactions.count ? self.transactions.count : 1;
case 1: return 1;
case 1: return 2;
case 2: return 1;
default: NSAssert(FALSE, @"[%s %s] line %d: unkown section %d", object_getClassName(self), sel_getName(_cmd),
__LINE__, section);
Expand Down Expand Up @@ -250,10 +250,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

switch (indexPath.row) {
case 0:
// cell.textLabel.text = @"safety tips";
// break;
//
// case 1:
cell.textLabel.text = @"about";
break;

case 1:
cell.textLabel.text = @"backup phrase";
break;

Expand Down Expand Up @@ -323,6 +323,9 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
case 0:
return 44;

case 1:
return 44;

default:
NSAssert(FALSE, @"[%s %s] line %d: unkown indexPath.row %d", object_getClassName(self),
sel_getName(_cmd), __LINE__, indexPath.row);
Expand Down Expand Up @@ -404,13 +407,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

case 1:
switch (indexPath.row) {
case 0:
// //XXX show safety tips
// [[[UIAlertView alloc] initWithTitle:nil message:@"Don't eat yellow snow." delegate:self
// cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
// break;
//
// case 1:
case 0:
[self.navigationController pushViewController:[self.storyboard
instantiateViewControllerWithIdentifier:@"ZNAboutViewController"] animated:YES];
break;

case 1:
[[[UIAlertView alloc] initWithTitle:@"WARNING" message:@"DO NOT let anyone see your backup phrase "
"or they can spend your bitcoins." delegate:self cancelButtonTitle:@"cancel"
otherButtonTitles:@"show", nil] show];
Expand Down Expand Up @@ -463,6 +465,7 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
}

ZNSeedViewController *c = [self.storyboard instantiateViewControllerWithIdentifier:@"ZNSeedViewController"];

[self.navigationController pushViewController:c animated:YES];
}

Expand Down
4 changes: 2 additions & 2 deletions ZincWallet/ZNWallet.m
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ - (void)queryAddresses:(NSArray *)addresses completion:(void (^)(NSError *error)
}];

[JSON[@"txs"] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
//XXX we shouldn't be saving json without sanitizing it... security risk
//XXXX we shouldn't be saving json without sanitizing it... security risk
if (obj[@"hash"]) {
self.transactions[obj[@"hash"]] = obj;
[self.updatedTransactions addObject:obj[@"hash"]];
Expand Down Expand Up @@ -627,7 +627,7 @@ - (void)queryUnspentOutputs:(NSArray *)addresses completion:(void (^)(NSError *e
[JSON[@"unspent_outputs"] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSString *key = [obj[@"tx_hash"] stringByAppendingString:[obj[@"tx_output_n"] description]];

//XXX we shouldn't be storing json without sanitizing it... security risk
//XXXX we shouldn't be storing json without sanitizing it... security risk
if (key && [obj[@"value"] unsignedLongLongValue] > 0) self.unspentOutputs[key] = obj;
}];

Expand Down
73 changes: 64 additions & 9 deletions ZincWallet/en.lproj/MainStoryboard_iPhone.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,72 @@
</objects>
<point key="canvasLocation" x="1676" y="-349"/>
</scene>
<!--View Controller-->
<scene sceneID="6tF-9l-hjv">
<objects>
<viewController storyboardIdentifier="ZNAboutViewController" id="b2e-Yj-tnf" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Caj-Y4-4Ch">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" id="61a-av-Tj6">
<rect key="frame" x="0.0" y="147" width="320" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" id="qVy-JO-nVM">
<rect key="frame" x="0.0" y="0.0" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.75" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Cl2-sB-zuB">
<rect key="frame" x="20" y="0.0" width="280" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<string key="text">zinc wallet v0.2
Copyright © 2013 Aaron Voisine

This app is open source: https://github.com/voisine/zincwallet

v0.2 relies on blockchain.info for blockchain data. More data sources coming soon!</string>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="15"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" id="yax-ki-WWt">
<rect key="frame" x="0.0" y="229" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="0.75" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="0.5" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="OTw-xU-SSV">
<nil key="title"/>
<view key="titleView" contentMode="scaleToFill" id="nXU-B1-b35">
<rect key="frame" x="118" y="15" width="84" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="[email protected]" id="xKl-vO-gte">
<rect key="frame" x="0.0" y="0.0" width="84" height="15"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="blackTranslucent" prompted="NO"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="j7O-Ti-5i4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2090" y="-349"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="s6E-a9-Gyw">
<objects>
<navigationController definesPresentationContext="YES" id="wFs-aD-OST" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="BD4-0j-VHW"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackTranslucent"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="SIy-7t-6Bs">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="1" alpha="0.84999999999999998" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -431,6 +492,7 @@
<scene sceneID="d5q-zo-uy4">
<objects>
<navigationController definesPresentationContext="YES" modalTransitionStyle="flipHorizontal" id="jaw-AS-YG5" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackTranslucent"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="QD8-9d-Z2F">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand Down Expand Up @@ -1019,6 +1081,7 @@
<scene sceneID="qbV-Kl-jGa">
<objects>
<navigationController storyboardIdentifier="ZNEraseNav" definesPresentationContext="YES" id="9BH-Hw-65r" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackTranslucent"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="2Ct-UV-mSm">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand Down Expand Up @@ -1084,6 +1147,7 @@
<scene sceneID="cpQ-Xn-G9w">
<objects>
<navigationController definesPresentationContext="YES" id="dNo-Sm-bI0" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackTranslucent"/>
<nil key="simulatedBottomBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="2le-zU-AuV">
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -1130,9 +1194,6 @@
<class className="ZNPayViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ZNPayViewController.h"/>
<relationships>
<relationship kind="action" name="doIt:"/>
<relationship kind="action" name="page:"/>
<relationship kind="action" name="refresh:"/>
<relationship kind="outlet" name="pageControl" candidateClass="UIPageControl"/>
<relationship kind="outlet" name="refreshButton" candidateClass="UIBarButtonItem"/>
<relationship kind="outlet" name="scrollView" candidateClass="UIScrollView"/>
Expand All @@ -1146,16 +1207,13 @@
<class className="ZNRestoreViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ZNRestoreViewController.h"/>
<relationships>
<relationship kind="action" name="cancel:"/>
<relationship kind="outlet" name="label" candidateClass="UILabel"/>
<relationship kind="outlet" name="textView" candidateClass="UITextView"/>
</relationships>
</class>
<class className="ZNSeedViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ZNSeedViewController.h"/>
<relationships>
<relationship kind="action" name="done:"/>
<relationship kind="action" name="refresh:"/>
<relationship kind="outlet" name="compatiblityLabel" candidateClass="UILabel"/>
<relationship kind="outlet" name="labelFrame" candidateClass="UIView"/>
<relationship kind="outlet" name="logo" candidateClass="UIImageView"/>
Expand All @@ -1166,9 +1224,6 @@
</class>
<class className="ZNSettingsViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ZNSettingsViewController.h"/>
<relationships>
<relationship kind="action" name="done:"/>
</relationships>
</class>
<class className="ZNWelcomeViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ZNWelcomeViewController.h"/>
Expand Down
2 changes: 0 additions & 2 deletions ZincWalletTests/ZincWalletTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

@implementation ZincWalletTests

//XXX remember to test on iOS 5

- (void)setUp
{
[super setUp];
Expand Down

0 comments on commit df22bab

Please sign in to comment.