2 Commits 96e7ecde0b ... 05dd5e7a99

Auteur SHA1 Bericht Datum
  xiaoxi 05dd5e7a99 noti 6 jaren geleden
  xiaoxi 2da87c1f64 noti 6 jaren geleden
20 gewijzigde bestanden met toevoegingen van 955 en 25 verwijderingen
  1. BIN
      .DS_Store
  2. 20 0
      KXCardHelp.xcodeproj/project.pbxproj
  3. 14 0
      KXCardHelp.xcodeproj/xcuserdata/xiaoxi.xcuserdatad/xcschemes/xcschememanagement.plist
  4. BIN
      KXCardHelp.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/UserInterfaceState.xcuserstate
  5. 17 0
      KXCardHelp.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  6. 91 5
      KXCardHelp/AppDelegate/AppDelegate.m
  7. 2 0
      KXCardHelp/AppDelegate/HFile/LVKBClassHeader.h
  8. 2 2
      KXCardHelp/AppDelegate/HFile/LVKBURLHeader.h
  9. 2 2
      KXCardHelp/Base/Tab/LVKBBaseTabBarViewController.m
  10. 88 0
      KXCardHelp/Category/NSDictionary+SafeAccess.h
  11. 326 0
      KXCardHelp/Category/NSDictionary+SafeAccess.m
  12. 9 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckHomeViewController.m
  13. 62 13
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckRemindMeViewController.m
  14. 1 1
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.h
  15. 8 0
      KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.m
  16. 35 0
      KXCardHelp/Main/CheckPage/CreditCardManager/Manager/WWRemindMeManager.h
  17. 181 0
      KXCardHelp/Main/CheckPage/CreditCardManager/Manager/WWRemindMeManager.m
  18. 11 0
      KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m
  19. 2 2
      KXCardHelp/Tools/WWValuePickerView/WWValuePickerView.m
  20. 84 0
      Pods/Pods.xcodeproj/xcuserdata/xiaoxi.xcuserdatad/xcschemes/xcschememanagement.plist

BIN
.DS_Store


+ 20 - 0
KXCardHelp.xcodeproj/project.pbxproj

@@ -192,6 +192,8 @@
192 192
 		4AAC10B021B914B2004BE83C /* WWCheckCardListDetailVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC10AF21B914B2004BE83C /* WWCheckCardListDetailVC.m */; };
193 193
 		4AAC10B321BA5A3F004BE83C /* KXInstallmentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAC10B121BA5A3E004BE83C /* KXInstallmentViewController.m */; };
194 194
 		5B982B19B445B1CF86AEC93C /* libPods-KXCardHelp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E6ACD581411C8CD82F0EE3FF /* libPods-KXCardHelp.a */; };
195
+		707B395E21BA1B510004F521 /* NSDictionary+SafeAccess.m in Sources */ = {isa = PBXBuildFile; fileRef = 707B395D21BA1B510004F521 /* NSDictionary+SafeAccess.m */; };
196
+		707B396221BA20F40004F521 /* WWRemindMeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 707B396121BA20F40004F521 /* WWRemindMeManager.m */; };
195 197
 /* End PBXBuildFile section */
196 198
 
197 199
 /* Begin PBXCopyFilesBuildPhase section */
