Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	Classes/Telemetry/BITPersistence.m
#	HockeySDK-Mac.podspec
#	README.md
#	Support/HockeySDK.xcodeproj/project.pbxproj
#	Support/buildnumber.xcconfig
#	docs/Changelog-template.md
#	docs/Guide-Installation-Setup-template.md
  • Loading branch information
lumaxis committed May 25, 2016
2 parents 8aace86 + f12a02d commit 4adf3b7
Show file tree
Hide file tree
Showing 26 changed files with 1,037 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Classes/Telemetry/BITPersistence.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ - (void)createDirectoryStructureIfNeeded {

// Create telemetry subfolder

//NOTE: createDirectoryAtURL:withIntermediateDirectories:attributes:error
//will return YES if the directory already exists and won't override anything.
//No need to check if the directory already exists.
// NOTE: createDirectoryAtURL:withIntermediateDirectories:attributes:error
// will return YES if the directory already exists and won't override anything.
// No need to check if the directory already exists.
NSURL *telemetryURL = [appURL URLByAppendingPathComponent:kBITTelemetryDirectory];
if (![fileManager createDirectoryAtURL:telemetryURL withIntermediateDirectories:YES attributes:nil error:&error]) {
BITHockeyLogError(@"%@", error.localizedDescription);
Expand Down Expand Up @@ -290,14 +290,24 @@ - (void)sendBundleSavedNotification {

- (NSString *)appHockeySDKDirectoryPath {
if (!_appHockeySDKDirectoryPath) {

// Assemble the directory path we use to store our telemetry data in.
// We use the current app's bundle identifier for the name of the subfolder within Application Support
// as this is one of the few directories a sandboxed app can write to (Compare
// https://developer.apple.com/library/mac/documentation/General/Conceptual/MOSXAppProgrammingGuide/AppRuntime/AppRuntime.html#//apple_ref/doc/uid/TP40010543-CH2-SW9 )
// and then create our own subfolder within that.
NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] stringByStandardizingPath];
NSString *bundleID = bit_mainBundleIdentifier();
NSString *bundleID = [self bundleIdentifier];

if (appSupportPath && bundleID) {
NSString *hockeySDKPath = [appSupportPath stringByAppendingPathComponent:kBITHockeyDirectory];
_appHockeySDKDirectoryPath = [hockeySDKPath stringByAppendingPathComponent:bundleID];
_appHockeySDKDirectoryPath = [[appSupportPath stringByAppendingPathComponent:bundleID] stringByAppendingPathComponent:kBITHockeyDirectory];
}
}
return _appHockeySDKDirectoryPath;
}

- (NSString *)bundleIdentifier {
return bit_mainBundleIdentifier();
}

@end
2 changes: 2 additions & 0 deletions Classes/Telemetry/BITPersistencePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ FOUNDATION_EXPORT NSString *const BITPersistenceSuccessNotification;
*/
- (NSString *)fileURLForType:(BITPersistenceType)type;

- (NSString *)appHockeySDKDirectoryPath;

@end

NS_ASSUME_NONNULL_END
45 changes: 45 additions & 0 deletions Support/BITPersistenceTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// BITPersistenceTests.m
// HockeySDK
//
// Created by Patrick Dinger on 24/05/16.
//
//

#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "BITPersistence.h"
#import "BITPersistencePrivate.h"

@interface BITPersistenceTests : XCTestCase

@end

@implementation BITPersistenceTests {
BITPersistence *_subject;
}

- (void)setUp {
[super setUp];
_subject = [BITPersistence alloc];
id mock = OCMPartialMock(_subject);

OCMStub([mock bundleIdentifier]).andReturn(@"com.testapp");

_subject = [_subject init];
}

- (void)tearDown {
[super tearDown];
}

- (void)testAppHockeySDKDirectoryPath {
NSString *path = [_subject appHockeySDKDirectoryPath];

NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] stringByStandardizingPath];
NSString *validPath = [NSString stringWithFormat:@"%@/%@", appSupportPath, @"com.testapp/com.microsoft.HockeyApp"];

