瀏覽代碼

添加占位图,小米推送

jikaipeng 5 年之前
父節點
當前提交
70a9894cc7

+ 6 - 4
KuDianProject.xcodeproj/project.pbxproj

@@ -1493,7 +1493,7 @@
1493 1493
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1494 1494
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1495 1495
 				CODE_SIGN_STYLE = Automatic;
1496
-				DEVELOPMENT_TEAM = RZ3D6KK298;
1496
+				DEVELOPMENT_TEAM = WV23VEMQV8;
1497 1497
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1498 1498
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1499 1499
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
@@ -1501,7 +1501,8 @@
1501 1501
 					"$(inherited)",
1502 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 1506
 				PRODUCT_NAME = "$(TARGET_NAME)";
1506 1507
 				TARGETED_DEVICE_FAMILY = 1;
1507 1508
 			};
@@ -1514,7 +1515,7 @@
1514 1515
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1515 1516
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1516 1517
 				CODE_SIGN_STYLE = Automatic;
1517
-				DEVELOPMENT_TEAM = RZ3D6KK298;
1518
+				DEVELOPMENT_TEAM = WV23VEMQV8;
1518 1519
 				GCC_PREFIX_HEADER = KuDianProject/PrefixHeader.pch;
1519 1520
 				INFOPLIST_FILE = KuDianProject/Info.plist;
1520 1521
 				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
@@ -1522,7 +1523,8 @@
1522 1523
 					"$(inherited)",
1523 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 1528
 				PRODUCT_NAME = "$(TARGET_NAME)";
1527 1529
 				TARGETED_DEVICE_FAMILY = 1;
1528 1530
 			};

二進制
KuDianProject.xcworkspace/xcuserdata/kaipeng.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
KuDianProject/AppDelegate.h

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

+ 128 - 0
KuDianProject/AppDelegate.m

@@ -10,6 +10,7 @@
10 10
 #import "KDPTabBarVC.h"
11 11
 #import "KDPAccountTool.h"
12 12
 #import "KDPWelcomePageViewController.h"
13
+#import "KDPNoticeViewController.h"
13 14
 @interface AppDelegate ()
14 15
 
15 16
 @end
@@ -23,6 +24,8 @@
23 24
     self.window.rootViewController=[[KDPTabBarVC alloc]init];
24 25
     [self.window makeKeyAndVisible];
25 26
     [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
27
+    [self setUpUM];
28
+    [self setUpMiPush];
26 29
     if (![KDPAccountTool isLogin]) {
27 30
          [self.window.rootViewController presentViewController:[[UINavigationController alloc]initWithRootViewController:[[KDPWelcomePageViewController alloc]init]] animated:YES completion:nil];
28 31
     }
@@ -30,6 +33,131 @@
30 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 162
 - (void)applicationWillResignActive:(UIApplication *)application {
35 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.

二進制
KuDianProject/Assets.xcassets/.DS_Store


+ 6 - 0
KuDianProject/Info.plist

@@ -28,6 +28,12 @@
28 28
 	</array>
29 29
 	<key>LSRequiresIPhoneOS</key>
30 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 37
 	<key>NSAppTransportSecurity</key>
32 38
 	<dict>
33 39
 		<key>NSAllowsArbitraryLoads</key>

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

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

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

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

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

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

+ 5 - 0
KuDianProject/MainTab/KDPBaseLabel.m

@@ -14,4 +14,9 @@
14 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 22
 @end

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

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

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

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