From 54229c04fcb0cd4ba67950b7590c352d1b00910a Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Wed, 30 Mar 2016 01:31:18 +0200 Subject: [PATCH] Dropbox authentication with OAuth2 implemented --- FMC Planner 2.xcodeproj/project.pbxproj | 6 ++++ .../xcdebugger/Breakpoints_v2.xcbkptlist | 18 ++++++++++ FMC Planner 2/AppDelegate.h | 2 ++ FMC Planner 2/AppDelegate.m | 8 +++++ FMC Planner 2/Base.lproj/Main.storyboard | 5 ++- FMC Planner 2/DropboxV2ObjC.h | 21 +++++++++++ FMC Planner 2/DropboxV2ObjC.m | 35 +++++++++++++++++++ FMC Planner 2/Info.plist | 17 +++++++-- FMC Planner 2/TableViewController.m | 1 - FMC Planner 2/ViewControllerServiceMenu.h | 4 +++ FMC Planner 2/ViewControllerServiceMenu.m | 18 +++++++++- FMC Planner 2/main.m | 7 ++-- 12 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 FMC Planner 2/DropboxV2ObjC.h create mode 100644 FMC Planner 2/DropboxV2ObjC.m diff --git a/FMC Planner 2.xcodeproj/project.pbxproj b/FMC Planner 2.xcodeproj/project.pbxproj index 4609d24..b080f5f 100644 --- a/FMC Planner 2.xcodeproj/project.pbxproj +++ b/FMC Planner 2.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ E22EE9DC1C9DB7B3001F5BC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E22EE9DB1C9DB7B3001F5BC0 /* Assets.xcassets */; }; E22EE9EA1C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9E91C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m */; }; E22EE9F51C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */; }; + E2549C761CAB2D3F00562602 /* DropboxV2ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = E2549C751CAB2D3F00562602 /* DropboxV2ObjC.m */; }; E2763C721CA6C8AE001E4EDA /* LSKs.plist in Resources */ = {isa = PBXBuildFile; fileRef = E2763C711CA6C8AE001E4EDA /* LSKs.plist */; }; E2763C751CA6E777001E4EDA /* ViewControllerServiceMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */; }; E280F3A41CA7C71500DF2A05 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E280F3A31CA7C71500DF2A05 /* TableViewController.m */; }; @@ -64,6 +65,8 @@ E22EE9F01C9DB7B4001F5BC0 /* FMC Planner 2UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FMC Planner 2UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMC_Planner_2UITests.m; sourceTree = ""; }; E22EE9F61C9DB7B4001F5BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E2549C741CAB2D3F00562602 /* DropboxV2ObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropboxV2ObjC.h; sourceTree = ""; }; + E2549C751CAB2D3F00562602 /* DropboxV2ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DropboxV2ObjC.m; sourceTree = ""; }; E2763C711CA6C8AE001E4EDA /* LSKs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = LSKs.plist; sourceTree = ""; }; E2763C731CA6E777001E4EDA /* ViewControllerServiceMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewControllerServiceMenu.h; sourceTree = ""; }; E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerServiceMenu.m; sourceTree = ""; }; @@ -170,6 +173,8 @@ children = ( E2A9270C1CA2FD6D00606E07 /* Implementation */, E2A9270B1CA2FD6000606E07 /* Header */, + E2549C741CAB2D3F00562602 /* DropboxV2ObjC.h */, + E2549C751CAB2D3F00562602 /* DropboxV2ObjC.m */, ); name = ViewControllers; sourceTree = ""; @@ -376,6 +381,7 @@ files = ( E22EE9D71C9DB7B3001F5BC0 /* ViewController.m in Sources */, E22EE9D41C9DB7B3001F5BC0 /* AppDelegate.m in Sources */, + E2549C761CAB2D3F00562602 /* DropboxV2ObjC.m in Sources */, E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */, E2A927161CA30CEE00606E07 /* SharedDeclerations.m in Sources */, E227C7831C9F42AB00DE0CA4 /* ViewControllerKeyboard.m in Sources */, diff --git a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index fe2b454..238ec92 100644 --- a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,4 +2,22 @@ + + + + + + diff --git a/FMC Planner 2/AppDelegate.h b/FMC Planner 2/AppDelegate.h index 3513d8c..bc028d4 100644 --- a/FMC Planner 2/AppDelegate.h +++ b/FMC Planner 2/AppDelegate.h @@ -6,10 +6,12 @@ // Copyright © 2016 Kilian Hofmann. All rights reserved. // +#import "DropboxV2ObjC.h" #import @interface AppDelegate : UIResponder @property(strong, nonatomic) UIWindow *window; +@property(strong, nonatomic) DropboxV2ObjC *dbClient; @end diff --git a/FMC Planner 2/AppDelegate.m b/FMC Planner 2/AppDelegate.m index c79586b..43b672e 100644 --- a/FMC Planner 2/AppDelegate.m +++ b/FMC Planner 2/AppDelegate.m @@ -13,6 +13,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. + _dbClient = [[DropboxV2ObjC alloc] init]; return YES; } @@ -50,4 +51,11 @@ // appropriate. See also applicationDidEnterBackground:. } +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { + // Display text + [_dbClient authorizeUserWithToke:url]; + + return YES; +} + @end diff --git a/FMC Planner 2/Base.lproj/Main.storyboard b/FMC Planner 2/Base.lproj/Main.storyboard index 308bbc6..b5555ec 100644 --- a/FMC Planner 2/Base.lproj/Main.storyboard +++ b/FMC Planner 2/Base.lproj/Main.storyboard @@ -89,6 +89,9 @@ + + +