Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Commit

Permalink
Fixed the recipient property of SKConversation
Browse files Browse the repository at this point in the history
  • Loading branch information
NSExceptional committed Oct 14, 2015
1 parent f13cacb commit 1273b66
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
B4CF268F1BC48BF100AAF1D0 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = ../../../../../Login.h; sourceTree = "<group>"; };
B4CF268F1BC48BF100AAF1D0 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = /Users/tantan/Login.h; sourceTree = "<absolute>"; };
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 = "<group>"; };
B4D11BAF1B90E3B60012116A /* TBTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBTimer.h; sourceTree = "<group>"; };
Expand Down
2 changes: 1 addition & 1 deletion Example/SnapchatKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
B49E0ED01B6A6F110086F8D0 /* SNTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNTableViewController.m; sourceTree = "<group>"; };
B49E0ED21B6A6F470086F8D0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
B49E0ED41B6A6FE80086F8D0 /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
B4F60B8F1B7A8EBB00044420 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = ../../../../Login.h; sourceTree = "<group>"; };
B4F60B8F1B7A8EBB00044420 /* Login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Login.h; path = /Users/tantan/Login.h; sourceTree = "<absolute>"; };
B4F75D7B1B7A7C3A008E6FF8 /* SKAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKAppDelegate.m; sourceTree = "<group>"; };
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 = "<group>"; };
CBB5C915BC5AC56D10244C95 /* SnapchatKit.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SnapchatKit.podspec; path = ../SnapchatKit.podspec; sourceTree = "<group>"; };
Expand Down
5 changes: 2 additions & 3 deletions Pod/Classes/Model/SKConversation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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. */
Expand Down
5 changes: 5 additions & 0 deletions Pod/Classes/Model/SKConversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ - (NSString *)suggestedChatPreview {
return @"";
}

- (void)setRecipient:(NSString *)recipient {
NSParameterAssert(recipient);
_recipient = recipient;
}

@end

@implementation SKConversation (SKClient)
Expand Down
3 changes: 3 additions & 0 deletions Pod/Classes/Model/SKSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion SnapchatKit.podspec
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 1273b66

Please sign in to comment.