Browse Source

添加占位图,小米推送

jikaipeng 5 years ago
parent
commit
70a9894cc7

+ 6 - 4
KuDianProject.xcodeproj/project.pbxproj

1493
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1493
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1494
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1494
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1495
 				CODE_SIGN_STYLE = Automatic;
1495
 				CODE_SIGN_STYLE = Automatic;
1496
-				DEVELOPMENT_TEAM = RZ3D6KK298;
1496
+				DEVELOPMENT_TEAM = WV23VEMQV8;
1497
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1497
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1498
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1498
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1499
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
1499
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
1501
 					"$(inherited)",
1501
 					"$(inherited)",
1502
 					"@executable_path/Frameworks",
1502
 					"@executable_path/Frameworks",
1503
 				);
1503
 				);
1504
-				PRODUCT_BUNDLE_IDENTIFIER = com.August.will.KuDianProject;
1504
+				MiSDKRun = debug;
1505
+				PRODUCT_BUNDLE_IDENTIFIER = com.KuDianProject.eight;
1505
 				PRODUCT_NAME = "$(TARGET_NAME)";
1506
 				PRODUCT_NAME = "$(TARGET_NAME)";
1506
 				TARGETED_DEVICE_FAMILY = 1;
1507
 				TARGETED_DEVICE_FAMILY = 1;
1507
 			};
1508
 			};
1514
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1515
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1515
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1516
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1516
 				CODE_SIGN_STYLE = Automatic;
1517
 				CODE_SIGN_STYLE = Automatic;
1517
-				DEVELOPMENT_TEAM = RZ3D6KK298;
1518
+				DEVELOPMENT_TEAM = WV23VEMQV8;
1518
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1519
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1519
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1520
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1520
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
1521
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
1522
 					"$(inherited)",
1523
 					"$(inherited)",
1523
 					"@executable_path/Frameworks",
1524
 					"@executable_path/Frameworks",
1524
 				);
1525
 				);
1525
-				PRODUCT_BUNDLE_IDENTIFIER = com.August.will.KuDianProject;
1526
+				MiSDKRun = online;
1527
+				PRODUCT_BUNDLE_IDENTIFIER = com.KuDianProject.eight;
1526
 				PRODUCT_NAME = "$(TARGET_NAME)";
1528
 				PRODUCT_NAME = "$(TARGET_NAME)";
1527
 				TARGETED_DEVICE_FAMILY = 1;
1529
 				TARGETED_DEVICE_FAMILY = 1;
1528
 			};
1530
 			};

BIN
KuDianProject.xcworkspace/xcuserdata/kaipeng.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
KuDianProject/AppDelegate.h

8
 
8
 
9
 #import <UIKit/UIKit.h>
9
 #import <UIKit/UIKit.h>
10
 
10
 
11
-@interface AppDelegate : UIResponder <UIApplicationDelegate>
11
+@interface AppDelegate : UIResponder <UIApplicationDelegate,MiPushSDKDelegate,UNUserNotificationCenterDelegate>
12
 
12
 
13
 @property (strong, nonatomic) UIWindow *window;
13
 @property (strong, nonatomic) UIWindow *window;
14
 
14
 

+ 128 - 0
KuDianProject/AppDelegate.m

10
 #import "KDPTabBarVC.h"
10
 #import "KDPTabBarVC.h"
11
 #import "KDPAccountTool.h"
11
 #import "KDPAccountTool.h"
12
 #import "KDPWelcomePageViewController.h"
12
 #import "KDPWelcomePageViewController.h"
13
+#import "KDPNoticeViewController.h"
13
 @interface AppDelegate ()
14
 @interface AppDelegate ()
14
 
15
 
15
 @end
16
 @end
23
     self.window.rootViewController=[[KDPTabBarVC alloc]init];
24
     self.window.rootViewController=[[KDPTabBarVC alloc]init];
24
     [self.window makeKeyAndVisible];
25
     [self.window makeKeyAndVisible];
25
     [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
26
     [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
27
+    [self setUpUM];
28
+    [self setUpMiPush];
26
     if (![KDPAccountTool isLogin]) {
29
     if (![KDPAccountTool isLogin]) {
27
          [self.window.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPWelcomePageViewController alloc]init]] animated:YES completion:nil];
30
          [self.window.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPWelcomePageViewController alloc]init]] animated:YES completion:nil];
