|
|
@@ -20,6 +20,7 @@
|
|
|
#import "../Views/PerfTraceView.h"
|
|
|
#import "TracesViewController+Accessibility.h"
|
|
|
|
|
|
+#import "FIRCrashlytics.h"
|
|
|
#import "FirebasePerformance/Sources/Public/FirebasePerformance/FIRPerformance.h"
|
|
|
|
|
|
/** Edge insets used by internal subviews. */
|
|
|
@@ -36,6 +37,9 @@ static const CGFloat kEdgeInsetsRight = 20.0f;
|
|
|
/** Button to add a new PerfTraceView. */
|
|
|
@property(nonatomic) UIButton *addTraceButton;
|
|
|
|
|
|
+/** Button to add a new PerfTraceView. */
|
|
|
+@property(nonatomic) UIButton *crashButton;
|
|
|
+
|
|
|
/** A counter to maintain the number of traces created. Used for the unique names for traces. */
|
|
|
@property(nonatomic, assign) NSInteger traceCounter;
|
|
|
|
|
|
@@ -62,6 +66,7 @@ static const CGFloat kEdgeInsetsRight = 20.0f;
|
|
|
|
|
|
[self createViewTree];
|
|
|
[self constrainViews];
|
|
|
+ [[FIRCrashlytics crashlytics] log:@"Does logging work?"];
|
|
|
}
|
|
|
|
|
|
#pragma mark - Properties
|
|
|
@@ -107,6 +112,34 @@ static const CGFloat kEdgeInsetsRight = 20.0f;
|
|
|
return _addTraceButton;
|
|
|
}
|
|
|
|
|
|
+- (UIButton *)addCrashButton {
|
|
|
+ if (!_crashButton) {
|
|
|
+ _crashButton = [[UIButton alloc] init];
|
|
|
+ _crashButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
+
|
|
|
+ [_crashButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
|
|
+ [_crashButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
|
|
|
+ _crashButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
+
|
|
|
+ _crashButton.contentEdgeInsets =
|
|
|
+ UIEdgeInsetsMake(kEdgeInsetsTop, kEdgeInsetsLeft, kEdgeInsetsBottom, kEdgeInsetsRight);
|
|
|
+ _crashButton.layer.cornerRadius = 3.0f;
|
|
|
+ _crashButton.layer.borderColor = [[UIColor blackColor] CGColor];
|
|
|
+ _crashButton.layer.borderWidth = 1.0f;
|
|
|
+
|
|
|
+ [_crashButton setTitle:@"Crash - Perflytics!" forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ [_crashButton addTarget:self
|
|
|
+ action:@selector(crashButtonTapped:)
|
|
|
+ forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ }
|
|
|
+ return _crashButton;
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)crashButtonTapped:(id)sender {
|
|
|
+ @[][1];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Private Methods
|
|
|
|
|
|
#pragma mark - View hierarchy methods
|
|
|
@@ -115,8 +148,13 @@ static const CGFloat kEdgeInsetsRight = 20.0f;
|
|
|
[self addConstraintsString:@"H:|-40-[_addTraceButton]-40-|"
|
|
|
forViewsBinding:NSDictionaryOfVariableBindings(_addTraceButton)];
|
|
|
|
|
|
- [self addConstraintsString:@"V:|-60-[_addTraceButton(40)]-10-[_contentView]-|"
|
|
|
- forViewsBinding:NSDictionaryOfVariableBindings(_addTraceButton, _contentView)];
|
|
|
+ [self
|
|
|
+ addConstraintsString:@"V:|-60-[_addTraceButton(40)]-10-[_crashButton(40)]-10-[_contentView]-|"
|
|
|
+ forViewsBinding:NSDictionaryOfVariableBindings(_addTraceButton, _crashButton,
|
|
|
+ _contentView)];
|
|
|
+
|
|
|
+ [self addConstraintsString:@"H:|-40-[_crashButton]-40-|"
|
|
|
+ forViewsBinding:NSDictionaryOfVariableBindings(_crashButton)];
|
|
|
|
|
|
[self addConstraintsString:@"H:|[_contentView]|"
|
|
|
forViewsBinding:NSDictionaryOfVariableBindings(_contentView)];
|
|
|
@@ -133,6 +171,7 @@ static const CGFloat kEdgeInsetsRight = 20.0f;
|
|
|
- (void)createViewTree {
|
|
|
[self.view addSubview:self.contentView];
|
|
|
[self.view addSubview:self.addTraceButton];
|
|
|
+ [self.view addSubview:self.addCrashButton];
|
|
|
}
|
|
|
|
|
|
/**
|