@@ -537,6 +539,10 @@
537 539
 		4AAC10AC21B908DF004BE83C /* WWCheckCardListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WWCheckCardListViewController.m; sourceTree = "<group>"; };
538 540
 		4AAC10AE21B914B2004BE83C /* WWCheckCardListDetailVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WWCheckCardListDetailVC.h; sourceTree = "<group>"; };
539 541
 		4AAC10AF21B914B2004BE83C /* WWCheckCardListDetailVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WWCheckCardListDetailVC.m; sourceTree = "<group>"; };
542
+		707B395C21BA1B500004F521 /* NSDictionary+SafeAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+SafeAccess.h"; sourceTree = "<group>"; };
543
+		707B395D21BA1B510004F521 /* NSDictionary+SafeAccess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+SafeAccess.m"; sourceTree = "<group>"; };
544
+		707B396021BA20F40004F521 /* WWRemindMeManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WWRemindMeManager.h; sourceTree = "<group>"; };
545
+		707B396121BA20F40004F521 /* WWRemindMeManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WWRemindMeManager.m; sourceTree = "<group>"; };
540 546
 		4AAC10B121BA5A3E004BE83C /* KXInstallmentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KXInstallmentViewController.m; sourceTree = "<group>"; };
541 547
 		4AAC10B221BA5A3E004BE83C /* KXInstallmentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KXInstallmentViewController.h; sourceTree = "<group>"; };
542 548
 		E6ACD581411C8CD82F0EE3FF /* libPods-KXCardHelp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KXCardHelp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -735,6 +741,8 @@
735 741
 		1170B79F20E0C1F000F28085 /* Category */ = {
736 742
 			isa = PBXGroup;
737 743
 			children = (
744
+				707B395C21BA1B500004F521 /* NSDictionary+SafeAccess.h */,
745
+				707B395D21BA1B510004F521 /* NSDictionary+SafeAccess.m */,
738 746
 				110B860720FF0A3200082F55 /* UITable */,
739 747
 				1114D61D20ECCEF60094AC81 /* UIImage */,
740 748
 				1114D61220EB62B70094AC81 /* MBP */,
@@ -1819,6 +1827,7 @@
1819 1827
 		4AAC103A21B508D1004BE83C /* CreditCardManager */ = {
1820 1828
 			isa = PBXGroup;
1821 1829
 			children = (
1830
+				707B395F21BA20CF0004F521 /* Manager */,
1822 1831
 				4AAC103B21B508D1004BE83C /* HomePage */,
1823 1832
 				4AAC104121B508D1004BE83C /* Mine */,
1824 1833
 			);
@@ -1956,6 +1965,15 @@
1956 1965
 			path = JZCheckDataTool;
1957 1966
 			sourceTree = "<group>";
1958 1967
 		};
1968
+		707B395F21BA20CF0004F521 /* Manager */ = {
1969
+			isa = PBXGroup;
1970
+			children = (
1971
+				707B396021BA20F40004F521 /* WWRemindMeManager.h */,
1972
+				707B396121BA20F40004F521 /* WWRemindMeManager.m */,
1973
+			);
1974
+			path = Manager;
1975
+			sourceTree = "<group>";
1976
+		};
1959 1977
 		84E1864C4FDEEAE5A1B51EF6 /* Pods */ = {
1960 1978
 			isa = PBXGroup;
1961 1979
 			children = (
@@ -2251,6 +2269,7 @@
2251 2269
 				119AA01D2138E0350020C78E /* LVKBPersonSafeCenterViewController.m in Sources */,
2252 2270
 				119AA01C2138E0350020C78E /* LVKBPersonChangePwdViewController.m in Sources */,
2253 2271
 				119AA01F2138E0350020C78E /* LVKBPersonSettingViewController.m in Sources */,
2272
+				707B395E21BA1B510004F521 /* NSDictionary+SafeAccess.m in Sources */,
2254 2273
 				4AAC109221B8F9D4004BE83C /* XJCustomWebViewController.m in Sources */,
2255 2274
 				1170B7D520E0F44300F28085 /* LVKBNavigationBar.m in Sources */,
2256 2275
 				11E85CF320F48CB8007B2B0E /* LVKBWebViewController.m in Sources */,
@@ -2265,6 +2284,7 @@
2265 2284
 				1114D62020ECCF290094AC81 /* UIImage+Handle.m in Sources */,
2266 2285
 				1170B7AE20E0C8C100F28085 /* LVKBBaseViewController.m in Sources */,
2267 2286
 				1170B7C220E0D98800F28085 /* UIColor+CHColor.m in Sources */,
2287
+				707B396221BA20F40004F521 /* WWRemindMeManager.m in Sources */,
2268 2288
 				119A9FF52138E0350020C78E /* LVKBHomeReceiptViewController.m in Sources */,
2269 2289
 				119AA02A2138E0350020C78E /* LVKBCheckNineLockViewController.m in Sources */,
2270 2290
 				119A9FF02138E0350020C78E /* LVKBHomeCreditCardTableViewCell.m in Sources */,

+ 14 - 0
KXCardHelp.xcodeproj/xcuserdata/xiaoxi.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>SchemeUserState</key>
6
+	<dict>
7
+		<key>KXCardHelp.xcscheme</key>
8
+		<dict>
9
+			<key>orderHint</key>
10
+			<integer>15</integer>
11
+		</dict>
12
+	</dict>
13
+</dict>
14
+</plist>

BIN
KXCardHelp.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/UserInterfaceState.xcuserstate


+ 17 - 0
KXCardHelp.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Bucket
3
+   type = "0"
4
+   version = "2.0">
5
+   <Breakpoints>
6
+      <BreakpointProxy
7
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
8
+         <BreakpointContent
9
+            shouldBeEnabled = "Yes"
10
+            ignoreCount = "0"
11
+            continueAfterRunningActions = "No"
12
+            scope = "1"
13
+            stopOnStyle = "0">
14
+         </BreakpointContent>
15
+      </BreakpointProxy>
16
+   </Breakpoints>
17
+</Bucket>

+ 91 - 5
KXCardHelp/AppDelegate/AppDelegate.m

@@ -34,8 +34,8 @@ UNUserNotificationCenterDelegate
34 34
     [self setUM];                  //友盟统计和微信登录
35 35
     [self setBugly];               //腾讯bugly统计
36 36
     [self setBaiDu];               //设置百度OCR
37
-    [self setXiaoMiPush];          //小米push
38
-    
37
+    [self setXiaoMiPush:launchOptions];          //小米push
38
+    [self setLocalNotion:launchOptions];
39 39
     [self updateVersion];          //版本迭代处理
40 40
     NSNumber *num=[[NSUserDefaults standardUserDefaults]objectForKey:IOS_TYPE];
41 41
     if (num &&[num integerValue]==0) {
@@ -74,10 +74,51 @@ UNUserNotificationCenterDelegate
74 74
 -(void)setBaiDu{
75 75
     [[AipOcrService shardService] authWithAK:BAIDU_APP_ID andSK:BAIDU_SECRET];
76 76
 }
77
-
77
+- (void)setLocalNotion:(NSDictionary *)launchOptions {
78
+    
79
+    if (@available(iOS 8.0, *)) {
80
+        // iOS8以后 本地通知必须注册(获取权限)
81
+        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert categories:nil];
82
+        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
83
+    }
84
+    //如果是这个key有值,代表是杀死的程序接收到本地通知跳转
85
+    if (launchOptions[UIApplicationLaunchOptionsLocationKey]) {
86
+        // 根据这种方式查看launchOptions的内容
87
+        NSLog(@"跳转到指定页面");
88
+    }
89
+}
78 90
 //注册小米push
79
--(void)setXiaoMiPush{
80
-    [MiPushSDK registerMiPush:self];
91
+-(void)setXiaoMiPush:(NSDictionary *)launchOptions{
92
+    if (@available(iOS 10.0, *)) {
93
+        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
94
+        [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) {
95
+            if (granted) {
96
+                //点击允许
97
+                NSLog(@"注册通知成功");
98
+                [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
99
+                    NSLog(@"%@", settings);
100
+                }];
101
+            } else {
102
+                //点击不允许
103
+                NSLog(@"注册通知失败");
104
+            }
105
+        }];
106
+        
107
+        [MiPushSDK registerMiPush:self type:0 connect:YES];
108
+        center.delegate = self;
109
+        
110
+    } else {
111
+        // 注册推送,如果iOS10以下
112
+        [MiPushSDK registerMiPush:self type:0 connect:YES];
113
+    }
114
+    NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
115
+    if (userInfo) {
116
+        NSString *messageId = [userInfo objectForKey:@"_id_"];
117
+        if (messageId!=nil) {
118
+            [MiPushSDK openAppNotify:messageId];
119
+        }
120
+    }
121
+//    [MiPushSDK registerMiPush:self];
81 122
 }
82 123
 
83 124
 //升级版本后操作
@@ -291,6 +332,23 @@ UNUserNotificationCenterDelegate
291 332
     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
292 333
 }
293 334
 #pragma mark UIApplicationDelegate
335
+- (void)application: (UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
336
+    if (notificationSettings.types & UIUserNotificationTypeBadge) {
337
+        NSLog(@"Badge Nofitication type is allowed");
338
+    }
339
+    if (notificationSettings.types & UIUserNotificationTypeAlert) {
340
+        NSLog(@"Alert Notfication type is allowed");
341
+    }
342
+    if (notificationSettings.types & UIUserNotificationTypeSound) {
343
+        NSLog(@"Sound Notfication type is allowed");
344
+    }
345
+}
346
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler  API_AVAILABLE(ios(10.0)) {
347
+    completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
348
+}
349
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler  API_AVAILABLE(ios(10.0)) {
350
+    completionHandler();
351
+}
294 352
 - (void)application:(UIApplication *)app
295 353
 didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
296 354
 {
@@ -304,6 +362,34 @@ didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
304 362
     // 注册APNS失败
305 363
     // 自行处理
306 364
 }
365
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
366
+    // 当同时启动APNs与内部长连接时, 把两处收到的消息合并. 通过miPushReceiveNotification返回
367
+    [MiPushSDK handleReceiveRemoteNotification:userInfo];
368
+}
369
+- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
370
+    NSLog(@"收到本地通知");
371
+    // 可以让用户跳转到指定界面 app在前台接收到通知直接跳转界面不太好,所以要判断一下,是从后台进入前台还是本身就在前台
372
+    NSDictionary *userDict = notification.userInfo;
373
+    if (userDict) {
374
+        if ([[userDict valueForKey:@"name"] isEqualToString:@"逾期"]) {
375
+            if ([[userDict valueForKey:@"limit"] isEqual:@1]) {
376
+                [[UIApplication sharedApplication] cancelLocalNotification:notification];
377
+                notification.repeatInterval = NSCalendarUnitDay;
378
+                [[UIApplication sharedApplication] scheduleLocalNotification:notification];
379
+            }
380
+        }
381
+    }
382
+    
383
+    if (application.applicationState == UIApplicationStateInactive) {// 进入前台时候
384
+        NSLog(@"跳转到指定界面");
385
+        
386
+        // 如果接收到不同的通知,跳转到不同的界面:
387
+        NSLog(@"进行界面的跳转");
388
+        NSLog(@"%@", notification.userInfo);
389
+    } else {
390
+        
391
+    }
392
+}
307 393
 
