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

Commit 4adf3b7

Browse files
committed
Merge branch 'master' into develop
# 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
2 parents 8aace86 + f12a02d commit 4adf3b7

26 files changed

+1037
-6
lines changed

Classes/Telemetry/BITPersistence.m

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ - (void)createDirectoryStructureIfNeeded {
209209

210210
// Create telemetry subfolder
211211

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

291291
- (NSString *)appHockeySDKDirectoryPath {
292292
if (!_appHockeySDKDirectoryPath) {
293+
294+
// Assemble the directory path we use to store our telemetry data in.
295+
// We use the current app's bundle identifier for the name of the subfolder within Application Support
296+
// as this is one of the few directories a sandboxed app can write to (Compare
297+
// https://developer.apple.com/library/mac/documentation/General/Conceptual/MOSXAppProgrammingGuide/AppRuntime/AppRuntime.html#//apple_ref/doc/uid/TP40010543-CH2-SW9 )
298+
// and then create our own subfolder within that.
293299
NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] stringByStandardizingPath];
294-
NSString *bundleID = bit_mainBundleIdentifier();
300+
NSString *bundleID = [self bundleIdentifier];
301+
295302
if (appSupportPath && bundleID) {
296-
NSString *hockeySDKPath = [appSupportPath stringByAppendingPathComponent:kBITHockeyDirectory];
297-
_appHockeySDKDirectoryPath = [hockeySDKPath stringByAppendingPathComponent:bundleID];
303+
_appHockeySDKDirectoryPath = [[appSupportPath stringByAppendingPathComponent:bundleID] stringByAppendingPathComponent:kBITHockeyDirectory];
298304
}
299305
}
300306
return _appHockeySDKDirectoryPath;
301307
}
302308

309+
- (NSString *)bundleIdentifier {
310+
return bit_mainBundleIdentifier();
311+
}
312+
303313
@end

Classes/Telemetry/BITPersistencePrivate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ FOUNDATION_EXPORT NSString *const BITPersistenceSuccessNotification;
130130
*/
131131
- (NSString *)fileURLForType:(BITPersistenceType)type;
132132

133+
- (NSString *)appHockeySDKDirectoryPath;
134+
133135
@end
134136

135137
NS_ASSUME_NONNULL_END

Support/BITPersistenceTests.m

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// BITPersistenceTests.m
3+
// HockeySDK
4+
//
5+
// Created by Patrick Dinger on 24/05/16.
6+
//
7+
//
8+
9+
#import <XCTest/XCTest.h>
10+
#import <OCMock/OCMock.h>
11+
#import "BITPersistence.h"
12+
#import "BITPersistencePrivate.h"
13+
14+
@interface BITPersistenceTests : XCTestCase
15+
16+
@end
17+
18+
@implementation BITPersistenceTests {
19+
BITPersistence *_subject;
20+
}
21+
22+
- (void)setUp {
23+
[super setUp];
24+
_subject = [BITPersistence alloc];
25+
id mock = OCMPartialMock(_subject);
26+
27+
OCMStub([mock bundleIdentifier]).andReturn(@"com.testapp");
28+
29+
_subject = [_subject init];
30+
}
31+
32+
- (void)tearDown {
33+
[super tearDown];
34+
}
35+
36+
- (void)testAppHockeySDKDirectoryPath {
37+
NSString *path = [_subject appHockeySDKDirectoryPath];
38+
39+
NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] stringByStandardizingPath];
40+
NSString *validPath = [NSString stringWithFormat:@"%@/%@", appSupportPath, @"com.testapp/com.microsoft.HockeyApp"];
41+
42+
XCTAssertEqualObjects(path, validPath);
43+
}
44+
45+
@end

