Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit 7359f61

Browse files
committed
Merge pull request #57 from ParsePlatform/nlutsenko.exceptions
Improve visibility of initialization order.
2 parents 14c656f + 5cc9849 commit 7359f61

File tree

9 files changed

+40
-16
lines changed

9 files changed

+40
-16
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ branches:
44
- master-v3
55
language: objective-c
66
os: osx
7-
osx_image: xcode7.2
7+
osx_image: xcode7.3
88
env:
99
global:
1010
- LC_CTYPE=en_US.UTF-8

Gemfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (4.2.5)
4+
activesupport (4.2.6)
55
i18n (~> 0.7)
66
json (~> 1.7, >= 1.7.7)
77
minitest (~> 5.1)
@@ -41,12 +41,12 @@ GEM
4141
fuzzy_match (2.0.4)
4242
i18n (0.7.0)
4343
json (1.8.3)
44-
minitest (5.8.3)
45-
molinillo (0.4.0)
46-
nap (1.0.0)
44+
minitest (5.8.4)
45+
molinillo (0.4.4)
46+
nap (1.1.0)
4747
naturally (2.1.0)
4848
netrc (0.7.8)
49-
rake (10.4.2)
49+
rake (11.1.2)
5050
rouge (1.10.1)
5151
thread_safe (0.3.5)
5252
tzinfo (1.2.2)
@@ -55,7 +55,7 @@ GEM
5555
activesupport (>= 3)
5656
claide (~> 0.9.1)
5757
colored (~> 1.2)
58-
xcpretty (0.2.1)
58+
xcpretty (0.2.2)
5959
rouge (~> 1.8)
6060

6161
PLATFORMS
@@ -68,4 +68,4 @@ DEPENDENCIES
6868
xcpretty
6969

7070
BUNDLED WITH
71-
1.10.6
71+
1.11.2

ParseFacebookUtils.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
isa = PBXProject;
554554
attributes = {
555555
CLASSPREFIX = PF;
556-
LastUpgradeCheck = 0720;
556+
LastUpgradeCheck = 0730;
557557
ORGANIZATIONNAME = "Parse, LLC";
558558
TargetAttributes = {
559559
81CB98C51AB7905D00136FA5 = {

ParseFacebookUtils.xcodeproj/xcshareddata/xcschemes/ParseFacebookUtilsV4-iOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0730"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ParseFacebookUtils.xcodeproj/xcshareddata/xcschemes/ParseFacebookUtilsV4-tvOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0730"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ParseFacebookUtils/Internal/PFFacebookPrivateUtilities.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ - (instancetype)pffb_continueWithMainThreadBooleanBlock:(PFBooleanResultBlock)bl
8484
}
8585

8686
- (instancetype)pffb_continueWithMainThreadBlock:(BFContinuationBlock)block {
87-
return [self continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:block];
87+
return [self continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task) {
88+
if (task.exception) {
89+
@throw task.exception;
90+
}
91+
return block(task);
92+
}];
8893
}
8994

9095
@end

ParseFacebookUtils/PFFacebookUtils.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#import "PFFacebookUtils.h"
1111

1212
#import <Bolts/BFExecutor.h>
13-
1413
#import <FBSDKCoreKit/FBSDKCoreKit.h>
14+
#import <Parse/Parse.h>
1515

1616
#import "PFFacebookPrivateUtilities.h"
1717

@@ -48,6 +48,10 @@ + (void)_setAuthenticationProvider:(PFFacebookAuthenticationProvider *)provider
4848
///--------------------------------------
4949

5050
+ (void)initializeFacebookWithApplicationLaunchOptions:(NSDictionary *)launchOptions {
51+
if (![Parse currentConfiguration]) {
52+
// TODO: (nlutsenko) Remove this when Parse SDK throws on every access to Parse._currentManager
53+
[NSException raise:NSInternalInconsistencyException format:@"PFFacebookUtils must be initialized after initializing Parse."];
54+
}
5155
if (!authenticationProvider_) {
5256
Class providerClass = nil;
5357
#if TARGET_OS_IOS

Tests/Unit/FacebookUtilsTests.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
@import Parse.PFConstants;
10+
@import Parse;
1111

1212
#import <OCMock/OCMock.h>
1313

@@ -57,9 +57,14 @@ - (void)testInitialize {
5757

5858
XCTAssertThrows([PFFacebookUtils unlinkUserInBackground:userMock]);
5959

60-
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:nil];
61-
XCTAssertNotNil([PFFacebookUtils _authenticationProvider]);
60+
XCTAssertThrows([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:nil]);
61+
62+
id parseMock = PFStrictClassMock([Parse class]);
63+
id configurationMock = PFStrictClassMock([ParseClientConfiguration class]);
64+
OCMStub(ClassMethod([parseMock currentConfiguration])).andReturn(configurationMock);
6265

66+
XCTAssertNoThrow([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:nil]);
67+
XCTAssertNotNil([PFFacebookUtils _authenticationProvider]);
6368
XCTAssertNoThrow([PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:nil]);
6469

6570
OCMVerifyAll(userMock);

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
comment: off
3+
ignore:
4+
- Tests/*
5+
status:
6+
project:
7+
default:
8+
target: 75
9+
only_pulls: yes
10+

0 commit comments

Comments
 (0)