Skip to content

Commit de63d14

Browse files
authored
Add downloadContentHost for download style request in DBTransportBaseHostnameConfig (#381)
1 parent 1dd6694 commit de63d14

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
3030
@property (nonatomic, readonly, copy) NSString *meta;
3131
@property (nonatomic, readonly, copy) NSString *api;
3232
@property (nonatomic, readonly, copy) NSString *content;
33+
@property (nonatomic, readonly, copy) NSString *downloadContent;
3334
@property (nonatomic, readonly, copy) NSString *notify;
3435

3536
///
@@ -45,11 +46,12 @@ NS_ASSUME_NONNULL_BEGIN
4546
/// @param meta the hostname to metaserver
4647
/// @param api the hostname to api server
4748
/// @param content the hostname to content server
49+
/// @param downloadContent the hostname to content server for download style
4850
/// @param notify the hostname to notify server
4951
///
5052
/// @return An initialized instance with the provided hostname configuration
5153
///
52-
- (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content notify:(NSString *)notify;
54+
- (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content downloadContent:(NSString *)downloadContent notify:(NSString *)notify;
5355

5456
///
5557
/// Returns the prefix to use for API calls to the given route type.

Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,32 @@ - (instancetype)initWithMeta:(NSString *)meta
4141
_meta = meta;
4242
_api = api;
4343
_content = content;
44+
_downloadContent = content;
4445
_notify = notify;
4546
}
4647
return self;
4748
}
4849

50+
- (instancetype)initWithMeta:(NSString *)meta
51+
api:(NSString *)api
52+
content:(NSString *)content
53+
downloadContent:(NSString *)downloadContent
54+
notify:(NSString *)notify {
55+
self = [self initWithMeta:meta api:api content:content notify:notify];
56+
_downloadContent = downloadContent;
57+
return self;
58+
}
59+
4960
- (nullable NSString *)apiV2PrefixWithRoute:(DBRoute *)route {
5061
switch (route.host) {
5162
case DBRouteHostApi:
5263
return [NSString stringWithFormat:@"https://%@/2", _api];
5364
case DBRouteHostContent:
54-
return [NSString stringWithFormat:@"https://%@/2", _content];
65+
if ([route.attrs[@"style"] isEqualToString:@"download"]) {
66+
return [NSString stringWithFormat:@"https://%@/2", _downloadContent];
67+
} else {
68+
return [NSString stringWithFormat:@"https://%@/2", _content];
69+
}
5570
case DBRouteHostNotify:
5671
return [NSString stringWithFormat:@"https://%@/2", _notify];
5772
case DBRouteHostUnknown:

0 commit comments

Comments
 (0)