Skip to content

Commit

Permalink
Update to v4.3.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
joeljfischer committed Aug 18, 2016
1 parent 054b478 commit f026b1e
Show file tree
Hide file tree
Showing 18 changed files with 239 additions and 71 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 4.3.0 Beta 2 Release Notes (Since Beta 1)
### Enhancements
* Starting up `SDLManager` now requires a block which will pass back an error if it failed.
* `SDLManager` now provides a method to call in `AppDelegate applicationWillTerminate:` that will prevent killed apps from being unable to re-register.

### Bug Fixes
* Fixed a memory leak caused by the strong / weak block dance.

### Other
* Currently removed automatic resumption. Resumption will return in a future build as a manual configuration pass in.

# 4.3.0 Beta 1 Release Notes (Since Alpha 1)
### Breaking Changes
* State machine transition names are no longer public to allow for behind the scenes changes without minor or major version changes.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ See the [roadmap](https://github.com/smartdevicelink/sdl_ios/wiki/Roadmap) to se

You can install this library using [Cocoapods](https://cocoapods.org/pods/SmartDeviceLink-iOS). You can get started with Cocoapods by [following their install guide](https://guides.cocoapods.org/using/getting-started.html#getting-started), and learn how to use Cocoapods to install dependencies [by following this guide](https://guides.cocoapods.org/using/using-cocoapods.html).

In your podfile, you want to add `pod 'SmartDeviceLink-iOS', '~> 4.3.0-alpha.1'`. Then run `pod install` inside your terminal. With Cocoapods, we support iOS 6.0+.
In your podfile, you want to add `pod 'SmartDeviceLink-iOS', '~> 4.3.0-beta.2'`. Then run `pod install` inside your terminal. With Cocoapods, we support iOS 6.0+.

##### Carthage

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SmartDeviceLink-iOS"
s.version = "4.3.0-beta.1"
s.version = "4.3.0-beta.2"
s.summary = "Connect your app with cars!"
s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS"
s.license = { :type => "New BSD", :file => "LICENSE" }
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.3.0-beta.1</string>
<string>4.3.0-beta.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
8 changes: 4 additions & 4 deletions SmartDeviceLink/SDLError.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ + (NSError *)sdl_lifecycle_managersFailedToStart {

+ (NSError *)sdl_lifecycle_startedWithBadResult:(SDLResult *)result {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey : NSLocalizedString(result.value, nil)
};
NSLocalizedDescriptionKey : NSLocalizedString(result.value, nil)
};
return [NSError errorWithDomain:SDLErrorDomainLifecycleManager
code:SDLManagerErrorRegistrationFailed
userInfo:userInfo];
}

+ (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult *)result {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey : NSLocalizedString(result.value, nil)
};
NSLocalizedDescriptionKey : NSLocalizedString(result.value, nil)
};
return [NSError errorWithDomain:SDLErrorDomainLifecycleManager
code:SDLManagerErrorRegistrationFailed
userInfo:userInfo];
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLLifecycleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

NS_ASSUME_NONNULL_BEGIN

typedef void(^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);


@interface SDLLifecycleManager : NSObject
Expand Down
10 changes: 5 additions & 5 deletions SmartDeviceLink/SDLLifecycleManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (instancetype)initWithConfiguration:(SDLConfiguration *)configuration delegate

