“wangdongchao” 1 éve
szülő
commit
7fe3416097

+ 6 - 0
Asteria.xcodeproj/project.pbxproj

@@ -232,6 +232,7 @@
 		8810F5A82C01849C00346FD4 /* ASGoodsReviewFootCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8810F5A72C01849C00346FD4 /* ASGoodsReviewFootCell.m */; };
 		8810F5AB2C045FD600346FD4 /* ToolStripePayment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8810F5AA2C045FD600346FD4 /* ToolStripePayment.swift */; };
 		88484D262C4132AB007C3293 /* ASJumpHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 88484D252C4132AB007C3293 /* ASJumpHandler.m */; };
+		88484D292C4606DD007C3293 /* AppDelegate+PushNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 88484D282C4606DD007C3293 /* AppDelegate+PushNotification.m */; };
 		88516B6E2C12E51600F2E396 /* ASLoginBindingC.m in Sources */ = {isa = PBXBuildFile; fileRef = 88516B6D2C12E51600F2E396 /* ASLoginBindingC.m */; };
 		88C9F9202C3FC64400B47ADA /* ASPushOneSignalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C9F91F2C3FC64400B47ADA /* ASPushOneSignalManager.m */; };
 		8C24ECE114420CDEE7B9B22B /* Pods_Asteria.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54DCE8001991D89B696E7D44 /* Pods_Asteria.framework */; };
@@ -818,6 +819,8 @@
 		8810F5AA2C045FD600346FD4 /* ToolStripePayment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToolStripePayment.swift; sourceTree = "<group>"; };
 		88484D242C4132AB007C3293 /* ASJumpHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASJumpHandler.h; sourceTree = "<group>"; };
 		88484D252C4132AB007C3293 /* ASJumpHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASJumpHandler.m; sourceTree = "<group>"; };
+		88484D272C4606DD007C3293 /* AppDelegate+PushNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+PushNotification.h"; sourceTree = "<group>"; };
+		88484D282C4606DD007C3293 /* AppDelegate+PushNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+PushNotification.m"; sourceTree = "<group>"; };
 		88516B6C2C12E51600F2E396 /* ASLoginBindingC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLoginBindingC.h; sourceTree = "<group>"; };
 		88516B6D2C12E51600F2E396 /* ASLoginBindingC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASLoginBindingC.m; sourceTree = "<group>"; };
 		88C9F91E2C3FC64400B47ADA /* ASPushOneSignalManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASPushOneSignalManager.h; sourceTree = "<group>"; };
@@ -1550,6 +1553,8 @@
 				9AD364CC2A05EBE800452C7A /* Fuction */,
 				8172449D29F3B2ED005FA9C9 /* AppDelegate.h */,
 				8172449E29F3B2ED005FA9C9 /* AppDelegate.m */,
+				88484D272C4606DD007C3293 /* AppDelegate+PushNotification.h */,
+				88484D282C4606DD007C3293 /* AppDelegate+PushNotification.m */,
 				9ACBEC2A2A14CCA200A8F97A /* ThirdPartService.h */,
 				9ACBEC292A14CCA200A8F97A /* ThirdPartService.m */,
 				814F5CF12A11B337003847A9 /* ASUI */,
@@ -3144,6 +3149,7 @@
 				8810F5812BF74A5800346FD4 /* ASGoodsDetailsTableView.m in Sources */,
 				9AD346202A08E30E005CA070 /* SelectVCollectionViewCell.m in Sources */,
 				81601FFB2A2DC78300E4A8F1 /* WMZBannerOverLayout.m in Sources */,
+				88484D292C4606DD007C3293 /* AppDelegate+PushNotification.m in Sources */,
 				81354C002A2899CB0082C93A /* KWMineMoreProductModel.m in Sources */,
 				81717D362A3D322700648139 /* KWLenovoWordListView.m in Sources */,
 				8134C1BA2A1372A7006EB0EC /* ASUserCenterEnterItemV.m in Sources */,

+ 24 - 0
Asteria/AppDelegate+PushNotification.h

@@ -0,0 +1,24 @@
+//
+//  AppDelegate+PushNotification.h
+//  Asteria
+//
+//  Created by xingyu on 2024/7/16.
+//
+
+#import "AppDelegate.h"
+#import <OneSignal/OneSignal.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+@interface AppDelegate (PushNotification)<UNUserNotificationCenterDelegate>
+
+//初始化OneSignal  SDK
+- (void)initPushNotificationConfig:(NSDictionary *)launchOptions;
+
+//处理推送消息
+//- (void)handlePushAction:(NSDictionary *)payLoad;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 171 - 0
Asteria/AppDelegate+PushNotification.m

