Permalink
Browse files

Merge branch 'experimental' into oauth2

Conflicts:
	Sources/SoundCloudAPI/SCSoundCloudAPIConfiguration.h
	TestApps/iPhoneTestApp/iPhoneTestApp.xcodeproj/project.pbxproj
  • Loading branch information...
2 parents 0a24fc7 + 1843eca commit e4ea96d266ba86245f16ea7bdb5ebfcc13c8f81c @stigi stigi committed Oct 6, 2010
Showing with 4,075 additions and 2,535 deletions.
  1. +3 −3 .gitmodules
  2. 0 {SoundCloudAPI → }/LICENSE
  3. +0 −3 {SoundCloudAPI → }/NOTICE
  4. +1 −0 Outsourced/OAuth2Client
  5. BIN SoundCloud.bundle/close.png
  6. BIN SoundCloud.bundle/cloud.png
  7. BIN SoundCloud.bundle/cloud@2x.png
  8. BIN SoundCloud.bundle/cwsc.png
  9. BIN SoundCloud.bundle/cwsc@2x.png
  10. +22 −0 SoundCloudAPI.framework-Info.plist
  11. +615 −0 SoundCloudAPI.xcodeproj/project.pbxproj
  12. +0 −1 SoundCloudAPI/.gitignore
  13. +0 −1 SoundCloudAPI/Outsourced/OAuth2Client
  14. +0 −368 SoundCloudAPI/SoundCloudAPI.xcodeproj/project.pbxproj
  15. +0 −16 SoundCloudAPI/Sources/CocoaExtensions/NSString+SoundCloudAPI.h
  16. +0 −23 SoundCloudAPI/Sources/CocoaExtensions/NSString+SoundCloudAPI.m
  17. +0 −107 SoundCloudAPI/Sources/SoundCloudAPI/SCSoundCloudAPI.h
  18. +0 −195 SoundCloudAPI/Sources/SoundCloudAPI/SCSoundCloudAPI.m
  19. +0 −42 SoundCloudAPI/Sources/SoundCloudAPI/SCSoundCloudConnection.h
  20. +0 −127 SoundCloudAPI/Sources/SoundCloudAPI/SCSoundCloudConnection.m
  21. +0 −20 SoundCloudAPI/Sources/SoundCloudAPI/SCSoundCloudConnectionDelegate.h
  22. +28 −0 Sources/CocoaExtensions/NSString+SoundCloudAPI.h
  23. +35 −0 Sources/CocoaExtensions/NSString+SoundCloudAPI.m
  24. +5 −2 {SoundCloudAPI → }/Sources/SoundCloudAPI/SCAPI.h
  25. +2 −9 {SoundCloudAPI → }/Sources/SoundCloudAPI/SCAPIErrors.h
  26. +82 −0 Sources/SoundCloudAPI/SCAudioBufferQueue.h
  27. +537 −0 Sources/SoundCloudAPI/SCAudioBufferQueue.m
  28. +55 −0 Sources/SoundCloudAPI/SCAudioFileStreamParser.h
  29. +272 −0 Sources/SoundCloudAPI/SCAudioFileStreamParser.m
  30. +101 −0 Sources/SoundCloudAPI/SCAudioStream.h
  31. +504 −0 Sources/SoundCloudAPI/SCAudioStream.m
  32. +38 −0 Sources/SoundCloudAPI/SCAudioStreamPacketDescriptions.h
  33. +50 −0 Sources/SoundCloudAPI/SCAudioStreamPacketDescriptions.m
  34. +35 −0 Sources/SoundCloudAPI/SCLoginViewController.h
  35. +364 −0 Sources/SoundCloudAPI/SCLoginViewController.m
  36. +124 −0 Sources/SoundCloudAPI/SCSoundCloudAPI.h
  37. +285 −0 Sources/SoundCloudAPI/SCSoundCloudAPI.m
  38. +49 −0 Sources/SoundCloudAPI/SCSoundCloudAPIAuthentication.h
  39. +195 −0 Sources/SoundCloudAPI/SCSoundCloudAPIAuthentication.m
  40. +44 −0 Sources/SoundCloudAPI/SCSoundCloudAPIAuthenticationDelegate.h
  41. +3 −10 {SoundCloudAPI → }/Sources/SoundCloudAPI/SCSoundCloudAPIConfiguration.h
  42. +19 −33 {SoundCloudAPI → }/Sources/SoundCloudAPI/SCSoundCloudAPIConfiguration.m
  43. +30 −0 Sources/SoundCloudAPI/SCSoundCloudAPIDelegate.h
  44. +3 −0 {SoundCloudAPI → }/Sources/SoundCloudAPI_Prefix.pch
  45. +2 −2 TestApps/MacTestApp/Info.plist
  46. +0 −44 TestApps/MacTestApp/JSON/JSON.h
  47. +0 −60 TestApps/MacTestApp/JSON/NSObject+SBJSON.h
  48. +0 −57 TestApps/MacTestApp/JSON/NSObject+SBJSON.m
  49. +0 −41 TestApps/MacTestApp/JSON/NSString+SBJSON.h
  50. +0 −60 TestApps/MacTestApp/JSON/NSString+SBJSON.m
  51. +0 −137 TestApps/MacTestApp/JSON/SBJSON.h
  52. +0 −740 TestApps/MacTestApp/JSON/SBJSON.m
  53. +255 −138 TestApps/MacTestApp/MacTestApp.xcodeproj/project.pbxproj
  54. +1 −1 TestApps/MacTestApp/SCParameterTableDataSource.h
  55. +8 −9 TestApps/MacTestApp/SCTest_AppDelegate.h
  56. +31 −46 TestApps/MacTestApp/SCTest_AppDelegate.m
  57. +1 −1 TestApps/Support/JSON
  58. +28 −0 TestApps/iPhoneTestApp/Classes/SCSoundCloudAPI+TestApp.h
  59. +49 −0 TestApps/iPhoneTestApp/Classes/SCSoundCloudAPI+TestApp.m
  60. +3 −3 TestApps/iPhoneTestApp/Classes/iPhoneTestAppAppDelegate.h
  61. +39 −32 TestApps/iPhoneTestApp/Classes/iPhoneTestAppAppDelegate.m
  62. +0 −56 TestApps/iPhoneTestApp/Classes/iPhoneTestAppSoundCloudController.h
  63. +0 −100 TestApps/iPhoneTestApp/Classes/iPhoneTestAppSoundCloudController.m
  64. +2 −1 TestApps/iPhoneTestApp/Classes/iPhoneTestAppViewController.h
  65. +37 −22 TestApps/iPhoneTestApp/Classes/iPhoneTestAppViewController.m
  66. +118 −25 TestApps/iPhoneTestApp/iPhoneTestApp.xcodeproj/project.pbxproj
