Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/*
2
 * Copyright 2019 Google
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
#import "FirebaseCore/Sources/FIRDiagnosticsData.h"
18
 
19
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRApp.h"
20
 
21
#import "FirebaseCore/Sources/Private/FIRAppInternal.h"
22
#import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
23
 
24
@implementation FIRDiagnosticsData {
25
  /** Backing ivar for the diagnosticObjects property. */
26
  NSMutableDictionary<NSString *, id> *_diagnosticObjects;
27
}
28
 
29
- (instancetype)init {
30
  self = [super init];
31
  if (self) {
32
    _diagnosticObjects = [[NSMutableDictionary alloc] init];
33
  }
34
  return self;
35
}
36
 
37
- (void)insertValue:(nullable id)value forKey:(NSString *)key {
38
  if (key) {
39
    _diagnosticObjects[key] = value;
40
  }
41
}
42
 
43
#pragma mark - FIRCoreDiagnosticsData
44
 
45
- (NSDictionary<NSString *, id> *)diagnosticObjects {
46
  if (!_diagnosticObjects[kFIRCDllAppsCountKey]) {
47
    _diagnosticObjects[kFIRCDllAppsCountKey] = @([FIRApp allApps].count);
48
  }
49
  if (!_diagnosticObjects[kFIRCDIsDataCollectionDefaultEnabledKey]) {
50
    _diagnosticObjects[kFIRCDIsDataCollectionDefaultEnabledKey] =
51
        @([[FIRApp defaultApp] isDataCollectionDefaultEnabled]);
52
  }
53
  if (!_diagnosticObjects[kFIRCDFirebaseUserAgentKey]) {
54
    _diagnosticObjects[kFIRCDFirebaseUserAgentKey] = [FIRApp firebaseUserAgent];
55
  }
56
  return _diagnosticObjects;
57
}
58
 
59
#pragma clang diagnostic push
60
#pragma clang diagnostic ignored "-Wunused-parameter"
61
- (void)setDiagnosticObjects:(NSDictionary<NSString *, id> *)diagnosticObjects {
62
  NSAssert(NO, @"Please use -insertValue:forKey:");
63
}
64
#pragma clang diagnostic pop
65
 
66
@end