Skip to content

Commit

Permalink
Adding a quick info screen to show round info.
Browse files Browse the repository at this point in the history
  • Loading branch information
neosavvy committed Feb 11, 2012
1 parent 9ccbcc2 commit 2034c47
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 21 deletions.
12 changes: 12 additions & 0 deletions tilt-ios/tilt-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
8C93642F14D5A694004862E0 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C93642914D5A694004862E0 /* Security.framework */; };
8C93643014D5A694004862E0 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C93642A14D5A694004862E0 /* SystemConfiguration.framework */; };
8CE5BB8C14DDDDE900013A9A /* TiltInvestment.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE5BB8B14DDDDE900013A9A /* TiltInvestment.m */; };
8CF4A94F14E6377000A4098D /* TiltRound.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF4A94E14E6377000A4098D /* TiltRound.m */; };
8CF4A95214E638C500A4098D /* TiltRoundInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF4A95114E638C500A4098D /* TiltRoundInfoViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -109,6 +111,10 @@
8C93642A14D5A694004862E0 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
8CE5BB8A14DDDDE900013A9A /* TiltInvestment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiltInvestment.h; sourceTree = "<group>"; };
8CE5BB8B14DDDDE900013A9A /* TiltInvestment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiltInvestment.m; sourceTree = "<group>"; };
8CF4A94D14E6377000A4098D /* TiltRound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiltRound.h; sourceTree = "<group>"; };
8CF4A94E14E6377000A4098D /* TiltRound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiltRound.m; sourceTree = "<group>"; };
8CF4A95014E638C500A4098D /* TiltRoundInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiltRoundInfoViewController.h; sourceTree = "<group>"; };
8CF4A95114E638C500A4098D /* TiltRoundInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiltRoundInfoViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -193,6 +199,8 @@
8C9363EE14D4868E004862E0 /* TiltTeamInvestmentsViewController.m */,
8C9363FB14D59638004862E0 /* TIInvestmentsFinalizedViewController.h */,
8C9363FC14D59638004862E0 /* TIInvestmentsFinalizedViewController.m */,
8CF4A95014E638C500A4098D /* TiltRoundInfoViewController.h */,
8CF4A95114E638C500A4098D /* TiltRoundInfoViewController.m */,
);
path = "tilt-ios";
sourceTree = "<group>";
Expand Down Expand Up @@ -230,6 +238,8 @@
8CE5BB8B14DDDDE900013A9A /* TiltInvestment.m */,
8C11279C14E36843008BAC1C /* TiltTeamInvestment.h */,
8C11279D14E36843008BAC1C /* TiltTeamInvestment.m */,
8CF4A94D14E6377000A4098D /* TiltRound.h */,
8CF4A94E14E6377000A4098D /* TiltRound.m */,
);
name = model;
sourceTree = "<group>";
Expand Down Expand Up @@ -347,6 +357,8 @@
8CE5BB8C14DDDDE900013A9A /* TiltInvestment.m in Sources */,
8C852D4614E32EA200A0CDC9 /* TiltInvestmentService.m in Sources */,
8C11279E14E36843008BAC1C /* TiltTeamInvestment.m in Sources */,
8CF4A94F14E6377000A4098D /* TiltRound.m in Sources */,
8CF4A95214E638C500A4098D /* TiltRoundInfoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
12 changes: 12 additions & 0 deletions tilt-ios/tilt-ios/TiltInvestorAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#import "TiltInvestorAppDelegate.h"
#import <RestKit/RestKit.h>

#import "TiltRound.h"

@implementation TiltInvestorAppDelegate

@synthesize window = _window;
Expand All @@ -29,6 +31,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
RKLogConfigureByName("RestKit/Network/Queue", RKLogLevelTrace);
RKLogConfigureByName("RestKit/Network/Reachability", RKLogLevelTrace);


RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[TiltRound class]];
[objectMapping mapKeyPath:@"allocated" toAttribute:@"allocated"];
[objectMapping mapKeyPath:@"is_open" toAttribute:@"isOpen"];
[objectMapping mapKeyPath:@"number" toAttribute:@"number"];

[manager.mappingProvider setMapping:objectMapping forKeyPath:@""];

[[manager router] routeClass:[TiltRound class] toResourcePath:@"/rounds/current.json"];

client.cachePolicy = RKRequestCachePolicyNone;

return YES;
Expand Down
31 changes: 31 additions & 0 deletions tilt-ios/tilt-ios/TiltRound.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// TiltRound.h
// tilt-ios
//
// Created by Adam Parrish on 2/11/12.
// Copyright (c) 2012 Neosavvy. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TiltRound : NSObject

/*
{
"_id":"4f2f0ee57221460100000001",
"number":1,
"updated_at":"2012-02-05T23:21:09.851Z",
"created_at":"2012-02-05T23:21:09.851Z",
"investor_count":0,
"total_funds":0,
"allocated":1000,
"is_open":true,
"is_current":true
}
*/