28
     }
31
     }
30
     return YES;
33
     return YES;
31
 }
34
 }
32
 
35
 
36
+#pragma mark - 推送
37
+
38
+- (void)setUpMiPush{
39
+    [MiPushSDK registerMiPush:self];
40
+}
41
+
42
+#pragma mark--友盟统计
43
+-(void)setUpUM
44
+{
45
+    UMConfigInstance.appKey=UMENG_KEY;
46
+    UMConfigInstance.channelId=@"App Store";
47
+    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
48
+    NSString *appVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
49
+    [MobClick setAppVersion:appVersion];
50
+    [MobClick startWithConfigure:UMConfigInstance];
51
+    [MobClick setLogEnabled:YES];
52
+    
53
+}
54
+
55
+#pragma mark 注册push服务.
56
+- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
57
+{
58
+    NSLog(@"APNS token: %@", [deviceToken description]);
59
+    
60
+    // 注册APNS成功, 注册deviceToken
61
+    [MiPushSDK bindDeviceToken:deviceToken];
62
+    
63
+    
64
+}
65
+
66
+- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
67
+{
68
+    NSLog(@"APNS error: %@", err);
69
+    
70
+    // 注册APNS失败.
71
+    // 自行处理.
72
+}
73
+#pragma mark MiPushSDKDelegate
74
+
75
+- (void)miPushRequestSuccWithSelector:(NSString *)selector data:(NSDictionary *)data
76
+{
77
+    // 请求成功
78
+    // 可在此获取regId
79
+    if ([selector isEqualToString:@"bindDeviceToken:"]) {
80
+        NSLog(@"regid = %@", data[@"regid"]);
81
+    }
82
+}
83
+
84
+- (void)miPushRequestErrWithSelector:(NSString *)selector error:(int)error data:(NSDictionary *)data
85
+{
86
+    // 请求失败
87
+}
88
+
89
+#pragma mark Local And Push Notification
90
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
91
+{
92
+    NSLog(@"APNS notify: %@", userInfo);
93
+    
94
+    // 当同时启动APNs与内部长连接时, 把两处收到的消息合并. 通过miPushReceiveNotification返回
95
+    [MiPushSDK handleReceiveRemoteNotification:userInfo];
96
+}
97
+
98
+// iOS10新加入的回调方法
99
+// 应用在前台收到通知
100
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __IOS_AVAILABLE(10.0)  {
101
+    NSDictionary * userInfo = notification.request.content.userInfo;
102
+    if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
103
+        NSLog(@"APNS notify: %@", userInfo);;
104
+        [MiPushSDK handleReceiveRemoteNotification:userInfo];
105
+        NSString *messageId = [userInfo objectForKey:@"_id_"];
106
+        [MiPushSDK openAppNotify:messageId];
107
+    }
108
+    
109
+    [self cancelIconBadgeNumber];
110
+    
111
+}
112
+- (void)cancelIconBadgeNumber {
113
+    // 注册显示应用程序BadgeNumber的通知
114
+    UIApplication *application = [UIApplication sharedApplication];
115
+    
116
+    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];
117
+    
118
+    [application registerUserNotificationSettings:settings];
119
+    
120
+    if (application.applicationIconBadgeNumber > 0) {
121
+        application.applicationIconBadgeNumber = 0;
122
+    }
123
+}
124
+
125
+// 点击通知进入应用
126
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler __IOS_AVAILABLE(10.0) {
127
+    
128
+    NSDictionary * userInfo = response.notification.request.content.userInfo;
129
+    if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
130
+        NSLog(@"APNS notify: %@", userInfo);
131
+        [MiPushSDK handleReceiveRemoteNotification:userInfo];
132
+        NSString *messageId = [userInfo objectForKey:@"_id_"];
133
+        [MiPushSDK openAppNotify:messageId];
134
+    }
135
+    
136
+    [self jumpViewController:userInfo];
137
+    completionHandler();
138
+}
139
+
140
+- (void)jumpViewController:(NSDictionary *)remoteNotification {
141
+    [self cancelIconBadgeNumber];
142
+    NSInteger pushType = [remoteNotification[@"pushType"] integerValue];
143
+    switch (pushType) {
144
+        case 1005://跳转到消息列表
145
+            [self pushMessage];
146
+            break;
147
+            
148
+        default:
149
+            break;
150
+    }
151
+    
152
+    
153
+    
154
+}
155
+#pragma mark---消息列表
156
+-(void)pushMessage
157
+{
158
+    KDPNoticeViewController *message=[[KDPNoticeViewController alloc]init];
159
+    [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:message] animated:YES completion:nil];
160
+}
33
 