View
@@ -1,6 +1,6 @@
-[submodule "SoundCloudAPI/Outsourced/OAuth2Client"]
- path = SoundCloudAPI/Outsourced/OAuth2Client
+[submodule "Outsourced/OAuth2Client"]
+ path = Outsourced/OAuth2Client
url = git://github.com/nxtbgthng/OAuth2Client.git
[submodule "TestApps/Support/JSON"]
path = TestApps/Support/JSON
- url = git://github.com/stig/json-framework.git
+ url = git://github.com/nxtbgthng/json-framework.git
File renamed without changes.
@@ -10,6 +10,3 @@
This product includes software developed by
Ullrich Schäfer and Gernot Poetsch on behalf of SoundCloud Ltd.
-
- This product also includes software developed by:
- - OAuthConsumer - Jon Crosby, Copyright 2007 Kaboomerang LLC - MIT license
Submodule OAuth2Client added at 716d05
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
Oops, something went wrong.
View
@@ -1 +0,0 @@
-Dist
Submodule OAuth2Client deleted from 382e08
Oops, something went wrong.
@@ -1,16 +0,0 @@
-//
-// NSString+SoundCloudAPI.h
-// Soundcloud
-//
-// Created by Ullrich Schäfer on 07.10.09.
-// Copyright 2009 nxtbgthng. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface NSString (SoundCloudAPI)
-
-+ (NSString *)stringWithUUID;
-
-@end
@@ -1,23 +0,0 @@
-//
-// NSString+SoundCloudAPI.m
-// Soundcloud
-//
-// Created by Ullrich Schäfer on 07.10.09.
-// Copyright 2009 nxtbgthng. All rights reserved.
-//
-
-#import "NSString+SoundCloudAPI.h"
-
-
-@implementation NSString (SoundCloudAPI)
-
-+ (NSString *)stringWithUUID;
-{
- CFUUIDRef theUUID = CFUUIDCreate(NULL);
- CFStringRef string = CFUUIDCreateString(NULL, theUUID);
- CFRelease(theUUID);
-
- return [(NSString *)string autorelease];
-}
-
-@end
@@ -1,107 +0,0 @@
-/*
- * Copyright 2009 Ullrich Schäfer, Gernot Poetsch for SoundCloud Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- *
- * For more information and documentation refer to
- * http://soundcloud.com/api
- *
- */
-
-#import <Foundation/Foundation.h>
-
-@class NXOAuth2Client;
-@class SCSoundCloudAPIConfiguration, SCSoundCloudConnection;
-@protocol SCSoundCloudAPIAuthenticationDelegate, SCSoundCloudConnectionDelegate;
-
-
-typedef enum {
- SCResponseFormatXML,
- SCResponseFormatJSON
-} SCResponseFormat;
-
-
-@interface SCSoundCloudAPI : NSObject {
- SCSoundCloudAPIConfiguration *configuration;
- NXOAuth2Client *oauthClient;
-
- id<SCSoundCloudAPIAuthenticationDelegate> authDelegate;
- SCResponseFormat responseFormat;
- BOOL isAuthenticated;
-
- NSMutableDictionary *apiConnections;
-}
-
-@property (assign) id<SCSoundCloudAPIAuthenticationDelegate> authDelegate;
-@property SCResponseFormat responseFormat;
-@property (assign) BOOL isAuthenticated; // this might change dynamicaly
-
-/*!
- * initialize the api object
- */
-- (id)initWithAuthenticationDelegate:(id<SCSoundCloudAPIAuthenticationDelegate>)authDelegate
- apiConfiguration:(SCSoundCloudAPIConfiguration *)configuration;
-
-/*!
- * invokes a request using the specified HTTP method on the specified resource
- * pass your connection delegate here
- * returns a connection identifier that can be used to cancel the connection
- *
- * NOTE: your connection delegate is going to be retained for as long as the connection is running.
- */
-- (id)performMethod:(NSString *)httpMethod
- onResource:(NSString *)resource
- withParameters:(NSDictionary *)parameters
- context:(id)context
- connectionDelegate:(NSObject<SCSoundCloudConnectionDelegate> *)connectionDelegate;
-
-/*!
- * cancels the connection with the particular connection identifier
- */
-- (void)cancelConnection:(id)connectionId;
-
-
-#pragma mark Authentication
-
-/*!
- * checks if authorized, and if not lets you know in the authDelegate
- */
-- (void)requestAuthentication;
-
-/*!
- * resets token to nil, and removes it from the keychain
- */
-- (void)resetAuthentication;
-
-/*!
- * When you app recieves the callback via it's callback URL pass it on to this method
- * returns YES if the redirectURL was handled
- */
-- (BOOL)handleOpenRedirectURL:(NSURL *)redirectURL;
-
-/*!
- * Use this method to pass Username & Password on Credentials flow
- */
-- (void)authorizeWithUsername:(NSString *)username password:(NSString *)password;
-
-
-@end
-
-
-@protocol SCSoundCloudAPIAuthenticationDelegate <NSObject>
-- (void)soundCloudAPIDidAuthenticate:(SCSoundCloudAPI *)scAPI;
-- (void)soundCloudAPIDidResetAuthentication:(SCSoundCloudAPI *)scAPI;
-- (void)soundCloudAPI:(SCSoundCloudAPI *)scAPI didFailToGetAccessTokenWithError:(NSError *)error;
-
-- (void)soundCloudAPI:(SCSoundCloudAPI *)scAPI preparedAuthorizationURL:(NSURL *)authorizationURL;
-@end
@@ -1,195 +0,0 @@
-/*
- * Copyright 2009 Ullrich Schäfer, Gernot Poetsch for SoundCloud Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- *
- * For more information and documentation refer to
- * http://soundcloud.com/api
- *
- */
-
-
-#import "NXOAuth2Client.h"
-#import "NXOAuth2PostBodyStream.h"
-#import "NSMutableURLRequest+NXOAuth2.h"
-
-#import "SCAPIErrors.h"
-#import "SCSoundCloudConnection.h"
-#import "SCSoundCloudAPIConfiguration.h"
-
-#import "NSString+SoundCloudAPI.h"
-
-#import "SCSoundCloudAPI.h"
-
-
-@interface SCSoundCloudAPI () <NXOAuth2ConnectionDelegate, NXOAuth2ClientAuthDelegate>
-- (NSString *)_responseTypeFromEnum:(SCResponseFormat)responseFormat;
-@end
-
-
-@implementation SCSoundCloudAPI
-
-#pragma mark Lifecycle
-
-- (id)initWithAuthenticationDelegate:(id<SCSoundCloudAPIAuthenticationDelegate>)inAuthDelegate
- apiConfiguration:(SCSoundCloudAPIConfiguration *)aConfiguration;
-{
- if (self = [super init]) {
- responseFormat = SCResponseFormatXML;
-
- configuration = [aConfiguration retain];
- authDelegate = inAuthDelegate;
-
- oauthClient = [[NXOAuth2Client alloc] initWithClientID:[configuration consumerKey]
- clientSecret:[configuration consumerSecret]
- authorizeURL:[configuration authURL]
- tokenURL:[configuration accessTokenURL]
- authDelegate:self];
- apiConnections = [[NSMutableDictionary alloc] init];
- }
- return self;
-}
-
-- (void)dealloc;
-{
- for(SCSoundCloudConnection *connection in [apiConnections allValues]) {
- [connection cancel];
- }
- [apiConnections release];
- [configuration release];
- oauthClient.authDelegate = nil;
- [oauthClient release];
- [super dealloc];
-}
-
-
-#pragma mark Accessors
-
-@synthesize authDelegate;
-@synthesize responseFormat;
-@synthesize isAuthenticated;
-
-
-#pragma mark Public methods
-
-- (void)requestAuthentication;
-{
- [oauthClient requestAccess];
-}
-
-- (void)resetAuthentication;
-{
- oauthClient.accessToken = nil;
-}
-
-- (BOOL)handleOpenRedirectURL:(NSURL *)redirectURL;
-{
- return [oauthClient openRedirectURL:redirectURL];
-}
-
-- (void)authorizeWithUsername:(NSString *)username password:(NSString *)password;
-{
- [oauthClient authorizeWithUsername:username password:password];
-}
-
-#pragma mark Pirivate methods
-
-- (NSString *)_responseTypeFromEnum:(SCResponseFormat)inResponseFormat;
-{
- switch (inResponseFormat) {
- case SCResponseFormatJSON:
- return @"application/json";
- case SCResponseFormatXML:
- default:
- return @"application/xml";
- }
-}
-
-#pragma mark API method
-
-- (id)performMethod:(NSString *)httpMethod
- onResource:(NSString *)resource
- withParameters:(NSDictionary *)parameters
- context:(id)context
- connectionDelegate:(NSObject<SCSoundCloudConnectionDelegate> *)connectionDelegate;
-{
- if (!configuration.apiBaseURL) {
- NSLog(@"API is not configured with base URL");
- return nil;
- }
-
- NSURL *url = [NSURL URLWithString:resource relativeToURL:configuration.apiBaseURL];
- NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
- [request addValue:[self _responseTypeFromEnum:self.responseFormat] forHTTPHeaderField:@"Accept"];
-
- [request setHTTPMethod:[httpMethod uppercaseString]];
- if ((![[httpMethod uppercaseString] isEqualToString:@"POST"]
- && ![[httpMethod uppercaseString] isEqualToString:@"PUT"])
- || parameters.count == 0) {
- [request setParameters:parameters];
- } else {
- NXOAuth2PostBodyStream *postStream = [[NXOAuth2PostBodyStream alloc] initWithParameters:parameters];
- [request setValue: [NSString stringWithFormat:@"multipart/form-data; boundary=%@", [postStream boundary]] forHTTPHeaderField: @"Content-Type"];
- [request setValue:[NSString stringWithFormat:@"%d", [postStream length]] forHTTPHeaderField:@"Content-Length"];
-
- [request setHTTPBodyStream:postStream];
- [postStream release];
- }
-
- id connectionId = [NSString stringWithUUID];
- SCSoundCloudConnection *connection = [SCSoundCloudConnection connectionFromSoundCloudAPI:self request:request oauthClient:oauthClient context:context connectionDelegate:connectionDelegate];
- [apiConnections setObject:connection forKey:connectionId];
- return connectionId;
-}
-
-- (void)cancelConnection:(id)connectionId;
-{
- SCSoundCloudConnection *connection = [apiConnections objectForKey:connectionId];
- if (connection) {
- [connection cancel];
- [apiConnections removeObjectForKey:connectionId];
- }
-}
-
-
-#pragma mark NXOAuth2ClientAuthDelegate
-
-- (void)oauthClientRequestedAuthorization:(NXOAuth2Client *)client;
-{
- NSURL *authorizationURL = nil;
- if ([configuration callbackURL]) {
- authorizationURL = [client authorizationURLWithRedirectURL:[configuration callbackURL]];
- }
- [authDelegate soundCloudAPI:self preparedAuthorizationURL:authorizationURL];
-}
-
-- (void)oauthClientDidLoseAccessToken:(NXOAuth2Client *)client;
-{
- self.isAuthenticated = NO;
- [authDelegate soundCloudAPIDidResetAuthentication:self];
-}
-
-- (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client;
-{
- self.isAuthenticated = YES;
- [authDelegate soundCloudAPIDidAuthenticate:self];
-}
-
-- (void)oauthClient:(NXOAuth2Client *)client didFailToGetAccessTokenWithError:(NSError *)error;
-{
- [authDelegate soundCloudAPI:self didFailToGetAccessTokenWithError:error];
-}
-
-
-@end
-
Oops, something went wrong.

0 comments on commit e4ea96d

Please sign in to comment.