Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyue committed Jul 27, 2021
1 parent 6dac182 commit 4f88cb7
Show file tree
Hide file tree
Showing 43 changed files with 2,045 additions and 121 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#import <SensorsABTest.h>

/// 测试环境,获取试验地址
static NSString* kSABResultsTestURL = @"http://abtesting.saas.debugbox.sensorsdata.cn/api/v2/abtest/online/results?project-key=1C77D685FC5441F52550B4F5973B340EB693EBB4";
static NSString* kSABResultsTestURL = @"http://abtesting.saas.debugbox.sensorsdata.cn/api/v2/abtest/online/results?project-key=438B9364C98D54371751BA82F6484A1A03A5155E";

// 测试环境,数据接收地址
static NSString* kSABTestServerURL = @"http://10.120.173.133:8106/sa?project=default";
static NSString* kSABTestServerURL = @"http://10.130.6.4:8106/sa?project=default";

@interface AppDelegate ()

Expand All @@ -26,24 +26,28 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

[self startSensorsAnalyticsSDKWithConfigOptions:launchOptions];

[self startSensorsABTest];

return YES;
}

- (void)startSensorsAnalyticsSDKWithConfigOptions:(NSDictionary *)launchOptions {
SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:kSABTestServerURL launchOptions:launchOptions];
// options.autoTrackEventType = SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppClick | SensorsAnalyticsEventTypeAppViewScreen;
options.autoTrackEventType = SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppClick | SensorsAnalyticsEventTypeAppViewScreen;
options.enableTrackAppCrash = YES;
options.autoTrackEventType = SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppClick | SensorsAnalyticsEventTypeAppViewScreen;

options.enableHeatMap = YES;
options.enableVisualizedAutoTrack = YES;
options.enableJavaScriptBridge = YES;
options.enableLog = YES;
[SensorsAnalyticsSDK startWithConfigOptions:options];


[[SensorsAnalyticsSDK sharedInstance] setFlushNetworkPolicy:SensorsAnalyticsNetworkTypeALL];
}

- (void)startSensorsABTest {
SensorsABTestConfigOptions *abtestConfigOptions = [[SensorsABTestConfigOptions alloc] initWithURL:kSABResultsTestURL];
[SensorsABTest startWithConfigOptions:abtestConfigOptions];

return YES;
}


Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions Example/Example-iOS/Example.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<string>bjtest</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sa80e4dfd7</string>
<string>sabccc7723</string>
</array>
</dict>
</array>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
break;

case 2: { // STRING
id result = [[SensorsABTest sharedInstance] fetchCacheABTestWithParamName:@"color2" defaultValue:@"默认值字符串"];
NSLog(@"fetchCacheABTest,paramName:%@ - result:%@\n", @"color2", result);
id result = [[SensorsABTest sharedInstance] fetchCacheABTestWithParamName:@"hef_tes" defaultValue:@"默认值字符串"];
NSLog(@"fetchCacheABTest,paramName:%@ - result:%@\n", @"hef_tes", result);
}
break;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ - (void)viewDidLoad {
// NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]];

// js 测试页面
NSString *httpStr = @"http://ls869359954.gitee.io/sa-sdk-abtest/";
NSString *httpStr = @"http://jssdk.debugbox.sensorsdata.cn/js/ls/app/sa-sdk-abtest/index.html";
// 多链接试验
// httpStr = @"http://jssdk.debugbox.sensorsdata.cn/js/ls/ab/index.html";

// 不做多链接试验
// httpStr = @"http://jssdk.debugbox.sensorsdata.cn/js/ls/ab/index.html?saSDKMultilink=true";

NSURL *httpUrl = [NSURL URLWithString:httpStr];
NSURLRequest *request = [NSURLRequest requestWithURL:httpUrl];

Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions Example/Example-macOS/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// Example-macOS
//
// Created by 储强盛 on 2021/6/18.
// Copyright © 2021 Sensors Data Inc. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>


@end

67 changes: 67 additions & 0 deletions Example/Example-macOS/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// AppDelegate.m
// Example-macOS
//
// Created by 储强盛 on 2021/6/18.
// Copyright © 2021 Sensors Data Inc. All rights reserved.
//

#import "AppDelegate.h"
#import <SensorsAnalyticsSDK.h>
#import <SensorsABTest.h>


static NSString *const SADefaultServerURL = @"http://10.130.6.4:8106/sa?project=default";

/// 测试环境,获取试验地址
static NSString* kSABResultsTestURL = @"http://abtesting.saas.debugbox.sensorsdata.cn/api/v2/abtest/online/results?project-key=438B9364C98D54371751BA82F6484A1A03A5155E";


@interface AppDelegate ()


@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application

[self startSensorsAnalyticsSDKWithLaunching:aNotification];

[self startSensorsABTest];
}

- (void)startSensorsAnalyticsSDKWithLaunching:(NSNotification *)aNotification {
SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:SADefaultServerURL launchOptions:nil];
options.enableJavaScriptBridge = YES;
options.enableLog = YES;
[SensorsAnalyticsSDK startWithConfigOptions:options];

[[SensorsAnalyticsSDK sharedInstance] setFlushNetworkPolicy:SensorsAnalyticsNetworkTypeALL];
}

- (void)startSensorsABTest {
SensorsABTestConfigOptions *abtestConfigOptions = [[SensorsABTestConfigOptions alloc] initWithURL:kSABResultsTestURL];
[SensorsABTest startWithConfigOptions:abtestConfigOptions];
}

- (void)application:(NSApplication *)application openURLs:(NSArray<NSURL *> *)urls {
for (NSURL *url in urls) {
if ([SensorsABTest.sharedInstance handleOpenURL:url]) {
return;
}
}
}


- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}

//- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)application {
// return YES;
//}


@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example/Example-macOS/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 4f88cb7

Please sign in to comment.