Skip to content
This repository was archived by the owner on Dec 13, 2017. It is now read-only.

Commit be1ab2b

Browse files
committed
Bring back analytics through the delegate
1 parent a64d9ed commit be1ab2b

5 files changed

Lines changed: 60 additions & 0 deletions

File tree

Classes/WPEditorStat.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
typedef NS_ENUM(NSUInteger, WPEditorStat)
2+
{
3+
WPEditorStatTappedBlockquote,
4+
WPEditorStatTappedBold,
5+
WPEditorStatTappedHTML,
6+
WPEditorStatTappedImage,
7+
WPEditorStatTappedItalic,
8+
WPEditorStatTappedLink,
9+
WPEditorStatTappedMore,
10+
WPEditorStatTappedOrderedList,
11+
WPEditorStatTappedStrikethrough,
12+
WPEditorStatTappedUnderline,
13+
WPEditorStatTappedUnlink,
14+
WPEditorStatTappedUnorderedList
15+
};

Classes/WPEditorViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#import <UIKit/UIKit.h>
22
#import "HRColorPickerViewController.h"
33
#import "WPEditorFormatbarView.h"
4+
#import "WPEditorStat.h"
5+
46
@class WPEditorField;
57
@class WPEditorView;
68
@class WPEditorViewController;
@@ -23,6 +25,7 @@ WPEditorViewControllerMode;
2325
- (void)editorTitleDidChange:(WPEditorViewController *)editorController;
2426
- (void)editorTextDidChange:(WPEditorViewController *)editorController;
2527
- (void)editorDidPressMedia:(WPEditorViewController *)editorController;
28+
- (void)editorTrackStat:(WPEditorStat)stat;
2629

2730

2831
/**

Classes/WPEditorViewController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ - (void)didTouchMediaOptions
354354
animated:YES
355355
completion:nil];
356356
}
357+
[self.delegate editorTrackStat:WPEditorStatTappedImage];
357358
}
358359

359360
#pragma mark - Editor and Misc Methods
@@ -516,6 +517,8 @@ - (void)showHTMLSource:(UIBarButtonItem *)barButtonItem
516517
[self.toolbarView toolBarItemWithTag:kWPEditorViewControllerElementShowSourceBarButton
517518
setSelected:NO];
518519
}
520+
521+
[self.delegate editorTrackStat:WPEditorStatTappedHTML];
519522
}
520523

521524
- (void)removeFormat
@@ -547,18 +550,21 @@ - (void)setBold
547550
{
548551
[self.editorView setBold];
549552
[self clearToolbar];
553+
[self.delegate editorTrackStat:WPEditorStatTappedBold];
550554
}
551555

552556
- (void)setBlockQuote
553557
{
554558
[self.editorView setBlockQuote];
555559
[self clearToolbar];
560+
[self.delegate editorTrackStat:WPEditorStatTappedBlockquote];
556561
}
557562

558563
- (void)setItalic
559564
{
560565
[self.editorView setItalic];
561566
[self clearToolbar];
567+
[self.delegate editorTrackStat:WPEditorStatTappedItalic];
562568
}
563569

564570
- (void)setSubscript
@@ -570,6 +576,7 @@ - (void)setUnderline
570576
{
571577
[self.editorView setUnderline];
572578
[self clearToolbar];
579+
[self.delegate editorTrackStat:WPEditorStatTappedUnderline];
573580
}
574581

575582
- (void)setSuperscript
@@ -581,18 +588,21 @@ - (void)setStrikethrough
581588
{
582589
[self.editorView setStrikethrough];
583590
[self clearToolbar];
591+
[self.delegate editorTrackStat:WPEditorStatTappedStrikethrough];
584592
}
585593

586594
- (void)setUnorderedList
587595
{
588596
[self.editorView setUnorderedList];
589597
[self clearToolbar];
598+
[self.delegate editorTrackStat:WPEditorStatTappedUnorderedList];
590599
}
591600

592601
- (void)setOrderedList
593602
{
594603
[self.editorView setOrderedList];
595604
[self clearToolbar];
605+
[self.delegate editorTrackStat:WPEditorStatTappedOrderedList];
596606
}
597607

598608
- (void)setHR
@@ -688,6 +698,7 @@ - (void)linkBarButtonTapped
688698
} else {
689699
[self showInsertLinkDialogWithLink:self.editorView.selectedLinkURL
690700
title:[self.editorView selectedText]];
701+
[self.delegate editorTrackStat:WPEditorStatTappedLink];
691702
}
692703
}
693704

@@ -811,6 +822,7 @@ - (void)updateLink:(NSString *)url
811822
- (void)removeLink
812823
{
813824
[self.editorView removeLink];
825+
[self.delegate editorTrackStat:WPEditorStatTappedUnlink];
814826
}
815827

816828
- (void)quickLink

Classes/WPLegacyEditorViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#import <UIKit/UIKit.h>
2+
#import "WPEditorStat.h"
23

34
@class WPLegacyEditorViewController;
45

@@ -13,6 +14,7 @@
1314
- (void)editorDidPressSettings:(WPLegacyEditorViewController *)editorController;
1415
- (void)editorDidPressMedia:(WPLegacyEditorViewController *)editorController;
1516
- (void)editorDidPressPreview:(WPLegacyEditorViewController *)editorController;
17+
- (void)editorTrackStat:(WPEditorStat)stat;
1618
@end
1719

1820
@interface WPLegacyEditorViewController : UIViewController

Classes/WPLegacyEditorViewController.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,34 @@ - (void)wrapSelectionWithTag:(NSString *)tag
441441

442442
- (void)formatToolbar:(WPLegacyEditorFormatToolbar *)formatToolbar actionPressed:(WPLegacyEditorFormatAction)formatAction
443443
{
444+
switch (formatAction) {
445+
case WPLegacyEditorFormatActionBold:
446+
[self.delegate editorTrackStat:WPEditorStatTappedBold];
447+
break;
448+
case WPLegacyEditorFormatActionItalic:
449+
[self.delegate editorTrackStat:WPEditorStatTappedItalic];
450+
break;
451+
case WPLegacyEditorFormatActionUnderline:
452+
[self.delegate editorTrackStat:WPEditorStatTappedUnderline];
453+
break;
454+
case WPLegacyEditorFormatActionDelete:
455+
[self.delegate editorTrackStat:WPEditorStatTappedStrikethrough];
456+
break;
457+
case WPLegacyEditorFormatActionLink:
458+
[self.delegate editorTrackStat:WPEditorStatTappedLink];
459+
break;
460+
case WPLegacyEditorFormatActionQuote:
461+
[self.delegate editorTrackStat:WPEditorStatTappedBlockquote];
462+
break;
463+
case WPLegacyEditorFormatActionMore:
464+
[self.delegate editorTrackStat:WPEditorStatTappedMore];
465+
break;
466+
case WPLegacyEditorFormatActionMedia:
467+
[self.delegate editorTrackStat:WPEditorStatTappedImage];
468+
break;
469+
470+
}
471+
444472
if (formatAction == WPLegacyEditorFormatActionMedia) {
445473
[self didTouchMediaOptions];
446474
} else if (formatAction == WPLegacyEditorFormatActionLink) {

0 commit comments

Comments
 (0)