Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdonnelly committed Jun 28, 2014
2 parents 656e8bc + fce3e11 commit 929573f
Show file tree
Hide file tree
Showing 15 changed files with 287 additions and 211 deletions.
53 changes: 20 additions & 33 deletions Swifter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
8B116AF2194601970019A4DC /* SwifterHTTPRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B116AF0194601970019A4DC /* SwifterHTTPRequest.swift */; };
8B1F259F194A663D004BD304 /* SwifterHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1F259E194A663D004BD304 /* SwifterHelp.swift */; };
8B1F25A0194A663D004BD304 /* SwifterHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1F259E194A663D004BD304 /* SwifterHelp.swift */; };
8B300C241944AA1A00993175 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B300C231944AA1A00993175 /* AppDelegate.swift */; };
8B300C261944AA1A00993175 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B300C251944AA1A00993175 /* ViewController.swift */; };
8B300C291944AA1A00993175 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8B300C271944AA1A00993175 /* Main.storyboard */; };
8B300C3E1944AA6600993175 /* SwifteriOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9F50EE1944A5AB00894629 /* SwifteriOS.framework */; };
8B300C3F1944AA6600993175 /* SwifteriOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9F50EE1944A5AB00894629 /* SwifteriOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8B300C4C1944AECB00993175 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B300C4B1944AECB00993175 /* main.swift */; };
Expand All @@ -33,14 +30,14 @@
8B552D2B194643CF0052EB86 /* NSURL+Swifter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B552D29194643CF0052EB86 /* NSURL+Swifter.swift */; };
8B552D2D194695F80052EB86 /* SwifterStreaming.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B552D2C194695F80052EB86 /* SwifterStreaming.swift */; };
8B552D2E194695F80052EB86 /* SwifterStreaming.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B552D2C194695F80052EB86 /* SwifterStreaming.swift */; };
8B5EFF07195F064400B354F9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5EFF03195F064400B354F9 /* AppDelegate.swift */; };
8B5EFF08195F064400B354F9 /* AuthViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5EFF04195F064400B354F9 /* AuthViewController.swift */; };
8B5EFF09195F064400B354F9 /* TweetsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5EFF05195F064400B354F9 /* TweetsViewController.swift */; };
8B5EFF0A195F064400B354F9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8B5EFF06195F064400B354F9 /* Main.storyboard */; };
8B9F50F41944A5AB00894629 /* SwifteriOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F50F31944A5AB00894629 /* SwifteriOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
8B9F51181944A61D00894629 /* SwifterMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F51171944A61D00894629 /* SwifterMac.h */; settings = {ATTRIBUTES = (Public, ); }; };
8B9F514D1944A8DC00894629 /* Dictionary+Swifter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F51471944A8DC00894629 /* Dictionary+Swifter.swift */; };
8B9F514E1944A8DC00894629 /* Dictionary+Swifter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F51471944A8DC00894629 /* Dictionary+Swifter.swift */; };
8B9F514F1944A8DC00894629 /* HMACSHA1Signature.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F51481944A8DC00894629 /* HMACSHA1Signature.h */; };
8B9F51501944A8DC00894629 /* HMACSHA1Signature.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F51481944A8DC00894629 /* HMACSHA1Signature.h */; };
8B9F51511944A8DC00894629 /* HMACSHA1Signature.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F51491944A8DC00894629 /* HMACSHA1Signature.m */; };
8B9F51521944A8DC00894629 /* HMACSHA1Signature.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F51491944A8DC00894629 /* HMACSHA1Signature.m */; };
8B9F51531944A8DC00894629 /* String+Swifter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F514A1944A8DC00894629 /* String+Swifter.swift */; };
8B9F51541944A8DC00894629 /* String+Swifter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B9F514A1944A8DC00894629 /* String+Swifter.swift */; };
8B9F51551944A8DC00894629 /* Swifter-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B9F514B1944A8DC00894629 /* Swifter-Bridging-Header.h */; };
Expand Down Expand Up @@ -125,9 +122,6 @@
8B1F259E194A663D004BD304 /* SwifterHelp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterHelp.swift; sourceTree = "<group>"; };
8B300C1F1944AA1A00993175 /* SwifterDemoiOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwifterDemoiOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
8B300C221944AA1A00993175 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8B300C231944AA1A00993175 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
8B300C251944AA1A00993175 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
8B300C281944AA1A00993175 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8B300C471944AECB00993175 /* SwifterDemoMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwifterDemoMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
8B300C4A1944AECB00993175 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8B300C4B1944AECB00993175 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
Expand All @@ -142,15 +136,17 @@
8B548F5B1945331D00EE2927 /* SwifterTimelines.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterTimelines.swift; sourceTree = "<group>"; };
8B552D29194643CF0052EB86 /* NSURL+Swifter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSURL+Swifter.swift"; sourceTree = "<group>"; };
8B552D2C194695F80052EB86 /* SwifterStreaming.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterStreaming.swift; sourceTree = "<group>"; };
8B5EFF03195F064400B354F9 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
8B5EFF04195F064400B354F9 /* AuthViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthViewController.swift; sourceTree = "<group>"; };
8B5EFF05195F064400B354F9 /* TweetsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TweetsViewController.swift; sourceTree = "<group>"; };
8B5EFF06195F064400B354F9 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
8B9F50EE1944A5AB00894629 /* SwifteriOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwifteriOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8B9F50F21944A5AB00894629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8B9F50F31944A5AB00894629 /* SwifteriOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwifteriOS.h; sourceTree = "<group>"; };
8B9F51131944A61D00894629 /* SwifterMac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwifterMac.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8B9F51161944A61D00894629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8B9F51171944A61D00894629 /* SwifterMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwifterMac.h; sourceTree = "<group>"; };
8B9F51471944A8DC00894629 /* Dictionary+Swifter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Dictionary+Swifter.swift"; sourceTree = "<group>"; };
8B9F51481944A8DC00894629 /* HMACSHA1Signature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMACSHA1Signature.h; sourceTree = "<group>"; };
8B9F51491944A8DC00894629 /* HMACSHA1Signature.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMACSHA1Signature.m; sourceTree = "<group>"; };
8B9F514A1944A8DC00894629 /* String+Swifter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Swifter.swift"; sourceTree = "<group>"; };
8B9F514B1944A8DC00894629 /* Swifter-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Swifter-Bridging-Header.h"; sourceTree = "<group>"; };
8B9F514C1944A8DC00894629 /* Swifter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Swifter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -216,10 +212,11 @@
8B300C201944AA1A00993175 /* SwifterDemoiOS */ = {
isa = PBXGroup;
children = (
8B300C231944AA1A00993175 /* AppDelegate.swift */,
8B300C251944AA1A00993175 /* ViewController.swift */,
8B5EFF03195F064400B354F9 /* AppDelegate.swift */,
8B5EFF04195F064400B354F9 /* AuthViewController.swift */,
8B5EFF05195F064400B354F9 /* TweetsViewController.swift */,
8B5EFF06195F064400B354F9 /* Main.storyboard */,
8BCB9328194B2E1200A998EA /* Images.xcassets */,
8B300C271944AA1A00993175 /* Main.storyboard */,
8B300C211944AA1A00993175 /* Supporting Files */,
);
path = SwifterDemoiOS;
Expand Down Expand Up @@ -315,6 +312,7 @@
8B9F51461944A8DC00894629 /* SwifterCommon */ = {
isa = PBXGroup;
children = (
8B9F514B1944A8DC00894629 /* Swifter-Bridging-Header.h */,
8B9F514C1944A8DC00894629 /* Swifter.swift */,
8BF1D6871948C11E00E3AA64 /* SwifterCredential.swift */,
8B548F581945325E00EE2927 /* SwifterAuth.swift */,
Expand All @@ -339,9 +337,6 @@
8BA50EC61953828A00FB1829 /* SwifterAppOnlyClient.swift */,
8B116AF0194601970019A4DC /* SwifterHTTPRequest.swift */,
8B33CA3E19587C6D00739FCB /* JSON.swift */,
8B9F514B1944A8DC00894629 /* Swifter-Bridging-Header.h */,
8B9F51481944A8DC00894629 /* HMACSHA1Signature.h */,
8B9F51491944A8DC00894629 /* HMACSHA1Signature.m */,
8B9F51591944A8E100894629 /* Extensions */,
);
path = SwifterCommon;
Expand All @@ -366,7 +361,6 @@
files = (
8B9F50F41944A5AB00894629 /* SwifteriOS.h in Headers */,
8B9F51551944A8DC00894629 /* Swifter-Bridging-Header.h in Headers */,
8B9F514F1944A8DC00894629 /* HMACSHA1Signature.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -376,7 +370,6 @@
files = (
8B9F51181944A61D00894629 /* SwifterMac.h in Headers */,
8B9F51561944A8DC00894629 /* Swifter-Bridging-Header.h in Headers */,
8B9F51501944A8DC00894629 /* HMACSHA1Signature.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -528,8 +521,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8B300C291944AA1A00993175 /* Main.storyboard in Resources */,
8BCB9329194B2E1200A998EA /* Images.xcassets in Resources */,
8B5EFF0A195F064400B354F9 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -570,8 +563,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8B300C261944AA1A00993175 /* ViewController.swift in Sources */,
8B300C241944AA1A00993175 /* AppDelegate.swift in Sources */,
8B5EFF08195F064400B354F9 /* AuthViewController.swift in Sources */,
8B5EFF07195F064400B354F9 /* AppDelegate.swift in Sources */,
8B5EFF09195F064400B354F9 /* TweetsViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -608,7 +602,6 @@
8B548F591945325E00EE2927 /* SwifterAuth.swift in Sources */,
8BCF431D1947907300E63301 /* SwifterMessages.swift in Sources */,
8B9F51531944A8DC00894629 /* String+Swifter.swift in Sources */,
8B9F51511944A8DC00894629 /* HMACSHA1Signature.m in Sources */,
8BF1D67C1948882700E3AA64 /* SwifterSpam.swift in Sources */,
8BCF431A19475D3C00E63301 /* SwifterSearch.swift in Sources */,
8B33CA3F19587C6D00739FCB /* JSON.swift in Sources */,
Expand Down Expand Up @@ -643,7 +636,6 @@
8B548F5A1945325E00EE2927 /* SwifterAuth.swift in Sources */,
8BCF431E1947907300E63301 /* SwifterMessages.swift in Sources */,
8B9F51541944A8DC00894629 /* String+Swifter.swift in Sources */,
8B9F51521944A8DC00894629 /* HMACSHA1Signature.m in Sources */,
8BF1D67D1948882700E3AA64 /* SwifterSpam.swift in Sources */,
8BCF431B19475D3C00E63301 /* SwifterSearch.swift in Sources */,
8B33CA4019587C6D00739FCB /* JSON.swift in Sources */,
Expand Down Expand Up @@ -683,14 +675,6 @@
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
8B300C271944AA1A00993175 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
8B300C281944AA1A00993175 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
8B300C531944AECB00993175 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand All @@ -707,6 +691,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -715,6 +700,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
METAL_ENABLE_DEBUG_INFO = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
Expand All @@ -723,6 +709,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = SwifterDemoiOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
METAL_ENABLE_DEBUG_INFO = NO;
Expand Down
32 changes: 0 additions & 32 deletions SwifterCommon/HMACSHA1Signature.h

This file was deleted.

13 changes: 13 additions & 0 deletions SwifterCommon/String+Swifter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ extension String {

return parameters
}

func SHA1DigestWithKey(key: String) -> NSData {
let str = self.cStringUsingEncoding(NSUTF8StringEncoding)
let strLen = UInt(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))
let digestLen = Int(CC_SHA1_DIGEST_LENGTH)
let result = UnsafePointer<CUnsignedChar>.alloc(digestLen)
let keyStr = key.cStringUsingEncoding(NSUTF8StringEncoding)
let keyLen = UInt(key.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))

CCHmac(CCHmacAlgorithm(kCCHmacAlgSHA1), keyStr!, keyLen, str!, strLen, result)

return NSData(bytes: result, length: digestLen)
}

}