XCTAssertEqualObjects(path, validPath);
}

@end
154 changes: 154 additions & 0 deletions Support/HockeySDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@
6EECFA701CA49ED60090AD57 /* BITChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EECFA6D1CA49ED60090AD57 /* BITChannel.h */; };
6EECFA711CA49ED60090AD57 /* BITChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EECFA6E1CA49ED60090AD57 /* BITChannel.m */; };
6EECFA721CA49ED60090AD57 /* BITChannelPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EECFA6F1CA49ED60090AD57 /* BITChannelPrivate.h */; };
6F53E30A1CF509AE00DC1C64 /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EF09D8C1523574200067A5C /* HockeySDK.framework */; };
6F53E3111CF509E000DC1C64 /* BITPersistenceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */; };
6F53E3151CF50DD800DC1C64 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F53E3141CF50DD800DC1C64 /* OCMock.framework */; };
6F53E3171CF50DFF00DC1C64 /* OCMock.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 6F53E3141CF50DD800DC1C64 /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
80EF93A31CD9334B006722E1 /* BITHockeyLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 80EF93A01CD9334B006722E1 /* BITHockeyLogger.h */; };
80EF93A41CD9334B006722E1 /* BITHockeyLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 80EF93A11CD9334B006722E1 /* BITHockeyLogger.m */; };
80EF93A51CD9334B006722E1 /* BITHockeyLoggerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 80EF93A21CD9334B006722E1 /* BITHockeyLoggerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand All @@ -184,6 +188,13 @@
remoteGlobalIDString = 1E7FB95C17D3F36B00B7E10D;
remoteInfo = "HockeySDK Documentation";
};
6F53E30B1CF509AE00DC1C64 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1EF09D821523574200067A5C /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1EF09D8B1523574200067A5C;
remoteInfo = HockeySDK;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -196,6 +207,17 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6F53E3161CF50DF800DC1C64 /* Copy Files */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
6F53E3171CF50DFF00DC1C64 /* OCMock.framework in Copy Files */,
);
name = "Copy Files";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -363,6 +385,10 @@
6EECFA6D1CA49ED60090AD57 /* BITChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITChannel.h; sourceTree = "<group>"; };
6EECFA6E1CA49ED60090AD57 /* BITChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITChannel.m; sourceTree = "<group>"; };
6EECFA6F1CA49ED60090AD57 /* BITChannelPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITChannelPrivate.h; sourceTree = "<group>"; };
6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6F53E3091CF509AE00DC1C64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BITPersistenceTests.m; path = ../BITPersistenceTests.m; sourceTree = "<group>"; };
6F53E3141CF50DD800DC1C64 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMock.framework; sourceTree = "<group>"; };
80EF93A01CD9334B006722E1 /* BITHockeyLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyLogger.h; sourceTree = "<group>"; };
80EF93A11CD9334B006722E1 /* BITHockeyLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITHockeyLogger.m; sourceTree = "<group>"; };
80EF93A21CD9334B006722E1 /* BITHockeyLoggerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyLoggerPrivate.h; sourceTree = "<group>"; };
Expand All @@ -384,6 +410,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6F53E3021CF509AE00DC1C64 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6F53E3151CF50DD800DC1C64 /* OCMock.framework in Frameworks */,
6F53E30A1CF509AE00DC1C64 /* HockeySDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand Down Expand Up @@ -576,6 +611,7 @@
1E7FB96117D3F44100B7E10D /* Support */,
1EF09DBF152357A500067A5C /* Vendor */,
1E260C7717D401D000C7F9FE /* docs */,
6F53E3061CF509AE00DC1C64 /* HockeySDKTests */,
1EF09D8E1523574200067A5C /* Frameworks */,
1EF09D8D1523574200067A5C /* Products */,
);
Expand All @@ -585,13 +621,15 @@
isa = PBXGroup;
children = (
1EF09D8C1523574200067A5C /* HockeySDK.framework */,
6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
1EF09D8E1523574200067A5C /* Frameworks */ = {
isa = PBXGroup;
children = (
6F53E3141CF50DD800DC1C64 /* OCMock.framework */,
1EB194CA1BA70BDE00793007 /* libz.tbd */,
1E378AF8195899B400451E28 /* Quartz.framework */,
1E378AF6195899A400451E28 /* QuartzCore.framework */,
Expand Down Expand Up @@ -687,6 +725,15 @@
name = BetaDistribution;
sourceTree = "<group>";
};
6F53E3061CF509AE00DC1C64 /* HockeySDKTests */ = {
isa = PBXGroup;
children = (
6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */,
6F53E3091CF509AE00DC1C64 /* Info.plist */,
);
path = HockeySDKTests;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -804,13 +851,37 @@
productReference = 1EF09D8C1523574200067A5C /* HockeySDK.framework */;
productType = "com.apple.product-type.framework";
};
6F53E3041CF509AE00DC1C64 /* HockeySDKTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6F53E30D1CF509AE00DC1C64 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */;
buildPhases = (
6F53E3011CF509AE00DC1C64 /* Sources */,
6F53E3021CF509AE00DC1C64 /* Frameworks */,
6F53E3031CF509AE00DC1C64 /* Resources */,
6F53E3161CF50DF800DC1C64 /* Copy Files */,
);
buildRules = (
);
dependencies = (
6F53E30C1CF509AE00DC1C64 /* PBXTargetDependency */,
);
name = HockeySDKTests;
productName = HockeySDKTests;
productReference = 6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
1EF09D821523574200067A5C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
TargetAttributes = {
6F53E3041CF509AE00DC1C64 = {
CreatedOnToolsVersion = 7.3.1;
};
};
};
buildConfigurationList = 1EF09D851523574200067A5C /* Build configuration list for PBXProject "HockeySDK" */;
compatibilityVersion = "Xcode 3.2";
Expand All @@ -834,6 +905,7 @@
1EF09D8B1523574200067A5C /* HockeySDK */,
1E7FB95C17D3F36B00B7E10D /* HockeySDK Documentation */,
1E3B4F6B1996796B00203B89 /* HockeySDK Distribution */,
6F53E3041CF509AE00DC1C64 /* HockeySDKTests */,
);
};
/* End PBXProject section */
Expand All @@ -849,6 +921,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6F53E3031CF509AE00DC1C64 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -934,6 +1013,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6F53E3011CF509AE00DC1C64 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6F53E3111CF509E000DC1C64 /* BITPersistenceTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
Expand All @@ -942,6 +1029,11 @@
target = 1E7FB95C17D3F36B00B7E10D /* HockeySDK Documentation */;
targetProxy = 1E3B4F6F1996797200203B89 /* PBXContainerItemProxy */;
};
6F53E30C1CF509AE00DC1C64 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1EF09D8B1523574200067A5C /* HockeySDK */;
targetProxy = 6F53E30B1CF509AE00DC1C64 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -1121,6 +1213,59 @@
};
name = Release;
};
6F53E30E1CF509AE00DC1C64 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = HockeySDKTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = net.hockeyapp.sdk.mac.HockeySDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
6F53E30F1CF509AE00DC1C64 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
ENABLE_NS_ASSERTIONS = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = HockeySDKTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = net.hockeyapp.sdk.mac.HockeySDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -1160,6 +1305,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6F53E30D1CF509AE00DC1C64 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6F53E30E1CF509AE00DC1C64 /* Debug */,
6F53E30F1CF509AE00DC1C64 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1EF09D821523574200067A5C /* Project object */;
Expand Down
24 changes: 24 additions & 0 deletions Support/HockeySDKTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions Support/OCMock.framework/Headers
1 change: 1 addition & 0 deletions Support/OCMock.framework/Modules
Loading

0 comments on commit 4adf3b7

Please sign in to comment.