Skip to content

Commit

Permalink
[App Check] Remove usages of FIR_*_SUPPORTED_TARGETS macros (#11831)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Sep 20, 2023
1 parent 00fd7c0 commit a885d5e
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@
* limitations under the License.
*/

#import <TargetConditionals.h>

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"

// Currently DCAppAttestService is available on iOS only.
#if FIR_APP_ATTEST_SUPPORTED_TARGETS

#import <DeviceCheck/DeviceCheck.h>

#import "FirebaseAppCheck/Sources/AppAttestProvider/FIRAppAttestService.h"

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"

NS_ASSUME_NONNULL_BEGIN

FIR_APP_ATTEST_PROVIDER_AVAILABILITY
Expand All @@ -33,5 +28,3 @@ FIR_APP_ATTEST_PROVIDER_AVAILABILITY
@end

NS_ASSUME_NONNULL_END

#endif // FIR_APP_ATTEST_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

#import "FirebaseAppCheck/Sources/AppAttestProvider/DCAppAttestService+FIRAppAttestService.h"

// Currently DCAppAttestService is available on iOS only.
#if FIR_APP_ATTEST_SUPPORTED_TARGETS

@implementation DCAppAttestService (FIRAppAttestService)

@end

#endif // FIR_APP_ATTEST_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ - (instancetype)initWithAppAttestService:(id<FIRAppAttestService>)appAttestServi
}

- (nullable instancetype)initWithApp:(FIRApp *)app {
#if FIR_APP_ATTEST_SUPPORTED_TARGETS
NSURLSession *URLSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]];

Expand Down Expand Up @@ -166,9 +165,6 @@ - (nullable instancetype)initWithApp:(FIRApp *)app {
keyIDStorage:keyIDStorage
artifactStorage:artifactStorage
backoffWrapper:backoffWrapper];
#else // FIR_APP_ATTEST_SUPPORTED_TARGETS
return nil;
#endif // FIR_APP_ATTEST_SUPPORTED_TARGETS
}

#pragma mark - FIRAppCheckProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

#import <DeviceCheck/DeviceCheck.h>

#import "FirebaseAppCheck/Sources/DeviceCheckProvider/FIRDeviceCheckTokenGenerator.h"
Expand All @@ -29,5 +25,3 @@ NS_ASSUME_NONNULL_BEGIN
@end

NS_ASSUME_NONNULL_END

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

#import "FirebaseAppCheck/Sources/DeviceCheckProvider/DCDevice+FIRDeviceCheckTokenGenerator.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

@implementation DCDevice (FIRDeviceCheckTokenGenerator)

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

#import <Foundation/Foundation.h>