161
 
34
 - (void)applicationWillResignActive:(UIApplication *)application {
162
 - (void)applicationWillResignActive:(UIApplication *)application {
35
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
163
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

BIN
KuDianProject/Assets.xcassets/.DS_Store


+ 6 - 0
KuDianProject/Info.plist

28
 	</array>
28
 	</array>
29
 	<key>LSRequiresIPhoneOS</key>
29
 	<key>LSRequiresIPhoneOS</key>
30
 	<true/>
30
 	<true/>
31
+	<key>MiSDKAppID</key>
32
+	<string>2882303761518060278</string>
33
+	<key>MiSDKAppKey</key>
34
+	<string>5351806025278</string>
35
+	<key>MiSDKRun</key>
36
+	<string>${MiSDKRun}</string>
31
 	<key>NSAppTransportSecurity</key>
37
 	<key>NSAppTransportSecurity</key>
32
 	<dict>
38
 	<dict>
33
 		<key>NSAllowsArbitraryLoads</key>
39
 		<key>NSAllowsArbitraryLoads</key>

+ 5 - 0
KuDianProject/LiveData/Controller/KDPLiveLeftViewController.m

54
     }];
54
     }];
55
 }
55
 }
56
 
56
 
57
+- (void)viewWillAppear:(BOOL)animated{
58
+    [super viewWillAppear:animated];
59
+    [self.tableView.mj_header beginRefreshing];
60
+}
61
+
57
 - (void)setUpUI{
62
 - (void)setUpUI{
58
     // tip view
63
     // tip view
59
     UILabel *tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,8, 223, 21)];
64
     UILabel *tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,8, 223, 21)];

+ 2 - 1
KuDianProject/LiveData/Controller/KDPLiveRightTableViewCell.m

169
     self.profitLabel.text = [NSString stringWithFormat:@"%@%%",statisModel.commission_rate];
169
     self.profitLabel.text = [NSString stringWithFormat:@"%@%%",statisModel.commission_rate];
170
     self.orderLabel.text = statisModel.predictCount;
170
     self.orderLabel.text = statisModel.predictCount;
171
     self.profitImageView.hidden = NO;
171
     self.profitImageView.hidden = NO;
172
-    self.profitDetailLabel.insets = UIEdgeInsetsMake(0, 0, 0, 10);
173
     if ([statisModel.commission_rate_2 integerValue] > [statisModel.commission_rate integerValue]) {
172
     if ([statisModel.commission_rate_2 integerValue] > [statisModel.commission_rate integerValue]) {
174
         self.profitImageView.image = [UIImage imageNamed:@"up_icon"];
173
         self.profitImageView.image = [UIImage imageNamed:@"up_icon"];
174
+        self.profitDetailLabel.insets = UIEdgeInsetsMake(0, 0, 0, 10);
175
     } else if ([statisModel.commission_rate integerValue] == [statisModel.commission_rate_2 integerValue]){
175
     } else if ([statisModel.commission_rate integerValue] == [statisModel.commission_rate_2 integerValue]){
176
         self.profitDetailLabel.insets = UIEdgeInsetsMake(0, 0, 0, 0);
176
         self.profitDetailLabel.insets = UIEdgeInsetsMake(0, 0, 0, 0);
177
         self.profitImageView.hidden = YES;
177
         self.profitImageView.hidden = YES;
178
     } else{
178
     } else{
179
+        self.profitDetailLabel.insets = UIEdgeInsetsMake(0, 0, 0, 10);
179
         self.profitImageView.image = [UIImage imageNamed:@"down_icon"];
180
         self.profitImageView.image = [UIImage imageNamed:@"down_icon"];
180
     }
181
     }
181
 }
182
 }

+ 5 - 0
KuDianProject/LiveData/Controller/KDPLiveRightViewController.m

66
     }];
66
     }];
67
 }
67
 }
68
 
68
 
