-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
2,285 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
Carthage | ||
xcuserdata | ||
.DS_Store | ||
report.xml | ||
test_output | ||
|
||
*.xcscmblueprint | ||
xcuserdata | ||
|
||
/archive | ||
/build | ||
|
||
/Carthage | ||
|
||
/fastlane/report.xml | ||
/fastlane/test_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(MARKETING_VERSION)</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NSTimer (SRGDiagnostics) | ||
|
||
/** | ||
* Create a block-based timer (a feature only available since iOS 10), scheduled with common run loop modes. | ||
*/ | ||
+ (NSTimer *)srgdiagnostics_timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
#import "NSTimer+SRGDiagnostics.h" | ||
|
||
#import "SRGDiagnosticsTimerTarget.h" | ||
|
||
@implementation NSTimer (SRGDiagnostics) | ||
|
||
+ (NSTimer *)srgdiagnostics_timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer * _Nonnull timer))block | ||
{ | ||
NSTimer *timer = nil; | ||
|
||
if (@available(iOS 10, *)) { | ||
timer = [self timerWithTimeInterval:interval repeats:repeats block:block]; | ||
} | ||
else { | ||
// Do not use self as target, since this would lead to subtle issues when the timer is deallocated | ||
SRGDiagnosticsTimerTarget *target = [[SRGDiagnosticsTimerTarget alloc] initWithBlock:block]; | ||
timer = [self timerWithTimeInterval:interval target:target selector:@selector(fire:) userInfo:nil repeats:repeats]; | ||
} | ||
|
||
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; | ||
return timer; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* Helper class used as target for a timer. | ||
*/ | ||
// TODO: Remove when iOS 10 is the minimum required version | ||
@interface SRGDiagnosticsTimerTarget : NSObject | ||
|
||
/** | ||
* Create the target with the specified to be executed when `-fire:` is called. | ||
*/ | ||
- (instancetype)initWithBlock:(nullable void (^)(NSTimer *timer))block; | ||
|
||
/** | ||
* Execute the attached block on behalf of the specified timer. | ||
*/ | ||
- (void)fire:(NSTimer *)timer; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
#import "SRGDiagnosticsTimerTarget.h" | ||
|
||
@interface SRGDiagnosticsTimerTarget () | ||
|
||
@property (nonatomic, copy) void (^block)(NSTimer *); | ||
|
||
@end | ||
|
||
@implementation SRGDiagnosticsTimerTarget | ||
|
||
- (instancetype)initWithBlock:(void (^)(NSTimer * _Nonnull))block | ||
{ | ||
if (self = [super init]) { | ||
self.block = block; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)fire:(NSTimer *)timer | ||
{ | ||
self.block ? self.block(timer) : nil; | ||
} | ||
|
||
@end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* Diagnostic information. | ||
*/ | ||
@interface SRGDiagnosticInformation : NSObject <NSCopying> | ||
|
||
/** | ||
* Associate primitive values with keys. | ||
*/ | ||
- (void)setBool:(BOOL)value forKey:(NSString *)key; | ||
- (void)setInteger:(NSInteger)value forKey:(NSString *)key; | ||
- (void)setFloat:(float)value forKey:(NSString *)key; | ||
- (void)setDouble:(double)value forKey:(NSString *)key; | ||
|
||
/** | ||
* Associate objects with keys. Setting `nil` removes the associated entry, if any. | ||
*/ | ||
- (void)setString:(nullable NSString *)string forKey:(NSString *)key; | ||
- (void)setNumber:(nullable NSNumber *)number forKey:(NSString *)key; | ||
- (void)setURL:(nullable NSURL *)URL forKey:(NSString *)key; | ||
|
||
/** | ||
* Start / stop a time measurement, saving the associated value under the specified key. | ||
* | ||
* @discussion If a measurement is not stopped, it will be ignored when the report is submitted. | ||
*/ | ||
- (void)startTimeMeasurementForKey:(NSString *)key; | ||
- (void)stopTimeMeasurementForKey:(NSString *)key; | ||
|
||
/** | ||
* Return nested information under the specified key. | ||
*/ | ||
- (SRGDiagnosticInformation *)informationForKey:(NSString *)key; | ||
|
||
/** | ||
* Return report information as a dictionary serializable to JSON. | ||
*/ | ||
- (NSDictionary<NSString *, id> *)JSONDictionary; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.