@@ -0,0 +1,171 @@
+//
+//  AppDelegate+PushNotification.m
+//  Asteria
+//
+//  Created by xingyu on 2024/7/16.
+//
+
+#import "AppDelegate+PushNotification.h"
+#import "ASJumpHandler.h"
+
+@implementation AppDelegate (PushNotification)
+
+- (void)initPushNotificationConfig:(NSDictionary *)launchOptions; {
+    
+    //初始化OneSignal SDK
+    [ASOneSignalManager initOneSignalSDKWithPushConfig:launchOptions];
+    //启动设置用户推送标签
+    [ASOneSignalManager setPushApnsTagWithUserInfo];
+    
+    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
+    [self pushAuthRequest];
+    
+#ifdef DEBUG
+    [PPNetworkHelper openLog];
+#else
+    [PPNetworkHelper closeLog];
+#endif
+    
+}
+
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+    NSLog(@"--------userInfo:%@",userInfo);
+//    completionHandler(UIBackgroundFetchResultNewData);
+    [self handlePush:userInfo];
+    
+}
+
+#pragma mark - dealwith push data
+
+/// 处理来自远程的推送内容
+- (void)handlePush:(NSDictionary *)payLoad {
+    if (payLoad == nil) {
+        return;
+    }
+    
+    NSDictionary *aps = [payLoad valueForKey:@"aps"];
+    if (aps == nil) {
+        return;
+    }
+    
+    UIApplication *application = [UIApplication sharedApplication];
+   
+    // 当前 APP 在前台
+    if (application.applicationState == UIApplicationStateActive || application.applicationState == UIApplicationStateBackground) { //活动状态下使用消息提示再提示一下,让用户可以点击
+        // 备注:这边比较特殊,当 APP 在前台时,当推送来的时候,会来到这个方法,当点击推送弹窗后,这个方法会再次调用,即这个方法会调用两次,走两次 push 操作.
+        NSLog(@"payLoad=%@",payLoad);
+//        [self handlePushAction:payLoad];  // 处理推送消息
+
+    } else {
+        [self handlePushAction:payLoad];  // 处理推送消息
+    }
+}
+
+- (void)handlePushAction:(NSDictionary *)payLoad {
+    
+    NSDictionary *customData = payLoad[@"custom"][@"a"];
+    NSString *title = customData[@"title"];
+    NSString *push_para = customData[@"push_para"];
+    NSString *message_id = customData[@"message_id"];
+    NSNumber *push_type = customData[@"push_type"];
+    if (!push_type) {
+        return;
+    }
+    NSInteger type = push_type.integerValue;
+    
+    
+    [[ASJumpHandler shareInstance] handleMessage:title messageId:message_id pushPara:push_para pushType:type];
+    
+    
+}
+
+
+#pragma mark ---- UNUserNotificationCenterDelegate ----
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
+    // 用户点击了通知
+        // 通过response参数处理用户的点击事件
+    completionHandler();
+    NSDictionary *payLoad = response.notification.request.content.userInfo;
+    [self handlePushAction:payLoad];
+}
+
+
+- (void)pushAuthRequest {
+    // 申请权限1
+    [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
+        if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined) {
+            UNAuthorizationOptions authOptions =
+            UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
+            [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions
+                                                                                completionHandler:^(BOOL granted, NSError *_Nullable error){
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
+                });
+            }];
+            
+        }
+    }];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
+    });
+}
+
+- (void)clearBadge {
+    [UIApplication sharedApplication].applicationIconBadgeNumber = -1;
+}
+
+
+
+-(void)oneSignalPushConfig:(NSDictionary *)launchOptions{
+    /*
+//#ifdef DEBUG
+//    [MobPush setAPNsForProduction:NO];
+//#else
+//    [MobPush setAPNsForProduction:YES];
+//#endif
+//    //设置地区:regionId 默认0(国内),1:海外
+//    [MobPush setRegionID:1];
+//    //MobPush推送设置(获得角标、声音、弹框提醒权限)
+//    MPushNotificationConfiguration *configuration = [[MPushNotificationConfiguration alloc] init];
+//    configuration.types = MPushAuthorizationOptionsBadge | MPushAuthorizationOptionsSound | MPushAuthorizationOptionsAlert;
+//    [MobPush setupNotification:configuration];
+//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMessage:) name:MobPushDidReceiveMessageNotification object:nil];
+    */
+
+    
+//    // Remove this method to stop OneSignal Debugging
+//      [OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
+//
+//      // OneSignal initialization
+//      [OneSignal initWithLaunchOptions:launchOptions];
+//      [OneSignal setAppId:@"618fe580-bc97-4bf4-b2bb-5039f9dbbc82"];
+//
+//      // promptForPushNotifications will show the native iOS notification permission prompt.
+//      // We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step 8)
+//      [OneSignal promptForPushNotificationsWithUserResponse:^(BOOL accepted) {
+//        NSLog(@"User accepted notifications: %d", accepted);
+//      }];
+    
+    
+      
+      // Set your customer userId
+      // [OneSignal setExternalUserId:@"userId"];
+    
+    // Pass in email provided by customer
+    // [OneSignal setEmail:@"example@domain.com"];
+
+    // Pass in phone number provided by customer
+    // [OneSignal setSMSNumber:@"+11234567890"];
+    
+    
+    // [OneSignal sendTag:@"key" value:@"value"];
+
+#ifdef DEBUG
+    [PPNetworkHelper openLog];
+#else
+    [PPNetworkHelper closeLog];
+#endif
+
+}
+
+@end

