Skip to content

Commit 49aa89b

Browse files
Merge develop to master for 5.0.4 (#2500)
Co-authored-by: Dmitriy Kirakosyan <[email protected]>
1 parent 5756ddb commit 49aa89b

File tree

50 files changed

+810
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+810
-194
lines changed

AppCenter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.cocoapods_version = '>= 1.10'
33
s.name = 'AppCenter'
4-
s.version = '5.0.3'
4+
s.version = '5.0.4'
55

66
s.summary = 'Visual Studio App Center is your continuous integration, delivery and learning solution for iOS and macOS apps.'
77
s.description = <<-DESC

AppCenter/AppCenter.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,8 @@
13331333
D55E7082252F5A1000AB994D /* MSACTestSessionInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSACTestSessionInfo.m; sourceTree = "<group>"; };
13341334
D55E7083252F5A1000AB994D /* MSACTestSessionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSACTestSessionInfo.h; sourceTree = "<group>"; };
13351335
D5812F312423C2FA00C5F5C5 /* MSACUserDefaultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSACUserDefaultsTests.m; sourceTree = "<group>"; };
1336+
D80EC5002AB0713B000C82D7 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
1337+
D881A6B62AAF4176009644A0 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ../PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
13361338
DF5DA1F823A0E55500DE695C /* MSACDispatcherUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSACDispatcherUtil.h; sourceTree = "<group>"; };
13371339
DF5DA1FC23A0E57B00DE695C /* MSACDispatcherUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSACDispatcherUtil.m; sourceTree = "<group>"; };
13381340
DFCB7FFD2472C1BD0058D292 /* OCHamcrest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OCHamcrest.xcodeproj; path = ../../Vendor/OCHamcrest/Source/OCHamcrest.xcodeproj; sourceTree = "<group>"; };
@@ -1588,6 +1590,8 @@
15881590
6E0400FA1D1C98220051BCFA = {
15891591
isa = PBXGroup;
15901592
children = (
1593+
D80EC5002AB0713B000C82D7 /* PrivacyInfo.xcprivacy */,
1594+
D881A6B62AAF4176009644A0 /* PrivacyInfo.xcprivacy */,
15911595
6E0401051D1C98220051BCFA /* AppCenter */,
15921596
6E2395791D22EF4F00E543C8 /* AppCenterTests */,
15931597
6E0401041D1C98220051BCFA /* Products */,

AppCenter/AppCenter/Internals/Channel/MSACChannelUnitDefault.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ - (void)enqueueItem:(id<MSACLog>)item flags:(MSACFlags)flags {
8787
if (item && !item.device) {
8888
item.device = [[MSACDeviceTracker sharedInstance] device];
8989
}
90+
if (item && !item.dataResidencyRegion) {
91+
item.dataResidencyRegion = [MSACAppCenter dataResidencyRegion];
92+
}
9093
if (!item || ![item isValid]) {
9194
MSACLogWarning([MSACAppCenter logTag], @"Log is not valid.");
9295
return;

AppCenter/AppCenter/Internals/MSACAppCenterInternal.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ static NSString *const kMSACTrueEnvironmentString = @"1";
4949

5050
@property(atomic, copy) NSString *logUrl;
5151

52+
@property(atomic, copy) NSString *dataResidencyRegion;
53+
5254
@property(nonatomic, readonly) NSUUID *installId;
5355

5456
@property(nonatomic) NSNumber *requestedMaxStorageSizeInBytes;
@@ -110,6 +112,13 @@ static NSString *const kMSACTrueEnvironmentString = @"1";
110112
*/
111113
- (NSString *)logUrl;
112114

115+
/**
116+
* Get the data residency region.
117+
*
118+
* @return data residency region.
119+
*/
120+
- (NSString *)dataResidencyRegion;
121+
113122
/**
114123
* Get the app secret.
115124
*

AppCenter/AppCenter/Internals/Model/MSACAbstractLog.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ @implementation MSACAbstractLog
3131
@synthesize sid = _sid;
3232
@synthesize distributionGroupId = _distributionGroupId;
3333
@synthesize userId = _userId;
34+
@synthesize dataResidencyRegion = _dataResidencyRegion;
3435
@synthesize device = _device;
3536
@synthesize tag = _tag;
3637

@@ -62,6 +63,9 @@ - (NSMutableDictionary *)serializeToDictionary {
6263
if (self.device) {
6364
dict[kMSACDevice] = [self.device serializeToDictionary];
6465
}
66+
if (self.dataResidencyRegion) {
67+
dict[kMSACDataResidencyRegion] = self.dataResidencyRegion;
68+
}
6569
return dict;
6670
}
6771

@@ -80,7 +84,9 @@ - (BOOL)isEqual:(id)object {
8084
((!self.sid && !log.sid) || [self.sid isEqualToString:log.sid]) &&
8185
((!self.distributionGroupId && !log.distributionGroupId) || [self.distributionGroupId isEqualToString:log.distributionGroupId]) &&
8286
((!self.userId && !log.userId) || [self.userId isEqualToString:log.userId]) &&
83-
((!self.device && !log.device) || [self.device isEqual:log.device]);
87+
((!self.device && !log.device) || [self.device isEqual:log.device]) &&
88+
((!self.dataResidencyRegion && !log.dataResidencyRegion) || [self.dataResidencyRegion isEqualToString:log.dataResidencyRegion]);
89+
8490
}
8591

8692
#pragma mark - NSCoding
@@ -98,6 +104,7 @@ - (instancetype)initWithCoder:(NSCoder *)coder {
98104
_distributionGroupId = [coder decodeObjectForKey:kMSACDistributionGroupId];
99105
_userId = [coder decodeObjectForKey:kMSACUserId];
100106
_device = [coder decodeObjectForKey:kMSACDevice];
107+
_dataResidencyRegion = [coder decodeObjectForKey:kMSACDataResidencyRegion];
101108
}
102109
return self;
103110
}
@@ -109,6 +116,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
109116
[coder encodeObject:self.distributionGroupId forKey:kMSACDistributionGroupId];
110117
[coder encodeObject:self.userId forKey:kMSACUserId];
111118
[coder encodeObject:self.device forKey:kMSACDevice];
119+
[coder encodeObject:self.dataResidencyRegion forKey:kMSACDataResidencyRegion];
112120
}
113121

114122
#pragma mark - Utility

AppCenter/AppCenter/Internals/Model/MSACAbstractLogPrivate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#import <Foundation/Foundation.h>
55

6+
static NSString *const kMSACDataResidencyRegion = @"dataResidencyRegion";
67
static NSString *const kMSACDevice = @"device";
78
static NSString *const kMSACDistributionGroupId = @"distributionGroupId";
89
static NSString *const kMSACSId = @"sid";

AppCenter/AppCenter/MSACAppCenter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ NS_SWIFT_NAME(AppCenter)
109109
*/
110110
@property(class, nonatomic, strong) NSString *logUrl;
111111

112+
/**
113+
* Data residency region.
114+
* Verify list of supported regions on <link>. Value outside of supported range is treated by backend as ANY.
115+
*/
116+
@property(class, nonatomic, strong) NSString *dataResidencyRegion;
117+
112118
/**
113119
* Set log handler.
114120
*/

AppCenter/AppCenter/MSACAppCenter.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ @implementation MSACAppCenter
5656

5757
@synthesize logUrl = _logUrl;
5858

59+
@synthesize dataResidencyRegion = _dataResidencyRegion;
60+
5961
+ (instancetype)sharedInstance {
6062
dispatch_once(&onceToken, ^{
6163
if (sharedInstance == nil) {
@@ -246,6 +248,10 @@ + (NSString *)groupId {
246248
return kMSACGroupId;
247249
}
248250

251+
+ (NSString *)dataResidencyRegion {
252+
return [[MSACAppCenter sharedInstance] dataResidencyRegion];
253+
}
254+
249255
+ (void)setMaxStorageSize:(long)sizeInBytes completionHandler:(void (^)(BOOL))completionHandler {
250256
[[MSACAppCenter sharedInstance] setMaxStorageSize:sizeInBytes completionHandler:completionHandler];
251257
}
@@ -254,6 +260,10 @@ + (void)setUserId:(NSString *)userId {
254260
[[MSACAppCenter sharedInstance] setUserId:userId];
255261
}
256262

263+
+ (void)setDataResidencyRegion:(NSString *)dataResidencyRegion {
264+
[[MSACAppCenter sharedInstance] setDataResidencyRegion:dataResidencyRegion];
265+
}
266+
257267
+ (void)setCountryCode:(NSString *)countryCode {
258268
[[MSACDeviceTracker sharedInstance] setCountryCode:countryCode];
259269
}

AppCenter/AppCenter/Model/MSACLog.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ NS_SWIFT_NAME(Log)
3232
*/
3333
@property(nonatomic, copy) NSString *distributionGroupId;
3434

35+
/**
36+
* Data residency region.
37+
*/
38+
@property(nonatomic, copy) NSString *dataResidencyRegion;
39+
3540
/**
3641
* Optional user identifier.
3742
*/

AppCenter/AppCenterTests/MSACAbstractLogTests.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ - (void)setUp {
3333
self.sut.timestamp = [NSDate dateWithTimeIntervalSince1970:0];
3434
self.sut.sid = @"FAKE-SESSION-ID";
3535
self.sut.distributionGroupId = @"FAKE-GROUP-ID";
36+
self.sut.dataResidencyRegion = @"FAKE-DATA-RESIDENCY-REGION";
3637
self.sut.userId = @"FAKE-USER-ID";
3738
self.sut.device = OCMPartialMock([MSACDevice new]);
3839

@@ -57,6 +58,7 @@ - (void)testSerializingToDictionaryWorks {
5758
assertThat(actual[@"timestamp"], equalTo(@"1970-01-01T00:00:00.000Z"));
5859
assertThat(actual[@"sid"], equalTo(@"FAKE-SESSION-ID"));
5960
assertThat(actual[@"distributionGroupId"], equalTo(@"FAKE-GROUP-ID"));
61+
assertThat(actual[@"dataResidencyRegion"], equalTo(@"FAKE-DATA-RESIDENCY-REGION"));
6062
assertThat(actual[@"userId"], equalTo(@"FAKE-USER-ID"));
6163
assertThat(actual[@"device"], equalTo(@{}));
6264
}
@@ -76,6 +78,7 @@ - (void)testNSCodingSerializationAndDeserializationWorks {
7678
assertThat(actualLog.timestamp, equalTo(self.sut.timestamp));
7779
assertThat(actualLog.sid, equalTo(self.sut.sid));
7880
assertThat(actualLog.distributionGroupId, equalTo(self.sut.distributionGroupId));
81+
assertThat(actualLog.dataResidencyRegion, equalTo(self.sut.dataResidencyRegion));
7982
assertThat(actualLog.userId, equalTo(self.sut.userId));
8083
assertThat(actualLog.device, equalTo(self.sut.device));
8184
}
@@ -126,6 +129,7 @@ - (void)testIsEqual {
126129
log.timestamp = self.sut.timestamp;
127130
log.sid = self.sut.sid;
128131
log.distributionGroupId = self.sut.distributionGroupId;
132+
log.dataResidencyRegion = self.sut.dataResidencyRegion;
129133
log.userId = self.sut.userId;
130134
log.device = self.sut.device;
131135
log.tag = self.sut.tag;
@@ -159,6 +163,14 @@ - (void)testIsEqual {
159163

160164
// Then
161165
XCTAssertFalse([self.sut isEqual:log]);
166+
167+
// When
168+
self.sut.userId = @"FAKE-USER-ID";
169+
self.sut.dataResidencyRegion = @"FAKE-NEW-DATA-RESIDENCY-REGION";
170+
171+
// Then
172+
XCTAssertFalse([self.sut isEqual:log]);
173+
162174
}
163175

164176
- (void)testSerializingToJsonWorks {
@@ -174,6 +186,7 @@ - (void)testSerializingToJsonWorks {
174186
assertThat([actualDict objectForKey:@"timestamp"], equalTo(@"1970-01-01T00:00:00.000Z"));
175187
assertThat([actualDict objectForKey:@"sid"], equalTo(@"FAKE-SESSION-ID"));
176188
assertThat([actualDict objectForKey:@"distributionGroupId"], equalTo(@"FAKE-GROUP-ID"));
189+
assertThat([actualDict objectForKey:@"dataResidencyRegion"], equalTo(@"FAKE-DATA-RESIDENCY-REGION"));
177190
assertThat([actualDict objectForKey:@"userId"], equalTo(@"FAKE-USER-ID"));
178191
assertThat([actualDict objectForKey:@"device"], equalTo(@{}));
179192
}

0 commit comments

Comments
 (0)