Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/external_security_support
# Conflicts: # SmartDeviceLink/SDLProxy.m # SmartDeviceLink/SDLStreamingMediaManager.h # SmartDeviceLink/SDLStreamingMediaManager.m
- Loading branch information
Showing
21 changed files
with
2,100 additions
and
20 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// CGPoint_Util.h | ||
// SmartDeviceLink-iOS | ||
// | ||
// Created by Muller, Alexander (A.) on 6/14/16. | ||
// Copyright © 2016 smartdevicelink. All rights reserved. | ||
// | ||
|
||
#ifndef CGPoint_Util_h | ||
#define CGPoint_Util_h | ||
|
||
#include <stdio.h> | ||
#include <CoreGraphics/CGGeometry.h> | ||
|
||
/** | ||
* @abstract | ||
* Calculate the center of two points. | ||
* @param point1 | ||
* First point. | ||
* @param point2 | ||
* Second point. | ||
* @return CGPoint | ||
* Center of the points. | ||
*/ | ||
CGPoint CGPointCenterOfPoints(CGPoint point1, CGPoint point2); | ||
|
||
/** | ||
* @abstract | ||
* Calculate the distance between two points. | ||
* @param point1 | ||
* First point. | ||
* @param point2 | ||
* Second point. | ||
* @return CGFloat | ||
* Distance between the points. | ||
*/ | ||
CGFloat CGPointDistanceBetweenPoints(CGPoint point1, CGPoint point2); | ||
|
||
#endif /* CGPoint_Util_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// CGPoint_Util.c | ||
// SmartDeviceLink-iOS | ||
// | ||
// Created by Muller, Alexander (A.) on 6/14/16. | ||
// Copyright © 2016 smartdevicelink. All rights reserved. | ||
// | ||
|
||
#include "CGPoint_Util.h" | ||
#include "math.h" | ||
|
||
CGPoint CGPointCenterOfPoints(CGPoint point1, CGPoint point2) { | ||
CGFloat xCenter = (point1.x + point2.x) / 2.0f; | ||
CGFloat yCenter = (point1.y + point2.y) / 2.0f; | ||
return CGPointMake(xCenter, yCenter); | ||
} | ||
|
||
CGFloat CGPointDistanceBetweenPoints(CGPoint point1, CGPoint point2) { | ||
return hypotf(point1.x - point2.x, point1.y - point2.y); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// SDLPinchGesture.h | ||
// SmartDeviceLink-iOS | ||
// | ||
// Created by Muller, Alexander (A.) on 6/14/16. | ||
// Copyright © 2016 smartdevicelink. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import "SDLTouch.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SDLPinchGesture : NSObject | ||
|
||
/** | ||
* @abstract | ||
* Initializes a pinch gesture. | ||
* @param firstTouch | ||
* First touch of the gesture | ||
* @param secondTouch | ||
* Second touch of the gesture | ||
* @return SDLPinchGesture | ||
* Instance of SDLPinchGesture. | ||
*/ | ||
- (instancetype)initWithFirstTouch:(SDLTouch*)firstTouch secondTouch:(SDLTouch*)secondTouch; | ||
|
||
/** | ||
* @abstract | ||
* First touch of a pinch gesture. | ||
*/ | ||
@property (nonatomic, strong) SDLTouch* firstTouch; | ||
|
||
/** | ||
* @abstract | ||
* Second touch of a pinch gesture. | ||
*/ | ||
@property (nonatomic, strong) SDLTouch* secondTouch; | ||
|
||
/** | ||
* @abstract | ||
* Distance between first and second touches. | ||
*/ | ||
@property (nonatomic, assign, readonly) CGFloat distance; | ||
|
||
/** | ||
* @abstract | ||
* Center point between first and second touches. | ||
*/ | ||
@property (nonatomic, assign, readonly) CGPoint center; | ||
|
||
/** | ||
* @abstract | ||
* Returns whether or not the pinch gesture is valid. This is true if both touches | ||
* are non null. | ||
*/ | ||
@property (nonatomic, assign, readonly) BOOL isValid; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// SDLPinchGesture.m | ||
// SmartDeviceLink-iOS | ||
// | ||
// Created by Muller, Alexander (A.) on 6/14/16. | ||
// Copyright © 2016 smartdevicelink. All rights reserved. | ||
// | ||
|
||
#import "SDLPinchGesture.h" | ||
|
||
#import "SDLTouch.h" | ||
#import "CGPoint_Util.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@implementation SDLPinchGesture | ||
|
||
@synthesize distance = _distance; | ||
@synthesize center = _center; | ||
|
||
- (instancetype)initWithFirstTouch:(SDLTouch*)firstTouch secondTouch:(SDLTouch*)secondTouch { | ||
self = [super init]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_firstTouch = firstTouch; | ||
_secondTouch = secondTouch; | ||
_distance = -1; | ||
_center = CGPointZero; | ||
|
||
return self; | ||
} | ||
|
||
#pragma mark - Setters | ||
- (void)setFirstTouch:(SDLTouch *)firstTouch { | ||
if (firstTouch.identifier == SDLTouchIdentifierFirstFinger) { | ||
_firstTouch = firstTouch; | ||
[self sdl_invalidate]; | ||
} | ||
} | ||
|
||
- (void)setSecondTouch:(SDLTouch *)secondTouch { | ||
if (secondTouch.identifier == SDLTouchIdentifierSecondFinger) { | ||
_secondTouch = secondTouch; | ||
[self sdl_invalidate]; | ||
} | ||
} | ||
|
||
#pragma mark - Getters | ||
- (CGFloat)distance { | ||
if (_distance == -1) { | ||
_distance = CGPointDistanceBetweenPoints(self.firstTouch.location, | ||
self.secondTouch.location); | ||
} | ||
return _distance; | ||
} | ||
|
||
- (CGPoint)center { | ||
if (CGPointEqualToPoint(_center, CGPointZero)) { | ||
_center = CGPointCenterOfPoints(self.firstTouch.location, | ||
self.secondTouch.location); | ||
} | ||
return _center; | ||
} | ||
|
||
- (BOOL)isValid { | ||
return (self.firstTouch != nil) && (self.secondTouch != nil); | ||
} | ||
|
||
#pragma mark - Private | ||
- (void)sdl_invalidate { | ||
_distance = -1; | ||
_center = CGPointZero; | ||
} | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.