+ 8 - 150
Asteria/AppDelegate.m

@@ -14,7 +14,7 @@
 
 #import <OneSignal/OneSignal.h>
 
-#import "ASPushOneSignalManager.h"
+#import "AppDelegate+PushNotification.h"
 
 @import Stripe;
 
@@ -46,9 +46,6 @@
     AS_TabBarViewController *tab = [[AS_TabBarViewController alloc] init];
     tab.selectedIndex = 0;
     self.window.rootViewController = tab;
-    if (ASUserInfoManager.shared.isLogin ) {
-        [ASUserInfoManager.shared getInfo];
-    }
     [self.window makeKeyAndVisible];
     
     //StripeAPI
@@ -60,12 +57,13 @@
     [[FBSDKSettings sharedSettings] setAppID:Facebook_AppID];
     
     //推送相关配置
-    [self oneSignalPushConfig:launchOptions];
-    
-    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
-    [self pushAuthRequest];
-//    [OneSignal sendTag:@"SufixUid" value:@"-"];
-//    [self updateUserData];
+    if (ASUserInfoManager.shared.isLogin ) {
+        [ASUserInfoManager.shared getInfo:^{
+            [self initPushNotificationConfig:launchOptions];
+        }];
+    } else {
+        [self initPushNotificationConfig:launchOptions];
+    }
 
     
     return YES;
@@ -80,57 +78,6 @@
     NSLog(@"baseUrl-----%@",config.baseUrl)
 }
 
-- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
-    NSLog(@"--------userInfo:%@",userInfo);
-//    completionHandler(UIBackgroundFetchResultNewData);
-    [self handlePush:userInfo];
-    
-}
-
-#pragma mark - dealwith push data
-
-/// 处理来自远程的推送内容
-- (void)handlePush:(NSDictionary *)payLoad {
-    if (payLoad == nil) {
-        return;
-    }
-    
-    NSDictionary *aps = [payLoad valueForKey:@"aps"];
-    if (aps == nil) {
-        return;
-    }
-    
-    UIApplication *application = [UIApplication sharedApplication];
-   
-    // 当前 APP 在前台
-    if (application.applicationState == UIApplicationStateActive || application.applicationState == UIApplicationStateBackground) { //活动状态下使用消息提示再提示一下,让用户可以点击
-        // 备注:这边比较特殊,当 APP 在前台时,当推送来的时候,会来到这个方法,当点击推送弹窗后,这个方法会再次调用,即这个方法会调用两次,走两次 push 操作.
-        NSLog(@"payLoad=%@",payLoad);
-//        [self handlePushAction:payLoad];  // 处理推送消息
-
-    } else {
-        [self handlePushAction:payLoad];  // 处理推送消息
-    }
-}
-
-- (void)handlePushAction:(NSDictionary *)payLoad {
-    
-    NSDictionary *customData = payLoad[@"custom"][@"a"];
-    NSString *title = customData[@"title"];
-    NSString *push_para = customData[@"push_para"];
-    NSString *message_id = customData[@"message_id"];
-    NSNumber *push_type = customData[@"push_type"];
-    if (!push_type) {
-        return;
-    }
-    NSInteger type = push_type.integerValue;
-    
-    
-//    [[KWPushMessageHandler shareInstance] handleMessage:title messageId:message_id pushPara:push_para pushType:type];
-    
-    
-}
-
 #pragma mark - **************** applicationDelegate  ****************
 - (BOOL)application:(UIApplication *)app
             openURL:(NSURL *)url
