Skip to content

Commit 40045b8

Browse files
authored
Consolidate SecureCoding to avoid a new subspec (#4462)
1 parent 3a397c2 commit 40045b8

File tree

6 files changed

+29
-35
lines changed

6 files changed

+29
-35
lines changed

GoogleUtilities.podspec

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ other Google CocoaPods. They're not intended for direct public usage.
2525
s.prefix_header_file = false
2626

2727
s.subspec 'Environment' do |es|
28-
es.source_files = 'GoogleUtilities/Environment/third_party/*.[mh]'
29-
es.public_header_files = 'GoogleUtilities/Environment/third_party/*.h'
30-
es.private_header_files = 'GoogleUtilities/Environment/third_party/*.h'
31-
es.dependency 'GoogleUtilities/SecureCoding'
28+
es.source_files = 'GoogleUtilities/Environment/**/*.[mh]'
29+
es.public_header_files = 'GoogleUtilities/Environment/**/*.h'
30+
es.private_header_files = 'GoogleUtilities/Environment/**/*.h'
3231
end
3332

3433
s.subspec 'Logger' do |ls|
@@ -106,11 +105,6 @@ other Google CocoaPods. They're not intended for direct public usage.
106105
ud.dependency 'GoogleUtilities/Logger'
107106
end
108107

109-
s.subspec 'SecureCoding' do |sc|
110-
sc.source_files = 'GoogleUtilities/SecureCoding/**/*.[hm]'
111-
sc.public_header_files = 'GoogleUtilities/SecureCoding/Public/*.h'
112-
end
113-
114108
s.test_spec 'unit' do |unit_tests|
115109
# All tests require arc except Tests/Network/third_party/GTMHTTPServer.m
116110
unit_tests.source_files = 'GoogleUtilities/Example/Tests/**/*.[mh]'

GoogleUtilities/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ if(APPLE)
1616
# Environment and Logger subspecs
1717
file(
1818
GLOB sources
19+
Environment/*.m
1920
Environment/third_party/*.m
2021
Logger/*.m
21-
SecureCoding/*.m
2222
)
2323
file(
2424
GLOB headers
25+
Environment/Public/*.h
2526
Environment/third_party/*.h
2627
Logger/Private/*.h
2728
Logger/Public/*.h
28-
SecureCoding/Public/*.h
2929
)
3030

3131
podspec_version(version ${PROJECT_SOURCE_DIR}/GoogleUtilities.podspec)

GoogleUtilities/Environment/third_party/GULHeartbeatDateStorage.m renamed to GoogleUtilities/Environment/GULHeartbeatDateStorage.m

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GULHeartbeatDateStorage.h"
17+
#import <GoogleUtilities/GULHeartbeatDateStorage.h>
1818
#import <GoogleUtilities/GULSecureCoding.h>
1919

2020
@interface GULHeartbeatDateStorage ()
@@ -56,7 +56,8 @@ + (NSURL *)directoryPathURL {
5656
* @param directoryPathURL The path to the directory which needs to be created.
5757
* @param fileCoordinator The fileCoordinator object to coordinate writes to the directory.
5858
*/
59-
+ (void)checkAndCreateDirectory:(NSURL *)directoryPathURL fileCoordinator:(NSFileCoordinator *)fileCoordinator {
59+
+ (void)checkAndCreateDirectory:(NSURL *)directoryPathURL
60+
fileCoordinator:(NSFileCoordinator *)fileCoordinator {
6061
NSError *fileCoordinatorError = nil;
6162
[fileCoordinator
6263
coordinateWritingItemAtURL:directoryPathURL
@@ -67,11 +68,10 @@ + (void)checkAndCreateDirectory:(NSURL *)directoryPathURL fileCoordinator:(NSFil
6768
if (![writingDirectoryURL checkResourceIsReachableAndReturnError:&error]) {
6869
// If fail creating the Application Support directory, log warning.
6970
NSError *error;
70-
[[NSFileManager defaultManager]
71-
createDirectoryAtURL:writingDirectoryURL
72-
withIntermediateDirectories:YES
73-
attributes:nil
74-
error:&error];
71+
[[NSFileManager defaultManager] createDirectoryAtURL:writingDirectoryURL
72+
withIntermediateDirectories:YES
73+
attributes:nil
74+
error:&error];
7575
}
7676
}];
7777
}
@@ -84,9 +84,9 @@ - (nullable NSMutableDictionary *)heartbeatDictionaryWithFileURL:(NSURL *)readin
8484
dict = [NSMutableDictionary dictionary];
8585
} else {
8686
dict = [GULSecureCoding
87-
unarchivedObjectOfClasses:[NSSet setWithArray:@[ NSDictionary.class, NSDate.class ]]
88-
fromData:objectData
89-
error:&error];
87+
unarchivedObjectOfClasses:[NSSet setWithArray:@[ NSDictionary.class, NSDate.class ]]
88+
fromData:objectData
89+
error:&error];
9090
if (dict == nil || error != nil) {
9191
dict = [NSMutableDictionary dictionary];
9292
}
@@ -109,20 +109,20 @@ - (nullable NSDate *)heartbeatDateForTag:(NSString *)tag {
109109
- (BOOL)setHearbeatDate:(NSDate *)date forTag:(NSString *)tag {
110110
NSError *error;
111111
__block BOOL isSuccess = false;
112-
[self.fileCoordinator
113-
coordinateReadingItemAtURL:self.fileURL
114-
options:0
115-
writingItemAtURL:self.fileURL
116-
options:0
117-
error:&error
118-
byAccessor:^(NSURL *readingURL, NSURL *writingURL) {
119-
NSMutableDictionary *dictionary = [self heartbeatDictionaryWithFileURL:readingURL];
120-
dictionary[tag] = date;
121-
NSError *error;
122-
isSuccess = [self writeDictionary:dictionary
123-
forWritingURL:writingURL
124-
error:&error];
125-
}];
112+
[self.fileCoordinator coordinateReadingItemAtURL:self.fileURL
113+
options:0
114+
writingItemAtURL:self.fileURL
115+
options:0
116+
error:&error
117+
byAccessor:^(NSURL *readingURL, NSURL *writingURL) {
118+
NSMutableDictionary *dictionary =
119+
[self heartbeatDictionaryWithFileURL:readingURL];
120+
dictionary[tag] = date;
121+
NSError *error;
122+
isSuccess = [self writeDictionary:dictionary
123+
forWritingURL:writingURL
124+
error:&error];
125+
}];
126126
return isSuccess;
127127
}
128128

0 commit comments

Comments
 (0)