Skip to content

Implement some stubbed methods, update umbrella header, add missing test #2214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 22, 2018
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
15 changes: 13 additions & 2 deletions GoogleDataLogger/GoogleDataLogger/Classes/GDLRegistrar.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#import "GDLRegistrar.h"

#import "GDLRegistrar_Private.h"

@implementation GDLRegistrar

+ (instancetype)sharedInstance {
Expand All @@ -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<GDLLogBackend>)backend forLogTarget:(NSInteger)logTarget {
// TODO
self.logTargetToBackend[@(logTarget)] = backend;
}

- (void)registerLogPrioritizer:(id<GDLLogPrioritizer>)prioritizer
forLogTarget:(NSInteger)logTarget {
// TODO
self.logTargetToPrioritizer[@(logTarget)] = prioritizer;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
@interface GDLRegistrar ()

/** A map of logTargets to backend implementations. */
@property(nonatomic) NSDictionary<NSNumber *, id<GDLLogBackend>> *logTargetToBackend;
@property(nonatomic) NSMutableDictionary<NSNumber *, id<GDLLogBackend>> *logTargetToBackend;

/** A map of logTargets to prioritizer implementations. */
@property(nonatomic) NSDictionary<NSNumber *, id<GDLLogPrioritizer>> *logTargetToPrioritizer;
@property(nonatomic) NSMutableDictionary<NSNumber *, id<GDLLogPrioritizer>> *logTargetToPrioritizer;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

#import <Foundation/Foundation.h>

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<NSURL *> *successfulUploads,
NSSet<NSURL *> *unsuccessfulUploads);
typedef void (^GDLBackendCompletionBlock)(NSSet<NSURL *> *_Nullable successfulUploads,
NSSet<NSURL *> *_Nullable unsuccessfulUploads);

/** This protocol defines the common interface for logging backend implementations. */
@protocol GDLLogBackend <NSObject>
Expand All @@ -37,3 +39,5 @@ typedef void (^GDLBackendCompletionBlock)(NSSet<NSURL *> *successfulUploads,
- (void)uploadLogs:(NSSet<NSURL *> *)logFiles onComplete:(GDLBackendCompletionBlock)onComplete;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -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"
32 changes: 32 additions & 0 deletions GoogleDataLogger/Tests/GDLClockTest.m
Original file line number Diff line number Diff line change
@@ -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 <XCTest/XCTest.h>

#import "GDLClock.h"

@interface GDLClockTest : XCTestCase

@end

@implementation GDLClockTest

/** Tests the default initializer. */
- (void)testInit {
XCTAssertNotNil([[GDLClockTest alloc] init]);
}

@end