@@ -149,95 +96,6 @@
     return YES;
 }
 
-- (void)pushAuthRequest {
-    // 申请权限1
-    [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
-        if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined) {
-            UNAuthorizationOptions authOptions =
-            UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
-            [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions
-                                                                                completionHandler:^(BOOL granted, NSError *_Nullable error){
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
-                });
-            }];
-            
-        }
-    }];
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
-    });
-}
-
-
--(void)oneSignalPushConfig:(NSDictionary *)launchOptions{
-    /*
-//#ifdef DEBUG
-//    [MobPush setAPNsForProduction:NO];
-//#else
-//    [MobPush setAPNsForProduction:YES];
-//#endif
-//    //设置地区:regionId 默认0(国内),1:海外
-//    [MobPush setRegionID:1];
-//    //MobPush推送设置(获得角标、声音、弹框提醒权限)
-//    MPushNotificationConfiguration *configuration = [[MPushNotificationConfiguration alloc] init];
-//    configuration.types = MPushAuthorizationOptionsBadge | MPushAuthorizationOptionsSound | MPushAuthorizationOptionsAlert;
-//    [MobPush setupNotification:configuration];
-//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMessage:) name:MobPushDidReceiveMessageNotification object:nil];
-    */
-    
-    //初始化OneSignal SDK
-    [ASOneSignalManager initOneSignalSDKWithPushConfig:launchOptions];
-    
-    
-    
-//    // Remove this method to stop OneSignal Debugging
-//      [OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
-//      
-//      // OneSignal initialization
-//      [OneSignal initWithLaunchOptions:launchOptions];
-//      [OneSignal setAppId:@"618fe580-bc97-4bf4-b2bb-5039f9dbbc82"];
-//
-//      // promptForPushNotifications will show the native iOS notification permission prompt.
-//      // We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step 8)
-//      [OneSignal promptForPushNotificationsWithUserResponse:^(BOOL accepted) {
-//        NSLog(@"User accepted notifications: %d", accepted);
-//      }];
-    
-    
-      
-      // Set your customer userId
-      // [OneSignal setExternalUserId:@"userId"];
-    
-    // Pass in email provided by customer
-    // [OneSignal setEmail:@"example@domain.com"];
-
-    // Pass in phone number provided by customer
-    // [OneSignal setSMSNumber:@"+11234567890"];
-    
-    
-    // [OneSignal sendTag:@"key" value:@"value"];
-    
-    
-    
-
-    
-    
-#ifdef DEBUG
-    [PPNetworkHelper openLog];
-#else
-    [PPNetworkHelper closeLog];
-#endif
-
-}
-
-- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
-    // 用户点击了通知
-        // 通过response参数处理用户的点击事件
-    completionHandler();
-    NSDictionary *payLoad = response.notification.request.content.userInfo;
-    [self handlePushAction:payLoad];
-}
 
 
 @end

+ 4 - 3
Asteria/Fuction/Cart/PayManager/ASCheckoutPayManager.m

@@ -208,8 +208,9 @@ static ASCheckoutPayManager *_instance = nil;
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
         K_STRONG_SELF;
         [MBProgressHUD hideHUDForView:self.topVC.view animated:YES];
+        [self.topVC.view makeToast:msg duration:2 position:CSToastPositionCenter];
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
+            self.payFinishBlock(self.payType, 0, @{@"msg":@""});
         }
     }];
     
@@ -299,9 +300,9 @@ static ASCheckoutPayManager *_instance = nil;
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
         K_STRONG_SELF;
         [MBProgressHUD hideHUDForView:self.topVC.view animated:YES];
-        
+        [self.topVC.view makeToast:msg duration:2 position:CSToastPositionCenter];
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
+            self.payFinishBlock(self.payType, 0, @{@"msg":@""});
         }
     }];
 }