Support/HockeySDK.xcodeproj/project.pbxproj

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@
170170
6EECFA701CA49ED60090AD57 /* BITChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EECFA6D1CA49ED60090AD57 /* BITChannel.h */; };
171171
6EECFA711CA49ED60090AD57 /* BITChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EECFA6E1CA49ED60090AD57 /* BITChannel.m */; };
172172
6EECFA721CA49ED60090AD57 /* BITChannelPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EECFA6F1CA49ED60090AD57 /* BITChannelPrivate.h */; };
173+
6F53E30A1CF509AE00DC1C64 /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EF09D8C1523574200067A5C /* HockeySDK.framework */; };
174+
6F53E3111CF509E000DC1C64 /* BITPersistenceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */; };
175+
6F53E3151CF50DD800DC1C64 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F53E3141CF50DD800DC1C64 /* OCMock.framework */; };
176+
6F53E3171CF50DFF00DC1C64 /* OCMock.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 6F53E3141CF50DD800DC1C64 /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
173177
80EF93A31CD9334B006722E1 /* BITHockeyLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 80EF93A01CD9334B006722E1 /* BITHockeyLogger.h */; };
174178
80EF93A41CD9334B006722E1 /* BITHockeyLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 80EF93A11CD9334B006722E1 /* BITHockeyLogger.m */; };
175179
80EF93A51CD9334B006722E1 /* BITHockeyLoggerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 80EF93A21CD9334B006722E1 /* BITHockeyLoggerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -184,6 +188,13 @@
184188
remoteGlobalIDString = 1E7FB95C17D3F36B00B7E10D;
185189
remoteInfo = "HockeySDK Documentation";
186190
};
191+
6F53E30B1CF509AE00DC1C64 /* PBXContainerItemProxy */ = {
192+
isa = PBXContainerItemProxy;
193+
containerPortal = 1EF09D821523574200067A5C /* Project object */;
194+
proxyType = 1;
195+
remoteGlobalIDString = 1EF09D8B1523574200067A5C;
196+
remoteInfo = HockeySDK;
197+
};
187198
/* End PBXContainerItemProxy section */
188199

189200
/* Begin PBXCopyFilesBuildPhase section */
@@ -196,6 +207,17 @@
196207
);
197208
runOnlyForDeploymentPostprocessing = 0;
198209
};
210+
6F53E3161CF50DF800DC1C64 /* Copy Files */ = {
211+
isa = PBXCopyFilesBuildPhase;
212+
buildActionMask = 2147483647;
213+
dstPath = "";
214+
dstSubfolderSpec = 10;
215+
files = (
216+
6F53E3171CF50DFF00DC1C64 /* OCMock.framework in Copy Files */,
217+
);
218+
name = "Copy Files";
219+
runOnlyForDeploymentPostprocessing = 0;
220+
};
199221
/* End PBXCopyFilesBuildPhase section */
200222

201223
/* Begin PBXFileReference section */
@@ -363,6 +385,10 @@
363385
6EECFA6D1CA49ED60090AD57 /* BITChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITChannel.h; sourceTree = "<group>"; };
364386
6EECFA6E1CA49ED60090AD57 /* BITChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITChannel.m; sourceTree = "<group>"; };
365387
6EECFA6F1CA49ED60090AD57 /* BITChannelPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITChannelPrivate.h; sourceTree = "<group>"; };
388+
6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
389+
6F53E3091CF509AE00DC1C64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
390+
6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BITPersistenceTests.m; path = ../BITPersistenceTests.m; sourceTree = "<group>"; };
391+
6F53E3141CF50DD800DC1C64 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCMock.framework; sourceTree = "<group>"; };
366392
80EF93A01CD9334B006722E1 /* BITHockeyLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyLogger.h; sourceTree = "<group>"; };
367393
80EF93A11CD9334B006722E1 /* BITHockeyLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITHockeyLogger.m; sourceTree = "<group>"; };
368394
80EF93A21CD9334B006722E1 /* BITHockeyLoggerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyLoggerPrivate.h; sourceTree = "<group>"; };
@@ -384,6 +410,15 @@
384410
);
385411
runOnlyForDeploymentPostprocessing = 0;
386412
};
413+
6F53E3021CF509AE00DC1C64 /* Frameworks */ = {
414+
isa = PBXFrameworksBuildPhase;
415+
buildActionMask = 2147483647;
416+
files = (
417+
6F53E3151CF50DD800DC1C64 /* OCMock.framework in Frameworks */,
418+
6F53E30A1CF509AE00DC1C64 /* HockeySDK.framework in Frameworks */,
419+
);
420+
runOnlyForDeploymentPostprocessing = 0;
421+
};
387422
/* End PBXFrameworksBuildPhase section */
388423

