Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 787b71f

Browse files
author
Benjamin Scholtysik (Reimold)
authored
Merge pull request #318 from bitstadium/develop
Merging 4.1.0 back into master.
2 parents b284d9a + 753ca6f commit 787b71f

File tree

81 files changed

+2376
-958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2376
-958
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
- SCHEME="HockeySDK" DESTINATION="OS=8.4,name=iPhone 6" RUN_TESTS="YES"
1313
- SCHEME="HockeySDK" DESTINATION="OS=9.0,name=iPad Air" RUN_TESTS="YES"
1414
- SCHEME="HockeySDK" DESTINATION="OS=9.0,name=iPhone 6 Plus" RUN_TESTS="YES"
15-
- SCHEME="HockeySDK" DESTINATION="OS=9.2,name=iPad Pro" RUN_TESTS="YES"
15+
- SCHEME="HockeySDK" DESTINATION="OS=9.2,name=iPad Pro" RUN_TESTS="YES"
1616
- SCHEME="HockeySDK" DESTINATION="OS=9.2,name=iPhone 6s" RUN_TESTS="YES"
1717
- SCHEME="HockeySDK Framework" DESTINATION="platform=iOS Simulator,name=iPhone 6" RUN_TESTS="YES"
1818
- SCHEME="HockeySDK Distribution" RUN_TESTS="NO" LINT="YES"

Classes/BITApplication.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#import "BITApplication.h"
2-
#import "BITOrderedDictionary.h"
32