#if __has_include(<FBLPromises/FBLPromises.h>)
Expand Down Expand Up @@ -159,5 +155,3 @@ - (void)getTokenWithCompletion:(void (^)(FIRAppCheckToken *_Nullable token,
@end

NS_ASSUME_NONNULL_END

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRDeviceCheckProviderFactory.h"

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
Expand All @@ -34,5 +30,3 @@ + (void)load {
}

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#pragma mark - DeviceCheck

// Targets where DeviceCheck framework is available to be used in preprocessor conditions.
// TODO: Remove this macro during a breaking change; it is no longer used in the codebase but is
// defined in the public API.
#define FIR_DEVICE_CHECK_SUPPORTED_TARGETS \
TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH

Expand All @@ -32,6 +34,8 @@
#pragma mark - App Attest

// Targets where `DCAppAttestService` is available to be used in preprocessor conditions.
// TODO: Remove this macro during a breaking change; it is no longer used in the codebase but is
// defined in the public API.
#define FIR_APP_ATTEST_SUPPORTED_TARGETS \
TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#import "FIRAppCheckAvailability.h"
#import "FIRAppCheckProvider.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

@class FIRApp;
@protocol FIRDeviceCheckAPIServiceProtocol;
@protocol FIRDeviceCheckTokenGenerator;
Expand All @@ -46,5 +44,3 @@ NS_SWIFT_NAME(DeviceCheckProvider)
@end

NS_ASSUME_NONNULL_END

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
* limitations under the License.
*/

#import "FIRAppCheckAvailability.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

#import <Foundation/Foundation.h>

#import "FIRAppCheckAvailability.h"
#import "FIRAppCheckProviderFactory.h"

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -37,5 +34,3 @@ NS_SWIFT_NAME(DeviceCheckProviderFactory)
@end

NS_ASSUME_NONNULL_END

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@

#import "FirebaseAppCheck/Sources/AppAttestProvider/API/FIRAppAttestAPIService.h"
#import "FirebaseAppCheck/Sources/AppAttestProvider/API/FIRAppAttestAttestationResponse.h"
#import "FirebaseAppCheck/Sources/AppAttestProvider/Errors/FIRAppAttestRejectionError.h"
#import "FirebaseAppCheck/Sources/AppAttestProvider/FIRAppAttestService.h"
#import "FirebaseAppCheck/Sources/AppAttestProvider/Storage/FIRAppAttestArtifactStorage.h"
#import "FirebaseAppCheck/Sources/AppAttestProvider/Storage/FIRAppAttestKeyIDStorage.h"
#import "FirebaseAppCheck/Sources/Core/Utils/FIRAppCheckCryptoUtils.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h"

#import "FirebaseAppCheck/Sources/AppAttestProvider/Errors/FIRAppAttestRejectionError.h"
#import "FirebaseAppCheck/Sources/Core/Errors/FIRAppCheckErrorUtil.h"
#import "FirebaseAppCheck/Sources/Core/Errors/FIRAppCheckHTTPError.h"
#import "FirebaseAppCheck/Sources/Core/Utils/FIRAppCheckCryptoUtils.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h"

#import "FirebaseCore/Extension/FirebaseCoreInternal.h"

#import "SharedTestUtilities/AppCheckBackoffWrapperFake/FIRAppCheckBackoffWrapperFake.h"

#if FIR_APP_ATTEST_SUPPORTED_TARGETS

FIR_APP_ATTEST_PROVIDER_AVAILABILITY
@interface FIRAppAttestProvider (Tests)
- (instancetype)initWithAppAttestService:(id<FIRAppAttestService>)appAttestService
Expand Down Expand Up @@ -1089,5 +1087,3 @@ - (void)expectAttestationReset {
}

@end

#endif // FIR_APP_ATTEST_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

#import <OCMock/OCMock.h>

#import <TargetConditionals.h>

@import FirebaseAppCheckInterop;

#import "FirebaseAppCheck/Sources/Core/TokenRefresh/FIRAppCheckTokenRefresher.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheck.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckProviderFactory.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckToken.h"

Expand All @@ -34,8 +33,6 @@

NS_ASSUME_NONNULL_BEGIN

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

@interface DummyAppCheckProvider : NSObject <FIRAppCheckProvider>
@end

Expand Down Expand Up @@ -226,6 +223,4 @@ - (void)disableTokenRefresher {

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
#import "FirebaseAppCheck/Sources/Core/FIRAppCheckToken+Internal.h"
#import "FirebaseAppCheck/Sources/DeviceCheckProvider/API/FIRDeviceCheckAPIService.h"
#import "FirebaseAppCheck/Sources/DeviceCheckProvider/FIRDeviceCheckTokenGenerator.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRDeviceCheckProvider.h"

#import "FirebaseCore/Extension/FirebaseCoreInternal.h"

#import "SharedTestUtilities/AppCheckBackoffWrapperFake/FIRAppCheckBackoffWrapperFake.h"

#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
@interface FIRDeviceCheckProvider (Tests)

Expand Down Expand Up @@ -326,5 +325,3 @@ - (void)testGetTokenBackoff {
}

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS

0 comments on commit a885d5e

Please sign in to comment.