Skip to content

Commit

Permalink
fix: default server host change to napi prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Mar 31, 2023
1 parent 6adccbd commit 7342a8e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ - (void)testDefaultConfiguration_Autotracker {
XCTAssertEqual(configuration.sessionInterval, 30);
XCTAssertEqual(configuration.dataCollectionEnabled, YES);
XCTAssertEqual(configuration.uploadExceptionEnable, YES);
XCTAssertEqualObjects(configuration.dataCollectionServerHost, @"https://api.growingio.com");
XCTAssertEqualObjects(configuration.dataCollectionServerHost, @"https://napi.growingio.com");
XCTAssertEqual(configuration.excludeEvent, 0);
XCTAssertEqual(configuration.ignoreField, 0);
XCTAssertEqual(configuration.idMappingEnabled, NO);
Expand Down Expand Up @@ -155,7 +155,7 @@ - (void)testDefaultConfiguration_Tracker {
XCTAssertEqual(configuration.sessionInterval, 30);
XCTAssertEqual(configuration.dataCollectionEnabled, YES);
XCTAssertEqual(configuration.uploadExceptionEnable, YES);
XCTAssertEqualObjects(configuration.dataCollectionServerHost, @"https://api.growingio.com");
XCTAssertEqualObjects(configuration.dataCollectionServerHost, @"https://napi.growingio.com");
XCTAssertEqual(configuration.excludeEvent, 0);
XCTAssertEqual(configuration.ignoreField, 0);
XCTAssertEqual(configuration.idMappingEnabled, NO);
Expand Down
2 changes: 1 addition & 1 deletion GrowingTrackerCore/GrowingTrackConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#import "GrowingTrackerCore/Public/GrowingTrackConfiguration.h"
#import "GrowingTrackerCore/Manager/GrowingSession.h"

NSString * const kGrowingDefaultDataCollectionServerHost = @"https://api.growingio.com";
NSString * const kGrowingDefaultDataCollectionServerHost = @"https://napi.growingio.com";

@interface GrowingTrackConfiguration ()

Expand Down
12 changes: 3 additions & 9 deletions GrowingTrackerCore/Network/Request/GrowingNetworkConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,13 @@

+ (instancetype)sharedInstance;

/// 返回 growingApiHostEnd 拼接的事件上传地址 eg:https://api.growingio.com/v3/projects/91eaf9b283361032/collect
/// 返回 growingApiHostEnd 拼接的事件上传地址 eg:https://napi.growingio.com/v3/projects/91eaf9b283361032/collect
+ (NSString *)absoluteURL;

/// 返回url path eg:v3/projects/91eaf9b283361032/collect
+ (NSString *)path;

/// 返回GrowingTrackConfiguration配置的dataCollectionServerHost,如果没有额外配置该参数的话,默认返回 https://api.growingio.com
/// 返回GrowingTrackConfiguration配置的dataCollectionServerHost,如果没有额外配置该参数的话,默认返回 https://napi.growingio.com
- (NSString *)growingApiHostEnd;

/// 1. 如果设置了 customDataHost,则使用customDataHost,否则使用 https://www.growingio.com
- (NSString *)growingDataHostEnd;

/// 固定值,为 https://tags.growingio.com
- (NSString *)tagsHost;


@end
13 changes: 0 additions & 13 deletions GrowingTrackerCore/Network/Request/GrowingNetworkConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ @implementation GrowingNetworkConfig

static GrowingNetworkConfig *sharedInstance;

static NSString * const kGrowingDataHost = @"https://www.growingio.com";
static NSString * const kGrowingTrackerHost = @"https://api.growingio.com";
static NSString * const kGrowingTagsHostFormat = @"https://tags.growingio.com";
static NSString * const kGrowingWsHostFormat = @"wss://ws.growingio.com";

+ (instancetype)sharedInstance {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand Down Expand Up @@ -86,12 +81,4 @@ - (NSString *)growingApiHostEnd {
return GrowingConfigurationManager.sharedInstance.trackConfiguration.dataCollectionServerHost;
}

- (NSString *)growingDataHostEnd {
return _customDataHost.length > 0 ? _customDataHost : kGrowingDataHost;
}

- (NSString *)tagsHost {
return [NSString stringWithFormat:kGrowingTagsHostFormat];
}

@end

0 comments on commit 7342a8e

Please sign in to comment.