308 394
 #pragma mark MiPushSDKDelegate
309 395
 

+ 2 - 0
KXCardHelp/AppDelegate/HFile/LVKBClassHeader.h

@@ -53,6 +53,7 @@
53 53
 #import "MBProgressHUD+Extension.h"
54 54
 #import "UIImage+Handle.h"
55 55
 #import "NSDate+JCYEX.h"
56
+#import "NSDictionary+SafeAccess.h"
56 57
 /*其余类*/
57 58
 #import "MLMSegmentManager.h"
58 59
 #import "PublicFunction.h"
@@ -62,6 +63,7 @@
62 63
 #import "RSAUtil.h"
63 64
 #import "UITableView+CHHandle.h"
64 65
 #import "YDFMDB.h"
66
+#import "WWRemindMeManager.h"
65 67
 
66 68
 /*工具类*/
67 69
 #import "JZGetHeightTool.h"         //获取h高度

+ 2 - 2
KXCardHelp/AppDelegate/HFile/LVKBURLHeader.h

@@ -12,12 +12,12 @@
12 12
 #define CHURLHeader_h
13 13
 
14 14
 //测试环境
15
-//#define BaseURL  @"http://182.92.118.1:5240"
15
+#define BaseURL  @"http://182.92.118.1:5240"
16 16
 //static NSString *const advURL = @"http://182.92.118.1:8070/api";   //广告测试URL
17 17
 
18 18
 
19 19
 //真实环
20
-#define BaseURL     @"https://api.lanjiekuan.com"
20
+//#define BaseURL     @"https://api.lanjiekuan.com"
21 21
 static NSString *const advURL = @"http://ads.726p.com/api";   //广告线上URL
22 22
 
23 23
 /**********************************************************/

+ 2 - 2
KXCardHelp/Base/Tab/LVKBBaseTabBarViewController.m

@@ -23,7 +23,7 @@
23 23
     [self.tabBar setBarTintColor:[UIColor whiteColor]];
24 24
     
25 25
     NSNumber *num=[[NSUserDefaults standardUserDefaults]objectForKey:IOS_TYPE];
