From 1273b66ec0f125ae483b4752963830b3de6c58ac Mon Sep 17 00:00:00 2001 From: ThePantsThief Date: Tue, 13 Oct 2015 19:21:13 -0500 Subject: [PATCH] Fixed the recipient property of SKConversation --- .../SnapchatKit-OSX.xcodeproj/project.pbxproj | 2 +- Example/SnapchatKit.xcodeproj/project.pbxproj | 2 +- Pod/Classes/Model/SKConversation.h | 5 ++--- Pod/Classes/Model/SKConversation.m | 5 +++++ Pod/Classes/Model/SKSession.m | 3 +++ SnapchatKit.podspec | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Example/SnapchatKit-OSX/SnapchatKit-OSX.xcodeproj/project.pbxproj b/Example/SnapchatKit-OSX/SnapchatKit-OSX.xcodeproj/project.pbxproj index 7ecdc15..fb8dd31 100755 --- a/Example/SnapchatKit-OSX/SnapchatKit-OSX.xcodeproj/project.pbxproj +++ b/Example/SnapchatKit-OSX/SnapchatKit-OSX.xcodeproj/project.pbxproj @@ -26,7 +26,7 @@ /* Begin PBXFileReference section */ A3FE50062F493EF242FAFB51 /* Pods-SnapchatKit-OSX.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SnapchatKit-OSX.release.xcconfig"; path = "../Pods/Target Support Files/Pods-SnapchatKit-OSX/Pods-SnapchatKit-OSX.release.xcconfig"; sourceTree = ""; }; - B4CF268F1BC48BF100AAF1D0 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = ../../../../../Login.h; sourceTree = ""; }; + B4CF268F1BC48BF100AAF1D0 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = /Users/tantan/Login.h; sourceTree = ""; }; B4D11BA51B90E3850012116A /* SnapchatKit-OSX */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "SnapchatKit-OSX"; sourceTree = BUILT_PRODUCTS_DIR; }; B4D11BA81B90E3850012116A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; B4D11BAF1B90E3B60012116A /* TBTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBTimer.h; sourceTree = ""; }; diff --git a/Example/SnapchatKit.xcodeproj/project.pbxproj b/Example/SnapchatKit.xcodeproj/project.pbxproj index fba3b48..3e51004 100755 --- a/Example/SnapchatKit.xcodeproj/project.pbxproj +++ b/Example/SnapchatKit.xcodeproj/project.pbxproj @@ -64,7 +64,7 @@ B49E0ED01B6A6F110086F8D0 /* SNTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNTableViewController.m; sourceTree = ""; }; B49E0ED21B6A6F470086F8D0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; B49E0ED41B6A6FE80086F8D0 /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = ""; }; - B4F60B8F1B7A8EBB00044420 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = ../../../../Login.h; sourceTree = ""; }; + B4F60B8F1B7A8EBB00044420 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = /Users/tantan/Login.h; sourceTree = ""; }; B4F75D7B1B7A7C3A008E6FF8 /* SKAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKAppDelegate.m; sourceTree = ""; }; C50B6337FD849C47AAA86405 /* Pods-SnapchatKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SnapchatKit_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SnapchatKit_Example/Pods-SnapchatKit_Example.release.xcconfig"; sourceTree = ""; }; CBB5C915BC5AC56D10244C95 /* SnapchatKit.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SnapchatKit.podspec; path = ../SnapchatKit.podspec; sourceTree = ""; }; diff --git a/Pod/Classes/Model/SKConversation.h b/Pod/Classes/Model/SKConversation.h index eba3697..4288573 100755 --- a/Pod/Classes/Model/SKConversation.h +++ b/Pod/Classes/Model/SKConversation.h @@ -69,6 +69,8 @@ extern SKChatType SKChatTypeFromString(NSString *chatTypeString); /** \c nil if not applicable. */ @property (nonatomic, readonly) SKCashTransaction *lastTransaction; +/** The current signed in user. */ +@property (nonatomic, readonly) NSString *recipient; /** Array of username strings. */ @property (nonatomic, readonly) NSArray *participants; /** Array of username strings. */ @@ -85,9 +87,6 @@ extern SKChatType SKChatTypeFromString(NSString *chatTypeString); @end @interface SKConversation (SKClient) -@property (nonatomic, readonly) NSString *recipient; -/** @return The (first) participant that is not the current (given) user. */ -- (NSString *)recipientGivenUser:(NSString *)user; /** Whether or not \c user has unread messages. */ - (BOOL)userHasUnreadChats:(NSString *)user; /** All messages in a human-readable, newline separated format. */ diff --git a/Pod/Classes/Model/SKConversation.m b/Pod/Classes/Model/SKConversation.m index 0260f16..3767c24 100755 --- a/Pod/Classes/Model/SKConversation.m +++ b/Pod/Classes/Model/SKConversation.m @@ -183,6 +183,11 @@ - (NSString *)suggestedChatPreview { return @""; } +- (void)setRecipient:(NSString *)recipient { + NSParameterAssert(recipient); + _recipient = recipient; +} + @end @implementation SKConversation (SKClient) diff --git a/Pod/Classes/Model/SKSession.m b/Pod/Classes/Model/SKSession.m index 65464ae..990e599 100755 --- a/Pod/Classes/Model/SKSession.m +++ b/Pod/Classes/Model/SKSession.m @@ -98,6 +98,9 @@ - (id)initWithDictionary:(NSDictionary *)json { [temp addObject:[[SKConversation alloc] initWithDictionary:convo]]; _conversations = temp; + #pragma clang diagnostic ignored "-Wundeclared-selector" + [_conversations.array makeObjectsPerformSelector:@selector(setRecipient:) withObject:self.username]; + // Story collections temp = [NSMutableOrderedSet orderedSet]; for (NSDictionary *collection in friendStories) diff --git a/SnapchatKit.podspec b/SnapchatKit.podspec index b93f158..5938c82 100644 --- a/SnapchatKit.podspec +++ b/SnapchatKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SnapchatKit" - s.version = "0.3.5" + s.version = "0.3.6" s.summary = "An Objective-C implementation of the unofficial Snapchat API." s.homepage = "https://github.com/ThePantsThief/SnapchatKit" s.license = 'MIT'