From cc5a6d88c4878a27f28e284e8eedff6c543e8e4b Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Thu, 7 Mar 2013 10:37:35 -0800 Subject: [PATCH] Allow the secret to be safely specified externally. The way the code is written today expects users to modify the file that's under the version control system. This is inherently dangerous as a developer needs to locally edit this file and then be very careful not to accidentally commit the change in to the repository. A better way to do this is to either allow these constants to be defined through a compiler switch (for interactive dekstop development) or in a separate file (outside the ForcePad source tree and the -I option allows you to have this import statement resolve the header file correctly.) This will also work better in a build server, where an in-place modification to a file is tricky. --- .../ViewControllers/Modal/OAuthViewController.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Accounts/ViewControllers/Modal/OAuthViewController.h b/Accounts/ViewControllers/Modal/OAuthViewController.h index aedd13d..cde0367 100644 --- a/Accounts/ViewControllers/Modal/OAuthViewController.h +++ b/Accounts/ViewControllers/Modal/OAuthViewController.h @@ -29,9 +29,19 @@ #import "OAuthLoginHostPicker.h" #import "OAuthCustomHostCreator.h" -// keys for login -#define OAuthClientID @"Your OAuth Key" -#define OAuthConsumerSecret @"Your OAuth secret" +/* + * Keys for login + * + * You can either define them as parameters to the compiler (with the -D option) + * or you can define them in a separate file. Do not check this file into Git, though. + * The file would look like this: + * + * #define OAuthClientID @"Your OAuth Key" + * #define OAuthConsumerSecret @"Your OAuth secret" + */ +#if !defined(OAuthClientID) /*Your OAuth key*/ || !defined(OAuthConsumerSecret) /*Your OAuth secret*/ +#import "OAuthKeys.h" +#endif @interface OAuthViewController : UIViewController {