-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathETNetworkConfig.h
executable file
·65 lines (37 loc) · 1.43 KB
/
ETNetworkConfig.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// ETNetworkConfig.h
// 能量圈
//
// Created by vj on 2017/3/31.
// Copyright © 2017年 Weijie Zhu. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ETBaseRequest;
@class AFSecurityPolicy;
@protocol ETUrlFilterProtocol <NSObject>
//
- (NSString *)filterUrl:(NSString *)originUrl withRequest:(ETBaseRequest *)request;
@end
@protocol ETCacheDirPathFilterProtocol <NSObject>
// 在存储数据前先预先存储路径
- (NSString *)filterCacheDirPath:(NSString *)originPath withRequest:(ETBaseRequest *)request;
@end
@interface ETNetworkConfig : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
+ (instancetype)init NS_UNAVAILABLE;
//// 返回一个单列
+ (ETNetworkConfig *)sharedConfig;
@property (nonatomic, strong) NSString *baseUrl;
@property (nonatomic, strong) NSString *cdnUrl;
// 集合了经过筛选的Url
@property (nonatomic, strong, readonly) NSArray<id<ETUrlFilterProtocol>> *urlFilters;
/// 集合了经过筛选的缓存路径
@property (nonatomic, strong, readonly) NSArray<id<ETCacheDirPathFilterProtocol>> *cacheDirPathFilters;
@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
@property (nonatomic, strong) NSURLSessionConfiguration* sessionConfiguration;
- (void)addUrlFilter:(id<ETUrlFilterProtocol>)filter;
- (void)clearUrlFilter;
- (void)addCacheDirPathFilter:(id<ETCacheDirPathFilterProtocol>)filter;
- (void)clearCacheDirPathFilter;
@end