Skip to content

Commit edbd012

Browse files
authored
MetricKit SDK incorporation (#8436)
Adds MetricKit diagnostic report collection (for allowlisted apps only).
1 parent fa514c4 commit edbd012

35 files changed

+2282
-26
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [added] Internal SDK updates to test potential future MetricKit support.
3+
14
# v8.4.0
25
- [fixed] Bump Promises dependency. (#8365)
36

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <Availability.h>
16+
#import <Foundation/Foundation.h>
17+
18+
#if defined(__IPHONE_15_0)
19+
#define CLS_METRICKIT_SUPPORTED (__has_include(<MetricKit/MetricKit.h>) && TARGET_OS_IOS)
20+
#else
21+
#define CLS_METRICKIT_SUPPORTED 0
22+
#endif
23+
24+
#if CLS_METRICKIT_SUPPORTED
25+
#import <MetricKit/MetricKit.h>
26+
27+
#import "Crashlytics/Crashlytics/Controllers/FIRCLSExistingReportManager.h"
28+
#import "Crashlytics/Crashlytics/Models/FIRCLSFileManager.h"
29+
30+
#if __has_include(<FBLPromises/FBLPromises.h>)
31+
#import <FBLPromises/FBLPromises.h>
32+
#else
33+
#import "FBLPromises.h"
34+
#endif
35+
36+
NS_ASSUME_NONNULL_BEGIN
37+
38+
@interface FIRCLSMetricKitManager : NSObject <MXMetricManagerSubscriber>
39+
40+
- (instancetype)initWithManagerData:(FIRCLSManagerData *)managerData
41+
existingReportManager:(FIRCLSExistingReportManager *)existingReportManager
42+
fileManager:(FIRCLSFileManager *)fileManager;
43+
44+
- (instancetype)init NS_UNAVAILABLE;
45+
- (void)registerMetricKitManager;
46+
- (FBLPromise *)waitForMetricKitDataAvailable;
47+
- (void)processDiagnosticPayloads:(NSArray<MXDiagnosticPayload *> *)payloads;
48+
49+
@end
50+
51+
NS_ASSUME_NONNULL_END
52+
#endif // CLS_METRICKIT_SUPPORTED

0 commit comments

Comments
 (0)