Browse Source

APEX CRM 1.16

Ray Zhang 7 năm trước cách đây
mục cha
commit
28eb55a00e
26 tập tin đã thay đổi với 84 bổ sung34 xóa
  1. BIN
      RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
  2. 1 1
      RedAnt CRM/APEX CRM/APEX CRM/AppDelegate.h
  3. 3 3
      RedAnt CRM/APEX CRM/APEX CRM/AppDelegate.m
  4. 17 17
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/Contents.json
  5. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-1.png
  6. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-2.png
  7. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-3.png
  8. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-4.png
  9. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-5.png
  10. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-6.png
  11. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-7.png
  12. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-8.png
  13. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-9.png
  14. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon.png
  15. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneApp_60pt@2x.png
  16. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneApp_60pt@3x.png
  17. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneNotification_20pt@2x.png
  18. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneNotification_20pt@3x.png
  19. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight5_29pt@2x.png
  20. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight5_29pt@3x.png
  21. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight7_40pt@2x.png
  22. BIN
      RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight7_40pt@3x.png
  23. 1 1
      RedAnt CRM/APEX CRM/APEX CRM/Info.plist
  24. 38 5
      RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.m
  25. 5 4
      RedAnt CRM/APEX CRM/APEX CRM/WKWebTestViewController.m
  26. 19 3
      RedAnt CRM/APEX CRM/APEX CRM/config/config.h

BIN
RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
RedAnt CRM/APEX CRM/APEX CRM/AppDelegate.h

@@ -13,6 +13,6 @@
 @property (strong, nonatomic) UIWindow *window;
 
 @property (strong, nonatomic) NSString *apnToken;
-@property (strong, nonatomic) NSMutableDictionary *launchNotification;
+@property (strong, nonatomic) NSString *launchNotification;
 @end
 

+ 3 - 3
RedAnt CRM/APEX CRM/APEX CRM/AppDelegate.m

@@ -46,8 +46,8 @@
             userInfo[@"launch_app"]=@(true);
                 NSLog(@"didFinishLaunchingWithOptions launch from notification");
             
-            self.launchNotification = userInfo;
-            [self receiveNotification:userInfo];
+            self.launchNotification = [RAConvertor dict2string:userInfo];
+//            [self receiveNotification:userInfo];
         }
     }
     return YES;
@@ -187,7 +187,7 @@ content-available = 1
 }
 
 - (void)receiveNotification:(NSDictionary *)userInfo {
-    int badge=[userInfo[@"aps"][@"badge"] intValue]-1;
+    int badge=0;//[userInfo[@"aps"][@"badge"] intValue]-1;
     [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge];
     [[NSNotificationCenter defaultCenter] postNotificationName:CRM_REMOTE_NOTIFICATION_RECEVIED object:self userInfo:userInfo];
 }