+ 3 - 1
Asteria/Fuction/Login/VC/AS_LoginC.m

@@ -226,7 +226,9 @@
         
         [DataUtil setLoginToken:token];
         [ASNetTools.shared updateEngine];
-        [ASUserInfoManager.shared getInfo];
+        [ASUserInfoManager.shared getInfo:^{
+            [ASOneSignalManager setPushApnsTagWithUserInfo];
+        }];
         
         K_WEAK_SELF;
         [self.view makeToast:@"Login Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {

+ 6 - 0
Asteria/Fuction/Manager/NotificationManager/ASJumpHandler.h

@@ -13,6 +13,12 @@ NS_ASSUME_NONNULL_BEGIN
 
 + (instancetype)shareInstance;
 
+//推送消息相关点击跳转处理
+- (void)handleMessage:(NSString *)title messageId:(NSString *)mid pushPara:(NSString *)push_para pushType:(NSInteger)type;
+
+//普通广告位类似点击跳转
+- (void)handleJumpWithTitle:(NSString *)title jumpData:(NSString *)jumpData type:(NSInteger)type;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 242 - 0
Asteria/Fuction/Manager/NotificationManager/ASJumpHandler.m

@@ -7,6 +7,16 @@
 
 #import "ASJumpHandler.h"
 
+#import "ASOrderListViewController.h"
+#import "Cart_MyCartC.h"
+#import "ASMessageListViewController.h"
+#import "ASProductListViewController.h"
+#import "ASGoodsDetailsViewController.h"
+#import "ASPointsHomeViewController.h"
+#import "ASVipCenterViewController.h"
+#import "ASCouponsListViewController.h"
+
+
 @implementation ASJumpHandler
 
 static  ASJumpHandler *jumpHandler = nil;
@@ -20,5 +30,237 @@ static  ASJumpHandler *jumpHandler = nil;
 }
 
 
