mirror of
https://github.com/docker/docs.git
synced 2026-11-05 00:14:17 +03:00
@@ -35,18 +35,25 @@
|
||||
return uuid;
|
||||
}
|
||||
|
||||
+ (void) trackEvent:(NSString *)name forPane:(InstallerPane*)pane {
|
||||
+ (void) trackEvent:(NSString *)name forPane:(InstallerPane*)pane withProperties:(NSDictionary *)properties {
|
||||
BOOL trackingDisabled = [[[[pane section] sharedDictionary] objectForKey:@"disableTracking"] boolValue];
|
||||
NSString *uuid = [self uuid];
|
||||
|
||||
if (!uuid || trackingDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *props = @"";
|
||||
for (NSString *key in properties) {
|
||||
props = [props stringByAppendingFormat:@",\"%@\": \"%@\"", key, [properties objectForKey:key]];
|
||||
}
|
||||
|
||||
NSBundle* bundle = [[pane section] bundle];
|
||||
NSString* token = [bundle objectForInfoDictionaryKey:@"Mixpanel Token"];
|
||||
NSString* installerVersion = [bundle objectForInfoDictionaryKey:@"Installer Version"];
|
||||
NSString* payload = [NSString stringWithFormat:@"{\"event\": \"%@\", \"properties\": {\"token\": \"%@\", \"distinct_id\": \"%@\", \"os\": \"darwin\", \"version\": \"%@\"}}", name, token, uuid, installerVersion];
|
||||
NSString* payload = [NSString stringWithFormat:@"{\"event\": \"%@\", \"properties\": {\"token\": \"%@\", \"distinct_id\": \"%@\", \"os\": \"darwin\", \"version\": \"%@\" %@}}", name, token, uuid, installerVersion, props];
|
||||
|
||||
NSLog(@"%@", payload);
|
||||
|
||||
NSData * data = [payload dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString* base64Encoded = [data base64EncodedStringWithOptions:0];
|
||||
@@ -54,6 +61,11 @@
|
||||
|
||||
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
|
||||
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {}];
|
||||
|
||||
}
|
||||
|
||||
+ (void) trackEvent:(NSString *)name forPane:(InstallerPane*)pane {
|
||||
[self trackEvent:name forPane:pane withProperties:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,8 +9,18 @@
|
||||
#import "overviewpluginPane.h"
|
||||
#import "mixpanel.h"
|
||||
|
||||
@interface overviewpluginPane()
|
||||
@property BOOL firstTime;
|
||||
@end
|
||||
|
||||
@implementation overviewpluginPane
|
||||
|
||||
- (id) init {
|
||||
self.firstTime = YES;
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)title {
|
||||
return [[NSBundle bundleForClass:[self class]] localizedStringForKey:@"PaneTitle" value:nil table:nil];
|
||||
}
|
||||
@@ -21,8 +31,10 @@
|
||||
[formattedHTML addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:13.0f] range:NSMakeRange(0, formattedHTML.length)];
|
||||
|
||||
[[self.textView textStorage] setAttributedString:formattedHTML];
|
||||
|
||||
[Mixpanel trackEvent:@"Installer Started" forPane:self];
|
||||
if (self.firstTime) {
|
||||
[Mixpanel trackEvent:@"Installer Started" forPane:self];
|
||||
self.firstTime = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) willExitPane:(InstallerSectionDirection)dir {
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
|
||||
- (void) willExitPane:(InstallerSectionDirection)dir {
|
||||
if (dir == InstallerDirectionForward) {
|
||||
[Mixpanel trackEvent:@"Installer Finished" forPane:self];
|
||||
[Mixpanel trackEvent:@"Installer Finished" forPane:self withProperties:[[NSDictionary alloc] initWithObjectsAndKeys:@"Continue Button", @"action", nil]];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)quickstartTerminalClicked:(id)sender {
|
||||
[Mixpanel trackEvent:@"Opened Docker Quickstart Terminal" forPane:self];
|
||||
[Mixpanel trackEvent:@"Installer Finished" forPane:self withProperties:[[NSDictionary alloc] initWithObjectsAndKeys:@"Quickstart Terminal", @"action", nil]];
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = @"/usr/bin/open";
|
||||
task.arguments = @[@"/Applications/Docker/Docker Quickstart Terminal.app"];
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
- (IBAction)kitematicClicked:(id)sender {
|
||||
[Mixpanel trackEvent:@"Opened Kitematic" forPane:self];
|
||||
[Mixpanel trackEvent:@"Installer Finished" forPane:self withProperties:[[NSDictionary alloc] initWithObjectsAndKeys:@"Kitematic", @"action", nil]];
|
||||
[[NSWorkspace sharedWorkspace] launchApplication:@"Kitematic (Beta)"];
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user