@property (nonatomic, strong) NSNumber *number;
@property (nonatomic, strong) NSNumber *allocated;
@property (nonatomic, strong) NSString *isOpen;

@end
17 changes: 17 additions & 0 deletions tilt-ios/tilt-ios/TiltRound.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// TiltRound.m
// tilt-ios
//
// Created by Adam Parrish on 2/11/12.
// Copyright (c) 2012 Neosavvy. All rights reserved.
//

#import "TiltRound.h"

@implementation TiltRound

@synthesize allocated;
@synthesize isOpen;
@synthesize number;

@end
18 changes: 18 additions & 0 deletions tilt-ios/tilt-ios/TiltRoundInfoViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// TiltRoundInfoViewController.h
// tilt-ios
//
// Created by Adam Parrish on 2/11/12.
// Copyright (c) 2012 Neosavvy. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <RestKit/RestKit.h>

@interface TiltRoundInfoViewController : UIViewController <RKObjectLoaderDelegate>

@property (weak, nonatomic) IBOutlet UILabel *currentRoundLabel;
@property (weak, nonatomic) IBOutlet UILabel *availableCashLabel;
@property (weak, nonatomic) IBOutlet UILabel *openOrClosedLabel;

@end
71 changes: 71 additions & 0 deletions tilt-ios/tilt-ios/TiltRoundInfoViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// TiltRoundInfoViewController.m
// tilt-ios
//
// Created by Adam Parrish on 2/11/12.
// Copyright (c) 2012 Neosavvy. All rights reserved.
//

#import "TiltRoundInfoViewController.h"
#import "TiltRound.h"

@interface TiltRoundInfoViewController()

@property (nonatomic, strong) TiltRound *round;

@end

@implementation TiltRoundInfoViewController
@synthesize currentRoundLabel = _currentRoundLabel;
@synthesize availableCashLabel = _availableCashLabel;
@synthesize openOrClosedLabel = _openOrClosedLabel;

@synthesize round = _round;

-(TiltRound *) round
{
if( _round == nil )
{
_round = [[TiltRound alloc] init];
}
return _round;
}

- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObject:(id)object
{
self.round = (TiltRound *)object;


NSComparisonResult result = [@"true" compare:self.round.isOpen ];
if( result == NSOrderedSame )
{
self.currentRoundLabel.text = [NSString stringWithFormat:@"you're currently bidding on round: %@", self.round.number];
self.availableCashLabel.text = [NSString stringWithFormat:@" $%@ of $%@ ", self.round.allocated, self.round.allocated];

self.openOrClosedLabel.text = @"round is open beatches!";
}
else
{
self.openOrClosedLabel.text = @"pay attention to the preso! round closed";
}
}

- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error {
NSLog(@"Encountered an error: %@", error);
}

-(void) viewWillAppear:(BOOL)animated
{
RKObjectManager *manager = [RKObjectManager sharedManager];
[manager getObject:self.round delegate:self];

[super viewWillAppear:animated];
}