26
-    if (num &&[num integerValue]==0) {   //0
26
+    if (num &&[num integerValue]==1) {   //0
27 27
         [self initViewControllers];
28 28
         self.initViewFlag=YES;
29 29
     }
@@ -60,7 +60,7 @@
60 60
         [[NSUserDefaults standardUserDefaults]setObject:ios forKey:IOS_TYPE];
61 61
         [[NSUserDefaults standardUserDefaults] synchronize];
62 62
         if (!self.initViewFlag) {
63
-            if ([ios integerValue]==0) {   //0
63
+            if ([ios integerValue]==1) {   //0
64 64
                 [self initViewControllers];
65 65
             }else{
66 66
                 [self initViewControllers2];

+ 88 - 0
KXCardHelp/Category/NSDictionary+SafeAccess.h

@@ -0,0 +1,88 @@
1
+//
2
+//  NSDictionary+SafeAccess.h
3
+//  IOS-Categories
4
+//
5
+//  Created by Jakey on 15/1/25.
6
+//  Copyright (c) 2015年 www.skyfox.org. All rights reserved.
7
+//
8
+
9
+#import <Foundation/Foundation.h>
10
+#import <UIKit/UIKit.h>
11
+
12
+@interface NSDictionary (SafeAccess)
13
+- (BOOL)hasKey:(NSString *)key;
14
+
15
+- (NSString*)stringForKey:(id)key;
16
+
17
+- (NSNumber*)numberForKey:(id)key;
18
+
19
+- (NSArray*)arrayForKey:(id)key;
20
+
21
+- (NSDictionary*)dictionaryForKey:(id)key;
22
+
23
+- (NSInteger)integerForKey:(id)key;
24
+
25
+- (NSUInteger)unsignedIntegerForKey:(id)key;
26
+
27
+- (BOOL)boolForKey:(id)key;
28
+
29
+- (int16_t)int16ForKey:(id)key;
30
+
31
+- (int32_t)int32ForKey:(id)key;
32
+
33
+- (int64_t)int64ForKey:(id)key;
34
+
35
+- (char)charForKey:(id)key;
36
+
37
+- (short)shortForKey:(id)key;
38
+
39
+- (float)floatForKey:(id)key;
40
+
41
+- (double)doubleForKey:(id)key;
42
+
43
+- (long long)longLongForKey:(id)key;
44
+
45
+- (unsigned long long)unsignedLongLongForKey:(id)key;
46
+
47
+//CG
48
+- (CGFloat)CGFloatForKey:(id)key;
49
+
50
+- (CGPoint)pointForKey:(id)key;
51
+
52
+- (CGSize)sizeForKey:(id)key;
53
+
54
+- (CGRect)rectForKey:(id)key;
55
+@end
56
+
57
+#pragma --mark NSMutableDictionary setter
58
+
59
+@interface NSMutableDictionary(SafeAccess)
60
+
61
+-(void)setObj:(id)i forKey:(NSString*)key;
62
+
63
+-(void)setString:(NSString*)i forKey:(NSString*)key;
64
+
65
+-(void)setBool:(BOOL)i forKey:(NSString*)key;
66
+
67
+-(void)setInt:(int)i forKey:(NSString*)key;
68
+
69
+-(void)setInteger:(NSInteger)i forKey:(NSString*)key;
70
+
71
+-(void)setUnsignedInteger:(NSUInteger)i forKey:(NSString*)key;
72
+
73
+-(void)setCGFloat:(CGFloat)f forKey:(NSString*)key;
74
+
75
+-(void)setChar:(char)c forKey:(NSString*)key;
76
+
77
+-(void)setFloat:(float)i forKey:(NSString*)key;
78
+
79
+-(void)setDouble:(double)i forKey:(NSString*)key;
80
+
81
+-(void)setLongLong:(long long)i forKey:(NSString*)key;
82
+
83
+-(void)setPoint:(CGPoint)o forKey:(NSString*)key;
84
+
85
+-(void)setSize:(CGSize)o forKey:(NSString*)key;
86
+
87
+-(void)setRect:(CGRect)o forKey:(NSString*)key;
88
+@end

+ 326 - 0
KXCardHelp/Category/NSDictionary+SafeAccess.m

@@ -0,0 +1,326 @@
1
+//
2
+//  NSDictionary+SafeAccess.m
3
+//  IOS-Categories
4
+//
5
+//  Created by Jakey on 15/1/25.
6
+//  Copyright (c) 2015年 www.skyfox.org. All rights reserved.
7
+//
8
+
9
+#import "NSDictionary+SafeAccess.h"
10
+
11
+@implementation NSDictionary (SafeAccess)
12
+- (BOOL)hasKey:(NSString *)key
13
+{
14
+    return [self objectForKey:key] != nil;
15
+}
16
+
17
+- (NSString*)stringForKey:(id)key
18
+{
19
+    id value = [self objectForKey:key];
20
+    if (value == nil || value == [NSNull null])
21
+    {
22
+        return nil;
23
+    }
24
+    if ([value isKindOfClass:[NSString class]]) {
25
+        return (NSString*)value;
26
+    }
27
+    if ([value isKindOfClass:[NSNumber class]]) {
28
+       return [value stringValue];
29
+    }
30
+    
31
+    return nil;
32
+}
33
+
34
+- (NSNumber*)numberForKey:(id)key
35
+{
36
+    id value = [self objectForKey:key];
37
+    if ([value isKindOfClass:[NSNumber class]]) {
38
+        return (NSNumber*)value;
39
+    }
40
+    if ([value isKindOfClass:[NSString class]]) {
41
+        NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
42
+        [f setNumberStyle:NSNumberFormatterDecimalStyle];
43
+        return [f numberFromString:(NSString*)value];
44
+    }
45
+    return nil;
46
+}
47
+
48
+- (NSArray*)arrayForKey:(id)key
49
+{
50
+    id value = [self objectForKey:key];
51
+    if (value == nil || value == [NSNull null])
52
+    {
53
+        return nil;
54
+    }
55
+    if ([value isKindOfClass:[NSArray class]])
56
+    {
57
+        return value;
58
+    }
59
+    return nil;
60
+}
61
+
62
+- (NSDictionary*)dictionaryForKey:(id)key
63
+{
64
+    id value = [self objectForKey:key];
65
+    if (value == nil || value == [NSNull null])
66
+    {
67
+        return nil;
68
+    }
69
+    if ([value isKindOfClass:[NSDictionary class]])
70
+    {
71
+        return value;
72
+    }
73
+    return nil;
74
+}
75
+
76
+- (NSInteger)integerForKey:(id)key
77
+{
78
+    id value = [self objectForKey:key];
79
+    if (value == nil || value == [NSNull null])
80
+    {
81
+        return 0;
82
+    }
83
+    if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]])
84
+    {
85
+        return [value integerValue];
86
+    }
87
+    return 0;
88
+}
89
+- (NSUInteger)unsignedIntegerForKey:(id)key{
90
+    id value = [self objectForKey:key];
91
+    if (value == nil || value == [NSNull null])
92
+    {
93
+        return 0;
94
+    }
95
+    if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]])
96
+    {
97
+        return [value unsignedIntegerValue];
98
+    }
99
+    return 0;
100
+}
101
+- (BOOL)boolForKey:(id)key
102
+{
103
+    id value = [self objectForKey:key];
104
+    
105
+    if (value == nil || value == [NSNull null])
106
+    {
107
+        return NO;
108
+    }
109
+    if ([value isKindOfClass:[NSNumber class]])
110
+    {
111
+        return [value boolValue];
112
+    }
113
+    if ([value isKindOfClass:[NSString class]])
114
+    {
115
+        return [value boolValue];
116
+    }
117
+    return NO;
118
+}
119
+- (int16_t)int16ForKey:(id)key
120
+{
121
+    id value = [self objectForKey:key];
122
+    
123
+    if (value == nil || value == [NSNull null])
124
+    {
125
+        return 0;
126
+    }
127
+    if ([value isKindOfClass:[NSNumber class]])
128
+    {
129
+        return [value shortValue];
130
+    }
131
+    if ([value isKindOfClass:[NSString class]])
132
+    {
133
+        return [value intValue];
134
+    }
135
+    return 0;
136
+}
137
+- (int32_t)int32ForKey:(id)key
138
+{
139
+    id value = [self objectForKey:key];
140
+    
141
+    if (value == nil || value == [NSNull null])
142
+    {
143
+        return 0;
144
+    }
145
+    if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])
146
+    {
147
+        return [value intValue];
148
+    }
149
+    return 0;
150
+}
151
+- (int64_t)int64ForKey:(id)key
152
+{
153
+    id value = [self objectForKey:key];
154
+    
155
+    if (value == nil || value == [NSNull null])
156
+    {
157
+        return 0;
158
+    }
159
+    if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])
160
+    {
161
+        return [value longLongValue];
162
+    }
163
+    return 0;
164
+}
165
+- (char)charForKey:(id)key{
166
+    id value = [self objectForKey:key];
167
+    
168
+    if (value == nil || value == [NSNull null])
169
+    {
170
+        return 0;
171
+    }
172
+    if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])
173
+    {
174
+        return [value charValue];
175
+    }
176
+    return 0;
177
+}
178
+- (short)shortForKey:(id)key
179
+{
180
+    id value = [self objectForKey:key];
181
+    
182
+    if (value == nil || value == [NSNull null])
183
+    {
184
+        return 0;
185
+    }
186
+    if ([value isKindOfClass:[NSNumber class]])
187
+    {
188
+        return [value shortValue];
189
+    }
190
+    if ([value isKindOfClass:[NSString class]])
191
+    {
192
+        return [value intValue];
193
+    }
194
+    return 0;
195
+}
196
+- (float)floatForKey:(id)key
197
+{
198
+    id value = [self objectForKey:key];
199
+    
200
+    if (value == nil || value == [NSNull null])
201
+    {
202
+        return 0;
203
+    }
204
+    if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])
205
+    {
206
+        return [value floatValue];
207
+    }
208
+    return 0;
209
+}
210
+- (double)doubleForKey:(id)key
211
+{
212
+    id value = [self objectForKey:key];
213
+    
214
+    if (value == nil || value == [NSNull null])
215
+    {
216
+        return 0;
217
+    }
218
+    if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])
219
+    {
220
+        return [value doubleValue];
221
+    }
222
+    return 0;
223
+}
224
+- (long long)longLongForKey:(id)key
225
+{
226
+    id value = [self objectForKey:key];
227
+    if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]]) {
228
+        return [value longLongValue];
229
+    }
230
+    return 0;
231
+}
232
+
233
+- (unsigned long long)unsignedLongLongForKey:(id)key
234
+{
235
+    id value = [self objectForKey:key];
236
+    if ([value isKindOfClass:[NSString class]]) {
237
+        NSNumberFormatter *nf = [[NSNumberFormatter alloc] init];
238
+        value = [nf numberFromString:value];
239
+    }
240
+    if ([value isKindOfClass:[NSNumber class]]) {
241
+        return [value unsignedLongLongValue];
242
+    }
243
+    return 0;
244
+}
245
+//CG
246
+- (CGFloat)CGFloatForKey:(id)key
247
+{
248
+    CGFloat f = [self[key] doubleValue];
249
+    return f;
250
+}
251
+
252
+- (CGPoint)pointForKey:(id)key
253
+{
254
+    CGPoint point = CGPointFromString(self[key]);
255
+    return point;
256
+}
257
+- (CGSize)sizeForKey:(id)key
258
+{
259
+    CGSize size = CGSizeFromString(self[key]);
260
+    return size;
261
+}
262
+- (CGRect)rectForKey:(id)key
263
+{
264
+    CGRect rect = CGRectFromString(self[key]);
265
+    return rect;
266
+}
267
+@end
268
+
269
+#pragma --mark NSMutableDictionary setter
270
+@implementation NSMutableDictionary (SafeAccess)
271
+-(void)setObj:(id)i forKey:(NSString*)key{
272
+    if (i!=nil) {
273
+        self[key] = i;
274
+    }
275
+}
276
+-(void)setString:(NSString*)i forKey:(NSString*)key;
277
+{
278
+    [self setValue:i forKey:key];
279
+}
280
+-(void)setBool:(BOOL)i forKey:(NSString *)key
281
+{
282
+    self[key] = @(i);
283
+}
284
+-(void)setInt:(int)i forKey:(NSString *)key
285
+{
286
+    self[key] = @(i);
287
+}
288
+-(void)setInteger:(NSInteger)i forKey:(NSString *)key
289
+{
290
+    self[key] = @(i);
291
+}
292
+-(void)setUnsignedInteger:(NSUInteger)i forKey:(NSString *)key
293
+{
294
+    self[key] = @(i);
295
+}
296
+-(void)setCGFloat:(CGFloat)f forKey:(NSString *)key
297
+{
298
+    self[key] = @(f);
299
+}
300
+-(void)setChar:(char)c forKey:(NSString *)key
301
+{
302
+    self[key] = @(c);
303
+}
304
+-(void)setFloat:(float)i forKey:(NSString *)key
305
+{
306
+    self[key] = @(i);
307
+}
308
+-(void)setDouble:(double)i forKey:(NSString*)key{
309
+    self[key] = @(i);
310
+}
311
+-(void)setLongLong:(long long)i forKey:(NSString*)key{
312
+    self[key] = @(i);
313
+}
314
+-(void)setPoint:(CGPoint)o forKey:(NSString *)key
315
+{
316
+    self[key] = NSStringFromCGPoint(o);
317
+}
318
+-(void)setSize:(CGSize)o forKey:(NSString *)key
319
+{
320
+    self[key] = NSStringFromCGSize(o);
321
+}
322
+-(void)setRect:(CGRect)o forKey:(NSString *)key
323
+{
324
+    self[key] = NSStringFromCGRect(o);
325
+}
326
+@end

