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

Commit

Permalink
Merge pull request #374 from bitstadium/release/4.1.3
Browse files Browse the repository at this point in the history
Release/4.1.3
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Dec 6, 2016
2 parents cac3df9 + 69e1374 commit 93551df
Show file tree
Hide file tree
Showing 16 changed files with 645 additions and 63 deletions.
36 changes: 20 additions & 16 deletions Classes/BITChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ - (void)persistDataItemQueue {
if (!BITSafeJsonEventsString || strlen(BITSafeJsonEventsString) == 0) {
return;
}

NSData *bundle = [NSData dataWithBytes:BITSafeJsonEventsString length:strlen(BITSafeJsonEventsString)];
[self.persistence persistBundle:bundle];

// Reset both, the async-signal-safe and item counter.
[self resetQueue];
}
Expand All @@ -103,7 +103,7 @@ - (void)enqueueTelemetryItem:(BITTelemetryData *)item {
__weak typeof(self) weakSelf = self;
dispatch_async(self.dataItemsOperations, ^{
typeof(self) strongSelf = weakSelf;

if (strongSelf.isQueueBusy) {
// Case 2: Channel is in blocked state: Trigger sender, start timer to check after again after a while and abort operation.
BITHockeyLogDebug(@"INFO: The channel is saturated. %@ was dropped.", item.debugDescription);
Expand All @@ -116,11 +116,11 @@ - (void)enqueueTelemetryItem:(BITTelemetryData *)item {
// Enqueue item
NSDictionary *dict = [self dictionaryForTelemetryData:item];
[strongSelf appendDictionaryToJsonStream:dict];

if (strongSelf->_dataItemCount >= self.maxBatchSize) {
// Case 3: Max batch count has been reached, so write queue to disk and delete all items.
[strongSelf persistDataItemQueue];

} else if (strongSelf->_dataItemCount == 1) {
// Case 4: It is the first item, let's start the timer.
if (![strongSelf timerIsRunning]) {
Expand All @@ -141,19 +141,19 @@ - (NSDictionary *)dictionaryForTelemetryData:(BITTelemetryData *) telemetryData

- (BITEnvelope *)envelopeForTelemetryData:(BITTelemetryData *)telemetryData {
telemetryData.version = @(BITSchemaVersion);

BITData *data = [BITData new];
data.baseData = telemetryData;
data.baseType = telemetryData.dataTypeName;

BITEnvelope *envelope = [BITEnvelope new];
envelope.time = bit_utcDateString([NSDate date]);
envelope.iKey = _telemetryContext.appIdentifier;

envelope.tags = _telemetryContext.contextDictionary;
envelope.data = data;
envelope.name = telemetryData.envelopeTypeName;

return envelope;
}

Expand All @@ -175,7 +175,7 @@ - (NSString *)serializeDictionaryToJSONString:(NSDictionary *)dictionary {
- (void)appendDictionaryToJsonStream:(NSDictionary *)dictionary {
if (dictionary) {
NSString *string = [self serializeDictionaryToJSONString:dictionary];

// Since we can't persist every event right away, we write it to a simple C string.
// This can then be written to disk by a signal handler in case of a crash.
bit_appendStringToSafeJsonStream(string, &(BITSafeJsonEventsString));
Expand All @@ -191,7 +191,7 @@ void bit_appendStringToSafeJsonStream(NSString *string, char **jsonString) {
if (*jsonString == NULL || strlen(*jsonString) == 0) {
bit_resetSafeJsonStream(jsonString);
}

if (string.length == 0) { return; }

char *new_string = NULL;
Expand Down Expand Up @@ -235,17 +235,21 @@ - (void)startTimer {

self.timerSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.dataItemsOperations);
dispatch_source_set_timer(self.timerSource, dispatch_walltime(NULL, NSEC_PER_SEC * self.batchInterval), 1ull * NSEC_PER_SEC, 1ull * NSEC_PER_SEC);

__weak typeof(self) weakSelf = self;
dispatch_source_set_event_handler(self.timerSource, ^{
typeof(self) strongSelf = weakSelf;

if (strongSelf->_dataItemCount > 0) {
[strongSelf persistDataItemQueue];
} else {
strongSelf.channelBlocked = NO;
if(strongSelf) {
if (strongSelf->_dataItemCount > 0) {
[strongSelf persistDataItemQueue];
} else {
strongSelf.channelBlocked = NO;
}
[strongSelf invalidateTimer];
}
[strongSelf invalidateTimer];
});

dispatch_resume(self.timerSource);
}

Expand Down
1 change: 0 additions & 1 deletion Classes/BITFeedbackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
*/
@property (nonatomic, readwrite) BITFeedbackObservationMode feedbackObservationMode;


/**
Prefill feedback compose message user interface with the items given.
Expand Down
29 changes: 23 additions & 6 deletions Classes/BITFeedbackManager.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2012-2016 HockeyApp, Bit Stadium GmbH.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -450,7 +450,7 @@ - (void)loadMessages {

if ([unarchiver containsValueForKey:kBITFeedbackUserDataAsked])
_didAskUserData = YES;

if ([unarchiver containsValueForKey:kBITFeedbackToken]) {
self.token = [unarchiver decodeObjectForKey:kBITFeedbackToken];
[self addStringValueToKeychain:self.token forKey:kBITFeedbackToken];
Expand All @@ -467,7 +467,11 @@ - (void)loadMessages {
self.token = nil;
}
}


if ([self shouldForceNewThread]) {
self.token = nil;
}

if ([unarchiver containsValueForKey:kBITFeedbackDateOfLastCheck])
self.lastCheck = [unarchiver decodeObjectForKey:kBITFeedbackDateOfLastCheck];

Expand Down Expand Up @@ -657,6 +661,15 @@ - (void)deleteAllMessages {
[self saveMessages];
}

- (BOOL)shouldForceNewThread {
if (self.delegate && [self.delegate respondsToSelector:@selector(forceNewFeedbackThreadForFeedbackManager:)]) {
return [self.delegate forceNewFeedbackThreadForFeedbackManager:self];
}
else {
return NO;
}
}


#pragma mark - User

Expand Down Expand Up @@ -729,9 +742,13 @@ - (void)updateMessageListFromResponse:(NSDictionary *)jsonDictionary {
NSString *token = [jsonDictionary objectForKey:@"token"];
NSDictionary *feedbackObject = [jsonDictionary objectForKey:@"feedback"];
if (feedback && token && feedbackObject) {
// update the thread token, which is not available until the 1st message was successfully sent
self.token = token;

if ([self shouldForceNewThread]) {
self.token = nil;
} else {
// update the thread token, which is not available until the 1st message was successfully sent
self.token = token;
}

self.lastCheck = [NSDate date];

// add all new messages
Expand Down
14 changes: 12 additions & 2 deletions Classes/BITFeedbackManagerDelegate.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Author: Stephan Diederich
* Authors: Stephan Diederich, Benjamin Scholtysik
*
* Copyright (c) 2013-2014 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2013-2016 HockeyApp, Bit Stadium GmbH.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -82,6 +82,16 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSArray *)preparedItemsForFeedbackManager:(BITFeedbackManager *)feedbackManager;

/**
* Indicates if a new thread should be created for each new feedback message
*
* Setting it to `YES` will force a new thread whenever a new message is sent as
* opposed to the default resume thread behaviour.
*
* @return A BOOL indicating if each feedback message should be sent as a new thread.
*/
- (BOOL)forceNewFeedbackThreadForFeedbackManager:(BITFeedbackManager *)feedbackManager;

@end

NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions HockeySDK-Source.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'HockeySDK-Source'
s.version = '4.1.2'
s.version = '4.1.3'

s.summary = 'Collect live crash reports, get feedback from your users, distribute your betas, and analyze your test coverage with HockeyApp.'
s.description = <<-DESC
Expand All @@ -25,7 +25,7 @@ Pod::Spec.new do |s|
s.frameworks = 'AssetsLibrary', 'CoreGraphics', 'CoreTelephony', 'CoreText', 'MobileCoreServices', 'Photos', 'QuartzCore', 'QuickLook', 'Security', 'SystemConfiguration', 'UIKit'
s.libraries = 'c++', 'z'
s.vendored_frameworks = 'Vendor/CrashReporter.framework'
s.pod_target_xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => %{$(inherited) BITHOCKEY_VERSION="@\\"#{s.version}\\"" BITHOCKEY_C_VERSION="\\"#{s.version}\\"" BITHOCKEY_BUILD="@\\"97\\"" BITHOCKEY_C_BUILD="\\"97\\""} }
s.pod_target_xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => %{$(inherited) BITHOCKEY_VERSION="@\\"#{s.version}\\"" BITHOCKEY_C_VERSION="\\"#{s.version}\\"" BITHOCKEY_BUILD="@\\"97\\"" BITHOCKEY_C_BUILD="\\"98\\""} }
s.resource_bundle = { 'HockeySDKResources' => ['Resources/*.png', 'Resources/*.lproj'] }
s.preserve_paths = 'Resources', 'Support'
s.private_header_files = 'Classes/*Private.h'
Expand Down
2 changes: 1 addition & 1 deletion HockeySDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'HockeySDK'
s.version = '4.1.2'
s.version = '4.1.3'

s.summary = 'Collect live crash reports, get feedback from your users, distribute your betas, and analyze your test coverage with HockeyApp.'
s.description = <<-DESC
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Version](http://cocoapod-badges.herokuapp.com/v/HockeySDK/badge.png)](http://cocoadocs.org/docsets/HockeySDK)

## Version 4.1.2
## Version 4.1.3

- [Changelog](http://www.hockeyapp.net/help/sdk/ios/4.1.2/docs/docs/Changelog.html)
- [Changelog](http://www.hockeyapp.net/help/sdk/ios/4.1.3/docs/docs/Changelog.html)

**NOTE** If your are using the binary integration of our SDK, make sure that the `HockeySDKResources.bundle` inside the `HockeySDK.embeddedframework`-folder has been added to your application.

### Feedback and iOS 10
**4.1.1 of the HockeySDK removes the Feedback feature from the default version of the SDK.**
**4.1.1 and later of the HockeySDK remove the Feedback feature from the default version of the SDK.**
The reason for this is that iOS 10 requires developers to add a usage string to their Info.plist in case they include the photos framework in their app. If this string is missing, the app will be rejected when submitting the app to the app store. As HockeyApp's Feedback feature includes a dependency to the photos framework. This means that if you include HockeyApp into your app, adding the usage string would be a requirement even for developers who don't use the Feedback feature. If you don't use Feedback in your app, simply upgrade HockeySDK to version 4.1.1 or newer. If you are using Feedback, please have a look at the [Feedback section](#feedback).


Expand Down Expand Up @@ -63,6 +63,7 @@ This document contains the following sections:

1. We assume that you already have a project in Xcode and that this project is opened in Xcode 7 or later.
2. The SDK supports iOS 6.0 and later.
3. Xcode 8

<a id="setup"></a>
## 2. Setup
Expand Down Expand Up @@ -567,7 +568,7 @@ You should never create your own instance of `BITFeedbackManager` but use the on
[BITHockeyManager sharedHockeyManager].feedbackManager
```

Please check the [documentation](#documentation) of the `BITFeedbackManager` class on more information on how to leverage this feature.
Please check the [documentation](#documentation) of the `BITFeedbackManager` and `BITFeedbackManagerDelegate` classes on more information on how to leverage this feature.

#### 3.8.2 Add the NSPhotoLibraryUsageDescription to your Info.plist.

Expand Down Expand Up @@ -634,7 +635,7 @@ To check if data is send properly to HockeyApp and also see some additional SDK
<a id="documentation"></a>
## 4. Documentation

Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/ios/4.1.2/index.html).
Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/ios/4.1.3/index.html).

<a id="troubleshooting"></a>
## 5.Troubleshooting
Expand All @@ -648,7 +649,7 @@ Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/ios/
Make sure none of the following files are copied into your app bundle, check under app target, `Build Phases`, `Copy Bundle Resources` or in the `.app` bundle after building:

- `HockeySDK.framework` (except if you build a dynamic framework version of the SDK yourself!)
- `de.bitstadium.HockeySDK-iOS-4.1.2.docset`
- `de.bitstadium.HockeySDK-iOS-4.1.3.docset`

### Feature are not working as expected

Expand Down
Loading

0 comments on commit 93551df

Please sign in to comment.