69
+- (void)viewWillAppear:(BOOL)animated{
70
+    [super viewWillAppear:animated];
71
+    [self.tableView.mj_header beginRefreshing];
72
+}
73
+
69
 - (UITableView *)tableView{
74
 - (UITableView *)tableView{
70
     if (!_tableView) {
75
     if (!_tableView) {
71
         _tableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, SCREEN_HEIGHT-KDNavBarHeight-KDTabBarHeight) style:UITableViewStylePlain];
76
         _tableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, SCREEN_HEIGHT-KDNavBarHeight-KDTabBarHeight) style:UITableViewStylePlain];

+ 5 - 0
KuDianProject/MainTab/KDPBaseLabel.m

14
     return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.insets)];
14
     return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.insets)];
15
 }
15
 }
16
 
16
 
17
+- (void)setInsets:(UIEdgeInsets)insets{
18
+    _insets = insets;
19
+    [self setNeedsDisplay];
20
+}
21
+
17
 @end
22
 @end

+ 4 - 0
KuDianProject/TOP/Controller/KDPNoticeViewController.m

44
 }
44
 }
45
 
45
 
46
 - (void)backAction{
46
 - (void)backAction{
47
+    if (self.presentingViewController) {
48
+        [self dismissViewControllerAnimated:YES completion:nil];
49
+    } else{
47
     [self.navigationController popViewControllerAnimated:YES];
50
     [self.navigationController popViewControllerAnimated:YES];
51
+    }
48
 }
52
 }
49
 
53
 
50
 - (void)clearAction{
54
 - (void)clearAction{

+ 1 - 4
KuDianProject/TOP/Drawer/View/KDPMessageTableViewCell.m

35
     _titleLabel = [[UILabel alloc] init];
35
     _titleLabel = [[UILabel alloc] init];
36
     _titleLabel.textColor = [UIColor colorWithHex:0x383838];
36
     _titleLabel.textColor = [UIColor colorWithHex:0x383838];
37
     _titleLabel.font =  [UIFont fontWithName:@"PingFangSC-Semibold" size: 15];
37
     _titleLabel.font =  [UIFont fontWithName:@"PingFangSC-Semibold" size: 15];
38
-    _titleLabel.text = @"提现通过";
39
     [self.contentView addSubview:_titleLabel];
38
     [self.contentView addSubview:_titleLabel];
40
     
39
     
41
     _timeLabel = [[UILabel alloc] init];
40
     _timeLabel = [[UILabel alloc] init];
42
     _timeLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 11];
41
     _timeLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 11];
43
     _timeLabel.textColor = [UIColor colorWithHex:0x9B9B9B];
42
     _timeLabel.textColor = [UIColor colorWithHex:0x9B9B9B];
44
     _timeLabel.textAlignment = NSTextAlignmentRight;
43
     _timeLabel.textAlignment = NSTextAlignmentRight;
45
-    _timeLabel.text = @"08-27 20:00";
46
     [self.contentView addSubview:_timeLabel];
44
     [self.contentView addSubview:_timeLabel];
47
     
45
     
48
     _grayView = [[UIView alloc] init];
46
     _grayView = [[UIView alloc] init];
64
     _contentLabel.numberOfLines = 0;
62
     _contentLabel.numberOfLines = 0;
65
     _contentLabel.textColor = [UIColor colorWithHex:0x333333];
63
     _contentLabel.textColor = [UIColor colorWithHex:0x333333];
66
     _contentLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 14];
64
     _contentLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 14];
67
-    _contentLabel.text = @"新的提现申请已通过,金额为20000元,请注意查收!";
68
     [_contentLabel sizeToFit];
65
     [_contentLabel sizeToFit];
69
     [_grayView addSubview:_contentLabel];
66
     [_grayView addSubview:_contentLabel];
70
 }
67
 }
97
     }];
94
     }];
98
     [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
95
     [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
99
         make.left.top.bottom.equalTo(self->_grayView);
96
         make.left.top.bottom.equalTo(self->_grayView);
100
-        make.width.equalTo(self->_grayView.height);
97
+        make.width.equalTo(self->_grayView.mas_height);
101
     }];
98
     }];
102
     [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
99
     [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
103
         make.left.equalTo(self->_iconImageView.mas_right).offset(11);
100
         make.left.equalTo(self->_iconImageView.mas_right).offset(11);