Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Role Chooser View Controller (nonfunctional yet), make login work.

  • Loading branch information...
commit c276bd7173293f0158871bf82fabff8d90e15f98 1 parent 63e54fe
@danhd123 danhd123 authored
View
3  SilentBoombox/Classes/SPLoginViewController.h
@@ -31,8 +31,9 @@
*/
#import <UIKit/UIKit.h>
+#import "SPSession.h"
-@interface SPLoginViewController : UIViewController {
+@interface SPLoginViewController : UIViewController <SPSessionDelegate> {
UITextField *usernameField;
UITextField *passwordField;
UIButton *loginButton;
View
18 SilentBoombox/Classes/SPLoginViewController.m
@@ -32,6 +32,7 @@
#import "SPLoginViewController.h"
#import "CocoaLibSpotify.h"
+#import "WCRoleChooserViewController.h"
@implementation SPLoginViewController
@synthesize usernameField;
@@ -51,7 +52,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- // Custom initialization
+
}
return self;
}
@@ -98,14 +99,19 @@ -(void)session:(SPSession *)aSession didFailToLoginWithError:(NSError *)error; {
self.spinner.hidden = YES;
}
-- (void)didReceiveMemoryWarning
+-(void)sessionDidLoginSuccessfully:(SPSession *)aSession
+{
+ //Push RoleChooserViewController
+ WCRoleChooserViewController *roleChooser = [[WCRoleChooserViewController alloc] initWithNibName:@"WCRoleChooserViewController" bundle:nil];
+ [self.navigationController pushViewController:roleChooser animated:YES];
+}
+
+-(void)sessionDidLogOut:(SPSession *)aSession
{
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
}
+
#pragma mark - View lifecycle
- (void)viewDidLoad
@@ -113,6 +119,8 @@ - (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.usernameField.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"username"];
+ [[SPSession sharedSession] setDelegate:self];
+
}
- (void)viewDidUnload
View
11 SilentBoombox/Classes/SilentBoomboxAppDelegate.m
@@ -8,6 +8,9 @@
#import "SilentBoomboxAppDelegate.h"
#import "SPLoginViewController.h"
+#import "SPLoginViewController.h"
+
+#import "include/appkey.c"
@implementation SilentBoomboxAppDelegate
@@ -22,6 +25,9 @@ @implementation SilentBoomboxAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
+ [SPSession initializeSharedSessionWithApplicationKey:[NSData dataWithBytes:&g_appkey length:g_appkey_size]
+ userAgent:@"com.wecodestuff.SilentBoombox"
+ error:nil];
// Set the navigation controller as the window's root view controller and display.
self.window.rootViewController = self.navigationController;
@@ -78,10 +84,5 @@ Free up as much memory as possible by purging cached data objects that can be re
*/
}
-
-- (void)dealloc {
-}
-
-
@end
View
13 SilentBoombox/Classes/WCRoleChooserViewController.h
@@ -0,0 +1,13 @@
+//
+// WCRoleChooserViewController.h
+// SilentBoombox
+//
+// Created by Daniel DeCovnick on 2/11/12.
+// Copyright (c) 2012 Softyards Software. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface WCRoleChooserViewController : UIViewController
+
+@end
View
51 SilentBoombox/Classes/WCRoleChooserViewController.m
@@ -0,0 +1,51 @@
+//
+// WCRoleChooserViewController.m
+// SilentBoombox
+//
+// Created by Daniel DeCovnick on 2/11/12.
+// Copyright (c) 2012 Softyards Software. All rights reserved.
+//
+
+#import "WCRoleChooserViewController.h"
+
+@implementation WCRoleChooserViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)didReceiveMemoryWarning
+{
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+#pragma mark - View lifecycle
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view from its nib.
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
View
118 SilentBoombox/Classes/WCRoleChooserViewController.xib
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1280</int>
+ <string key="IBDocument.SystemVersion">11C25</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1919</string>
+ <string key="IBDocument.AppKitVersion">1138.11</string>
+ <string key="IBDocument.HIToolboxVersion">566.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">916</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">WCRoleChooserViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">3</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">WCRoleChooserViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/WCRoleChooserViewController.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">916</string>
+ </data>
+</archive>
View
2  SilentBoombox/SilentBoombox-Info.plist
@@ -11,7 +11,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <string>com.wecodestuff.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
View
14 SilentBoombox/SilentBoombox.xcodeproj/project.pbxproj
@@ -21,6 +21,8 @@
BC146AF714E747A90082EB62 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC146AF614E747A90082EB62 /* CFNetwork.framework */; };
BC146B1414E74BA80082EB62 /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC146B1314E74BA80082EB62 /* libstdc++.dylib */; };
BC146B1614E74C750082EB62 /* libCocoaLibSpotify.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BC146B1514E74C750082EB62 /* libCocoaLibSpotify.a */; };
+ BC146B1E14E7602B0082EB62 /* WCRoleChooserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC146B1C14E7602B0082EB62 /* WCRoleChooserViewController.m */; };
+ BC146B1F14E7602B0082EB62 /* WCRoleChooserViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC146B1D14E7602B0082EB62 /* WCRoleChooserViewController.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -44,6 +46,10 @@
BC146AF614E747A90082EB62 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
BC146B1314E74BA80082EB62 /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; };
BC146B1514E74C750082EB62 /* libCocoaLibSpotify.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCocoaLibSpotify.a; sourceTree = "<group>"; };
+ BC146B1A14E7599C0082EB62 /* appkey.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = appkey.c; sourceTree = "<group>"; };
+ BC146B1B14E7602B0082EB62 /* WCRoleChooserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WCRoleChooserViewController.h; sourceTree = "<group>"; };
+ BC146B1C14E7602B0082EB62 /* WCRoleChooserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WCRoleChooserViewController.m; sourceTree = "<group>"; };
+ BC146B1D14E7602B0082EB62 /* WCRoleChooserViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = WCRoleChooserViewController.xib; path = Classes/WCRoleChooserViewController.xib; sourceTree = "<group>"; };
BC4D6EF714E7222F001504E6 /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = "<group>"; };
BC4D6EF814E7222F001504E6 /* CocoaLibSpotify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaLibSpotify.h; sourceTree = "<group>"; };
BC4D6EF914E7222F001504E6 /* CocoaLibSpotifyPlatformImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaLibSpotifyPlatformImports.h; sourceTree = "<group>"; };
@@ -95,6 +101,8 @@
BC146AF414E745E20082EB62 /* SPLoginViewController.m */,
1D3623240D0F684500981E51 /* SilentBoomboxAppDelegate.h */,
1D3623250D0F684500981E51 /* SilentBoomboxAppDelegate.m */,
+ BC146B1B14E7602B0082EB62 /* WCRoleChooserViewController.h */,
+ BC146B1C14E7602B0082EB62 /* WCRoleChooserViewController.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -132,6 +140,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
+ BC146B1D14E7602B0082EB62 /* WCRoleChooserViewController.xib */,
28F335F01007B36200424DE2 /* RootViewController.xib */,
BC146AEF14E745C90082EB62 /* SPLoginViewController_iPhone.xib */,
BC146AF114E745D30082EB62 /* SPLoginViewController_iPad.xib */,
@@ -158,6 +167,7 @@
isa = PBXGroup;
children = (
BC4D6EF714E7222F001504E6 /* api.h */,
+ BC146B1A14E7599C0082EB62 /* appkey.c */,
BC4D6EF814E7222F001504E6 /* CocoaLibSpotify.h */,
BC4D6EF914E7222F001504E6 /* CocoaLibSpotifyPlatformImports.h */,
BC4D6EFA14E7222F001504E6 /* SPAlbum.h */,
@@ -241,6 +251,7 @@
28F335F11007B36200424DE2 /* RootViewController.xib in Resources */,
BC146AF014E745C90082EB62 /* SPLoginViewController_iPhone.xib in Resources */,
BC146AF214E745D30082EB62 /* SPLoginViewController_iPad.xib in Resources */,
+ BC146B1F14E7602B0082EB62 /* WCRoleChooserViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -255,6 +266,7 @@
1D3623260D0F684500981E51 /* SilentBoomboxAppDelegate.m in Sources */,
28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */,
BC146AF514E745E20082EB62 /* SPLoginViewController.m in Sources */,
+ BC146B1E14E7602B0082EB62 /* WCRoleChooserViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -317,6 +329,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = iphoneos;
+ USER_HEADER_SEARCH_PATHS = .;
};
name = Debug;
};
@@ -330,6 +343,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
+ USER_HEADER_SEARCH_PATHS = .;
};
name = Release;
};
Please sign in to comment.
Something went wrong with that request. Please try again.