Răsfoiți Sursa

Apex CRM
增加推送功能

Ray Zhang 7 ani în urmă
părinte
comite
a0e0dd0374

+ 11 - 2
RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/project.pbxproj

@@ -193,6 +193,7 @@
 		7106E84121AD1BC10056DD20 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		7106E84221AF71310056DD20 /* NSDictionary+Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Extension.h"; path = "../../../../common/NSDictionary/NSDictionary+Extension.h"; sourceTree = "<group>"; };
 		7106E84321AF71310056DD20 /* NSDictionary+Extension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Extension.m"; path = "../../../../common/NSDictionary/NSDictionary+Extension.m"; sourceTree = "<group>"; };
+		713829952215563C002C8A36 /* APEX CRM.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "APEX CRM.entitlements"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -533,6 +534,7 @@
 		7106E80721A684F20056DD20 /* APEX CRM */ = {
 			isa = PBXGroup;
 			children = (
+				713829952215563C002C8A36 /* APEX CRM.entitlements */,
 				42201EE622004FA7008AEADE /* AES */,
 				42201EE2220046E1008AEADE /* User */,
 				421F3EAE21F9B951001A4BB9 /* EmptyView */,
@@ -633,6 +635,11 @@
 				TargetAttributes = {
 					7106E80421A684F20056DD20 = {
 						CreatedOnToolsVersion = 10.1;
+						SystemCapabilities = {
+							com.apple.Push = {
+								enabled = 1;
+							};
+						};
 					};
 				};
 			};
@@ -913,6 +920,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = "APEX CRM/APEX CRM.entitlements";
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "APEX CRM/Info.plist";
@@ -923,7 +931,7 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.APEX-CRM";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				TARGETED_DEVICE_FAMILY = "1,2";
+				TARGETED_DEVICE_FAMILY = 1;
 			};
 			name = Debug;
 		};
@@ -931,6 +939,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = "APEX CRM/APEX CRM.entitlements";
 				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "APEX CRM/Info.plist";
@@ -941,7 +950,7 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.APEX-CRM";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				TARGETED_DEVICE_FAMILY = "1,2";
+				TARGETED_DEVICE_FAMILY = 1;
 			};
 			name = Release;
 		};

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


+ 8 - 0
RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -10,5 +10,13 @@
 			<integer>0</integer>
 		</dict>
 	</dict>
+	<key>SuppressBuildableAutocreation</key>
+	<dict>
+		<key>7106E80421A684F20056DD20</key>
+		<dict>
+			<key>primary</key>
+			<true/>
+		</dict>
+	</dict>
 </dict>
 </plist>

+ 8 - 0
RedAnt CRM/APEX CRM/APEX CRM/APEX CRM.entitlements

@@ -0,0 +1,8 @@
+<?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>aps-environment</key>
+	<string>development</string>
+</dict>
+</plist>

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

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

+ 5 - 0
RedAnt CRM/APEX CRM/APEX CRM/AppDelegate.m

@@ -28,7 +28,9 @@
     UNAuthorizationOptions options = UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge;
     [center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) {
         if (granted) {
+            dispatch_async(dispatch_get_main_queue(), ^{
             [application registerForRemoteNotifications];
+            });
         } else {
             
         }
@@ -77,6 +79,7 @@
 #pragma mark - Notification
 
 - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
+    [application registerForRemoteNotifications];
     NSLog(@"Fail To Register Remote Notification: %@",error);
 }
 
@@ -89,6 +92,8 @@
     realDeviceToken = [realDeviceToken stringByReplacingOccurrencesOfString:@">" withString:@""];
     realDeviceToken = [realDeviceToken stringByReplacingOccurrencesOfString:@" " withString:@""];
     
+    self.apnToken =realDeviceToken;
+    NSLog(@"apn token %@",realDeviceToken);
     [CRMUser sharedUser].deviceToken = realDeviceToken;
     if (CRMUser.sharedUser.shouldUploadToken) {
         [RADataProvider uploadDeviceToken];

+ 16 - 8
RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.m

@@ -28,6 +28,7 @@
 #import "UIScrollView+Empty.h"
 #import "RAEmptyView.h"
 #import "UIImage+RedAnt.h"
+#import "AppDelegate.h"
 
 
 @interface RAWKWebView () <UINavigationControllerDelegate,UIImagePickerControllerDelegate,MFMailComposeViewControllerDelegate>
@@ -123,7 +124,7 @@
 
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"Signature"];
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"SelectContact"];
-    [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"requestApplicationVersion"];
+    [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"requestApplicationInfo"];
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"cleanCache"];
     
     [self.wkwebView.configuration.userContentController addScriptMessageHandler:self name:@"login"];