389424
/* Begin PBXGroup section */
@@ -576,6 +611,7 @@
576611
1E7FB96117D3F44100B7E10D /* Support */,
577612
1EF09DBF152357A500067A5C /* Vendor */,
578613
1E260C7717D401D000C7F9FE /* docs */,
614+
6F53E3061CF509AE00DC1C64 /* HockeySDKTests */,
579615
1EF09D8E1523574200067A5C /* Frameworks */,
580616
1EF09D8D1523574200067A5C /* Products */,
581617
);
@@ -585,13 +621,15 @@
585621
isa = PBXGroup;
586622
children = (
587623
1EF09D8C1523574200067A5C /* HockeySDK.framework */,
624+
6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */,
588625
);
589626
name = Products;
590627
sourceTree = "<group>";
591628
};
592629
1EF09D8E1523574200067A5C /* Frameworks */ = {
593630
isa = PBXGroup;
594631
children = (
632+
6F53E3141CF50DD800DC1C64 /* OCMock.framework */,
595633
1EB194CA1BA70BDE00793007 /* libz.tbd */,
596634
1E378AF8195899B400451E28 /* Quartz.framework */,
597635
1E378AF6195899A400451E28 /* QuartzCore.framework */,
@@ -687,6 +725,15 @@
687725
name = BetaDistribution;
688726
sourceTree = "<group>";
689727
};
728+
6F53E3061CF509AE00DC1C64 /* HockeySDKTests */ = {
729+
isa = PBXGroup;
730+
children = (
731+
6F53E3101CF509E000DC1C64 /* BITPersistenceTests.m */,
732+
6F53E3091CF509AE00DC1C64 /* Info.plist */,
733+
);
734+
path = HockeySDKTests;
735+
sourceTree = "<group>";
736+
};
690737
/* End PBXGroup section */
691738

692739
/* Begin PBXHeadersBuildPhase section */
@@ -804,13 +851,37 @@
804851
productReference = 1EF09D8C1523574200067A5C /* HockeySDK.framework */;
805852
productType = "com.apple.product-type.framework";
806853
};
854+
6F53E3041CF509AE00DC1C64 /* HockeySDKTests */ = {
855+
isa = PBXNativeTarget;
856+
buildConfigurationList = 6F53E30D1CF509AE00DC1C64 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */;
857+
buildPhases = (
858+
6F53E3011CF509AE00DC1C64 /* Sources */,
859+
6F53E3021CF509AE00DC1C64 /* Frameworks */,
860+
6F53E3031CF509AE00DC1C64 /* Resources */,
861+
6F53E3161CF50DF800DC1C64 /* Copy Files */,
862+
);
863+
buildRules = (
864+
);
865+
dependencies = (
866+
6F53E30C1CF509AE00DC1C64 /* PBXTargetDependency */,
867+
);
868+
name = HockeySDKTests;
869+
productName = HockeySDKTests;
870+
productReference = 6F53E3051CF509AE00DC1C64 /* HockeySDKTests.xctest */;
871+
productType = "com.apple.product-type.bundle.unit-test";
872+
};
807873
/* End PBXNativeTarget section */
808874

809875
/* Begin PBXProject section */
810876
1EF09D821523574200067A5C /* Project object */ = {
811877
isa = PBXProject;
812878
attributes = {
813879
LastUpgradeCheck = 0730;
880+
TargetAttributes = {
881+
6F53E3041CF509AE00DC1C64 = {
882+
CreatedOnToolsVersion = 7.3.1;
883+
};
884+
};
814885
};
815886
buildConfigurationList = 1EF09D851523574200067A5C /* Build configuration list for PBXProject "HockeySDK" */;
816887
compatibilityVersion = "Xcode 3.2";
@@ -834,6 +905,7 @@
834905
1EF09D8B1523574200067A5C /* HockeySDK */,
835906
1E7FB95C17D3F36B00B7E10D /* HockeySDK Documentation */,
836907
1E3B4F6B1996796B00203B89 /* HockeySDK Distribution */,
908+
6F53E3041CF509AE00DC1C64 /* HockeySDKTests */,
837909
);
838910
};
839911
/* End PBXProject section */
@@ -849,6 +921,13 @@
849921
);
850922
runOnlyForDeploymentPostprocessing = 0;
851923
};
924+
6F53E3031CF509AE00DC1C64 /* Resources */ = {
925+
isa = PBXResourcesBuildPhase;
926+
buildActionMask = 2147483647;
927+
files = (
928+
);
929+
runOnlyForDeploymentPostprocessing = 0;
930+
};
852931
/* End PBXResourcesBuildPhase section */
853932

854933
/* Begin PBXShellScriptBuildPhase section */
@@ -934,6 +1013,14 @@
9341013
);
9351014
runOnlyForDeploymentPostprocessing = 0;
9361015
};
1016+
6F53E3011CF509AE00DC1C64 /* Sources */ = {
1017+
isa = PBXSourcesBuildPhase;
1018+
buildActionMask = 2147483647;
1019+
files = (
1020+
6F53E3111CF509E000DC1C64 /* BITPersistenceTests.m in Sources */,
1021+
);
1022+
runOnlyForDeploymentPostprocessing = 0;
1023+
};
9371024
/* End PBXSourcesBuildPhase section */
9381025