- (void)viewDidUnload {
[self setCurrentRoundLabel:nil];
[self setAvailableCashLabel:nil];
[self setOpenOrClosedLabel:nil];
[super viewDidUnload];
}
@end
2 changes: 1 addition & 1 deletion tilt-ios/tilt-ios/TiltTeamInvestmentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ -(NSInteger) cellTag

- (void)finalizeInvestments:(id)sender {
TiltInvestment *investments = [[TiltInvestment alloc] init];
investments.round = [NSNumber numberWithInt:2];
investments.round = [NSNumber numberWithInt:1];

NSMutableArray *teamInvestments = [[NSMutableArray alloc] init];

Expand Down
75 changes: 56 additions & 19 deletions tilt-ios/tilt-ios/en.lproj/MainStoryboard_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1938" systemVersion="11C74" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="P86-b1-eoN">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1938" systemVersion="11D50b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="P86-b1-eoN">
<dependencies>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="933"/>
Expand Down Expand Up @@ -100,6 +100,11 @@
</tableView>
<navigationItem key="navigationItem" title="investments by team" id="5Bi-GS-S8X">
<barButtonItem key="backBarButtonItem" title="logout" id="gZH-HE-Gbu"/>
<barButtonItem key="rightBarButtonItem" title="Info" id="SKN-wW-pFm">
<connections>
<segue destination="OtN-Sd-Num" kind="push" id="oZ2-SR-DgC"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<segue destination="six-QB-fas" kind="push" identifier="InvestmentsFailed" id="oH0-Sc-WoM"/>
Expand Down Expand Up @@ -213,25 +218,57 @@
</objects>
<point key="canvasLocation" x="1328" y="359"/>
</scene>
<scene sceneID="dRt-s9-81t">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="Xuo-DY-LbY" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController id="OtN-Sd-Num" customClass="TiltRoundInfoViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="0u4-s6-1MM">
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="you have this much cash monies:" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="gqZ-gH-f5B">
<rect key="frame" x="20" y="144" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="$$$$" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="1Ns-d4-YyE">
<rect key="frame" x="20" y="182" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Your currently bidding on round: " textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="glt-kA-GUD">
<rect key="frame" x="20" y="63" width="280" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Label" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="qF5-Zp-czP">
<rect key="frame" x="20" y="11" width="280" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="round info" id="TRK-Em-vac"/>
<connections>
<outlet property="availableCashLabel" destination="1Ns-d4-YyE" id="sWS-3W-GH2"/>
<outlet property="currentRoundLabel" destination="glt-kA-GUD" id="ump-tT-DxP"/>
<outlet property="openOrClosedLabel" destination="qF5-Zp-czP" id="0TM-J7-zOD"/>
<outlet property="view" destination="0u4-s6-1MM" id="bsg-Ye-1ew"/>
</connections>
</viewController>
</objects>
<point key="canvasLocation" x="1328" y="-854"/>
</scene>
</scenes>
<classes>
<class className="TIInvesmentsFailedViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/TIInvesmentsFailedViewController.h"/>
</class>
<class className="TIInvestmentsFinalizedViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/TIInvestmentsFinalizedViewController.h"/>
</class>
<class className="TiltLoginViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/TiltLoginViewController.h"/>
<relationships>
<relationship kind="outlet" name="passwordField" candidateClass="UITextField"/>
<relationship kind="outlet" name="usernameField" candidateClass="UITextField"/>
</relationships>
</class>
<class className="TiltTeamInvestmentsViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/TiltTeamInvestmentsViewController.h"/>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
Expand Down
2 changes: 1 addition & 1 deletion tilt-ios/tilt-ios/tilt-ios-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<key>UIMainStoryboardFile</key>
<string>MainStoryboard_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>MainStoryboard_iPad</string>
<string>MainStoryboard_iPhone</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down

0 comments on commit 2034c47

Please sign in to comment.