@@ -150,7 +151,7 @@
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"DatetimePicker"];
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"Signature"];
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"SelectContact"];
-    [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"requestApplicationVersion"];
+    [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"requestApplicationInfo"];
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"cleanCache"];
     
     [self.wkwebView.configuration.userContentController removeScriptMessageHandlerForName:@"login"];
@@ -580,14 +581,21 @@
     }];
 }
 
-- (void)ra_requestAppVersion:(NSDictionary *)params {
+- (void)ra_requestAppInfo:(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];
     
-    [self returnToWebPage:params value:appVer];
+    NSMutableDictionary * ret = [NSMutableDictionary new];
+    ret[@"appVer"]=appVer;
+    ret[@"apnToken"]=delagate.apnToken ;
+    
+    NSString* Sret=[RAConvertor dict2string:ret];
+    [self returnToWebPage:params value:Sret];
 }
 
 - (void)ra_cleanCache:(NSDictionary *)params {
@@ -863,9 +871,9 @@
     } else if ([message.name isEqualToString:@"SelectContact"]) {
         
         [self handleSelectContact:params];
-    } else if ([message.name isEqualToString:@"requestApplicationVersion"]) {
+    } else if ([message.name isEqualToString:@"requestApplicationInfo"]) {
         
-        [self handleRequestApplicationVersion:params];
+        [self handleRequestApplicationInfo: params];
     } else if ([message.name isEqualToString:@"cleanCache"]) {
         
         [self handleCleanCache:params];
@@ -992,8 +1000,8 @@
     [self ra_selectContact:params];
 }
 
-- (void)handleRequestApplicationVersion:(NSDictionary *)params {
-    [self ra_requestAppVersion:params];
+- (void)handleRequestApplicationInfo:(NSDictionary *)params {
+    [self ra_requestAppInfo:params];
 }
 
 - (void)handleCleanCache:(NSDictionary *)params {

BIN
RedAnt CRM/RedAnt CRM.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 94 - 14
RedAnt CRM/RedAnt CRM.xcworkspace/xcuserdata/ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -10,7 +10,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
-            timestampString = "565770271.81768"
+            timestampString = "570339247.853042"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "490"
@@ -26,11 +26,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
-            timestampString = "565770271.818109"
+            timestampString = "570339247.853507"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "719"
-            endingLineNumber = "719"
+            startingLineNumber = "734"
+            endingLineNumber = "734"
             landmarkName = "-userContentController:didReceiveScriptMessage:"
             landmarkType = "7">
          </BreakpointContent>
@@ -38,15 +38,15 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
-            timestampString = "565770271.818174"
+            timestampString = "570339247.853829"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "733"
-            endingLineNumber = "733"
+            startingLineNumber = "748"
+            endingLineNumber = "748"
             landmarkName = "-userContentController:didReceiveScriptMessage:"
             landmarkType = "7">
          </BreakpointContent>
@@ -58,11 +58,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
-            timestampString = "565770271.818224"
+            timestampString = "570339247.854124"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "740"
-            endingLineNumber = "740"
+            startingLineNumber = "755"
+            endingLineNumber = "755"
             landmarkName = "-userContentController:didReceiveScriptMessage:"
             landmarkType = "7">
          </BreakpointContent>
@@ -74,14 +74,94 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
-            timestampString = "565770271.81827"
+            timestampString = "570339247.854424"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "754"
-            endingLineNumber = "754"
+            startingLineNumber = "769"
+            endingLineNumber = "769"
             landmarkName = "-userContentController:didReceiveScriptMessage:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
+            timestampString = "570339247.854707"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "394"
+            endingLineNumber = "394"
+            landmarkName = "-ra_signature:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
+            timestampString = "570339247.854983"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "846"
+            endingLineNumber = "846"
+            landmarkName = "-handlePhoto:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
+            timestampString = "570339247.8552639"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "154"
+            endingLineNumber = "154"
+            landmarkName = "-ra_openPhotoLibrary:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
+            timestampString = "570339247.855821"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "580"
+            endingLineNumber = "580"
+            landmarkName = "-returnToWebPage:value:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "APEX CRM/APEX CRM/RAWKWebView.m"
+            timestampString = "570339247.856096"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "593"
+            endingLineNumber = "593"
+            landmarkName = "-webPageCallback:caller:value:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>