+ 17 - 17
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -3,103 +3,103 @@
     {
       "size" : "20x20",
       "idiom" : "iphone",
-      "filename" : "appicon-1.png",
+      "filename" : "google_md_icon_grid-08iPhoneNotification_20pt@2x.png",
       "scale" : "2x"
     },
     {
       "size" : "20x20",
       "idiom" : "iphone",
-      "filename" : "appicon-2.png",
+      "filename" : "google_md_icon_grid-08iPhoneNotification_20pt@3x.png",
       "scale" : "3x"
     },
     {
       "size" : "29x29",
       "idiom" : "iphone",
-      "filename" : "appicon-3.png",
+      "filename" : "google_md_icon_grid-08iPhoneSpootlight5_29pt@2x.png",
       "scale" : "2x"
     },
     {
       "size" : "29x29",
       "idiom" : "iphone",
-      "filename" : "appicon-4.png",
+      "filename" : "google_md_icon_grid-08iPhoneSpootlight5_29pt@3x.png",
       "scale" : "3x"
     },
     {
       "size" : "40x40",
       "idiom" : "iphone",
-      "filename" : "appicon-5.png",
+      "filename" : "google_md_icon_grid-08iPhoneSpootlight7_40pt@2x.png",
       "scale" : "2x"
     },
     {
       "size" : "40x40",
       "idiom" : "iphone",
-      "filename" : "appicon-6.png",
+      "filename" : "google_md_icon_grid-08iPhoneSpootlight7_40pt@3x.png",
       "scale" : "3x"
     },
     {
       "size" : "60x60",
       "idiom" : "iphone",
-      "filename" : "appicon-7.png",
+      "filename" : "google_md_icon_grid-08iPhoneApp_60pt@2x.png",
       "scale" : "2x"
     },
     {
       "size" : "60x60",
       "idiom" : "iphone",
-      "filename" : "appicon-8.png",
+      "filename" : "google_md_icon_grid-08iPhoneApp_60pt@3x.png",
       "scale" : "3x"
     },
     {
       "size" : "20x20",
       "idiom" : "ipad",
-      "filename" : "appicon-9.png",
+      "filename" : "appicon-2.png",
       "scale" : "1x"
     },
     {
       "size" : "20x20",
       "idiom" : "ipad",
-      "filename" : "appicon-10.png",
+      "filename" : "appicon-3.png",
       "scale" : "2x"
     },
     {
       "size" : "29x29",
       "idiom" : "ipad",
-      "filename" : "appicon-11.png",
+      "filename" : "appicon-4.png",
       "scale" : "1x"
     },
     {
       "size" : "29x29",
       "idiom" : "ipad",
-      "filename" : "appicon-12.png",
+      "filename" : "appicon-5.png",
       "scale" : "2x"
     },
     {
       "size" : "40x40",
       "idiom" : "ipad",
-      "filename" : "appicon-13.png",
+      "filename" : "appicon-6.png",
       "scale" : "1x"
     },
     {
       "size" : "40x40",
       "idiom" : "ipad",
-      "filename" : "appicon-14.png",
+      "filename" : "appicon-7.png",
       "scale" : "2x"
     },
     {
       "size" : "76x76",
       "idiom" : "ipad",
-      "filename" : "appicon-15.png",
+      "filename" : "appicon-8.png",
       "scale" : "1x"
     },
     {
       "size" : "76x76",
       "idiom" : "ipad",
-      "filename" : "appicon-16.png",
+      "filename" : "appicon-9.png",
       "scale" : "2x"
     },
     {
       "size" : "83.5x83.5",
       "idiom" : "ipad",
-      "filename" : "appicon-17.png",
+      "filename" : "appicon-1.png",
       "scale" : "2x"
     },
     {

BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-1.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-2.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-3.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-4.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-5.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-6.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-7.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-8.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon-9.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/appicon.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneApp_60pt@2x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneApp_60pt@3x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneNotification_20pt@2x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneNotification_20pt@3x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight5_29pt@2x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight5_29pt@3x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight7_40pt@2x.png


BIN
RedAnt CRM/APEX CRM/APEX CRM/Assets.xcassets/AppIcon.appiconset/google_md_icon_grid-08iPhoneSpootlight7_40pt@3x.png


+ 1 - 1
RedAnt CRM/APEX CRM/APEX CRM/Info.plist

@@ -15,7 +15,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.11</string>
+	<string>1.16</string>
 	<key>CFBundleVersion</key>
 	<string>40506</string>
 	<key>LSRequiresIPhoneOS</key>

+ 38 - 5
RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.m

@@ -132,6 +132,7 @@
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"login"];
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"logout"];
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"UpdateBadge"];
+    [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"QueryLaunchNotification"];
     
     //    [self.configuration.userContentController addScriptMessageHandler:self name:@"Color"];
     //    [self.configuration.userContentController addScriptMessageHandler:self name:@"Pay"];
@@ -160,6 +161,7 @@
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"login"];
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"logout"];
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"UpdateBadge"];
+    [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"QueryLaunchNotification"];
     
 }
 - (void)dealloc
@@ -598,6 +600,25 @@
     [self returnToWebPage:params value:Sret];
 }
 