+- (void)handleMessage:(NSString *)title messageId:(NSString *)mid pushPara:(NSString *)push_para pushType:(NSInteger)type {
+    
+    [self handleJumpWithTitle:title jumpData:push_para type:type];
+}
+
+
+- (void)handleJumpWithTitle:(NSString *)title jumpData:(NSString *)jumpData type:(NSInteger)type {
+    
+    
+    UIViewController *topVC = topViewController();
+    /// 跳转类型 0:url 1:商品列表 2:订单列表  3:商品详情   4:购物车  5:消息列表
+    /// 2024-02-27新增: 6.explore首页 7.explore详情 8.我的积分 9.koc 10.vip Center 11.我的优惠券 12. 登录注册, 13.签到 14.首页
+    switch (type) {
+        case 0:
+            [Fuction_Tool push_BaseWebUrl:jumpData  webTitle:title];
+            break;
+        case 1:
+            [self pushToProductList:title typeid:jumpData];
+            break;
+        case 2:
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            
+            if (![topVC isKindOfClass:[ASOrderListViewController class]]) {
+                ASOrderListViewController *orderC = [[ASOrderListViewController alloc] init];
+                [topVC.navigationController pushViewController:orderC animated:true];
+            }
+        }
+            break;
+        case 3:
+            [self goto_WKM_GoodsDetailsC:jumpData];
+            break;
+        case 4:
+        {
+            
+            if (![topVC isKindOfClass:[Cart_MyCartC class]]) {
+                Cart_MyCartC *cartC = [[Cart_MyCartC alloc]init];
+                [topVC.navigationController pushViewController:cartC animated:true];
+            }
+        }
+            break;
+        case 5: {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            
+            if (![topVC isKindOfClass:[ASMessageListViewController class]]) {
+                ASMessageListViewController *mesVC = [[ASMessageListViewController alloc]init];
+                [topVC.navigationController pushViewController:mesVC animated:true];
+            }
+        }
+            break;
+        case 6:// explore列表
+        {
+//            [Fuction_Tool navPopRootToExpolerVC];
+        }
+            break;
+        case 7:// explore详情
+        {
+//            [self goto_exploreDetailsC:push_para];
+        }
+            break;
+        case 8:// 积分
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            [self to_pointsVc];
+        }
+            break;
+        case 9:// koc
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            [self to_KocVc];
+        }
+            break;
+        case 10:// vip center
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            [self to_vipCenter];
+        }
+            break;
+        case 11:// 我的优惠券
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            NSInteger index = jumpData.integerValue;
+            [self to_couponsVc:index];
+        }
+            break;
+        case 12://登录注册
+        {
+            [Fuction_Tool pop_toLoginVC];
+        }
+            break;
+        case 13://签到
+        {
+            if (!ASUserInfoManager.shared.isLogin) {
+                [Fuction_Tool pop_toLoginVC];
+                return;
+            }
+            [self to_checkInVc];
+        }
+            break;
+        case 14:// 首页
+            [Fuction_Tool popToHomeVc];
+            break;
+        default:
+            if (jumpData.isValidUrl) {
+                [Fuction_Tool push_BaseWebUrl:jumpData webTitle:title];
+                
+            }
+            break;
+    }
+}
+
+-(void)pushToProductList:(NSString *)name typeid:(NSString *)typeId {
+    if (typeId == nil || [typeId isEqualToString:@""]) {
+        return;
+    }
+    if (name == nil || [name isEqualToString:@""]) {
+        name = @"Products";
+    }
+    ASProductListViewController *vc = [[ASProductListViewController alloc] init];
+    vc.titleName = name;
+    vc.type = typeId;
+    [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
+
+}
+
+-(void)goto_WKM_GoodsDetailsC:(NSString *)entity_id {
+    ASGoodsDetailsViewController *vc = [[ASGoodsDetailsViewController alloc]init];
+    vc.entity_id = entity_id;
+    [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
+
+}
+
+//// 跳explore详情
+//-(void)goto_exploreDetailsC:(NSString *)entity_id {
+//    UIViewController *topC = [Current_normalTool topViewController];
+//    if ([topC isKindOfClass:AP_ExploreDetailsC.class]) {
+//        return;
+//    }
+//    AP_ExploreDetailsC *vc = [[AP_ExploreDetailsC alloc]init];
+//    ExploreListM *m = [[ExploreListM alloc] init];
+//    m.listId = entity_id;
+//    vc.listModel =  m;
+//    [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
+//
+//}
+
+- (void)to_pointsVc {
+    UIViewController *topC = [Current_normalTool topViewController];
+    if ([topC isKindOfClass:ASPointsHomeViewController.class]) {
+        return;
+    }
+    ASPointsHomeViewController *vc = [[ASPointsHomeViewController alloc] init];
+    [topC.navigationController pushViewController:vc animated:true];
+}
+
+
+- (void)to_KocVc {
+//    UIViewController *vc = [Current_normalTool topViewController];
+//    if ([vc isKindOfClass:KWBrandAMBViewController.class] || [vc isKindOfClass:[APKocTotalViewController class]]) {
+//        return;
+//    }
+//    UIWindow *w = UIApplication.sharedApplication.windows.firstObject;
+//    [MBProgressHUD showHUDAddedTo:w animated:true];
+//    __block BOOL hadPush = false;
+//    [[KWBalanceInfoManager shareInstance] updateApplyStatus:^(BOOL flag) {
+//        [MBProgressHUD hideHUDForView:w animated:true];
+//        if (hadPush) {
+//            return;
+//        }
+//        hadPush = true;
+//        if (![KWBalanceInfoManager shareInstance].isApply) {
+//            KWBrandAMBViewController *vc = [KWBrandAMBViewController new];
+//            [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
+//        } else {
+//            APKocTotalViewController *vc = [[APKocTotalViewController alloc] init];
+//            [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
+//        }
+//    }];
+}
+
+- (void)to_vipCenter {
+    UIViewController *vc = [Current_normalTool topViewController];
+//    [MBProgressHUD showHUDAddedTo:vc.view animated:true];
+//    __block BOOL hadPush = false;
+//    
+//    [KWLoginedManager.shareInstance getAllLevelInfo:^(bool flag) {
+//        if (hadPush) {
+//            return;
+//        }
+//        hadPush = true;
+//        [MBProgressHUD hideHUDForView:vc.view animated:true];
+//        ASVipCenterViewController *vc = [[ASVipCenterViewController alloc] init];
+//        vc.currentLeave = KWLoginedManager.shareInstance.levelInfo.level;
+//        [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
+//    }];
+    
+    
+    ASVipCenterViewController *vipCenterVC = [[ASVipCenterViewController alloc] init];
+//    vipCenterVC.currentLeave = KWLoginedManager.shareInstance.levelInfo.level;
+    [vc.navigationController pushViewController:vipCenterVC animated:true];
+
+}
+
+- (void)to_couponsVc:(NSInteger)index {
+    ASCouponsListViewController *vc = [[ASCouponsListViewController alloc] init];
+    [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
+}
+
+- (void)to_checkInVc {
+//    WK_CheckPointsC *vc = [[WK_CheckPointsC alloc] init];
+//    KWLoginedUserModel *m = [KWLoginedManager.shareInstance getCurrentLoginedUser];
+//    vc.points = m.points;
+//    [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
+}
 
 @end

+ 2 - 5
Asteria/Fuction/Manager/NotificationManager/ASPushOneSignalManager.h

@@ -19,11 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 //初始化OneSignal  SDK
 - (void)initOneSignalSDKWithPushConfig:(NSDictionary *)launchOptions;
 
-//处理推送消息
-- (void)handlePushAction:(NSDictionary *)payLoad;
-
-//设置用户推送标签  userInfo 为nil 默认取本地
-- (void)setPushApnsTagWithUserInfo:(ASUserModel *)userInfo;
+//设置用户推送标签
+- (void)setPushApnsTagWithUserInfo;
 
 @end
 

+ 2 - 57
Asteria/Fuction/Manager/NotificationManager/ASPushOneSignalManager.m

@@ -37,38 +37,14 @@
       NSLog(@"User accepted notifications: %d", accepted);
     }];
     
-    
-//    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
-//    [self pushAuthRequest];
-    
 }
 