+ 9 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckHomeViewController.m

@@ -122,6 +122,15 @@ static NSString *cellID = @"cellID";
122 122
         [self.tableHeaderView addSubview:self.cardDataView];
123 123
         
124 124
         NSArray *array = [NSArray yy_modelArrayWithClass:[WWCheckCardListModel class] json:json[@"card_list"]];
125
+        
126
+        NSMutableArray *mutArr = [NSMutableArray arrayWithCapacity:50];
127
+        for (WWCheckCardListModel *model in array) {
128
+            NSData *data = [NSKeyedArchiver archivedDataWithRootObject:model];
129
+            [mutArr addObject:data];
130
+        }
131
+        [[NSUserDefaults standardUserDefaults] setObject:mutArr forKey:kLocalCardListArray];
132
+        [[NSUserDefaults standardUserDefaults] synchronize];
133
+        
125 134
         [self.dataArray addObjectsFromArray:array];
126 135
         [self.tableView reloadData];
127 136
         

+ 62 - 13
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Controller/WWCheckRemindMeViewController.m

@@ -18,11 +18,18 @@ static NSString *cellID = @"cellID";
18 18
 
19 19
 @property (nonatomic, strong)UITableView *tableView;             //tableView
20 20
 @property (nonatomic, strong)NSMutableArray *statusArray;    //提醒开关状态
21
-
21
+@property (nonatomic, strong)WWRemindMeManager *manager;
22 22
 @end
23 23
 
24 24
 @implementation WWCheckRemindMeViewController
25 25
 
26
+- (WWRemindMeManager *)manager {
27
+    if (!_manager) {
28
+        _manager = [WWRemindMeManager shared];
29
+    }
30
+    return _manager;
31
+}
32
+
26 33
 - (void)viewDidLoad {
27 34
     [super viewDidLoad];
28 35
     // Do any additional setup after loading the view.
@@ -49,12 +56,16 @@ static NSString *cellID = @"cellID";
49 56
 
50 57
 #pragma mark - 配置数据
51 58
 - (void)createStatusArray {
52
-    self.statusArray = [[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray];
59
+    self.statusArray = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray]];
53 60
     if (self.statusArray == nil) {
54 61
         self.statusArray = [NSMutableArray array];
55
-        NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"出账日当天"}];
56
-        NSMutableDictionary *dict2 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"还款日当天"}];
57
-        NSMutableDictionary *dict3 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"超过还款日当天"}];
62
+        NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"出账日当天", @"limit": @0}];
63
+        NSMutableDictionary *dict2 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"还款日当天", @"limit": @0}];
64
+        NSMutableDictionary *dict3 = [[NSMutableDictionary alloc] initWithDictionary:@{@"isOn" : @(NO), @"time" : @"超过还款日当天", @"limit": @0}];
65
+        
66
+        [self.manager setBillStatus:NO];
67
+        [self.manager setRefundStatus:NO];
68
+        [self.manager setOverdueStatus:NO];
58 69
         
59 70
         [self.statusArray addObject:dict1];
60 71
         [self.statusArray addObject:dict2];
@@ -101,7 +112,7 @@ static NSString *cellID = @"cellID";
101 112
     [headerView addSubview:titleLabel];
102 113
     
103 114
     
104
-    NSMutableDictionary *isOnDict = self.statusArray[section];
115
+    NSDictionary *isOnDict = self.statusArray[section];
105 116
     BOOL swStatus = [isOnDict[@"isOn"] boolValue];
106 117
     
107 118
     //开关
@@ -134,7 +145,7 @@ static NSString *cellID = @"cellID";
134 145
 }
135 146
 
136 147
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
137
-    NSMutableDictionary *isOnDict = self.statusArray[indexPath.section];
148
+    NSDictionary *isOnDict = self.statusArray[indexPath.section];
138 149
     
139 150
     WWCheckRemindMeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
