Skip to content

Commit

Permalink
feat: add abtesting module (#281)
Browse files Browse the repository at this point in the history
* feat: add abtesting module

* style: code format

* test: update demo

* fix: experiment storage bug

* style: code format

* fix: ABTesting 兼容 SwiftPM 集成

* style: code format

* fix(ABTesting): 添加注释,修复 sonar quality bug

* style: code format

* ci: add ABTesting unit-testing

* ci: fix ABTesting test

* ci: fix protobuf test

* ci: add more ABTesting test

* fix(ABTesting): read experiment from storage at muti-threads

* fix(ABTesting): read experiment from storage at multi-threads

* ci: add mock request waiting time

* fix: rename projectId to accountId

* ci: add first mock request waiting time

* chore: update podfile lock

* feat: abTesting request timeout config

* feat: abTesting request timeout config

* fix: rename experimentTTL to requestInterval

* fix: add default host for Ads/AB-Testing

* fix(ABTesting): request header content-type

* style: code format

* fix(ABTesting): 仅 HTTP 请求失败时重试

* fix(ABTesting): request body

* ci(ABTesting): update ci

* fix: add dataSourceId to configuration that send to hybrid

* style: code format

* style: spelling check

---------

Co-authored-by: GIOSDK <[email protected]>
  • Loading branch information
YoloMao and GIOSDK authored Dec 25, 2023
1 parent 5f9bb1c commit 2d3950f
Show file tree
Hide file tree
Showing 64 changed files with 1,845 additions and 340 deletions.
2 changes: 1 addition & 1 deletion Example/Example-macOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
let config = GrowingTrackConfiguration(projectId: "bcc4fc9dea27f25d")
let config = GrowingTrackConfiguration(accountId: "bcc4fc9dea27f25d")
config?.dataSourceId = "be46cd165dcc3c7e"
config?.dataCollectionServerHost = "https://run.mocky.io/v3/08999138-a180-431d-a136-051f3c6bd306"
config?.idMappingEnabled = true
Expand Down
216 changes: 215 additions & 1 deletion Example/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Example/Example/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (void)SDK3rdStart {

#if defined(SDKADSMODULE)
configuration.ASAEnabled = YES;
configuration.deepLinkHost = @"https://n.datayi.cn";
configuration.deepLinkHost = @"https://link.growingio.com";
configuration.deepLinkCallback = ^(NSDictionary * _Nullable params, NSTimeInterval processTime, NSError * _Nullable error) {
if (error) {
NSLog(@"error = %@", error);
Expand All @@ -65,6 +65,11 @@ - (void)SDK3rdStart {
configuration.APMConfig = config;
#endif

#if defined(SDKABTESTINGMODULE)
configuration.abTestingServerHost = @"https://ab.growingio.com";
configuration.abTestingRequestInterval = 5;
#endif

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
[GrowingSDK startWithConfiguration:configuration launchOptions:nil];
Expand Down
6 changes: 6 additions & 0 deletions Example/Example/GrowingIO-Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
#endif
#endif

#if __has_include("GrowingABTesting.h")
// ABTesting Module
#import "GrowingABTesting.h"
#define SDKABTESTINGMODULE
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[tableView deselectRowAtIndexPath:indexPath animated:YES];

if (indexPath.row == 3) {
GIOChildsAddViewController *childsvc = [[GIOChildsAddViewController alloc] init];
[self.navigationController pushViewController:childsvc animated:NO];
GIOChildsAddViewController *children = [[GIOChildsAddViewController alloc] init];
[self.navigationController pushViewController:children animated:NO];
}
}
- (IBAction)clickRed:(id)sender {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)testGrowingUIView {
[view2 performSelector:@selector(growingNodeSubSimilarIndex)];
[view2 performSelector:@selector(growingNodeChilds)];
[view2 performSelector:@selector(growingNodeParent)];
[view2 performSelector:@selector(growingViewNodeIsInvisiable)];
[view2 performSelector:@selector(growingViewNodeIsInvisible)];
[view2 performSelector:@selector(growingImpNodeIsVisible)];
[view2 performSelector:@selector(growingNodeDonotTrack)];
[view2 performSelector:@selector(growingViewDontTrack)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
"identifier" : "349B528A28C0884400EE88FE",
"name" : "AdvertisingTests"
}
},
{
"target" : {
"containerPath" : "container:Example.xcodeproj",
"identifier" : "346521DE2ADD0E540091E815",
"name" : "ABTestingTests"
}
}
],
"version" : 1
Expand Down
Loading

0 comments on commit 2d3950f

Please sign in to comment.