Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebaseAppCheck/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 9.5.0
- [added] AppCheck's DeviceCheck provider is available for watchOS 9.0+.

# 9.0.0
- [added] **Breaking change:** `FirebaseAppCheck` has exited beta and is now
generally available for use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,34 @@

// Availability conditions for different App Check SDK components.

#import <Foundation/Foundation.h>
#import <TargetConditionals.h>

#pragma mark - DeviceCheck

// DeviceCheck availability was extended to watchOS in Xcode 14.
#if defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0

// Targets where DeviceCheck framework is available to be used in preprocessor conditions.
#define FIR_DEVICE_CHECK_SUPPORTED_TARGETS \
TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH

// `DeviceCheckProvider` availability.
#define FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY \
API_AVAILABLE(ios(11.0), macos(10.15), tvos(11.0), watchos(9.0))

// TODO(ncooke3): Remove `#else` clause when Xcode 14 is the minimum supported Xcode.
#else // defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0

// Targets where DeviceCheck framework is available to be used in preprocessor conditions.
#define FIR_DEVICE_CHECK_SUPPORTED_TARGETS TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV

// `DeviceCheckProvider` availability.
#define FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY \
API_AVAILABLE(ios(11.0), macos(10.15), tvos(11.0)) API_UNAVAILABLE(watchos)

#endif // defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0

#pragma mark - App Attest

// App Attest availability was extended to macOS and Mac Catalyst in Xcode 12.5.
Expand Down
6 changes: 6 additions & 0 deletions FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

#import "FirebaseCore/Extension/FirebaseCoreInternal.h"

// Since DeviceCheck is the default attestation provider for AppCheck, disable
// test cases that may be dependent on DeviceCheck being available.
#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

// The FAC token value returned when an error occurs.
static NSString *const kDummyToken = @"eyJlcnJvciI6IlVOS05PV05fRVJST1IifQ==";

Expand Down Expand Up @@ -1009,3 +1013,5 @@ - (void)verifyAllMocks {
}

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,9 @@

#import "SharedTestUtilities/AppCheckBackoffWrapperFake/FIRAppCheckBackoffWrapperFake.h"

API_AVAILABLE(ios(11.0), macos(10.15), tvos(11.0))
API_UNAVAILABLE(watchos)
@interface FIRDeviceCheckProviderTests : XCTestCase

@property(nonatomic) FIRDeviceCheckProvider *provider;
@property(nonatomic) id fakeAPIService;
@property(nonatomic) id fakeTokenGenerator;
@property(nonatomic) FIRAppCheckBackoffWrapperFake *fakeBackoffWrapper;

@end
#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS

FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
@interface FIRDeviceCheckProvider (Tests)

- (instancetype)initWithAPIService:(id<FIRDeviceCheckAPIServiceProtocol>)APIService
Expand All @@ -47,6 +39,16 @@ - (instancetype)initWithAPIService:(id<FIRDeviceCheckAPIServiceProtocol>)APIServ

@end

FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
@interface FIRDeviceCheckProviderTests : XCTestCase

@property(nonatomic) FIRDeviceCheckProvider *provider;
@property(nonatomic) id fakeAPIService;
@property(nonatomic) id fakeTokenGenerator;
@property(nonatomic) FIRAppCheckBackoffWrapperFake *fakeBackoffWrapper;

@end

@implementation FIRDeviceCheckProviderTests

- (void)setUp {
Expand Down Expand Up @@ -268,3 +270,5 @@ - (void)testGetTokenBackoff {
}

@end

#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS