Permalink
Browse files

Merge branch 'CL-148' into CL-151

Conflicts:
	objective-c/3.3/Pubnub/PubNub/CEPubnub.m
  • Loading branch information...
2 parents d8a4eaa + a6396f3 commit a0888fdfb95aa7ae94154a79b6a28a64df367e89 geremy cohen committed Aug 31, 2012
Showing with 5,991 additions and 9 deletions.
  1. +11 −1 objective-c/3.3/Pubnub/PubNub/CEPubnub.m
  2. +328 −0 objective-c/3.3/PubnubTest/PubnubTest.xcodeproj/project.pbxproj
  3. +7 −0 objective-c/3.3/PubnubTest/PubnubTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  4. BIN ...st.xcodeproj/project.xcworkspace/xcuserdata/dahiwadkar.xcuserdatad/UserInterfaceState.xcuserstate
  5. +5 −0 ...bnubTest/PubnubTest.xcodeproj/xcuserdata/dahiwadkar.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  6. +95 −0 ...3/PubnubTest/PubnubTest.xcodeproj/xcuserdata/dahiwadkar.xcuserdatad/xcschemes/PubnubTest.xcscheme
  7. +27 −0 ...nubTest/PubnubTest.xcodeproj/xcuserdata/dahiwadkar.xcuserdatad/xcschemes/xcschememanagement.plist
  8. +15 −0 objective-c/3.3/PubnubTest/PubnubTest/AppDelegate.h
  9. +50 −0 objective-c/3.3/PubnubTest/PubnubTest/AppDelegate.m
  10. +23 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Base64.h
  11. +97 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Base64.m
  12. +102 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/CEPubnub.h
  13. +903 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/CEPubnub.m
  14. +21 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Cipher.h
  15. +107 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Cipher.m
  16. +26 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Common.h
  17. +110 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/Common.m
  18. +32 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/JSON.h
  19. +94 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/JSON.m
  20. +251 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/JSONKit.h
  21. +3,111 −0 objective-c/3.3/PubnubTest/PubnubTest/PubNub/JSONKit.m
  22. +40 −0 objective-c/3.3/PubnubTest/PubnubTest/PubnubTest-Info.plist
  23. +15 −0 objective-c/3.3/PubnubTest/PubnubTest/PubnubTest-Prefix.pch
  24. +16 −0 objective-c/3.3/PubnubTest/PubnubTest/ViewController.h
  25. +391 −0 objective-c/3.3/PubnubTest/PubnubTest/ViewController.m
  26. +2 −0 objective-c/3.3/PubnubTest/PubnubTest/en.lproj/InfoPlist.strings
  27. +68 −0 objective-c/3.3/PubnubTest/PubnubTest/en.lproj/MainStoryboard.storyboard
  28. +18 −0 objective-c/3.3/PubnubTest/PubnubTest/main.m
  29. +13 −1 objective-c/README.md
  30. +13 −7 python/README
