diff --git a/GoogleDataLogger/GoogleDataLogger/Classes/GDLRegistrar.m b/GoogleDataLogger/GoogleDataLogger/Classes/GDLRegistrar.m index 8520dbfd17f..d88508bde0f 100644 --- a/GoogleDataLogger/GoogleDataLogger/Classes/GDLRegistrar.m +++ b/GoogleDataLogger/GoogleDataLogger/Classes/GDLRegistrar.m @@ -16,6 +16,8 @@ #import "GDLRegistrar.h" +#import "GDLRegistrar_Private.h" + @implementation GDLRegistrar + (instancetype)sharedInstance { @@ -27,13 +29,22 @@ + (instancetype)sharedInstance { return sharedInstance; } +- (instancetype)init { + self = [super init]; + if (self) { + _logTargetToPrioritizer = [[NSMutableDictionary alloc] init]; + _logTargetToBackend = [[NSMutableDictionary alloc] init]; + } + return self; +} + - (void)registerBackend:(id)backend forLogTarget:(NSInteger)logTarget { - // TODO + self.logTargetToBackend[@(logTarget)] = backend; } - (void)registerLogPrioritizer:(id)prioritizer forLogTarget:(NSInteger)logTarget { - // TODO + self.logTargetToPrioritizer[@(logTarget)] = prioritizer; } @end diff --git a/GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLRegistrar_Private.h b/GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLRegistrar_Private.h index 0ee36e16a61..c05b5cdfe5e 100644 --- a/GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLRegistrar_Private.h +++ b/GoogleDataLogger/GoogleDataLogger/Classes/Private/GDLRegistrar_Private.h @@ -19,9 +19,9 @@ @interface GDLRegistrar () /** A map of logTargets to backend implementations. */ -@property(nonatomic) NSDictionary> *logTargetToBackend; +@property(nonatomic) NSMutableDictionary> *logTargetToBackend; /** A map of logTargets to prioritizer implementations. */ -@property(nonatomic) NSDictionary> *logTargetToPrioritizer; +@property(nonatomic) NSMutableDictionary> *logTargetToPrioritizer; @end diff --git a/GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogBackend.h b/GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogBackend.h index 8c17ec57a65..e4638ee54b0 100644 --- a/GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogBackend.h +++ b/GoogleDataLogger/GoogleDataLogger/Classes/Public/GDLLogBackend.h @@ -16,11 +16,13 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** A convenient typedef to define the block to be called upon completion of an upload to the * backend. */ -typedef void (^GDLBackendCompletionBlock)(NSSet *successfulUploads, - NSSet *unsuccessfulUploads); +typedef void (^GDLBackendCompletionBlock)(NSSet *_Nullable successfulUploads, + NSSet *_Nullable unsuccessfulUploads); /** This protocol defines the common interface for logging backend implementations. */ @protocol GDLLogBackend @@ -37,3 +39,5 @@ typedef void (^GDLBackendCompletionBlock)(NSSet *successfulUploads, - (void)uploadLogs:(NSSet *)logFiles onComplete:(GDLBackendCompletionBlock)onComplete; @end + +NS_ASSUME_NONNULL_END diff --git a/GoogleDataLogger/GoogleDataLogger/Classes/Public/GoogleDataLogger.h b/GoogleDataLogger/GoogleDataLogger/Classes/Public/GoogleDataLogger.h index 091625895eb..3c1ac580835 100644 --- a/GoogleDataLogger/GoogleDataLogger/Classes/Public/GoogleDataLogger.h +++ b/GoogleDataLogger/GoogleDataLogger/Classes/Public/GoogleDataLogger.h @@ -14,6 +14,10 @@ * limitations under the License. */ +#import "GDLLogBackend.h" #import "GDLLogEvent.h" +#import "GDLLogPrioritizer.h" +#import "GDLLogProto.h" #import "GDLLogTransformer.h" #import "GDLLogger.h" +#import "GDLRegistrar.h" diff --git a/GoogleDataLogger/Tests/GDLClockTest.m b/GoogleDataLogger/Tests/GDLClockTest.m new file mode 100644 index 00000000000..09f43daf5df --- /dev/null +++ b/GoogleDataLogger/Tests/GDLClockTest.m @@ -0,0 +1,32 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GDLClock.h" + +@interface GDLClockTest : XCTestCase + +@end + +@implementation GDLClockTest + +/** Tests the default initializer. */ +- (void)testInit { + XCTAssertNotNil([[GDLClockTest alloc] init]); +} + +@end