11 Commits

Author SHA1 Message Date
Andrew Marin 80ba32587b Update UPPlatform project and framework
* Fix ambiguity with 'delegate' property of UPAuthViewController so it does not clash with UINavigationController's 'delegate'

* Update project settings to Xcode recommendations

* Generate updated Framework
2016-02-24 17:12:49 -08:00
andrew-marin 14152201e1 Merge pull request #38 from hlung/master
Fix -dismissViewControllerAnimated:
2015-12-15 12:35:15 -08:00
Hlung 66011533ab Fix -dismissViewControllerAnimated: should not be called on self.rootViewController 2015-12-11 18:42:37 +07:00
Andrew Marin 4a944b772e - Add sleepDuration and eatUnsaturatedFat properties to UPTrend
- Format fix for method signatures
- Update UPPlatform.framework
2015-05-07 11:53:30 -07:00
andrew-marin 12c328cfc6 Merge pull request #26 from xinsight/add-viewcontroller-param
add presenting view controller parameter
2015-04-30 17:23:33 -07:00
andrew-marin 0537858c47 Merge pull request #28 from xinsight/fix-auth-navbar-ios7
use barTintColor if available
2015-04-30 17:12:43 -07:00
andrew-marin 11d34fb41f Merge pull request #27 from xinsight/fix-no-network
avoid exception: skip parse of nil data
2015-04-30 17:09:05 -07:00
Jay Moore 38f852adea use barTintColor if available 2014-09-10 15:47:29 -04:00
Jay Moore 5bc70dd48f avoid exception: skip parse of nil data 2014-09-10 15:00:28 -04:00
Jay Moore 459ea6d7a6 add presenting view controller parameter 2014-09-10 08:18:50 -04:00
rothacr d28f0ddfdd Update podspec 2014-06-13 15:56:31 -07:00
13 changed files with 92 additions and 24 deletions
Binary file not shown.
@@ -25,7 +25,7 @@
@interface UPAuthViewController : UINavigationController
- (id)initWithURL:(NSURL *)url delegate:(id<UPAuthViewControllerDelegate>)delegate;
- (void)show;
- (void)presentWithViewController:(UIViewController *)presentingViewController;
@end
#endif
@@ -178,6 +178,20 @@ typedef void(^UPPlatformRequestCompletion)(UPURLRequest *request, UPURLResponse
*/
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI completion:(UPPlatformSessionCompletion)completion;
/**
* Starts a user's session.
*
* This will present a UIWebView to perform the OAuth authentication flow, taking care of getting the access token for HTTP requests.
*
* @param clientID The client ID provided during application signup.
* @param clientSecret The client secret provided during application signup.
* @param authScope Options to request specific auth scopes during authentication. Defaults to UPPlatformAuthScopeBasicRead.
* @param redirectURI An alternate redirect URI used during authentication. This is not common.
* @param presentingViewController View controller to present authentication view controller. Uses the window root view controller if nil.
* @param completion The session completion block.
*/
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI presentingViewController:(UIViewController *)presentingViewController completion:(UPPlatformSessionCompletion)completion;
#endif
/**
@@ -269,6 +269,11 @@ typedef NS_ENUM(NSUInteger, UPUserGender)
*/
@property (nonatomic, strong) NSNumber *sleepTimeAwake;
/**
* Total number of seconds of sleep during the sleep period
*/
@property (nonatomic, strong) NSNumber *sleepDuration;
/**
* The user's protein eaten.
*/
@@ -284,6 +289,11 @@ typedef NS_ENUM(NSUInteger, UPUserGender)
*/
@property (nonatomic, strong) NSNumber *eatSaturatedFat;
/**
* The user's unsaturated fat eaten.
*/
@property (nonatomic, strong) NSNumber *eatUnsaturatedFat;
/**
* The user's calories eaten.
*/
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "UPPlatformSDK"
s.version = "1.1.4"
s.version = "1.1.5"
s.summary = "Jawbone's UP Platform SDK."
s.homepage = "https://github.com/Jawbone/UPPlatform_iOS_SDK"
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.author = { "Andy Roth" => "aroth@jawbone.com" }
s.source = {
:git => "https://github.com/Jawbone/UPPlatform_iOS_SDK.git",
:tag => "v1.1.4"
:tag => "v1.1.5"
}
s.platform = :ios, '7.0'
@@ -541,7 +541,7 @@
E3E46BF817173670009CCA56 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = Jawbone;
};
buildConfigurationList = E3E46BFB17173670009CCA56 /* Build configuration list for PBXProject "UPPlatformSDK" */;
@@ -733,10 +733,6 @@
1FE2964518D24C100047F094 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
"$(ARCHS_STANDARD)",
i386,
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "arm64 armv7 armv7s i386";
@@ -746,10 +742,6 @@
1FE2964618D24C100047F094 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
"$(ARCHS_STANDARD)",
i386,
);
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "arm64 armv7 armv7s i386";
};
@@ -762,6 +754,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SYSTEM_APPS_DIR)/Xcode5-DP.app/Contents/Developer/Library/Frameworks",
@@ -790,6 +783,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -822,6 +816,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -25,7 +25,7 @@
@interface UPAuthViewController : UINavigationController
- (id)initWithURL:(NSURL *)url delegate:(id<UPAuthViewControllerDelegate>)delegate;
- (void)show;
- (void)presentWithViewController:(UIViewController *)presentingViewController;
@end
#endif
@@ -13,7 +13,7 @@
@interface UPAuthViewController () <UIWebViewDelegate>
@property (nonatomic, weak) id<UPAuthViewControllerDelegate> delegate;
@property (nonatomic, weak) id<UPAuthViewControllerDelegate> authDelegate;
@property (nonatomic, strong) UIViewController *rootViewController;
@property (nonatomic, strong) UIWebView *webView;
@@ -35,7 +35,7 @@
if (self)
{
self.authURL = url;
self.delegate = delegate;
self.authDelegate = delegate;
// Setup the auth view
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
@@ -51,8 +51,13 @@
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationBar.tintColor = [UIColor darkGrayColor];
UIColor *barColor = [UIColor darkGrayColor];
if ([self.navigationBar respondsToSelector:@selector(setBarTintColor:)]) {
self.navigationBar.barTintColor = barColor;
} else {
self.navigationBar.tintColor = barColor;
}
self.navigationBar.translucent = NO;
[self pushViewController:[[UIViewController alloc] init] animated:NO];
@@ -80,9 +85,13 @@
self.webView.backgroundColor = [UIColor whiteColor];
}
- (void)show
- (void)presentWithViewController:(UIViewController *)presentingViewController;
{
[self.rootViewController presentViewController:self animated:YES completion:^{
if (presentingViewController == nil) {
presentingViewController = self.rootViewController;
}
[presentingViewController presentViewController:self animated:YES completion:^{
[self.webView loadRequest:[NSURLRequest requestWithURL:self.authURL]];
}];
}
@@ -92,7 +101,7 @@
if (self.isHiding) return;
self.isHiding = YES;
[self.rootViewController dismissViewControllerAnimated:YES completion:^{
[self dismissViewControllerAnimated:YES completion:^{
if (completion) completion();
}];
}
@@ -100,7 +109,7 @@
- (void)cancel
{
[self hideWithCompletion:^{
[self.delegate authViewControllerDidCancel:self];
[self.authDelegate authViewControllerDidCancel:self];
}];
}
@@ -132,7 +141,7 @@
NSString *code = [query stringByReplacingOccurrencesOfString:@"code=" withString:@""];
[self hideWithCompletion:nil];
[self.delegate authViewController:self didCompleteWithAuthCode:code];
[self.authDelegate authViewController:self didCompleteWithAuthCode:code];
return NO;
}
@@ -143,7 +152,7 @@
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[self hideWithCompletion:nil];
[self.delegate authViewController:self didFailWithError:error];
[self.authDelegate authViewController:self didFailWithError:error];
}
@end
+14
View File
@@ -178,6 +178,20 @@ typedef void(^UPPlatformRequestCompletion)(UPURLRequest *request, UPURLResponse
*/
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI completion:(UPPlatformSessionCompletion)completion;
/**
* Starts a user's session.
*
* This will present a UIWebView to perform the OAuth authentication flow, taking care of getting the access token for HTTP requests.
*
* @param clientID The client ID provided during application signup.
* @param clientSecret The client secret provided during application signup.
* @param authScope Options to request specific auth scopes during authentication. Defaults to UPPlatformAuthScopeBasicRead.
* @param redirectURI An alternate redirect URI used during authentication. This is not common.
* @param presentingViewController View controller to present authentication view controller. Uses the window root view controller if nil.
* @param completion The session completion block.
*/
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI presentingViewController:(UIViewController *)presentingViewController completion:(UPPlatformSessionCompletion)completion;
#endif
/**
+11 -1
View File
@@ -302,6 +302,11 @@ decisionListener:(id<WebPolicyDecisionListener>)listener
}
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI completion:(UPPlatformSessionCompletion)completion
{
[self startSessionWithClientID:clientID clientSecret:clientSecret authScope:authScope redirectURI:redirectURI presentingViewController:nil completion:completion];
}
- (void)startSessionWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret authScope:(UPPlatformAuthScope)authScope redirectURI:(NSString *)redirectURI presentingViewController:(UIViewController *)presentingViewController completion:(UPPlatformSessionCompletion)completion
{
self.sessionCompletion = completion;
self.clientID = clientID;
@@ -328,7 +333,7 @@ decisionListener:(id<WebPolicyDecisionListener>)listener
NSMutableString *authURLString = [NSMutableString stringWithFormat:@"%@/auth/oauth2/auth?response_type=code&client_id=%@&scope=%@&redirect_uri=%@", [UPPlatform basePlatformURL], self.clientID, [self stringFromAuthScope:authScope], redirectURI];
self.authViewController = [[UPAuthViewController alloc] initWithURL:[NSURL URLWithString:authURLString] delegate:self];
[self.authViewController show];
[self.authViewController presentWithViewController:presentingViewController];
}
#endif
@@ -447,6 +452,11 @@ decisionListener:(id<WebPolicyDecisionListener>)listener
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *urlResponse, NSData *data, NSError *error) {
if (data == nil) { // no network
completion(request, nil, error);
return;
}
NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
if (self.enableNetworkLogging)
+10
View File
@@ -269,6 +269,11 @@ typedef NS_ENUM(NSUInteger, UPUserGender)
*/
@property (nonatomic, strong) NSNumber *sleepTimeAwake;
/**
* Total number of seconds of sleep during the sleep period
*/
@property (nonatomic, strong) NSNumber *sleepDuration;
/**
* The user's protein eaten.
*/
@@ -284,6 +289,11 @@ typedef NS_ENUM(NSUInteger, UPUserGender)
*/
@property (nonatomic, strong) NSNumber *eatSaturatedFat;
/**
* The user's unsaturated fat eaten.
*/
@property (nonatomic, strong) NSNumber *eatUnsaturatedFat;
/**
* The user's calories eaten.
*/
+6
View File
@@ -247,9 +247,11 @@
self.sleepAwake = [values numberForKey:@"s_awake"];
self.sleepTimeAsleep = [values numberForKey:@"s_asleep_time"];
self.sleepTimeAwake = [values numberForKey:@"s_awake_time"];
self.sleepDuration = [values numberForKey:@"s_duration"];
self.eatProtein = [values numberForKey:@"e_protein"];
self.eatCalcium = [values numberForKey:@"e_calcium"];
self.eatSaturatedFat = [values numberForKey:@"e_sat_fat"];
self.eatUnsaturatedFat = [values numberForKey:@"e_unsat_fat"];
self.eatCalories = [values numberForKey:@"e_calories"];
self.eatSodium = [values numberForKey:@"e_sodium"];
self.eatSugar = [values numberForKey:@"e_sugar"];
@@ -279,9 +281,11 @@
"sleepAwake: %@, " \
"sleepTimeAsleep: %@, " \
"sleepTimeAwake: %@, " \
"sleepDuration: %@, " \
"eatProtein: %@, " \
"eatCalcium: %@, " \
"eatSaturatedFat: %@, " \
"eatUnSaturatedFat: %@, " \
"eatCalories: %@, " \
"eatSodium: %@, " \
"eatSugar: %@, " \
@@ -303,9 +307,11 @@
self.sleepAwake,
self.sleepTimeAsleep,
self.sleepTimeAwake,
self.sleepDuration,
self.eatProtein,
self.eatCalcium,
self.eatSaturatedFat,
self.eatUnsaturatedFat,
self.eatCalories,
self.eatSodium,
self.eatSugar,