140 151
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -161,9 +172,11 @@ static NSString *cellID = @"cellID";
161 172
     pickerView.valueDidSelect = ^(NSString *value){
162 173
         NSArray * stateArr = [value componentsSeparatedByString:@"/"];
163 174
         
164
-        NSMutableDictionary *isOnDict = self.statusArray[indexPath.section];
165
-        [isOnDict setValue:stateArr.firstObject forKey:@"time"];
166
-        [self.statusArray replaceObjectAtIndex:indexPath.section withObject:isOnDict];
175
+        NSDictionary *isOnDict = self.statusArray[indexPath.section];
176
+        NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:isOnDict];
177
+        [mutDict setValue:stateArr.firstObject forKey:@"time"];
178
+        [mutDict setValue:stateArr[1] forKey:@"limit"];
179
+        [self.statusArray replaceObjectAtIndex:indexPath.section withObject:mutDict];
167 180
         [[NSUserDefaults standardUserDefaults] setObject:self.statusArray forKey:checkRemindStatusArray];
168 181
         
169 182
         WWCheckRemindMeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
@@ -183,14 +196,50 @@ static NSString *cellID = @"cellID";
183 196
 #pragma mark - 打开/关闭 开关
184 197
 - (void)onClickSwich:(UISwitch *)swich {
185 198
     
186
-    NSMutableDictionary *isOnDict = self.statusArray[swich.tag - 666];
187
-    [isOnDict setValue:@(swich.on) forKey:@"isOn"];
188
-    [self.statusArray replaceObjectAtIndex:(swich.tag - 666) withObject:isOnDict];
199
+    NSDictionary *isOnDict = self.statusArray[swich.tag - 666];
200
+    NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:isOnDict];
201
+    [mutDict setValue:@(swich.isOn) forKey:@"isOn"];
202
+    [self.statusArray replaceObjectAtIndex:(swich.tag - 666) withObject:mutDict];
189 203
     [[NSUserDefaults standardUserDefaults] setObject:self.statusArray forKey:checkRemindStatusArray];
190 204
     [[NSUserDefaults standardUserDefaults] synchronize];
191 205
     [self.tableView reloadData];
192 206
     
193 207
     // 打开/关闭开关  遍历信用卡账单日 注册/删除 本地通知
208
+    switch (swich.tag-666) {
209
+        case 0:
210
+        {
211
+            [self.manager setBillStatus:swich.isOn];
212
+            if (swich.isOn) {
213
+                [self.manager managerBillRegisterAll];
214
+            } else {
215
+                [self.manager managerBillRemoveAll];
216
+            }
217
+        }
218
+            break;
219
+        case 1:
220
+        {
221
+            [self.manager setRefundStatus:swich.isOn];
222
+            if (swich.isOn) {
223
+                [self.manager managerRefundRegisterAll];
224
+            } else {
225
+                [self.manager managerRefundRemoveAll];
226
+            }
227
+        }
228
+            break;
229
+        case 2:
230
+        {
231
+            [self.manager setOverdueStatus:swich.isOn];
232
+            if (swich.isOn) {
233
+                [self.manager managerOverdueRegisterAll];
234
+            } else {
235
+                [self.manager managerOverdueRemoveAll];
236
+            }
237
+        }
238
+            break;
239
+        default:
240
+            break;
241
+    }
242
+    
194 243
 }
195 244
 
196 245
 #pragma mark - 懒加载

+ 1 - 1
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.h

@@ -10,7 +10,7 @@
10 10
 
11 11
 NS_ASSUME_NONNULL_BEGIN
12 12
 
13
-@interface WWCheckCardListModel : NSObject
13
+@interface WWCheckCardListModel : NSObject <YYModel, NSCoding>
14 14
 
15 15
 @property (nonatomic, copy)NSString *bank_name;
16 16
 @property (nonatomic, copy)NSString *bill_account;

+ 8 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/HomePage/Model/WWCheckCardListModel.m

@@ -14,4 +14,12 @@
14 14
     return @{@"ID" : @"id"};
15 15
 }
16 16
 
17
+- (void)encodeWithCoder:(NSCoder *)aCoder {
18
+    [self yy_modelEncodeWithCoder:aCoder];
19
+}
20
+
21
+- (instancetype)initWithCoder:(NSCoder *)aDecoder {
22
+    return [self yy_modelInitWithCoder:aDecoder];
23
+}
24
+
17 25
 @end

+ 35 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/Manager/WWRemindMeManager.h

@@ -0,0 +1,35 @@
1
+//
2
+//  WWRemindMeManager.h
3
+//  KXCardHelp
4
+//
5
+//  Created by xiaoxi on 2018/12/7.
6
+//  Copyright © 2018 jcymac. All rights reserved.
7
+//
8
+
9
+#import <Foundation/Foundation.h>
10
+
11
+NS_ASSUME_NONNULL_BEGIN
12
+
13
+static NSString *kLocalCardListArray = @"kLocalCardListArray";
14
+
15
+@class WWCheckCardListModel;
16
+
17
+@interface WWRemindMeManager : NSObject
18
+
19
++ (instancetype)shared;
20
+- (void)setBillStatus:(BOOL)status;
21
+- (void)setRefundStatus:(BOOL)status;
22
+- (void)setOverdueStatus:(BOOL)status;
23
+- (void)managerRegister:(WWCheckCardListModel *)card;
24
+- (void)managerRemove:(WWCheckCardListModel *)card;
25
+- (void)managerOverducResetRigister:(WWCheckCardListModel *)card;
26
+- (void)managerBillRegisterAll;
27
+- (void)managerBillRemoveAll;
28
+- (void)managerRefundRegisterAll;
29
+- (void)managerRefundRemoveAll;
30
+- (void)managerOverdueRegisterAll;
31
+- (void)managerOverdueRemoveAll;
32
+
33
+@end
34
+
35
+NS_ASSUME_NONNULL_END

+ 181 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/Manager/WWRemindMeManager.m

