Skip to content

Commit

Permalink
Remove unnecessary Core private headers (#6439)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Sep 17, 2020
1 parent dfba699 commit 0a87c31
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 133 deletions.
24 changes: 7 additions & 17 deletions FirebaseCore/Sources/FIRApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey =
@"FIRAuthStateDidChangeInternalNotificationUIDKey";

/**
* Error domain for exceptions and NSError construction.
*/
NSString *const kFirebaseCoreErrorDomain = @"com.firebase.core";

/**
* The URL to download plist files.
*/
Expand Down Expand Up @@ -479,20 +484,7 @@ + (NSError *)errorForMissingOptions {
NSLocalizedRecoverySuggestionErrorKey :
@"Check formatting and location of GoogleService-Info.plist."
};
return [NSError errorWithDomain:kFirebaseCoreErrorDomain
code:FIRErrorCodeInvalidPlistFile
userInfo:errorDict];
}

+ (NSError *)errorForSubspecConfigurationFailureWithDomain:(NSString *)domain
errorCode:(FIRErrorCode)code
service:(NSString *)service
reason:(NSString *)reason {
NSString *description =
[NSString stringWithFormat:@"Configuration failed for service %@.", service];
NSDictionary *errorDict =
@{NSLocalizedDescriptionKey : description, NSLocalizedFailureReasonErrorKey : reason};
return [NSError errorWithDomain:domain code:code userInfo:errorDict];
return [NSError errorWithDomain:kFirebaseCoreErrorDomain code:-100 userInfo:errorDict];
}

+ (NSError *)errorForInvalidAppID {
Expand All @@ -502,9 +494,7 @@ + (NSError *)errorForInvalidAppID {
@"Check formatting and location of GoogleService-Info.plist or GoogleAppID set in the "
@"customized options."
};
return [NSError errorWithDomain:kFirebaseCoreErrorDomain
code:FIRErrorCodeInvalidAppID
userInfo:errorDict];
return [NSError errorWithDomain:kFirebaseCoreErrorDomain code:-101 userInfo:errorDict];
}

+ (BOOL)isDefaultAppConfigured {
Expand Down
21 changes: 0 additions & 21 deletions FirebaseCore/Sources/FIRErrors.m

This file was deleted.

16 changes: 1 addition & 15 deletions FirebaseCore/Sources/Private/FIRAppInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@

#import <FirebaseCore/FIRApp.h>

// The has_include is a workaround so the old IID needed for the FIS tests can find FIRErrors.h
#if __has_include("FirebaseCore/Sources/Private/FIRErrors.h")
#import "FirebaseCore/Sources/Private/FIRErrors.h"
#else
#import <FirebaseCore/FIRErrors.h>
#endif

@class FIRComponentContainer;
@protocol FIRLibrary;

Expand All @@ -46,6 +39,7 @@ extern NSString *const kFIRAppDeleteNotification;
extern NSString *const kFIRAppIsDefaultAppKey;
extern NSString *const kFIRAppNameKey;
extern NSString *const kFIRGoogleAppIDKey;
extern NSString *const kFirebaseCoreErrorDomain;

/**
* The format string for the User Defaults key used for storing the data collection enabled flag.
Expand Down Expand Up @@ -105,14 +99,6 @@ extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey;
*/
@property(nonatomic) FIRComponentContainer *container;

/**
* Creates an error for failing to configure a subspec service. This method is called by each
* FIRApp notification listener.
*/
+ (NSError *)errorForSubspecConfigurationFailureWithDomain:(NSString *)domain
errorCode:(FIRErrorCode)code
service:(NSString *)service
reason:(NSString *)reason;
/**
* Checks if the default app is configured without trying to configure it.
*/
Expand Down
39 changes: 0 additions & 39 deletions FirebaseCore/Sources/Private/FIRErrorCode.h

This file was deleted.

24 changes: 0 additions & 24 deletions FirebaseCore/Sources/Private/FIRErrors.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

#import "FirebaseCore/Tests/SwiftUnit/SwiftTestingUtilities/ExceptionCatcher.h"
#import "FirebaseCore/Sources/Private/FIRErrorCode.h"

@implementation ExceptionCatcher

Expand All @@ -30,6 +29,7 @@ + (BOOL)catchException:(ThrowingBlock)block error:(__autoreleasing NSError **)er
[info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];

// Just using error code `FIRErrorCodeConfigFailed` for now
NSInteger FIRErrorCodeConfigFailed = -114;
*error = [[NSError alloc] initWithDomain:exception.name
code:FIRErrorCodeConfigFailed
userInfo:info];
Expand Down
11 changes: 0 additions & 11 deletions FirebaseCore/Tests/Unit/FIRAppTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,6 @@ - (void)testDeleteApp {
XCTAssertNil(FIR_COMPONENT(FIRTestProtocolEagerCached, app.container));
}

- (void)testErrorForSubspecConfigurationFailure {
NSError *error = [FIRApp errorForSubspecConfigurationFailureWithDomain:kFirebaseCoreErrorDomain
errorCode:-38
service:@"Auth"
reason:@"some reason"];
XCTAssertNotNil(error);
XCTAssert([error.domain isEqualToString:kFirebaseCoreErrorDomain]);
XCTAssert(error.code == -38);
XCTAssert([error.description containsString:@"Configuration failed for"]);
}

- (void)testOptionsLocking {
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
GCMSenderID:kGCMSenderID];
Expand Down
14 changes: 9 additions & 5 deletions FirebaseDynamicLinks/Sources/FIRDynamicLinks.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,15 @@ - (void)configureDynamicLinks:(FIRApp *)app {
urlScheme:urlScheme
userDefaults:nil];
} else {
error =
[FIRApp errorForSubspecConfigurationFailureWithDomain:kFirebaseDurableDeepLinkErrorDomain
errorCode:FIRErrorCodeDurableDeepLinkFailed
service:@"DynamicLinks"
reason:errorDescription];
NSString *description =
[NSString stringWithFormat:@"Configuration failed for service DynamicLinks."];
NSDictionary *errorDict = @{
NSLocalizedDescriptionKey : description,
NSLocalizedFailureReasonErrorKey : errorDescription
};
error = [NSError errorWithDomain:kFirebaseDurableDeepLinkErrorDomain
code:FIRErrorCodeDurableDeepLinkFailed
userInfo:errorDict];
}
if (error) {
NSString *message = nil;
Expand Down
1 change: 1 addition & 0 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfigComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ - (FIRRemoteConfig *)remoteConfigForNamespace:(NSString *)remoteConfigNamespace
}
if (errorPropertyName) {
NSString *const kFirebaseConfigErrorDomain = @"com.firebase.config";
[NSException
raise:kFirebaseConfigErrorDomain
format:@"%@",
Expand Down

0 comments on commit 0a87c31

Please # to comment.