Skip to content

Commit 62c7752

Browse files
authored
[AppCheck] DeviceCheck provider is supported by watchOS 9.0+ (#10094)
* [AppCheck] DeviceCheck provider is supported by watchOS 9.0+ * Update CHANGELOG * trailing whitespace * Review
1 parent 45ee209 commit 62c7752

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

FirebaseAppCheck/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 9.5.0
2+
- [added] AppCheck's DeviceCheck provider is available for watchOS 9.0+.
3+
14
# 9.0.0
25
- [added] **Breaking change:** `FirebaseAppCheck` has exited beta and is now
36
generally available for use.

FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckAvailability.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,34 @@
1616

1717
// Availability conditions for different App Check SDK components.
1818

19+
#import <Foundation/Foundation.h>
1920
#import <TargetConditionals.h>
2021

2122
#pragma mark - DeviceCheck
2223

24+
// DeviceCheck availability was extended to watchOS in Xcode 14.
25+
#if defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0
26+
27+
// Targets where DeviceCheck framework is available to be used in preprocessor conditions.
28+
#define FIR_DEVICE_CHECK_SUPPORTED_TARGETS \
29+
TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_WATCH
30+
31+
// `DeviceCheckProvider` availability.
32+
#define FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY \
33+
API_AVAILABLE(ios(11.0), macos(10.15), tvos(11.0), watchos(9.0))
34+
35+
// TODO(ncooke3): Remove `#else` clause when Xcode 14 is the minimum supported Xcode.
36+
#else // defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0
37+
2338
// Targets where DeviceCheck framework is available to be used in preprocessor conditions.
2439
#define FIR_DEVICE_CHECK_SUPPORTED_TARGETS TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_TV
2540

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

45+
#endif // defined(__WATCHOS_9_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_9_0
46+
3047
#pragma mark - App Attest
3148

3249
// App Attest availability was extended to macOS and Mac Catalyst in Xcode 12.5.

FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckTests.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
4040

41+
// Since DeviceCheck is the default attestation provider for AppCheck, disable
42+
// test cases that may be dependent on DeviceCheck being available.
43+
#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS
44+
4145
// The FAC token value returned when an error occurs.
4246
static NSString *const kDummyToken = @"eyJlcnJvciI6IlVOS05PV05fRVJST1IifQ==";
4347

@@ -1009,3 +1013,5 @@ - (void)verifyAllMocks {
10091013
}
10101014

10111015
@end
1016+
1017+
#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS

FirebaseAppCheck/Tests/Unit/DeviceCheckProvider/FIRDeviceCheckProviderTests.m

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,9 @@
2828

2929
#import "SharedTestUtilities/AppCheckBackoffWrapperFake/FIRAppCheckBackoffWrapperFake.h"
3030

31-
API_AVAILABLE(ios(11.0), macos(10.15), tvos(11.0))
32-
API_UNAVAILABLE(watchos)
33-
@interface FIRDeviceCheckProviderTests : XCTestCase
34-
35-
@property(nonatomic) FIRDeviceCheckProvider *provider;
36-
@property(nonatomic) id fakeAPIService;
37-
@property(nonatomic) id fakeTokenGenerator;
38-
@property(nonatomic) FIRAppCheckBackoffWrapperFake *fakeBackoffWrapper;
39-
40-
@end
31+
#if FIR_DEVICE_CHECK_SUPPORTED_TARGETS
4132

33+
FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
4234
@interface FIRDeviceCheckProvider (Tests)
4335

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

4840
@end
4941

42+
FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
43+
@interface FIRDeviceCheckProviderTests : XCTestCase
44+
45+
@property(nonatomic) FIRDeviceCheckProvider *provider;
46+
@property(nonatomic) id fakeAPIService;
47+
@property(nonatomic) id fakeTokenGenerator;
48+
@property(nonatomic) FIRAppCheckBackoffWrapperFake *fakeBackoffWrapper;
49+
50+
@end
51+
5052
@implementation FIRDeviceCheckProviderTests
5153

5254
- (void)setUp {
@@ -268,3 +270,5 @@ - (void)testGetTokenBackoff {
268270
}
269271

270272
@end
273+
274+
#endif // FIR_DEVICE_CHECK_SUPPORTED_TARGETS

0 commit comments

Comments
 (0)