@@ -0,0 +1,181 @@
1
+//
2
+//  WWRemindMeManager.m
3
+//  KXCardHelp
4
+//
5
+//  Created by xiaoxi on 2018/12/7.
6
+//  Copyright © 2018 jcymac. All rights reserved.
7
+//
8
+
9
+#import "WWRemindMeManager.h"
10
+#import "WWCheckCardListModel.h"
11
+
12
+static NSString *kBillStatus = @"kBillStatus";
13
+static NSString *kRefundStatus = @"kRefundStatus";
14
+static NSString *kOverdueStatus = @"kOverdueStatus";
15
+
16
+@implementation WWRemindMeManager
17
+
18
+static WWRemindMeManager *manager = nil;
19
++ (instancetype)shared {
20
+    static dispatch_once_t onceToken;
21
+    dispatch_once(&onceToken, ^{
22
+        manager = [[WWRemindMeManager alloc] init];
23
+    });
24
+    return manager;
25
+}
26
+
27
+- (void)setBillStatus:(BOOL)status {
28
+    [[NSUserDefaults standardUserDefaults] setBool:status forKey:kBillStatus];
29
+    [[NSUserDefaults standardUserDefaults] synchronize];
30
+}
31
+
32
+- (void)setRefundStatus:(BOOL)status {
33
+    [[NSUserDefaults standardUserDefaults] setBool:status forKey:kRefundStatus];
34
+    [[NSUserDefaults standardUserDefaults] synchronize];
35
+}
36
+
37
+- (void)setOverdueStatus:(BOOL)status {
38
+    [[NSUserDefaults standardUserDefaults] setBool:status forKey:kOverdueStatus];
39
+    [[NSUserDefaults standardUserDefaults] synchronize];
40
+}
41
+
42
+- (BOOL)managerStatus {
43
+    BOOL billStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kBillStatus];
44
+    BOOL refundStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kRefundStatus];
45
+    BOOL overdueStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kOverdueStatus];
46
+    return (billStatus || refundStatus || overdueStatus) ;
47
+}
48
+
49
+- (void)managerRemove:(WWCheckCardListModel *)card {
50
+    if ([self managerStatus]) {
51
+        NSArray *arr = [[UIApplication sharedApplication] scheduledLocalNotifications];
52
+        [arr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
53
+            UILocalNotification *localNoti = (UILocalNotification *)obj;
54
+            if ([localNoti.userInfo[@"account"] isEqualToString:card.bill_account]) {
55
+                [[UIApplication sharedApplication] cancelLocalNotification:localNoti];
56
+            }
57
+        }];
58
+    }
59
+}
60
+
61
+- (void)managerRegister:(WWCheckCardListModel *)card {
62
+    if ([self managerStatus]) {
63
+        NSArray *statusArr = [[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray];
64
+        BOOL billStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kBillStatus];
65
+        if (billStatus) {
66
+            NSDictionary *isOnDict = statusArr[0];
67
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"出账"];
68
+        }
69
+        BOOL refundStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kRefundStatus];
70
+        if (refundStatus) {
71
+            NSDictionary *isOnDict = statusArr[1];
72
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"还款"];
73
+        }
74
+        BOOL overdueStatus = [[NSUserDefaults standardUserDefaults] boolForKey:kOverdueStatus];
75
+        if (overdueStatus) {
76
+            NSDictionary *isOnDict = statusArr[2];
77
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"逾期"];
78
+        }
79
+    }
80
+}
81
+
82
+- (void)managerOverducResetRigister:(WWCheckCardListModel *)card {
83
+    NSArray *arr = [[UIApplication sharedApplication] scheduledLocalNotifications];
84
+    [arr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
85
+        UILocalNotification *localNoti = (UILocalNotification *)obj;
86
+        if ([localNoti.userInfo[@"account"] isEqualToString:card.bill_account]) {
87
+            [[UIApplication sharedApplication] cancelLocalNotification:localNoti];
88
+            localNoti.repeatInterval = NSCalendarUnitMonth;
89
+            [[UIApplication sharedApplication] scheduleLocalNotification:localNoti];
90
+            *stop = YES;
91
+        }
92
+    }];
93
+}
94
+
95
+- (void)managerBillRemoveAll {
96
+    NSArray *arr = [[UIApplication sharedApplication] scheduledLocalNotifications];
97
+    [arr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
98
+        UILocalNotification *localNoti = (UILocalNotification *)obj;
99
+        if ([localNoti.userInfo[@"name"] isEqualToString:@"出账"]) {
100
+            [[UIApplication sharedApplication] cancelLocalNotification:localNoti];
101
+        }
102
+    }];
103
+}
104
+
105
+- (void)managerBillRegisterAll {
106
+    NSArray *localArr = [[NSUserDefaults standardUserDefaults] objectForKey:kLocalCardListArray];
107
+    if (localArr && localArr.count > 0) {
108
+        NSArray *statusArr = [[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray];
109
+        [localArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
110
+            NSData *data = (NSData *)obj;
111
+            WWCheckCardListModel *card = [NSKeyedUnarchiver unarchiveObjectWithData:data];
112
+            NSDictionary *isOnDict = statusArr[0];
113
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"出账"];
114
+        }];
115
+    }
116
+}
117
+
118
+- (void)managerRefundRemoveAll {
119
+    NSArray *arr = [[UIApplication sharedApplication] scheduledLocalNotifications];
120
+    [arr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
121
+        UILocalNotification *localNoti = (UILocalNotification *)obj;
122
+        if ([localNoti.userInfo[@"name"] isEqualToString:@"还款"]) {
123
+            [[UIApplication sharedApplication] cancelLocalNotification:localNoti];
124
+        }
125
+    }];
126
+}
127
+
128
+- (void)managerRefundRegisterAll {
129
+    NSArray *localArr = [[NSUserDefaults standardUserDefaults] objectForKey:kLocalCardListArray];
130
+    if (localArr && localArr.count > 0) {
131
+        NSArray *statusArr = [[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray];
132
+        [localArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
133
+            NSData *data = (NSData *)obj;
134
+            WWCheckCardListModel *card = [NSKeyedUnarchiver unarchiveObjectWithData:data];
135
+            NSDictionary *isOnDict = statusArr[1];
136
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"还款"];
137
+        }];
138
+    }
139
+}
140
+
141
+- (void)managerOverdueRemoveAll {
142
+    NSArray *arr = [[UIApplication sharedApplication] scheduledLocalNotifications];
143
+    [arr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
144
+        UILocalNotification *localNoti = (UILocalNotification *)obj;
145
+        if ([localNoti.userInfo[@"name"] isEqualToString:@"逾期"]) {
146
+            [[UIApplication sharedApplication] cancelLocalNotification:localNoti];
147
+        }
148
+    }];
149
+}
150
+
151
+- (void)managerOverdueRegisterAll {
152
+    NSArray *localArr = [[NSUserDefaults standardUserDefaults] objectForKey:kLocalCardListArray];
153
+    if (localArr && localArr.count > 0) {
154
+        NSArray *statusArr = [[NSUserDefaults standardUserDefaults] objectForKey:checkRemindStatusArray];
155
+        [localArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
156
+            NSData *data = (NSData *)obj;
157
+            WWCheckCardListModel *card = [NSKeyedUnarchiver unarchiveObjectWithData:data];
158
+            NSDictionary *isOnDict = statusArr[2];
159
+            [self managerRegisterLocalNotificationWithParm:isOnDict card:card name:@"逾期"];
160
+        }];
161
+    }
162
+}
163
+
164
+- (void)managerRegisterLocalNotificationWithParm:(NSDictionary *)parm card:(WWCheckCardListModel *)card name:(NSString *)name {
165
+    UILocalNotification *localNote = [[UILocalNotification alloc] init];
166
+    localNote.timeZone = [NSTimeZone defaultTimeZone];
167
+    NSNumber *limit = [parm valueForKey:@"limit"];
168
+    if ([name isEqualToString:@"逾期"]) {
169
+        localNote.fireDate = [NSDate dateWithTimeInterval:10*60*60+24*60*60 sinceDate:[NSDate dateWithTimeIntervalSince1970:[card.due_date longValue]]];
170
+    } else {
171
+        localNote.fireDate = [NSDate dateWithTimeInterval:10*60*60-24*60*60*limit.intValue sinceDate:[NSDate dateWithTimeIntervalSince1970:[card.bill_date longValue]]];
172
+    }
173
+    localNote.repeatInterval = NSCalendarUnitMonth;
174
+    localNote.alertBody = [NSString stringWithFormat:@"%@%@啦",card.bill_account,name];
175
+    localNote.soundName = UILocalNotificationDefaultSoundName;
176
+    localNote.applicationIconBadgeNumber = [UIApplication sharedApplication].applicationIconBadgeNumber+1;
177
+    localNote.userInfo = @{@"name":name,@"limit":limit,@"account":card.bill_account};
178
+    [[UIApplication sharedApplication] scheduleLocalNotification:localNote];
179
+}
180
+
181
+@end