- (void)startWithHandler:(SDLManagerReadyBlock)readyBlock {
self.readyBlock = [readyBlock copy];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[SDLProxy enableSiphonDebug];
Expand Down Expand Up @@ -270,20 +270,20 @@ - (void)didEnterStatePostManagerProcessing {

- (void)didEnterStateReady {
[self.notificationDispatcher postNotificationName:SDLDidBecomeReady infoObject:nil];

SDLResult *registerResult = self.registerAppInterfaceResponse.resultCode;

BOOL success = NO;
NSError *startError = nil;

if (![registerResult isEqualToEnum:[SDLResult SUCCESS]]) {
// We did not succeed in registering
startError = [NSError sdl_lifecycle_failedWithBadResult:registerResult];
} else {
// We succeeded in registering
success = YES;
}

// Notify the block and delegate if it exists
self.readyBlock(success, startError);
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(managerDidBecomeReady)]) {
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

NS_ASSUME_NONNULL_BEGIN

typedef void(^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);


@interface SDLManager : NSObject
Expand Down
4 changes: 2 additions & 2 deletions SmartDeviceLink/SDLProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
typedef void (^URLSessionTaskCompletionHandler)(NSData *data, NSURLResponse *response, NSError *error);
typedef void (^URLSessionDownloadTaskCompletionHandler)(NSURL *location, NSURLResponse *response, NSError *error);

NSString *const SDLProxyVersion = @"4.3.0-beta.1";
NSString *const SDLProxyVersion = @"4.3.0-beta.2";
const float startSessionTime = 10.0;
const float notifyProxyClosedDelay = 0.1;
const int POLICIES_CORRELATION_ID = 65535;
Expand Down Expand Up @@ -189,7 +189,7 @@ - (SDLStreamingMediaManager *)streamingMediaManager {
[self.protocol.protocolDelegateTable addObject:_streamingMediaManager];
[self.mutableProxyListeners addObject:_streamingMediaManager.touchManager];
}

return _streamingMediaManager;
}

Expand Down
77 changes: 39 additions & 38 deletions SmartDeviceLink/SDLUploadFileOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,45 +89,46 @@ - (void)sdl_sendPutFiles:(NSArray<SDLPutFile *> *)putFiles withCompletion:(SDLFi
for (SDLPutFile *putFile in putFiles) {
dispatch_group_enter(putFileGroup);
__weak typeof(self) weakself = self;
[self.connectionManager sendManagerRequest:putFile withCompletionHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
typeof(weakself) strongself = weakself;
// If we've already encountered an error, then just abort
// TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was?
if (strongself.isCancelled) {
stop = YES;
}

if (stop) {
dispatch_group_leave(putFileGroup);
BLOCK_RETURN;
}

// If we encounted an error, abort in the future and call the completion handler
if (error != nil || response == nil || ![response.success boolValue]) {
stop = YES;
streamError = error;

if (completion != nil) {
completion(NO, 0, error);
}

dispatch_group_leave(putFileGroup);
BLOCK_RETURN;
}

// If we haven't encounted an error
SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response;

// We need to do this to make sure our bytesAvailable is accurate
if ([request.correlationID integerValue] > highestCorrelationIDReceived) {
highestCorrelationIDReceived = [request.correlationID integerValue];
bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue];
}

dispatch_group_leave(putFileGroup);
}];
[self.connectionManager sendManagerRequest:putFile
withCompletionHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) {
typeof(weakself) strongself = weakself;
// If we've already encountered an error, then just abort
// TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was?
if (strongself.isCancelled) {
stop = YES;
}

if (stop) {
dispatch_group_leave(putFileGroup);
BLOCK_RETURN;
}

// If we encounted an error, abort in the future and call the completion handler
if (error != nil || response == nil || ![response.success boolValue]) {
stop = YES;
streamError = error;

if (completion != nil) {
completion(NO, 0, error);
}

dispatch_group_leave(putFileGroup);
BLOCK_RETURN;
}

// If we haven't encounted an error
SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response;

// We need to do this to make sure our bytesAvailable is accurate
if ([request.correlationID integerValue] > highestCorrelationIDReceived) {
highestCorrelationIDReceived = [request.correlationID integerValue];
bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue];
}

dispatch_group_leave(putFileGroup);
}];
}

dispatch_group_leave(putFileGroup);
}

Expand Down
29 changes: 24 additions & 5 deletions docs/Classes/SDLManager.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ <h3>Section Contents</h3>
<li><a href="#section-delegate">delegate</a></li>
<li><a href="#section-registerResponse">registerResponse</a></li>
<li><a href="#section--initWithConfiguration:delegate:">-initWithConfiguration:delegate:</a></li>
<li><a href="#section--start">-start</a></li>
<li><a href="#section--startWithHandler:">-startWithHandler:</a></li>
<li><a href="#section--stop">-stop</a></li>
<li><a href="#section--applicationWillTerminate">-applicationWillTerminate</a></li>
<li><a href="#section--sendRequest:">-sendRequest:</a></li>
<li><a href="#section--sendRequest:withCompletionHandler:">-sendRequest:withCompletionHandler:</a></li>
</ul>
Expand Down Expand Up @@ -196,20 +197,20 @@ <h4>Return Value</h4>

</div>

<h3 id="section--start">
-start
<h3 id="section--startWithHandler:">
-startWithHandler:
</h3>

<p>Start the manager, which will tell it to start looking for a connection.</p>



<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">start</span><span class="p">;</span></code></pre>
<pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">startWithHandler</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type Definitions.html#/c:SDLManager.h@T@SDLManagerReadyBlock">SDLManagerReadyBlock</a></span><span class="p">)</span><span class="nv">readyBlock</span><span class="p">;</span></code></pre>


<h4>Swift</h4>
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">start</span><span class="p">()</span></code></pre>
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">startWithHandler</span><span class="p">(</span><span class="nv">readyBlock</span><span class="p">:</span> <span class="kt"><a href="../Type Definitions.html#/c:SDLManager.h@T@SDLManagerReadyBlock">SDLManagerReadyBlock</a></span><span class="p">)</span></code></pre>



Expand All @@ -232,6 +233,24 @@ <h4>Swift</h4>



<h3 id="section--applicationWillTerminate">
-applicationWillTerminate
</h3>

<p>Call this method within your AppDelegate&rsquo;s <code>applicationWillTerminate</code> method to properly shut down SDL. If you do not, you will not be able to reregister with the remote device.</p>



<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">applicationWillTerminate</span><span class="p">;</span></code></pre>


<h4>Swift</h4>
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">applicationWillTerminate</span><span class="p">()</span></code></pre>




<h3 id="section--sendRequest:">
-sendRequest:
</h3>
Expand Down
Loading

0 comments on commit f026b1e

Please sign in to comment.