-- (void)handlePushAction:(NSDictionary *)payLoad {
-    
-    NSDictionary *customData = payLoad[@"custom"][@"a"];
-    NSString *title = customData[@"title"];
-    NSString *push_para = customData[@"push_para"];
-    NSString *message_id = customData[@"message_id"];
-    NSNumber *push_type = customData[@"push_type"];
-    if (!push_type) {
-        return;
-    }
-    NSInteger type = push_type.integerValue;
-    
-    
-//    [[KWPushMessageHandler shareInstance] handleMessage:title messageId:message_id pushPara:push_para pushType:type];
-    
-    
-}
 
 #pragma mark ---- 设置用户推送标签 ----
-- (void)setPushApnsTagWithUserInfo:(ASUserModel *)userInfo {
+- (void)setPushApnsTagWithUserInfo {
     
     if ([ASUserInfoManager shared].isLogin) {
-        if (!userInfo) {
-            userInfo = [[ASUserInfoManager shared] userInfo];
-        }
-        
+        ASUserModel *userInfo = [[ASUserInfoManager shared] userInfo];
         if (!userInfo.Id.isEmpty) {
             NSInteger sufix = userInfo.Id.integerValue%10;
             [OneSignal sendTag:@"SufixUid" value:[NSString stringWithFormat:@"%ld", sufix]];
@@ -88,38 +64,7 @@
     } else {
         [OneSignal sendTag:@"SufixUid" value:@"-"];
     }
-    
-}
-
-
-#pragma mark ---- UNUserNotificationCenterDelegate ----
-- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
-    // 用户点击了通知
-        // 通过response参数处理用户的点击事件
-    completionHandler();
-    NSDictionary *payLoad = response.notification.request.content.userInfo;
-    [self handlePushAction:payLoad];
 }
 
 
-- (void)pushAuthRequest {
-    // 申请权限1
-    [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
-        if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined) {
-            UNAuthorizationOptions authOptions =
-            UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
-            [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions
-                                                                                completionHandler:^(BOOL granted, NSError *_Nullable error){
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
-                });
-            }];
-            
-        }
-    }];
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[UIApplication sharedApplication] registerForRemoteNotifications]; //注册获得device Token
-    });
-}
-
 @end

+ 2 - 0
Asteria/Fuction/Manager/UserManager/info/ASUserInfoManager.h

@@ -36,6 +36,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)getInfo;
 
+- (void)getInfo:(void(^)(void))completeBlock;
+
 - (void)baseInfoNet:(void(^)(void))comp;
 
 @end

+ 10 - 0
Asteria/Fuction/Manager/UserManager/info/ASUserInfoManager.m

@@ -34,6 +34,16 @@
     return self;
 }
 
