Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NRGramKit/NRGramKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ typedef void(^RelationshipResultBlock)(IGIncomingRelationshipStatus,IGOutgoingRe

@interface NRGramKit : NSObject {
}
+(void)setClientId:(NSString *)clientId clientSecret:(NSString *)clientSecret andClientCallbackURL:(NSString *)callbackURL;

+(BOOL) isLoggedIn;
+(IGUser*) loggedInUser;
+(void)loginInWebView:(UIWebView*)webview loginLoadingCallback:(LoginLoadingBlock)loadingCallback finishedCallback:(LoginResultBlock)callback;
Expand Down
24 changes: 21 additions & 3 deletions NRGramKit/NRGramKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,32 @@ +(void)initialize
{
access_token = [[NSUserDefaults standardUserDefaults] objectForKey:kAccessTokenKey];

NSBundle *bundle = [NSBundle mainBundle];
//NSLog(bundle);
NSString *path = [bundle pathForResource:@"NRGramKitConfigs" ofType:@"plist"];
NSString *path = [[NSBundle mainBundle] pathForResource:@"NRGramKitConfigs" ofType:@"plist"];
NSDictionary* configs = [[NSDictionary alloc]initWithContentsOfFile:path];
callback_url = configs[@"InstagramClientCallbackURL"];
client_id = configs[@"InstagramClientId"];
}

+(void)setClientId:(NSString *)clientId clientSecret:(NSString *)clientSecret andClientCallbackURL:(NSString *)callbackURL
{
NSString* path = [[NSBundle mainBundle] pathForResource:@"NRGramKitConfigs" ofType:@"plist"];
NSMutableDictionary* configs = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

if (clientId) {
client_id = clientId;
[configs setObject:clientId forKey:@"InstagramClientId"];
}
if (clientSecret) {
[configs setObject:clientSecret forKey:@"InstagramClientSecret"];
}
if (callbackURL) {
callback_url = callbackURL;
[configs setObject:callbackURL forKey:@"InstagramClientCallbackURL"];
}

[configs writeToFile:path atomically:YES];
}

+(void)setAccessToken:(NSString*)accessToken;
{
if(accessToken!=nil)
Expand Down