-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfig.m
More file actions
executable file
·36 lines (34 loc) · 948 Bytes
/
Config.m
File metadata and controls
executable file
·36 lines (34 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Config.m
// Contentstack
//
// Created by Priyanka Mistry on 01/06/16.
// Copyright © 2016 Contentstack. All rights reserved.
//
#import <Contentstack/Config.h>
#import "CSIOConstants.h"
#import "NSObject+Extensions.h"
@implementation Config
-(instancetype)init {
self = [super init];
if (self) {
_region = US;
_host = @"cdn.contentstack.io";
_version = kCSIO_ApiVersion;
_setEarlyAccess = nil;
}
return self;
}
- (void)setRegion:(ContentstackRegion)region {
_region = region;
// Always update host when region changes and notify observers
_host = [self hostURL:_region]; // Update host based on region
}
- (NSDictionary<NSString *, NSString *> *)earlyAccessHeaders {
if (_setEarlyAccess.count > 0) {
NSString *earlyAccessString = [_setEarlyAccess componentsJoinedByString:@","];
return @{@"x-header-ea": earlyAccessString};
}
return @{};
}
@end