2 changes: 1 addition & 1 deletion SwifterCommon/Swifter-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
// THE SOFTWARE.
//

#import "HMACSHA1Signature.h"
#import <CommonCrypto/CommonCrypto.h>
8 changes: 4 additions & 4 deletions SwifterCommon/SwifterOAuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ class SwifterOAuthClient: SwifterClientProtocol {
let encodedConsumerSecret = self.consumerSecret.urlEncodedStringWithEncoding(self.dataEncoding)

let signingKey = "\(encodedConsumerSecret)&\(tokenSecret)"
let signingKeyData = signingKey.bridgeToObjectiveC().dataUsingEncoding(self.dataEncoding)

let parameterComponents = parameters.urlEncodedQueryStringWithEncoding(self.dataEncoding).componentsSeparatedByString("&") as String[]
parameterComponents.sort { $0 < $1 }
Expand All @@ -170,9 +169,10 @@ class SwifterOAuthClient: SwifterClientProtocol {
let encodedURL = url.absoluteString.urlEncodedStringWithEncoding(self.dataEncoding)

let signatureBaseString = "\(method)&\(encodedURL)&\(encodedParameterString)"
let signatureBaseStringData = signatureBaseString.dataUsingEncoding(self.dataEncoding)

return HMACSHA1Signature.signatureForKey(signingKeyData, data: signatureBaseStringData).base64EncodedStringWithOptions(nil)

let signature = signatureBaseString.SHA1DigestWithKey(signingKey)

return signatureBaseString.SHA1DigestWithKey(signingKey).base64EncodedStringWithOptions(nil)
}

}
2 changes: 1 addition & 1 deletion SwifterDemoMac/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import SwifterMac

class ViewController: NSViewController {

let useACAccount = true
let useACAccount = false

override func viewDidLoad() {
super.viewDidLoad()
Expand Down
Empty file modified SwifterDemoiOS/AppDelegate.swift
100644 → 100755
Empty file.
Loading

0 comments on commit 929573f

Please sign in to comment.