Skip to content

Commit

Permalink
Merge pull request #219 from WideSpectrumComputing/master
Browse files Browse the repository at this point in the history
v1.10.0 release candidate
  • Loading branch information
akornich authored Nov 13, 2019
2 parents be986bc + 0752d35 commit 6570f79
Show file tree
Hide file tree
Showing 33 changed files with 509 additions and 301 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ The change log has moved to this repo's [GitHub Releases Page](https://github.co
depending on what is more appropriate in each case.

## Release Notes

**1.10.0**
- feat: resolve #206: Capture Log As Telemetry - Not working? Introducing RollbarLog(...)
- feat: resolve #217: Reimplement Deploys based on the DTOs

**1.9.1**
- feat: resolve #215: Change client.os element back to client.ios to fix dSYMs application

Expand Down
9 changes: 7 additions & 2 deletions Examples/macOScmdTool_Workspace/macOScmdTool/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ + (void) causeTrouble {
@"Dave",
@"Heywood",
@"Frank", nil];
NSLog(@"The crew: %@", crew);
// This will throw an exception.
NSLog(@"%@", [crew objectAtIndex:10]);
}
Expand All @@ -39,10 +40,14 @@ int main(int argc, const char * argv[]) {
// configure Rollbar:
RollbarConfiguration *config = [RollbarConfiguration configuration];
config.environment = @"samples";
config.telemetryEnabled = YES;
config.maximumTelemetryData = 20;
config.captureLogAsTelemetryData = YES;
[Rollbar initWithAccessToken:@"2ffc7997ed864dda94f63e7b7daae0f3" configuration:config];

NSLog(@"Hello, World!");

NSLog(@"See you in Telemetry!");

@try {
[BuggyClass callTroubleMaker];
}
Expand All @@ -54,7 +59,7 @@ int main(int argc, const char * argv[]) {
}


int i = 100;
int i = 10;
while (0 < i--) {
[Rollbar info:@"Message from macOScmdTool"];
[NSThread sleepForTimeInterval:1.0f];
Expand Down
4 changes: 3 additions & 1 deletion Rollbar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|

s.version = "1.9.1"
s.version = "1.10.0"
s.name = "Rollbar"
s.summary = "Objective-C library for crash reporting and logging with Rollbar. It works on iOS and macOS."
s.description = <<-DESC
Expand Down Expand Up @@ -32,12 +32,14 @@ Pod::Spec.new do |s|
'Rollbar/RollbarLevel.h',
'Rollbar/RollbarTelemetry.h',
'Rollbar/RollbarTelemetryType.h',
'Rollbar/RollbarLog.h',
'Rollbar/RollbarKSCrashReportSink.h',
'Rollbar/RollbarKSCrashInstallation.h',
'Rollbar/Deploys/RollbarDeploysProtocol.h',
'Rollbar/Deploys/RollbarDeploysManager.h',
'Rollbar/RollbarJSONFriendlyProtocol.h',
'Rollbar/RollbarJSONFriendlyObject.h',
'Rollbar/Deploys/DeployApiCallOutcome.h',
'Rollbar/Deploys/Deployment.h',
'Rollbar/Deploys/DeploymentDetails.h',
'Rollbar/Deploys/DeployApiCallResult.h',
Expand Down
84 changes: 62 additions & 22 deletions Rollbar.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Rollbar/DTOs/DataTransferObject+Protected.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ NS_ASSUME_NONNULL_BEGIN
- (NSUInteger)safelyGetUIntegerByKey:(NSString *)key;
- (void)setUInteger:(NSUInteger)data forKey:(NSString *)key;

- (NSInteger)safelyGetIntegerByKey:(NSString *)key;
- (void)setInteger:(NSInteger)data forKey:(NSString *)key;

@end

Expand Down
10 changes: 10 additions & 0 deletions Rollbar/DTOs/DataTransferObject+Protected.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,14 @@ - (void)setUInteger:(NSUInteger)data forKey:(NSString *)key {
[self setNumber:number forKey:key];
}

- (NSInteger)safelyGetIntegerByKey:(NSString *)key {
NSNumber *value = [self safelyGetNumberByKey:key];
return value.integerValue;
}

- (void)setInteger:(NSInteger)data forKey:(NSString *)key {
NSNumber *number = @(data);
[self setNumber:number forKey:key];
}

@end
12 changes: 6 additions & 6 deletions Rollbar/DTOs/DataTransferObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import "DataTransferObject.h"
#import "RollbarLogger.h"
#import "SdkLog.h"

#import <Foundation/NSObjCRuntime.h>
#import "objc/runtime.h"
Expand Down Expand Up @@ -84,10 +84,10 @@ + (NSMutableDictionary *)safeDataFromJSONObject:(id)obj {
if (error == nil) {
[safeData setObject:[[self class] safeDataFromJSONObject:json] forKey:key];
} else {
RollbarLog(@"Error serializing NSData: %@", [error localizedDescription]);
SdkLog(@"Error serializing NSData: %@", [error localizedDescription]);
}
} else {
RollbarLog(@"Error serializing class '%@' using NSJSONSerialization",
SdkLog(@"Error serializing class '%@' using NSJSONSerialization",
NSStringFromClass([obj class]));
}
}];
Expand Down Expand Up @@ -131,8 +131,8 @@ - (BOOL)deserializeFromJSONData:(NSData *)jsonData {
error:&error];
if (!self->_data) {
self->_data = [[NSMutableDictionary alloc] initWithCapacity:10];
RollbarLog(@"Error restoring data from JSON NSData instance: %@", jsonData);
RollbarLog(@"Error details: %@", error);
SdkLog(@"Error restoring data from JSON NSData instance: %@", jsonData);
SdkLog(@"Error details: %@", error);
return NO;
}
return YES;
Expand All @@ -141,7 +141,7 @@ - (BOOL)deserializeFromJSONData:(NSData *)jsonData {
- (BOOL)deserializeFromJSONString:(NSString *)jsonString {
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
if (!jsonData) {
RollbarLog(@"Error converting an NSString instance to NSData: %@", jsonString);
SdkLog(@"Error converting an NSString instance to NSData: %@", jsonString);
return NO;
}
return [self deserializeFromJSONData:jsonData];
Expand Down
2 changes: 1 addition & 1 deletion Rollbar/DTOs/RollbarConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma mark - constants

static NSString * const NOTIFIER_VERSION = @"1.9.1";
static NSString * const NOTIFIER_VERSION = @"1.10.0";

#define NOTIFIER_NAME_PREFIX = @"rollbar-";
#if TARGET_OS_IPHONE
Expand Down
31 changes: 31 additions & 0 deletions Rollbar/Deploys/DeployApiCallOutcome.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// DeployApiCallOutcome.h
// Rollbar
//
// Created by Andrey Kornich on 2019-11-08.
// Copyright © 2019 Rollbar. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, DeployApiCallOutcome) {
DeployApiCallSuccess,
DeployApiCallError,
};

NS_ASSUME_NONNULL_BEGIN

/// Enum to/from NSString conversion utility
@interface DeployApiCallOutcomeUtil : NSObject

/// Converts DeployApiCallOutcome value into a NSString
/// @param value DeployApiCallOutcome value to convert
+ (NSString *) DeployApiCallOutcomeToString:(DeployApiCallOutcome)value;

/// Converts NSString into a DeployApiCallOutcome value
/// @param value NSString to convert
+ (DeployApiCallOutcome) DeployApiCallOutcomeFromString:(NSString *)value;

@end

NS_ASSUME_NONNULL_END
37 changes: 37 additions & 0 deletions Rollbar/Deploys/DeployApiCallOutcome.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// DeployApiCallOutcome.m
// Rollbar
//
// Created by Andrey Kornich on 2019-11-08.
// Copyright © 2019 Rollbar. All rights reserved.
//

#import "DeployApiCallOutcome.h"

@implementation DeployApiCallOutcomeUtil

+ (NSString *) DeployApiCallOutcomeToString:(DeployApiCallOutcome)value; {
switch (value) {
case DeployApiCallSuccess:
return @"success";
case DeployApiCallError:
return @"error";
default:
return @"unknown";
}
}

+ (DeployApiCallOutcome) DeployApiCallOutcomeFromString:(NSString *)value {

if (NSOrderedSame == [value caseInsensitiveCompare:@"success"]) {
return DeployApiCallSuccess;
}
else if (NSOrderedSame == [value caseInsensitiveCompare:@"error"]) {
return DeployApiCallError;
}
else {
return DeployApiCallError; // default case...
}
}

@end
55 changes: 42 additions & 13 deletions Rollbar/Deploys/DeployApiCallResult.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,63 @@
// Copyright © 2018 Rollbar. All rights reserved.

#import <Foundation/Foundation.h>

#import "DeploymentDetails.h"
#import "RollbarJSONFriendlyObject.h"
#import "DataTransferObject.h"
#import "DeployApiCallOutcome.h"

#pragma mark - DeployApiCallResult

typedef NS_ENUM(NSInteger, DeployApiCallOutcome) {
DeployApiCallSuccess,
DeployApiCallError,
};
/// Models result of Deploy API call/request
@interface DeployApiCallResult : DataTransferObject

@interface DeployApiCallResult : RollbarJSONFriendlyObject
/// API call's outcome
@property (readonly) DeployApiCallOutcome outcome;

/// API call's result description
@property (readonly, copy) NSString *description;

- (id)initWithResponse:(NSHTTPURLResponse*)httpResponse
data:(NSData*)data
error:(NSError*)error
forRequest:(NSURLRequest*)request;
/// Designated initializer
/// @param httpResponse HTTP response object
/// @param data response data
/// @param error error (if any)
/// @param request corresponding HTTP request
- (instancetype)initWithResponse:(NSHTTPURLResponse*)httpResponse
data:(NSData*)data
error:(NSError*)error
forRequest:(NSURLRequest*)request
NS_DESIGNATED_INITIALIZER;

@end

#pragma mark - DeploymentRegistrationResult

/// Models result of a deployment registration request
@interface DeploymentRegistrationResult : DeployApiCallResult

/// Deployment ID
@property (readonly, copy) NSString *deploymentId;

@end

#pragma mark - DeploymentDetailsResult

/// Models result of a deployment details request
@interface DeploymentDetailsResult : DeployApiCallResult

/// Deployment details object
@property (readonly, retain) DeploymentDetails *deployment;

@end

#pragma mark - DeploymentDetailsPageResult

/// Models result of a deployment details page request
@interface DeploymentDetailsPageResult : DeployApiCallResult
@property (readonly, retain) NSSet<DeploymentDetails *> *deployments;
@property (readonly, copy) NSNumber *pageNumber;

/// Deployment details objects
@property (readonly, retain) NSArray<DeploymentDetails *> *deployments;

/// Deployment details page number
@property (readonly) NSUInteger pageNumber;

@end
Loading

0 comments on commit 6570f79

Please sign in to comment.