Skip to content

Commit

Permalink
feat: abTesting request timeout config
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Nov 29, 2023
1 parent e946d4f commit d7edac6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ - (void)testSetConfiguration_Autotracker {
config.dataSourceId = @"12345";
GrowingNetworkConfig *networkConfig = [GrowingNetworkConfig config];
networkConfig.requestTimeout = 0.3f;
networkConfig.abTestingRequestTimeout = 0.5f;
config.networkConfig = networkConfig;
[GrowingRealAutotracker trackerWithConfiguration:config launchOptions:nil];

Expand All @@ -170,7 +169,6 @@ - (void)testSetConfiguration_Autotracker {
XCTAssertEqualObjects(configuration.dataSourceId, @"12345");
XCTAssertNotNil(configuration.networkConfig);
XCTAssertEqual(configuration.networkConfig.requestTimeout, 0.3f);
XCTAssertEqual(configuration.networkConfig.abTestingRequestTimeout, 0.5f);
}

- (void)testDefaultConfiguration_Tracker {
Expand Down Expand Up @@ -211,7 +209,6 @@ - (void)testSetConfiguration_Tracker {
config.dataSourceId = @"12345";
GrowingNetworkConfig *networkConfig = [GrowingNetworkConfig config];
networkConfig.requestTimeout = 0.3f;
networkConfig.abTestingRequestTimeout = 0.5f;
config.networkConfig = networkConfig;
[GrowingRealTracker trackerWithConfiguration:config launchOptions:nil];

Expand All @@ -231,7 +228,6 @@ - (void)testSetConfiguration_Tracker {
XCTAssertEqualObjects(configuration.dataSourceId, @"12345");
XCTAssertNotNil(configuration.networkConfig);
XCTAssertEqual(configuration.networkConfig.requestTimeout, 0.3f);
XCTAssertEqual(configuration.networkConfig.abTestingRequestTimeout, 0.5f);
}

- (void)testVersionNameAndVersionCode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ + (void)setUp {
configuration.urlScheme = @"growing.530c8231345c492d";
configuration.abTestingServerHost = @"https://www.example.com";
configuration.experimentTTL = 5.0f;
GrowingNetworkConfig *networkConfig = [GrowingNetworkConfig config];
networkConfig.abTestingRequestTimeout = 3.0f;
configuration.networkConfig = networkConfig;
[GrowingAutotracker startWithConfiguration:configuration launchOptions:nil];
}

Expand Down
7 changes: 7 additions & 0 deletions GrowingTrackerCore/Network/Request/GrowingNetworkConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

#import "GrowingTrackerCore/Public/GrowingNetworkConfig.h"

@interface GrowingNetworkConfig ()

// ABTesting
@property (nonatomic, assign) NSTimeInterval abTestingRequestTimeout;

@end

@implementation GrowingNetworkConfig

- (instancetype)init {
Expand Down
1 change: 0 additions & 1 deletion GrowingTrackerCore/Public/GrowingNetworkConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ NS_SWIFT_NAME(NetworkConfig)
@interface GrowingNetworkConfig : NSObject <NSCopying>

@property (nonatomic, assign) NSTimeInterval requestTimeout;
@property (nonatomic, assign) NSTimeInterval abTestingRequestTimeout;

+ (instancetype)config;

Expand Down
6 changes: 6 additions & 0 deletions Modules/ABTesting/Public/GrowingABTesting.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ NS_SWIFT_NAME(ABTesting)

@end

@interface GrowingNetworkConfig (ABTesting)

@property (nonatomic, assign) NSTimeInterval abTestingRequestTimeout;

@end

NS_ASSUME_NONNULL_END

0 comments on commit d7edac6

Please sign in to comment.