From 7b3f3a10ffd4af5d0f33cab569b42297402ae22e Mon Sep 17 00:00:00 2001 From: ThePantsThief Date: Wed, 30 Dec 2015 17:21:35 -0600 Subject: [PATCH] Added [SKSnap isOutgoing] --- Example/Pods/Local Podspecs/SnapchatKit.podspec.json | 4 ++-- Example/SnapchatKit-OSX/SnapchatKit-OSX/main.m | 6 ------ Pod/Classes/Model/SKSnap.h | 2 ++ Pod/Classes/Model/SKSnap.m | 8 +++++++- Pod/Classes/Model/SKSnapResponse.h | 4 ++-- SnapchatKit.podspec | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Example/Pods/Local Podspecs/SnapchatKit.podspec.json b/Example/Pods/Local Podspecs/SnapchatKit.podspec.json index ab1542d..cc4788b 100644 --- a/Example/Pods/Local Podspecs/SnapchatKit.podspec.json +++ b/Example/Pods/Local Podspecs/SnapchatKit.podspec.json @@ -1,6 +1,6 @@ { "name": "SnapchatKit", - "version": "0.5.0", + "version": "0.5.1", "summary": "An Objective-C implementation of the unofficial Snapchat API.", "homepage": "https://github.com/ThePantsThief/SnapchatKit", "license": "MIT", @@ -9,7 +9,7 @@ }, "source": { "git": "https://github.com/ThePantsThief/SnapchatKit.git", - "tag": "0.5.0" + "tag": "0.5.1" }, "social_media_url": "https://twitter.com/ThePantsThief", "requires_arc": true, diff --git a/Example/SnapchatKit-OSX/SnapchatKit-OSX/main.m b/Example/SnapchatKit-OSX/SnapchatKit-OSX/main.m index 43584d9..2916aae 100644 --- a/Example/SnapchatKit-OSX/SnapchatKit-OSX/main.m +++ b/Example/SnapchatKit-OSX/SnapchatKit-OSX/main.m @@ -248,12 +248,6 @@ int main(int argc, const char * argv[]) { // Get unread snaps NSArray *unread = session.unread; SKLog(@"%lu unread snaps: %@", unread.count, unread); - - - [[SKClient sharedClient] updateFeatureSettings:@{SKFeatureSettings.scrambleBestFriends: @YES, SKFeatureSettings.barcodeEnabled: @YES} completion:^(NSError *error) { - if (error) - NSLog(@"%@", error.localizedDescription); - }]; // // SKStoryCollection *friend = [[SKClient sharedClient].currentSession.stories // filteredOrderedSetUsingPredicate:[NSPredicate predicateWithFormat:@"%K BEGINSWITH %@", @"username", @"luke"]].firstObject; diff --git a/Pod/Classes/Model/SKSnap.h b/Pod/Classes/Model/SKSnap.h index 561c689..73b99c9 100644 --- a/Pod/Classes/Model/SKSnap.h +++ b/Pod/Classes/Model/SKSnap.h @@ -10,6 +10,7 @@ #import "SKThing.h" @class SKBlob; +/** Not a counterpart of the \c SKSentSnap class. */ @interface SKSnap : SKThing /** nil if snap is "outgoing". */ @@ -21,6 +22,7 @@ @property (nonatomic, readonly) NSString *conversationIdentifier; @property (nonatomic, readonly) SKMediaKind mediaKind; @property (nonatomic, readonly) SKSnapStatus status; +@property (nonatomic, readonly) BOOL isOutgoing; @property (nonatomic, readonly) NSUInteger screenshots; /** Integer time. _mediaTimer rounded down. 0 if snap is "outgoing". */ @property (nonatomic, readonly) NSUInteger timer; diff --git a/Pod/Classes/Model/SKSnap.m b/Pod/Classes/Model/SKSnap.m index ba1c793..72051ce 100644 --- a/Pod/Classes/Model/SKSnap.m +++ b/Pod/Classes/Model/SKSnap.m @@ -14,7 +14,13 @@ @implementation SKSnap - (id)initWithDictionary:(NSDictionary *)json { if (!json.allKeys.count) return nil; - return [super initWithDictionary:json]; + + self = [super initWithDictionary:json]; + if (self) { + _isOutgoing = [_identifier hasSuffix:@"s"]; + } + + return self; } - (NSString *)description { diff --git a/Pod/Classes/Model/SKSnapResponse.h b/Pod/Classes/Model/SKSnapResponse.h index 7c45813..3613486 100644 --- a/Pod/Classes/Model/SKSnapResponse.h +++ b/Pod/Classes/Model/SKSnapResponse.h @@ -12,13 +12,13 @@ /** Passed to the completion of both of the \c -[SKClient sendSnap:...] methods. */ @interface SKSnapResponse : SKThing -/** An array of \c SKSentSnap objects. */ +/** An array of \c SKSentSnap objects, not to be confused with outgoing \c SKSnap objects. */ @property (nonatomic, readonly) NSArray *sentSnaps; @property (nonatomic, readonly) BOOL success; @end -/** Used as part of the \c SKSnapResponse class. */ +/** Used as part of the \c SKSnapResponse class; not a counterpart of \c SKSnap. */ @interface SKSentSnap : SKThing @property (nonatomic, readonly) NSString *sender; @property (nonatomic, readonly) NSString *identifier; diff --git a/SnapchatKit.podspec b/SnapchatKit.podspec index 3ed3342..98b6798 100644 --- a/SnapchatKit.podspec +++ b/SnapchatKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SnapchatKit" - s.version = "0.5.0" + s.version = "0.5.1" s.summary = "An Objective-C implementation of the unofficial Snapchat API." s.homepage = "https://github.com/ThePantsThief/SnapchatKit" s.license = 'MIT'