소스 검색

1.修复Signature在屏幕旋转时视图未更新。
2.Google Analytics增加自定义维度追踪User和Customer。

Pen Li 9 년 전
부모
커밋
eac08d316f

+ 1 - 1
RedAnt ERP Mobile/GoogleAnalytics/GoogleAnalyst.h

@@ -42,7 +42,7 @@
 
 + (void)trackTimingWithCategory:(NSString *)category interval:(NSTimeInterval)loadTime name:(NSString *)name label:(NSString *)label;
 
-
++ (void)clearTracker;
 
 + (void)trackSignInUserID:(NSString *)userID;
 

+ 28 - 2
RedAnt ERP Mobile/GoogleAnalytics/GoogleAnalyst.m

@@ -81,6 +81,8 @@
 
 + (void)trackProduct:(NSString *)productName action:(NSString *)action count:(NSNumber *)count{
     
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
     id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
     
     GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
@@ -99,17 +101,41 @@
     }
     GAIEcommerceProductAction *paction = [[GAIEcommerceProductAction alloc] init];
     if ([action isEqualToString:@"Add To Cart"]) {
+        
         [paction setAction:kGAIPAAdd];
+        // 自定义指标 Add To Cart
+        NSString *metricValue4 = @"1";
+        [tracker set:[GAIFields customMetricForIndex:4] value:metricValue4]; //
+        
     } else {
         
         [paction setAction:kGAIPADetail];
+        
+        // 自定义指标 View A Model
+        NSString *metricValue3 = @"1";
+        [tracker set:[GAIFields customMetricForIndex:3] value:metricValue3]; //
     }
     [builder setProductAction:paction];
     
+    // 自定义维度
+    NSString *dimensionValue1 = productName;
+    [tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue1]; // Model Name
+    NSString *dimensionValue2 = appDelegate.user;
+    [tracker set:[GAIFields customDimensionForIndex:2] value:dimensionValue2]; // User Name
+    NSString *dimensionValue3 = appDelegate.customerInfo[@"customer_name"];
+    [tracker set:[GAIFields customDimensionForIndex:3] value:dimensionValue3]; // Customer Name
     
+    //----------------
     [tracker send:[builder build]];
-    
-    
+}
+
++ (void)clearTracker {
+    id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
+    [tracker set:[GAIFields customMetricForIndex:3] value:nil]; //
+    [tracker set:[GAIFields customMetricForIndex:4] value:nil];
+    [tracker set:[GAIFields customDimensionForIndex:1] value:nil];
+//    [tracker set:[GAIFields customDimensionForIndex:2] value:nil];
+//    [tracker set:[GAIFields customDimensionForIndex:3] value:nil];
 }
 
 

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
RedAnt ERP Mobile/common/ERPUtils.m

@@ -260,6 +260,7 @@
     
 //    NSString *preScreenName = [GoogleAnalyst currentTrackScreen];
     
+    [GoogleAnalyst clearTracker];
     // 1.   Track all screens and sessions.
     [GoogleAnalyst trackScreen:screenName];
     

+ 4 - 0
RedAnt ERP Mobile/common/Functions/signature/SignatureViewController.m

@@ -252,4 +252,8 @@
 }
 */
 
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+    self.signatureView.frame = self.view.bounds;
+}
+
 @end

+ 1 - 1
RedAnt ERP Mobile/common/Functions/signature/signature.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16A323" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" colorMatched="YES">
     <device id="ipad9_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>

+ 1 - 1
RedAnt ERP Mobile/iSales-NPD/AppDelegate.m

@@ -815,7 +815,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     // 调试使用
 //    gai.logger.logLevel = kGAILogLevelVerbose;
 //    [[GAI sharedInstance] setDryRun:YES];
-//    
+//
 }
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

+ 1 - 1
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -11,7 +11,7 @@
 #define BUILD_NPD
 
 # ifdef DEBUG
-#define test_server 
+#define test_server
 # endif
 
 #define exception_switch 1