@@ -557,7 +557,9 @@ - (void) detailedHistory:(NSDictionary * )arg1 {
if ([parameters length] > 0) {
[parameters insertString:@"?" atIndex:0 ];
}
+
[CommonFunction Log: [NSString stringWithFormat:@"In detailedHistory with channel:%@",channel]];
+
NSString* url = [NSString stringWithFormat:@"%@/v2/history/sub-key/%@/channel/%@%@", _host, _subscribeKey, [channel urlEscapedString],[parameters description]];
PubNubConnection* connection = [[PubNubConnection alloc] initWithPubNub:self
url:[NSURL URLWithString:url]
@@ -722,6 +724,7 @@ - (void) connection:(PubNubConnection*)connection didCompleteWithResponse:(id)re
if ([it.channel isEqualToString:connection.channel])
{
[CommonFunction Log:@"In didCompleteWithResponse Test for discnnecting call "];
+
if(it.first && it.connected) {
it.connected=NO;
if ([_delegate respondsToSelector:@selector(pubnub:DisconnectToChannel:)]) {
@@ -737,7 +740,9 @@ - (void) connection:(PubNubConnection*)connection didCompleteWithResponse:(id)re
}else
{
+
[CommonFunction Log:@"In didCompleteWithResponse reconnect call "];
+
if ([_delegate respondsToSelector:@selector(pubnub:Re_ConnectToChannel:)]) {
[_delegate pubnub:self Re_ConnectToChannel:connection.channel];
}
@@ -841,21 +846,26 @@ - (void) connection:(PubNubConnection*)connection didCompleteWithResponse:(id)re
[mainArray addObject:str];
}
}
+
[CommonFunction Log:@"In didCompleteWithResponse FetchDetailHistory "];
- [returnArray replaceObjectAtIndex:0 withObject:mainArray];
+ [returnArray replaceObjectAtIndex:0 withObject:mainArray];
}else if (response) {
NSLog(@"Unexpected history response from PubNub");
}
if(response)
{
+
[CommonFunction Log:@"In didCompleteWithResponse Sucess FetchDetailHistory "];
+
if ([_delegate respondsToSelector: @selector(pubnub:didFetchDetailedHistory:forChannel:)]) {
[_delegate pubnub:self didFetchDetailedHistory: [NSArray arrayWithArray: returnArray] forChannel: connection.channel];
}
}else {
+
[CommonFunction Log:@"In didCompleteWithResponse Fail FetchDetailHistory "];
+
NSArray* array= [NSArray arrayWithObjects:@"0", @"Fetch History request failed due to missing Internet connection", nil];
if ([_delegate respondsToSelector: @selector(pubnub:didFailFetchDetailedHistoryOnChannel:withError:)]) {
[_delegate pubnub:self didFailFetchDetailedHistoryOnChannel:connection.channel withError:array];

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+</Bucket>
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C8FD6F4515B93F9B00A299E6"
+ BuildableName = "PubnubTest.app"
+ BlueprintName = "PubnubTest"
+ ReferencedContainer = "container:PubnubTest.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ <TestableReference
+ skipped = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C8FD6F6615B93F9D00A299E6"
+ BuildableName = "PubnubTestTests.octest"
+ BlueprintName = "PubnubTestTests"
+ ReferencedContainer = "container:PubnubTest.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C8FD6F4515B93F9B00A299E6"
+ BuildableName = "PubnubTest.app"
+ BlueprintName = "PubnubTest"
+ ReferencedContainer = "container:PubnubTest.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C8FD6F4515B93F9B00A299E6"
+ BuildableName = "PubnubTest.app"
+ BlueprintName = "PubnubTest"
+ ReferencedContainer = "container:PubnubTest.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C8FD6F4515B93F9B00A299E6"
+ BuildableName = "PubnubTest.app"
+ BlueprintName = "PubnubTest"
+ ReferencedContainer = "container:PubnubTest.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
@@ -0,0 +1,27 @@
+<?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>SchemeUserState</key>
+ <dict>
+ <key>PubnubTest.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>C8FD6F4515B93F9B00A299E6</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ <key>C8FD6F6615B93F9D00A299E6</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
@@ -0,0 +1,15 @@
+//
+// AppDelegate.h
+//
+//
+// Created by itshastra on 20/07/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end
@@ -0,0 +1,50 @@
+//
+// AppDelegate.m
+//
+//
+// Created by itshastra on 20/07/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
@@ -0,0 +1,23 @@
+//
+// Base64.h
+// CryptTest
+//
+// Created by Kiichi Takeuchi on 4/20/10.
+// Copyright 2010 ObjectGraph LLC. All rights reserved.
+//
+// Original Source Code is donated by Cyrus
+// Public Domain License
+// http://www.cocoadev.com/index.pl?BaseSixtyFour
+
+#import <Foundation/Foundation.h>
+
+
+@interface Base64 : NSObject {
+
+}
++ (void) initialize;
++ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length;
++ (NSString*) encode:(NSData*) rawBytes;
++ (NSData*) decode:(const char*) string length:(NSInteger) inputLength;
++ (NSData*) decode:(NSString*) string;
+@end
@@ -0,0 +1,97 @@
+//
+// Base64.m
+// CryptTest
+//
+// Created by Kiichi Takeuchi on 4/20/10.
+// Copyright 2010 ObjectGraph LLC. All rights reserved.
+//
+
+#import "Base64.h"
+
+
+@implementation Base64
+#define ArrayLength(x) (sizeof(x)/sizeof(*(x)))
+
+static char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static char decodingTable[128];
+
++ (void) initialize {
+ if (self == [Base64 class]) {
+ memset(decodingTable, 0, ArrayLength(decodingTable));
+ for (NSInteger i = 0; i < ArrayLength(encodingTable); i++) {
+ decodingTable[encodingTable[i]] = i;
+ }
+ }
+}
+
+
++ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length {
+ NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
+ uint8_t* output = (uint8_t*)data.mutableBytes;
+
+ for (NSInteger i = 0; i < length; i += 3) {
+ NSInteger value = 0;
+ for (NSInteger j = i; j < (i + 3); j++) {
+ value <<= 8;
+
+ if (j < length) {
+ value |= (0xFF & input[j]);
+ }
+ }
+
+ NSInteger index = (i / 3) * 4;
+ output[index + 0] = encodingTable[(value >> 18) & 0x3F];
+ output[index + 1] = encodingTable[(value >> 12) & 0x3F];
+ output[index + 2] = (i + 1) < length ? encodingTable[(value >> 6) & 0x3F] : '=';
+ output[index + 3] = (i + 2) < length ? encodingTable[(value >> 0) & 0x3F] : '=';
+ }
+
+ return [[NSString alloc] initWithData:data
+ encoding:NSASCIIStringEncoding] ;
+}
+
+
++ (NSString*) encode:(NSData*) rawBytes {
+ return [self encode:(const uint8_t*) rawBytes.bytes length:rawBytes.length];
+}
+
+
++ (NSData*) decode:(const char*) string length:(NSInteger) inputLength {
+ if ((string == NULL) || (inputLength % 4 != 0)) {
+ return nil;
+ }
+
+ while (inputLength > 0 && string[inputLength - 1] == '=') {
+ inputLength--;
+ }
+
+ NSInteger outputLength = inputLength * 3 / 4;
+ NSMutableData* data = [NSMutableData dataWithLength:outputLength];
+ uint8_t* output = data.mutableBytes;
+
+ NSInteger inputPoint = 0;
+ NSInteger outputPoint = 0;
+ while (inputPoint < inputLength) {
+ char i0 = string[inputPoint++];
+ char i1 = string[inputPoint++];
+ char i2 = inputPoint < inputLength ? string[inputPoint++] : 'A'; /* 'A' will decode to \0 */
+ char i3 = inputPoint < inputLength ? string[inputPoint++] : 'A';
+
+ output[outputPoint++] = (decodingTable[i0] << 2) | (decodingTable[i1] >> 4);
+ if (outputPoint < outputLength) {
+ output[outputPoint++] = ((decodingTable[i1] & 0xf) << 4) | (decodingTable[i2] >> 2);
+ }
+ if (outputPoint < outputLength) {
+ output[outputPoint++] = ((decodingTable[i2] & 0x3) << 6) | decodingTable[i3];
+ }
+ }
+
+ return data;
+}
+
+
++ (NSData*) decode:(NSString*) string {
+ return [self decode:[string cStringUsingEncoding:NSASCIIStringEncoding] length:string.length];
+}
+
+@end
Oops, something went wrong.

0 comments on commit a0888fd

Please sign in to comment.