+- (void)ra_queryLaunchNotification:(NSDictionary *)params {
+    
+    AppDelegate *delagate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
+    
+//    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
+//    NSString *ver = [infoDic objectForKey:@"CFBundleShortVersionString"];
+//    NSString *build = [infoDic objectForKey:@"CFBundleVersion"];
+//    NSString *appVer = [NSString localizedStringWithFormat:@"Ver: %@ build %@",ver,build];
+//
+//    NSMutableDictionary * ret = [NSMutableDictionary new];
+//    ret[@"appVer"]=appVer;
+//    ret[@"apnToken"]=delagate.apnToken ;
+//
+//    NSString* Sret=[RAConvertor dict2string:ret];
+    [self returnToWebPage:params value:delagate.launchNotification];
+    delagate.launchNotification = nil;
+    
+}
+
 - (void)ra_cleanCache:(NSDictionary *)params {
     
     /**
@@ -681,7 +702,7 @@
 
 #pragma mark - Web Callback
 
--(void) returnToWebPage:(NSDictionary*)params value:(NSObject*)value
+-(void) returnToWebPage:(NSDictionary*)params value:(NSString*)value
 {
     if(![params isNull:@"returnid"] )
     {
@@ -693,16 +714,19 @@
         [self webPageCallback:params caller:params[@"id"] value:value];
     }
 }
--(void) webPageCallback:(NSDictionary*)params caller:(NSString*) callerid value:(NSObject*)value
+-(void) webPageCallback:(NSDictionary*)params caller:(NSString*) callerid value:(NSString*)value
 {
 //    NSString* caller = [NSString stringWithFormat:@"'%@'",callerid];
     NSString *caller = [callerid ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
-    if([value isKindOfClass:NSString.class])
+    if(value==nil)
+        value=@"";
+//    if([value isKindOfClass:NSString.class])
     {
 //        value =[NSString stringWithFormat:@"'%@'",value];
         value = [(NSString *)value ra_stringByEscapingForJavascriptWithDelimiter:'\'' wrapWithDelimiters:YES];
     }
-    NSString *jsStr = [NSString stringWithFormat:params[@"callback"],caller.UTF8String,value.description.UTF8String];
+
+    NSString *jsStr = [NSString stringWithFormat:params[@"callback"],caller.UTF8String,value.UTF8String];
     [self.wkwebView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
         NSLog(@"%@----%@",result, error);
     }];
@@ -874,7 +898,12 @@
     } else if ([message.name isEqualToString:@"requestApplicationInfo"]) {
         
         [self handleRequestApplicationInfo: params];
-    } else if ([message.name isEqualToString:@"UpdateBadge"]) {
+    }else if ([message.name isEqualToString:@"QueryLaunchNotification"]) {
+        
+        [self ra_queryLaunchNotification: params];
+    }
+    
+    else if ([message.name isEqualToString:@"UpdateBadge"]) {
         
         [self handleUpdateBadge: params];
     } else if ([message.name isEqualToString:@"cleanCache"]) {
@@ -1002,6 +1031,7 @@
     
     [self ra_selectContact:params];
 }
+
 - (void)handleUpdateBadge:(NSDictionary *)params {
     [UIApplication sharedApplication].applicationIconBadgeNumber = [params[@"count"] intValue];
 //    [self ra_requestAppInfo:params];
@@ -1009,6 +1039,9 @@
 - (void)handleRequestApplicationInfo:(NSDictionary *)params {
     [self ra_requestAppInfo:params];
 }
+- (void)QueryLaunchNotification:(NSDictionary *)params {
+    [self ra_requestAppInfo:params];
+}
 
 - (void)handleCleanCache:(NSDictionary *)params {
     [self ra_cleanCache:params];

+ 5 - 4
RedAnt CRM/APEX CRM/APEX CRM/WKWebTestViewController.m

@@ -19,6 +19,7 @@
 @property (weak, nonatomic) IBOutlet RAWKWebView *webview;
 @property (nonatomic,assign) BOOL loaded;
 @property (nonatomic,strong) NSString* notificationstr;
+@property (nonatomic,strong) NSString* launch_notificationstr;
 
 @end
 
@@ -52,10 +53,10 @@
         [self.navigationController pushViewController:vc animated:YES];
     };
 
-    AppDelegate *delagate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
-    NSMutableDictionary* aps =[delagate.launchNotification[@"aps"] mutableCopy];
-    aps[@"launch_app"] =delagate.launchNotification[@"launch_app"];
-    self.notificationstr = [RAConvertor dict2string:aps];
+//    AppDelegate *delagate =(AppDelegate *) [[UIApplication sharedApplication]delegate];
+//    NSMutableDictionary* aps =[delagate.launchNotification[@"aps"] mutableCopy];
+//    aps[@"launch_app"] =delagate.launchNotification[@"launch_app"];
+//    self.launch_notificationstr = [RAConvertor dict2string:aps];
     [self regirsterBroadcast];
 }
 

+ 19 - 3
RedAnt CRM/APEX CRM/APEX CRM/config/config.h

@@ -8,12 +8,28 @@
 
 #ifndef config_h
 #define config_h
+
+# ifdef DEBUG
+
+
+#define test_server
+
+
+# endif
+
+#ifdef test_server
+
+#define URL_SERVER @"http://192.168.1.108:8081"
+#define URL_LOGIN @"http://192.168.1.108:8081/j/crm/mobile/login"
+#define URL_UPDATE_TOKEN @"http://192.168.1.108:8081/j/crm/mobile/token.mo/"
+
+#else
+
 #define URL_SERVER @"https://ra.apexshipping.com"
 #define URL_LOGIN @"https://ra.apexshipping.com/apexcrm/crm/mobile/login"
 #define URL_UPDATE_TOKEN @"https://ra.apexshipping.com/apexcrm/crm/mobile/token.mo/"
 
-//#define URL_SERVER @"http://192.168.1.108:8081"
-//#define URL_LOGIN @"http://192.168.1.108:8081/j/crm/mobile/login"
-//#define URL_UPDATE_TOKEN @"http://192.168.1.108:8081/j/crm/mobile/token.mo/"
+#endif
+
 
 #endif /* config_h */