+- (void)getInfo:(void(^)(void))completeBlock {
+    [self baseInfoNet:^{
+        if (completeBlock) {
+            completeBlock();
+        }
+    }];
+    [self vipInfoNet];
+    [self birthInfoNet];
+}
+
 - (void)getInfo {
     [self baseInfoNet:^{
         

+ 4 - 4
Asteria/Fuction/UserCenter/Address/ASAddressListViewController.m

@@ -137,10 +137,10 @@
     vc.isCartEdit = self.isSelMode;
     __weak typeof(self) weakSelf = self;
     vc.saveSuccess = ^(ASAddressModel * _Nonnull addressM) {
-        if (weakSelf.selectAddressBlock) {
-            weakSelf.selectAddressBlock(addressM);
-            [weakSelf.navigationController popViewControllerAnimated:true];
-        }
+//        if (weakSelf.selectAddressBlock) {
+//            weakSelf.selectAddressBlock(addressM);
+//            [weakSelf.navigationController popViewControllerAnimated:true];
+//        }
     };
     [self.navigationController pushViewController:vc animated:true];
 }

+ 2 - 1
Asteria/Fuction/UserCenter/Address/edit/ASEditAddressViewController.m

@@ -77,7 +77,8 @@
 
     }
     if(self.isCartEdit){
-        [self.saveBt setTitle:@"SAVE AND APPLY" forState:UIControlStateNormal];
+//        [self.saveBt setTitle:@"SAVE AND APPLY" forState:UIControlStateNormal];
+        [self.saveBt setTitle:@"Save" forState:UIControlStateNormal];
     }
 
 }

+ 18 - 6
Asteria/Fuction/UserCenter/Message/ASMessageListViewController.m

@@ -12,6 +12,8 @@
 
 @property (nonatomic, strong) UITableView *tableV;
 
+@property (nonatomic, strong) NSMutableArray *msgDataArray;
+
 @end
 
 @implementation ASMessageListViewController
@@ -21,6 +23,9 @@
     [self loadSubVs];
 //    self.vm = [KWMessageListViewModel new];
     self.titleStr = @"Message";
+    
+    self.msgDataArray = [[NSMutableArray alloc] initWithCapacity:1];
+    
     [self setNav];
     
 }
@@ -32,6 +37,18 @@
 
 - (void)getData {
     [self.tableV.mj_header endRefreshing];
+    
+    
+//    [self.msgDataArray addObjectsFromArray:@[@"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1", @"1"]];
+    
+    if (AS_Array_valid(self.msgDataArray)) {
+        [self hiddenEmpty];
+    } else {
+        [self showEmptyV:self.tableV];
+    }
+    
+    [self.tableV reloadData];
+    
 //    [MBProgressHUD showHUDAddedTo:self.view animated:true];
 //    @weakify(self);
 //    [self.vm getMessageList:self.tableV page:1 complate:^{
@@ -155,12 +172,7 @@
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    if (arc4random()%2 == 1) {
-        [self showEmptyV:self.tableV];
-        return  0;
-    }
-    [self hiddenEmpty];
-    return  40;//self.vm.messageList.count;
+    return  self.msgDataArray.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

+ 6 - 2
Asteria/NetTools/ASNetTools.m

@@ -733,7 +733,9 @@
         NSString *token = [NSString stringWithFormat:@"Bearer %@", result];
         [DataUtil setLoginToken:token];
         [ASNetTools.shared updateEngine];
-        [ASUserInfoManager.shared getInfo];
+        [ASUserInfoManager.shared getInfo:^{
+            [ASOneSignalManager setPushApnsTagWithUserInfo];
+        }];
         NSLog(@"----url:%@-----result:%@------", loginUrl, result);
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
         NSLog(@"----url:%@-----code:%@----msg:%@--", loginUrl, code, msg);
@@ -747,7 +749,9 @@
         NSString *token = [NSString stringWithFormat:@"Bearer %@", result];
         [DataUtil setLoginToken:token];
         [ASNetTools.shared updateEngine];
-        [ASUserInfoManager.shared getInfo];
+        [ASUserInfoManager.shared getInfo:^{
+            [ASOneSignalManager setPushApnsTagWithUserInfo];
+        }];
         success(result);
         NSLog(@"----url:%@-----result:%@------", loginUrl, result);
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {

+ 2 - 0
Asteria/PreFixHeader.h

@@ -32,6 +32,8 @@
 
 //工具类
 #import "ASCommonUtils.h"
+//推送管理类
+#import "ASPushOneSignalManager.h"
 
 
 //所有功能模块需要依赖的 项目(需变化)特定内容,相关内容和不变化的Base无关