43
/// Data contract class for type Application.
54
@implementation BITApplication
@@ -8,8 +7,8 @@ @implementation BITApplication
87
/// Adds all members of this class to a dictionary
98
/// @param dictionary to which the members of this class will be added.
109
///
11-
- (BITOrderedDictionary *)serializeToDictionary {
12-
BITOrderedDictionary *dict = [super serializeToDictionary];
10+
- (NSDictionary *)serializeToDictionary {
11+
NSMutableDictionary *dict = [super serializeToDictionary].mutableCopy;
1312
if (self.version != nil) {
1413
[dict setObject:self.version forKey:@"ai.application.ver"];
1514
}

Classes/BITAuthenticator.m

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ - (void)authenticate {
128128
[self dismissAuthenticationControllerAnimated:YES completion:nil];
129129
}
130130
} else {
131-
BITHockeyLog(@"Failed to identify. Error: %@", error);
131+
BITHockeyLogError(@"Failed to identify. Error: %@", error);
132132
}
133133
}];
134134
}
@@ -137,15 +137,15 @@ - (void)authenticate {
137137

138138
- (void)identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion {
139139
if (_authenticationController) {
140-
BITHockeyLog(@"Authentication controller already visible. Ignoring identify request");
140+
BITHockeyLogDebug(@"Authentication controller already visible. Ignoring identify request");
141141
if (completion) { completion(NO, nil); }
142142
return;
143143
}
144144
//first check if the stored identification type matches the one currently configured
145145
NSString *storedTypeString = [self stringValueFromKeychainForKey:kBITAuthenticatorIdentifierTypeKey];
146146
NSString *configuredTypeString = [self.class stringForIdentificationType:self.identificationType];
147147
if (storedTypeString && ![storedTypeString isEqualToString:configuredTypeString]) {
148-
BITHockeyLog(@"Identification type mismatch for stored auth-token. Resetting.");
148+
BITHockeyLogDebug(@"Identification type mismatch for stored auth-token. Resetting.");
149149
[self storeInstallationIdentifier:nil withType:BITAuthenticatorIdentificationTypeAnonymous];
150150
}
151151

@@ -242,7 +242,7 @@ - (void)validate {
242242
if (validated) {
243243
[self dismissAuthenticationControllerAnimated:YES completion:nil];
244244
} else {
245-
BITHockeyLog(@"Validation failed with error: %@", error);
245+
BITHockeyLogError(@"Validation failed with error: %@", error);
246246
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
247247
// requires iOS 8
248248
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
@@ -523,8 +523,9 @@ - (void)handleAuthenticationWithResponse:(NSHTTPURLResponse *)response email:(NS
523523
if (authToken) {
524524
identified = YES;
525525
[self storeInstallationIdentifier:authToken withType:self.identificationType];
526-
[self dismissAuthenticationControllerAnimated:YES completion:nil];
527-
self.authenticationController = nil;
526+
dispatch_async(dispatch_get_main_queue(), ^{
527+
[self dismissAuthenticationControllerAnimated:YES completion:nil];
528+
});
528529
BOOL success = [self addStringValueToKeychain:email forKey:kBITAuthenticatorUserEmailKey];
529530
if (!success) {
530531
[self alertOnFailureStoringTokenInKeychain];
@@ -690,7 +691,7 @@ - (BOOL)handleOpenURL:(NSURL *)url
690691
NSString *const kAuthorizationHost = @"authorize";
691692
NSString *urlScheme = self.urlScheme ?: [NSString stringWithFormat:@"ha%@", self.appIdentifier];
692693
if (!([[url scheme] isEqualToString:urlScheme] && [[url host] isEqualToString:kAuthorizationHost])) {
693-
BITHockeyLog(@"URL scheme for authentication doesn't match!");
694+
BITHockeyLogWarning(@"WARNING: URL scheme for authentication doesn't match!");
694695
return NO;
695696
}
696697

@@ -706,7 +707,7 @@ - (BOOL)handleOpenURL:(NSURL *)url
706707
[self alertOnFailureStoringTokenInKeychain];
707708
}
708709
} else {
709-
BITHockeyLog(@"No email found in URL: %@", url);
710+
BITHockeyLogDebug(@"No email found in URL: %@", url);
710711
}
711712
localizedErrorDescription = @"Failed to retrieve parameters from URL.";
712713
break;
@@ -723,7 +724,7 @@ - (BOOL)handleOpenURL:(NSURL *)url
723724
}
724725

725726
if (installationIdentifier) {
726-
BITHockeyLog(@"Authentication succeeded.");
727+
BITHockeyLogDebug(@"Authentication succeeded.");
727728
if (NO == self.restrictApplicationUsage) {
728729
[self dismissAuthenticationControllerAnimated:YES completion:nil];
729730
}
@@ -735,7 +736,7 @@ - (BOOL)handleOpenURL:(NSURL *)url
735736
}
736737
} else {
737738
//reset token
738-
BITHockeyLog(@"Resetting authentication token");
739+
BITHockeyLogDebug(@"Resetting authentication token");
739740
[self storeInstallationIdentifier:nil withType:self.identificationType];
740741
self.identified = NO;
741742
if (self.identificationCompletion) {
@@ -816,7 +817,7 @@ - (void)processFullSizeImage {
816817
return;
817818
}
818819

819-
BITHockeyLog(@"Processing full size image for possible authentication");
820+
BITHockeyLogDebug(@"Processing full size image for possible authentication");
820821

821822
unsigned char *buffer, *source;
822823
source = (unsigned char *)malloc((unsigned long)fs.st_size);
@@ -881,10 +882,10 @@ - (void)processFullSizeImage {
881882
free(source);
882883

883884
if (result) {
884-
BITHockeyLog(@"Authenticating using full size image information: %@", result);
885+
BITHockeyLogDebug(@"Authenticating using full size image information: %@", result);
885886
[self handleOpenURL:[NSURL URLWithString:result] sourceApplication:nil annotation:nil];
886887
} else {
887-
BITHockeyLog(@"No authentication information found");
888+
BITHockeyLogDebug(@"No authentication information found");
888889
}
889890
}
890891

Classes/BITBase.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#import "BITBase.h"
2-
#import "BITOrderedDictionary.h"
32

43
/// Data contract class for type Base.
54
@implementation BITBase
@@ -8,8 +7,8 @@ @implementation BITBase
87
/// Adds all members of this class to a dictionary
98
/// @param dictionary to which the members of this class will be added.
109
///
11-
- (BITOrderedDictionary *)serializeToDictionary {
12-
BITOrderedDictionary *dict = [super serializeToDictionary];
10+
- (NSDictionary *)serializeToDictionary {
11+
NSMutableDictionary *dict = [super serializeToDictionary].mutableCopy;
1312
if (self.baseType != nil) {
1413
[dict setObject:self.baseType forKey:@"baseType"];
1514
}

Classes/BITChannel.h

Lines changed: 6 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,14 @@
1-
/*
2-
* Author: Christoph Wendt <chwend@microsoft.com>
3-
*
4-
* Copyright (c) 2012-2015 HockeyApp, Bit Stadium GmbH.
5-
* All rights reserved.
6-
*
7-
* Permission is hereby granted, free of charge, to any person
8-
* obtaining a copy of this software and associated documentation
9-
* files (the "Software"), to deal in the Software without
10-
* restriction, including without limitation the rights to use,
11-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
12-
* copies of the Software, and to permit persons to whom the
13-
* Software is furnished to do so, subject to the following
14-
* conditions:
15-
*
16-
* The above copyright notice and this permission notice shall be
17-
* included in all copies or substantial portions of the Software.
18-
*
19-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26-
* OTHER DEALINGS IN THE SOFTWARE.
27-
*/
28-
291
#import <Foundation/Foundation.h>
30-
#import "HockeySDK.h"
2+
#import "HockeySDKFeatureConfig.h"
313

324
#if HOCKEYSDK_FEATURE_METRICS
335

34-
#import "HockeySDKNullability.h"
35-
36-
@class BITOrderedDictionary;
376
@class BITConfiguration;
387
@class BITTelemetryData;
398
@class BITTelemetryContext;
409
@class BITPersistence;
10+
11+
#import "HockeySDKNullability.h"
4112
NS_ASSUME_NONNULL_BEGIN
4213

4314
FOUNDATION_EXPORT char *BITSafeJsonEventsString;
@@ -48,30 +19,6 @@ FOUNDATION_EXPORT char *BITSafeJsonEventsString;
4819
*/
4920
@interface BITChannel : NSObject
5021

51-
/**
52-
* Telemetry context used by the channel to create the payload (testing).
53-
*/
54-
@property (nonatomic, strong) BITTelemetryContext *telemetryContext;
55-
56-
/**
57-
* Persistence instance for storing files after the queue gets flushed (testing).
58-
*/
59-
@property (nonatomic, strong) BITPersistence *persistence;
60-
61-
/**
62-
* Number of queue items which will trigger a flush (testing).
63-
*/
64-
@property (nonatomic) NSUInteger maxBatchCount;
65-
66-
/**
67-
* A queue which makes array operations thread safe.
68-
*/
69-
@property (nonatomic, strong) dispatch_queue_t dataItemsOperations;
70-
71-
/**
72-
* An integer value that keeps tracks of the number of data items added to the JSON Stream string.
73-
*/
74-
@property (nonatomic, assign) NSUInteger dataItemCount;
7522

7623
/**
7724
* Initializes a new BITChannel instance.
@@ -83,50 +30,15 @@ FOUNDATION_EXPORT char *BITSafeJsonEventsString;
8330
*/
8431
- (instancetype)initWithTelemetryContext:(BITTelemetryContext *)telemetryContext persistence:(BITPersistence *) persistence;
8532

86-
/**
87-
* Enqueue telemetry data (events, metrics, exceptions, traces) before processing it.
88-
*
89-
* @param item the telemetry object, which should be processed
90-
*/
91-
- (void)enqueueTelemetryItem:(BITTelemetryData *)item;
92-
93-
/**
94-
* Manually trigger the BITChannel to persist all items currently in its data item queue.
95-
*/
96-
- (void)persistDataItemQueue;
97-
98-
/**
99-
* Adds the specified dictionary to the JSON Stream string.
100-
*
101-
* @param dictionary the dictionary object which is to be added to the JSON Stream queue string.
102-
*/
103-
- (void)appendDictionaryToJsonStream:(BITOrderedDictionary *)dictionary;
104-
105-
/**
106-
* A C function that serializes a given dictionary to JSON and appends it to a char string
107-
*
108-
* @param dictionary A dictionary which will be serialized to JSON and then appended to the string.
109-
* @param string The C string which the dictionary's JSON representation will be appended to.
110-
*/
111-
void bit_appendStringToSafeJsonStream(NSString *string, char *__nonnull*__nonnull jsonStream);
112-
11333
/**
11434
* Reset BITSafeJsonEventsString so we can start appending JSON dictionaries.
11535
*
116-
* @param string The string that will be reset.
36+
* @param item The telemetry object, which should be processed
11737
*/
118-
void bit_resetSafeJsonStream(char *__nonnull*__nonnull jsonStream);
119-
120-
/**
121-
* A method which indicates whether the telemetry pipeline is busy and no new data should be enqueued.
122-
* Currently, we drop telemetry data if this returns YES.
123-
* This depends on defaultMaxBatchCount and defaultBatchInterval.
124-
*
125-
* @return Returns yes if currently no new data should be enqueued on the channel.
126-
*/
127-
- (BOOL)isQueueBusy;
38+
- (void)enqueueTelemetryItem:(BITTelemetryData *)item;
12839

12940
@end
41+
13042
NS_ASSUME_NONNULL_END
13143

13244
#endif /* HOCKEYSDK_FEATURE_METRICS */

0 commit comments

Comments
 (0)