forked from mmackh/Hacker-News-for-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Pocket support to the UIActivityVC
- Loading branch information
Showing
22 changed files
with
2,492 additions
and
41 deletions.
There are no files selected for viewing
39 changes: 0 additions & 39 deletions
39
Hacker News.xcodeproj/project.xcworkspace/xcshareddata/Hacker News.xccheckout
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Constants.h | ||
// Hacker News | ||
// | ||
// Created by Zach Orr on 6/29/13. | ||
// Copyright (c) 2013 Maximilian Mackh. All rights reserved. | ||
// | ||
|
||
#ifndef Hacker_News_Constants_h | ||
#define Hacker_News_Constants_h | ||
|
||
#define kPocketConsumerKeyiPhone @"" | ||
#define kPocketConsumerKeyiPad @"" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// PocketAPI.h | ||
// PocketSDK | ||
// | ||
// Created by James Yopp on 2012/08/21. | ||
// Copyright (c) 2012 Read It Later, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
// software and associated documentation files (the "Software"), to deal in the Software | ||
// without restriction, including without limitation the rights to use, copy, modify, | ||
// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
|
||
// Advanced use if you use your own NSOperationQueues for handling network traffic. | ||
// If you don't need tight control over network requests, just use the simple API. | ||
// Note: May not behave predictably if recoverable errors are encountered. | ||
|
||
@interface PocketAPI (NSOperations) | ||
|
||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
title:(NSString *)title | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
title:(NSString *)title | ||
tweetID:(NSString *)tweetID | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
-(NSOperation *)methodOperationWithAPIMethod:(NSString *)APIMethod | ||
forHTTPMethod:(PocketAPIHTTPMethod)HTTPMethod | ||
arguments:(NSDictionary *)arguments | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
#if NS_BLOCKS_AVAILABLE | ||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
handler:(PocketAPISaveHandler)handler; | ||
|
||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
title:(NSString *)title | ||
handler:(PocketAPISaveHandler)handler; | ||
|
||
-(NSOperation *)saveOperationWithURL:(NSURL *)url | ||
title:(NSString *)title | ||
tweetID:(NSString *)tweetID | ||
handler:(PocketAPISaveHandler)handler; | ||
|
||
-(NSOperation *)methodOperationWithAPIMethod:(NSString *)APIMethod | ||
forHTTPMethod:(PocketAPIHTTPMethod)HTTPMethod | ||
arguments:(NSDictionary *)arguments | ||
handler:(PocketAPIResponseHandler)handler; | ||
#endif | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// | ||
// PocketAPI.h | ||
// PocketSDK | ||
// | ||
// Created by Steve Streza on 5/29/12. | ||
// Copyright (c) 2012 Read It Later, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
// software and associated documentation files (the "Software"), to deal in the Software | ||
// without restriction, including without limitation the rights to use, copy, modify, | ||
// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
/** | ||
* The PocketAPI class represents a singleton for saving stuff to a user's Pocket list. | ||
* To begin, you will need to obtain an API token from https://getpocket.com/api/ and set it | ||
* on the PocketAPI singleton at some point at the beginning of your application's lifecycle. | ||
* | ||
* APIs are presented in one of four ways, but all behave fundamentally the same. Their differences | ||
* are presented for flexibility for your app. You can use: | ||
* | ||
* - a delegate-based API | ||
* - a block-based API | ||
* - an NSOperation based on a delegate (for advanced uses) | ||
* - an NSOperation based on a block (for advanced uses) | ||
* | ||
* All delegates and blocks are called on the main thread, so you can safely update UI from there. | ||
* | ||
* You can find more information on these in PocketAPITypes.h | ||
* | ||
* These classes are not implemented as ARC, but will interoperate with ARC. You will need to add the | ||
* -fno-objc-arc compiler flag to each of the files in the SDK. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "PocketAPITypes.h" | ||
|
||
@class PocketAPILogin; | ||
|
||
@interface PocketAPI : NSObject { | ||
NSString *consumerKey; | ||
NSString *URLScheme; | ||
NSOperationQueue *operationQueue; | ||
|
||
PocketAPILogin *currentLogin; | ||
NSString *userAgent; | ||
} | ||
|
||
@property (nonatomic, retain) NSString *consumerKey; | ||
@property (nonatomic, retain) NSString *URLScheme; // if you do not set this, it is derived from your consumer key | ||
|
||
@property (nonatomic, copy, readonly) NSString *username; | ||
@property (nonatomic, assign, readonly, getter=isLoggedIn) BOOL loggedIn; | ||
|
||
@property (nonatomic, retain) NSOperationQueue *operationQueue; | ||
|
||
+(PocketAPI *)sharedAPI; | ||
+(BOOL)hasPocketAppInstalled; | ||
+(NSString *)pocketAppURLScheme; | ||
|
||
-(void)setConsumerKey:(NSString *)consumerKey; | ||
|
||
-(NSUInteger)appID; | ||
|
||
// Simple API | ||
-(void)loginWithDelegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
-(void)saveURL:(NSURL *)url | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
-(void)saveURL:(NSURL *)url | ||
withTitle:(NSString *)title | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
-(void)saveURL:(NSURL *)url | ||
withTitle:(NSString *)title | ||
tweetID:(NSString *)tweetID | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
-(void)callAPIMethod:(NSString *)apiMethod | ||
withHTTPMethod:(PocketAPIHTTPMethod)HTTPMethod | ||
arguments:(NSDictionary *)arguments | ||
delegate:(id<PocketAPIDelegate>)delegate; | ||
|
||
#if NS_BLOCKS_AVAILABLE | ||
-(void)loginWithHandler:(PocketAPILoginHandler)handler; | ||
|
||
-(void)saveURL:(NSURL *)url | ||
handler:(PocketAPISaveHandler)handler; | ||
-(void)saveURL:(NSURL *)url | ||
withTitle:(NSString *)title | ||
handler:(PocketAPISaveHandler)handler; | ||
-(void)saveURL:(NSURL *)url | ||
withTitle:(NSString *)title | ||
tweetID:(NSString *)tweetID | ||
handler:(PocketAPISaveHandler)handler; | ||
|
||
-(void)callAPIMethod:(NSString *)apiMethod | ||
withHTTPMethod:(PocketAPIHTTPMethod)HTTPMethod | ||
arguments:(NSDictionary *)arguments | ||
handler:(PocketAPIResponseHandler)handler; | ||
#endif | ||
|
||
-(void)logout; | ||
|
||
-(BOOL)handleOpenURL:(NSURL *)url; | ||
|
||
@end | ||
|
||
extern NSString *PocketAPITweetID(unsigned long long tweetID); |
Oops, something went wrong.