9391026
/* Begin PBXTargetDependency section */
@@ -942,6 +1029,11 @@
9421029
target = 1E7FB95C17D3F36B00B7E10D /* HockeySDK Documentation */;
9431030
targetProxy = 1E3B4F6F1996797200203B89 /* PBXContainerItemProxy */;
9441031
};
1032+
6F53E30C1CF509AE00DC1C64 /* PBXTargetDependency */ = {
1033+
isa = PBXTargetDependency;
1034+
target = 1EF09D8B1523574200067A5C /* HockeySDK */;
1035+
targetProxy = 6F53E30B1CF509AE00DC1C64 /* PBXContainerItemProxy */;
1036+
};
9451037
/* End PBXTargetDependency section */
9461038

9471039
/* Begin PBXVariantGroup section */
@@ -1121,6 +1213,59 @@
11211213
};
11221214
name = Release;
11231215
};
1216+
6F53E30E1CF509AE00DC1C64 /* Debug */ = {
1217+
isa = XCBuildConfiguration;
1218+
buildSettings = {
1219+
CLANG_ANALYZER_NONNULL = YES;
1220+
CLANG_ENABLE_MODULES = YES;
1221+
CLANG_ENABLE_OBJC_ARC = YES;
1222+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1223+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1224+
CODE_SIGN_IDENTITY = "-";
1225+
COMBINE_HIDPI_IMAGES = YES;
1226+
DEBUG_INFORMATION_FORMAT = dwarf;
1227+
FRAMEWORK_SEARCH_PATHS = (
1228+
"$(inherited)",
1229+
"$(PROJECT_DIR)",
1230+
);
1231+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1232+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1233+
INFOPLIST_FILE = HockeySDKTests/Info.plist;
1234+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
1235+
MACOSX_DEPLOYMENT_TARGET = 10.11;
1236+
MTL_ENABLE_DEBUG_INFO = YES;
1237+
PRODUCT_BUNDLE_IDENTIFIER = net.hockeyapp.sdk.mac.HockeySDKTests;
1238+
PRODUCT_NAME = "$(TARGET_NAME)";
1239+
};
1240+
name = Debug;
1241+
};
1242+
6F53E30F1CF509AE00DC1C64 /* Release */ = {
1243+
isa = XCBuildConfiguration;
1244+
buildSettings = {
1245+
CLANG_ANALYZER_NONNULL = YES;
1246+
CLANG_ENABLE_MODULES = YES;
1247+
CLANG_ENABLE_OBJC_ARC = YES;
1248+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1249+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1250+
CODE_SIGN_IDENTITY = "-";
1251+
COMBINE_HIDPI_IMAGES = YES;
1252+
COPY_PHASE_STRIP = NO;
1253+
ENABLE_NS_ASSERTIONS = NO;
1254+
FRAMEWORK_SEARCH_PATHS = (
1255+
"$(inherited)",
1256+
"$(PROJECT_DIR)",
1257+
);
1258+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1259+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1260+
INFOPLIST_FILE = HockeySDKTests/Info.plist;
1261+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
1262+
MACOSX_DEPLOYMENT_TARGET = 10.11;
1263+
MTL_ENABLE_DEBUG_INFO = NO;
1264+
PRODUCT_BUNDLE_IDENTIFIER = net.hockeyapp.sdk.mac.HockeySDKTests;
1265+
PRODUCT_NAME = "$(TARGET_NAME)";
1266+
};
1267+
name = Release;
1268+
};
11241269
/* End XCBuildConfiguration section */
11251270

11261271
/* Begin XCConfigurationList section */
@@ -1160,6 +1305,15 @@
11601305
defaultConfigurationIsVisible = 0;
11611306
defaultConfigurationName = Release;
11621307
};
1308+
6F53E30D1CF509AE00DC1C64 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */ = {
1309+
isa = XCConfigurationList;
1310+
buildConfigurations = (
1311+
6F53E30E1CF509AE00DC1C64 /* Debug */,
1312+
6F53E30F1CF509AE00DC1C64 /* Release */,
1313+
);
1314+
defaultConfigurationIsVisible = 0;
1315+
defaultConfigurationName = Release;
1316+
};
11631317
/* End XCConfigurationList section */
11641318
};
11651319
rootObject = 1EF09D821523574200067A5C /* Project object */;

Support/HockeySDKTests/Info.plist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
</dict>
24+
</plist>

Support/OCMock.framework/Headers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers

Support/OCMock.framework/Modules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules

0 commit comments

Comments
 (0)