+ 11 - 0
KXCardHelp/Main/CheckPage/CreditCardManager/Mine/Controller/WWCheckCardListDetailVC.m

@@ -17,11 +17,19 @@ static NSString *cellID = @"cellID";
17 17
 
18 18
 @property (nonatomic, strong)UITableView *tableView;     //tableView
19 19
 @property (nonatomic, strong)UIView *tableFootView;      //底部视图
20
+@property (nonatomic, strong)WWRemindMeManager *manager;
20 21
 
21 22
 @end
22 23
 
23 24
 @implementation WWCheckCardListDetailVC
24 25
 
26
+- (WWRemindMeManager *)manager {
27
+    if (!_manager) {
28
+        _manager = [WWRemindMeManager shared];
29
+    }
30
+    return _manager;
31
+}
32
+
25 33
 - (void)viewDidLoad {
26 34
     [super viewDidLoad];
27 35
     // Do any additional setup after loading the view.
@@ -101,6 +109,7 @@ static NSString *cellID = @"cellID";
101 109
     if ([self.cardModel.status isEqualToString:@"1"]) {   //立即还款
102 110
         [LVKBHttp post:checkeRefundCardRequest params:@{@"id" : self.cardModel.ID} success:^(id json) {
103 111
             //
112
+            [self.manager managerOverducResetRigister:self.cardModel];
104 113
             [self.navigationController popViewControllerAnimated:YES];
105 114
         } failure:^(NSError *error) {
106 115
             //
@@ -114,6 +123,7 @@ static NSString *cellID = @"cellID";
114 123
 - (void)deleteCard {
115 124
     [LVKBHttp post:checkeDelCarddCardRequest params:@{@"id" : self.cardModel.ID} success:^(id json) {
116 125
         //
126
+        [self.manager managerRemove:self.cardModel];
117 127
         [self.navigationController popViewControllerAnimated:YES];
118 128
     } failure:^(NSError *error) {
119 129
         //
@@ -212,6 +222,7 @@ static NSString *cellID = @"cellID";
212 222
     if ([model.status isEqualToString:@"1"]) {   //立即还款
213 223
         [LVKBHttp post:checkeRefundCardRequest params:@{@"id" : model.ID} success:^(id json) {
214 224
             //
225
+            [self.manager managerOverducResetRigister:model];
215 226
             [self.navigationController popViewControllerAnimated:YES];
216 227
         } failure:^(NSError *error) {
217 228
             //

+ 2 - 2
KXCardHelp/Tools/WWValuePickerView/WWValuePickerView.m

@@ -128,7 +128,7 @@
128 128
     }
129 129
     
130 130
     //设置返回默认值
131
-    self.stateStr = [NSString stringWithFormat:@"%@/%@",_dataSource[0],@(1)];
131
+    self.stateStr = [NSString stringWithFormat:@"%@/%@",_dataSource[0],@(0)];
132 132
     
133 133
     //刷新布局
134 134
     [self layoutSelfSubviews];
@@ -179,7 +179,7 @@
179 179
 
180 180
 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
181 181
 {
182
-    self.stateStr = [NSString stringWithFormat:@"%@/%@",self.dataSource[row], @(row + 1)];
182
+    self.stateStr = [NSString stringWithFormat:@"%@/%@",self.dataSource[row], @(row)];
183 183
 }
184 184
 
185 185
 #pragma mark - 按钮相关

+ 84 - 0
Pods/Pods.xcodeproj/xcuserdata/xiaoxi.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -0,0 +1,84 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>SchemeUserState</key>
6
+	<dict>
7
+		<key>AFNetworking.xcscheme</key>
8
+		<dict>
9
+			<key>orderHint</key>
10
+			<integer>0</integer>
11
+		</dict>
12
+		<key>FLAnimatedImage.xcscheme</key>
13
+		<dict>
14
+			<key>orderHint</key>
15
+			<integer>1</integer>
16
+		</dict>
17
+		<key>FMDB.xcscheme</key>
18
+		<dict>
19
+			<key>orderHint</key>
20
+			<integer>2</integer>
21
+		</dict>
22
+		<key>IQKeyboardManager.xcscheme</key>
23
+		<dict>
24
+			<key>orderHint</key>
25
+			<integer>3</integer>
26
+		</dict>
27
+		<key>MBProgressHUD.xcscheme</key>
28
+		<dict>
29
+			<key>orderHint</key>
30
+			<integer>5</integer>
31
+		</dict>
32
+		<key>MJExtension.xcscheme</key>
33
+		<dict>
34
+			<key>orderHint</key>
35
+			<integer>6</integer>
36
+		</dict>
37
+		<key>MJRefresh.xcscheme</key>
38
+		<dict>
39
+			<key>orderHint</key>
40
+			<integer>7</integer>
41
+		</dict>
42
+		<key>Masonry.xcscheme</key>
43
+		<dict>
44
+			<key>orderHint</key>
45
+			<integer>4</integer>
46
+		</dict>
47
+		<key>PPBadgeView.xcscheme</key>
48
+		<dict>
49
+			<key>orderHint</key>
50
+			<integer>9</integer>
51
+		</dict>
52
+		<key>Pods-KXCardHelp.xcscheme</key>
53
+		<dict>
54
+			<key>orderHint</key>
55
+			<integer>8</integer>
56
+		</dict>
57
+		<key>ReactiveCocoa.xcscheme</key>
58
+		<dict>
59
+			<key>orderHint</key>
60
+			<integer>10</integer>
61
+		</dict>
62
+		<key>SDWebImage.xcscheme</key>
63
+		<dict>
64
+			<key>orderHint</key>
65
+			<integer>11</integer>
66
+		</dict>
67
+		<key>XHLaunchAd.xcscheme</key>
68
+		<dict>
69
+			<key>orderHint</key>
70
+			<integer>12</integer>
71
+		</dict>
72
+		<key>YYCategories.xcscheme</key>
73
+		<dict>
74
+			<key>orderHint</key>
75
+			<integer>13</integer>
76
+		</dict>
77
+		<key>YYModel.xcscheme</key>
78
+		<dict>
79
+			<key>orderHint</key>
80
+			<integer>14</integer>
81
+		</dict>
82
+	</dict>
83
+</dict>
84
+</plist>