网络层完善;tabbar。

This commit is contained in:
zu
2021-09-07 23:05:43 +08:00
parent cbc85a02d2
commit f5c178bdfd
70 changed files with 1094 additions and 134 deletions

View File

@@ -8,6 +8,7 @@ target 'xplan-ios' do
# Pods for xplan-ios # Pods for xplan-ios
pod 'AFNetworking' pod 'AFNetworking'
pod 'YYText' pod 'YYText'
pod 'YYModel'
pod 'Masonry' pod 'Masonry'
pod 'ReactiveObjC' pod 'ReactiveObjC'
pod 'MBProgressHUD' pod 'MBProgressHUD'

View File

@@ -18,6 +18,7 @@ PODS:
- MBProgressHUD (1.2.0) - MBProgressHUD (1.2.0)
- NTESQuickPass (2.1.9) - NTESQuickPass (2.1.9)
- ReactiveObjC (3.1.1) - ReactiveObjC (3.1.1)
- YYModel (1.0.4)
- YYText (1.0.7) - YYText (1.0.7)
DEPENDENCIES: DEPENDENCIES:
@@ -26,6 +27,7 @@ DEPENDENCIES:
- MBProgressHUD - MBProgressHUD
- NTESQuickPass (~> 2.1.6) - NTESQuickPass (~> 2.1.6)
- ReactiveObjC - ReactiveObjC
- YYModel
- YYText - YYText
SPEC REPOS: SPEC REPOS:
@@ -35,6 +37,7 @@ SPEC REPOS:
- MBProgressHUD - MBProgressHUD
- NTESQuickPass - NTESQuickPass
- ReactiveObjC - ReactiveObjC
- YYModel
- YYText - YYText
SPEC CHECKSUMS: SPEC CHECKSUMS:
@@ -43,8 +46,9 @@ SPEC CHECKSUMS:
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377 NTESQuickPass: 8431dc52737c95883cd382c2ee75664d58f39377
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040 ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849 YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
PODFILE CHECKSUM: f8d8c44df1ae85a1571fe37ee767fc992db1ff6b PODFILE CHECKSUM: 34d6fc0f46b543fbcabfb886e7a531f43d5dd7f5
COCOAPODS: 1.10.1 COCOAPODS: 1.10.1

View File

@@ -7,6 +7,10 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEDB26E89B32002833B2 /* BaseModel.m */; };
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEE026E89BFB002833B2 /* AccountModel.m */; };
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */; };
187EEEFE26E8A82C002833B2 /* NSObject+AutoCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEFC26E8A82C002833B2 /* NSObject+AutoCoding.m */; };
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD52D26DE255300AB55B1 /* AppDelegate.m */; }; 189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD52D26DE255300AB55B1 /* AppDelegate.m */; };
189DD53426DE255300AB55B1 /* TabbarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD53326DE255300AB55B1 /* TabbarViewController.m */; }; 189DD53426DE255300AB55B1 /* TabbarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD53326DE255300AB55B1 /* TabbarViewController.m */; };
189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 189DD53826DE255600AB55B1 /* Assets.xcassets */; }; 189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 189DD53826DE255600AB55B1 /* Assets.xcassets */; };
@@ -29,10 +33,21 @@
189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD74E26E21D9000AB55B1 /* GCDHelper.m */; }; 189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD74E26E21D9000AB55B1 /* GCDHelper.m */; };
189DD75926E6003C00AB55B1 /* Api.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD75826E6003C00AB55B1 /* Api.m */; }; 189DD75926E6003C00AB55B1 /* Api.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD75826E6003C00AB55B1 /* Api.m */; };
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD76126E60DDC00AB55B1 /* Api+Login.m */; }; 189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */ = {isa = PBXBuildFile; fileRef = 189DD76126E60DDC00AB55B1 /* Api+Login.m */; };
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E7B1B126E8AF980064BC9B /* MainPresenter.m */; };
18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E7B1B626E8B2D10064BC9B /* Api+Main.m */; };
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; }; 73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; };
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
187EEEDA26E89B32002833B2 /* BaseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseModel.h; sourceTree = "<group>"; };
187EEEDB26E89B32002833B2 /* BaseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseModel.m; sourceTree = "<group>"; };
187EEEDF26E89BFB002833B2 /* AccountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountModel.h; sourceTree = "<group>"; };
187EEEE026E89BFB002833B2 /* AccountModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccountModel.m; sourceTree = "<group>"; };
187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountInfoStorage.m; sourceTree = "<group>"; };
187EEEEF26E89FE8002833B2 /* AccountInfoStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountInfoStorage.h; sourceTree = "<group>"; };
187EEEFC26E8A82C002833B2 /* NSObject+AutoCoding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+AutoCoding.m"; sourceTree = "<group>"; };
187EEEFD26E8A82C002833B2 /* NSObject+AutoCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+AutoCoding.h"; sourceTree = "<group>"; };
189DD52926DE255300AB55B1 /* xplan-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "xplan-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 189DD52926DE255300AB55B1 /* xplan-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "xplan-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
189DD52C26DE255300AB55B1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 189DD52C26DE255300AB55B1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
189DD52D26DE255300AB55B1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 189DD52D26DE255300AB55B1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -78,7 +93,14 @@
189DD76026E60DDC00AB55B1 /* Api+Login.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+Login.h"; sourceTree = "<group>"; }; 189DD76026E60DDC00AB55B1 /* Api+Login.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+Login.h"; sourceTree = "<group>"; };
189DD76126E60DDC00AB55B1 /* Api+Login.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+Login.m"; sourceTree = "<group>"; }; 189DD76126E60DDC00AB55B1 /* Api+Login.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+Login.m"; sourceTree = "<group>"; };
189DD78026E620FE00AB55B1 /* ApiHost.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApiHost.h; sourceTree = "<group>"; }; 189DD78026E620FE00AB55B1 /* ApiHost.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApiHost.h; sourceTree = "<group>"; };
18E7B1AE26E8AD760064BC9B /* MainProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainProtocol.h; sourceTree = "<group>"; };
18E7B1B026E8AF980064BC9B /* MainPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainPresenter.h; sourceTree = "<group>"; };
18E7B1B126E8AF980064BC9B /* MainPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MainPresenter.m; sourceTree = "<group>"; };
18E7B1B526E8B2D10064BC9B /* Api+Main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+Main.h"; sourceTree = "<group>"; };
18E7B1B626E8B2D10064BC9B /* Api+Main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+Main.m"; sourceTree = "<group>"; };
7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = "<group>"; }; 7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = "<group>"; };
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = "<group>"; };
B66633E061B1B34177CD011C /* Pods-xplan-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.release.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.release.xcconfig"; sourceTree = "<group>"; }; B66633E061B1B34177CD011C /* Pods-xplan-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.release.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.release.xcconfig"; sourceTree = "<group>"; };
CACF623970097D653132D69A /* Pods_xplan_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xplan_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CACF623970097D653132D69A /* Pods_xplan_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xplan_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@@ -178,6 +200,14 @@
189DD56026DE456100AB55B1 /* Model */ = { 189DD56026DE456100AB55B1 /* Model */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
187EEEDA26E89B32002833B2 /* BaseModel.h */,
187EEEDB26E89B32002833B2 /* BaseModel.m */,
187EEEDF26E89BFB002833B2 /* AccountModel.h */,
187EEEE026E89BFB002833B2 /* AccountModel.m */,
187EEEEF26E89FE8002833B2 /* AccountInfoStorage.h */,
187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */,
187EEEFD26E8A82C002833B2 /* NSObject+AutoCoding.h */,
187EEEFC26E8A82C002833B2 /* NSObject+AutoCoding.m */,
); );
path = Model; path = Model;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -185,10 +215,8 @@
189DD56126DE45F800AB55B1 /* Main */ = { 189DD56126DE45F800AB55B1 /* Main */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
189DD54826DE327B00AB55B1 /* MVP */, 18E7B1B426E8B2960064BC9B /* Tabbar */,
189DD56226DE460400AB55B1 /* Login */, 189DD56226DE460400AB55B1 /* Login */,
189DD53226DE255300AB55B1 /* TabbarViewController.h */,
189DD53326DE255300AB55B1 /* TabbarViewController.m */,
); );
path = Main; path = Main;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -208,6 +236,7 @@
189DD56B26DF5B0900AB55B1 /* Base */ = { 189DD56B26DF5B0900AB55B1 /* Base */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
189DD54826DE327B00AB55B1 /* MVP */,
189DD61E26E0ED0100AB55B1 /* Net */, 189DD61E26E0ED0100AB55B1 /* Net */,
189DD5A726DFA09700AB55B1 /* Tool */, 189DD5A726DFA09700AB55B1 /* Tool */,
189DD56C26DF5B5400AB55B1 /* UI */, 189DD56C26DF5B5400AB55B1 /* UI */,
@@ -221,6 +250,8 @@
children = ( children = (
189DD54926DE338800AB55B1 /* BaseViewController.h */, 189DD54926DE338800AB55B1 /* BaseViewController.h */,
189DD54A26DE338800AB55B1 /* BaseViewController.m */, 189DD54A26DE338800AB55B1 /* BaseViewController.m */,
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */,
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */,
189DD67C26E1FD8900AB55B1 /* UIImage+Utils.h */, 189DD67C26E1FD8900AB55B1 /* UIImage+Utils.h */,
189DD67D26E1FD8900AB55B1 /* UIImage+Utils.m */, 189DD67D26E1FD8900AB55B1 /* UIImage+Utils.m */,
189DD68326E1FDBB00AB55B1 /* XCHUDTool.h */, 189DD68326E1FDBB00AB55B1 /* XCHUDTool.h */,
@@ -332,6 +363,20 @@
path = Api; path = Api;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
18E7B1B426E8B2960064BC9B /* Tabbar */ = {
isa = PBXGroup;
children = (
18E7B1B526E8B2D10064BC9B /* Api+Main.h */,
18E7B1B626E8B2D10064BC9B /* Api+Main.m */,
18E7B1B026E8AF980064BC9B /* MainPresenter.h */,
18E7B1B126E8AF980064BC9B /* MainPresenter.m */,
18E7B1AE26E8AD760064BC9B /* MainProtocol.h */,
189DD53226DE255300AB55B1 /* TabbarViewController.h */,
189DD53326DE255300AB55B1 /* TabbarViewController.m */,
);
path = Tabbar;
sourceTree = "<group>";
};
BFB922F5D81845AC32D1E1ED /* Frameworks */ = { BFB922F5D81845AC32D1E1ED /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -482,18 +527,25 @@
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */, 189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */,
189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */, 189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */,
189DD53426DE255300AB55B1 /* TabbarViewController.m in Sources */, 189DD53426DE255300AB55B1 /* TabbarViewController.m in Sources */,
187EEEFE26E8A82C002833B2 /* NSObject+AutoCoding.m in Sources */,
189DD55A26DE39D200AB55B1 /* BaseMvpPresenter.m in Sources */, 189DD55A26DE39D200AB55B1 /* BaseMvpPresenter.m in Sources */,
189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */, 189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */,
189DD74A26E21D8400AB55B1 /* SSKeychain.m in Sources */, 189DD74A26E21D8400AB55B1 /* SSKeychain.m in Sources */,
189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */, 189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */,
189DD73F26E21C3F00AB55B1 /* YYUtility+Carrier.m in Sources */, 189DD73F26E21C3F00AB55B1 /* YYUtility+Carrier.m in Sources */,
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */,
189DD54B26DE338800AB55B1 /* BaseViewController.m in Sources */, 189DD54B26DE338800AB55B1 /* BaseViewController.m in Sources */,
18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */,
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */,
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */, 189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */, 189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */, 189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */, 189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */, 189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */,
189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */, 189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */,
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */,
189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */, 189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */,
189DD75926E6003C00AB55B1 /* Api.m in Sources */, 189DD75926E6003C00AB55B1 /* Api.m in Sources */,
189DD53F26DE255600AB55B1 /* main.m in Sources */, 189DD53F26DE255600AB55B1 /* main.m in Sources */,

View File

@@ -7,6 +7,7 @@
#import "AppDelegate.h" #import "AppDelegate.h"
#import "TabbarViewController.h" #import "TabbarViewController.h"
#import "BaseNavigationController.h"
@interface AppDelegate () @interface AppDelegate ()
@@ -16,9 +17,10 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
TabbarViewController *vc = [[TabbarViewController alloc] init]; TabbarViewController *vc = [[TabbarViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
[bnc setNavigationBarHidden:YES];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = nav; self.window.rootViewController = bnc;
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
return YES; return YES;
} }

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_discover_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_discover_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_discover_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_discover_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_gameHome_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_gameHome_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_gameHome_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_gameHome_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_game_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_game_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_game_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_game_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_message_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_message_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_message_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_message_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_mine_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_mine_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tab_mine_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_mine_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tabbar_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tabbar_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

View File

@@ -11,6 +11,7 @@
// Include any system framework and library headers here that should be included in all compilation units. // Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <YYModel/YYModel.h>
#define AppName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]) #define AppName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"])
@@ -36,6 +37,12 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
#define ThemeButtonGradientStartColor UIColorFromRGB(0x218EFF) #define ThemeButtonGradientStartColor UIColorFromRGB(0x218EFF)
/// 按钮渐变色 end /// 按钮渐变色 end
#define ThemeButtonGradientEndColor UIColorFromRGB(0x7727E4) #define ThemeButtonGradientEndColor UIColorFromRGB(0x7727E4)
/// Tabbar 未选中
#define ThemeTabbarNormalColor UIColorFromRGB(0x555574)
/// Tabbar 选中
#define ThemeTabbarSelectedColor UIColorFromRGB(0x248CFE)
/// Tabbar 背景色
#define ThemeTabbarBackgroundColor UIColorFromRGB(0x2A2A39)
#define KScreenWidth [[UIScreen mainScreen] bounds].size.width #define KScreenWidth [[UIScreen mainScreen] bounds].size.width
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height #define KScreenHeight [[UIScreen mainScreen] bounds].size.height

View File

@@ -0,0 +1,25 @@
//
// DataUtils.h
// YYFaceAuth
//
// Created by chenran on 16/10/18.
// Copyright © 2016年 zhangji. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AccountModel.h"
@interface AccountInfoStorage : NSObject
+ (instancetype)instance;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (id)copy NS_UNAVAILABLE;
- (id)mutableCopy NS_UNAVAILABLE;
- (AccountModel *)getCurrentAccountInfo;
- (void)saveAccountInfo:(AccountModel *)accountInfo;
- (void)saveTicket:(NSString *)ticket;
- (NSString *)getTicket;
- (NSString *)getUid;
@end

View File

@@ -0,0 +1,89 @@
//
// DataUtils.m
// YYFaceAuth
//
// Created by chenran on 16/10/18.
// Copyright © 2016 zhangji. All rights reserved.
//
#define kFileName @"AccountInfo.data"
#define kDataKey @"accountInfo"
#import "AccountInfoStorage.h"
@interface AccountInfoStorage()
@property (nonatomic, copy) NSString *ticket;
@property (nonatomic, strong) AccountModel *accountModel;
@end
@implementation AccountInfoStorage
static AccountInfoStorage *_instance = nil;
+ (AccountInfoStorage *)instance {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[self alloc] init];
}) ;
return _instance;
}
-(NSString *) getFilePath{
NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[array objectAtIndex:0] stringByAppendingPathComponent:kFileName];
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil];
}
return path;
}
- (AccountModel *)getCurrentAccountInfo
{
if (self.accountModel != nil) {
return self.accountModel;
}
NSData *data = [[NSData alloc] initWithContentsOfFile:[self getFilePath]];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
//
self.accountModel = [unarchiver decodeObjectForKey:kDataKey];
[unarchiver finishDecoding];//finishDecoding
return self.accountModel;
}
- (void)saveAccountInfo:(AccountModel *)accountInfo
{
if (accountInfo == nil) {
accountInfo = [[AccountModel alloc] init];
}
self.accountModel = accountInfo;
NSMutableData *data = [[NSMutableData alloc] init];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
[archiver encodeObject:accountInfo forKey:kDataKey];
[archiver finishEncoding];
[data writeToFile:[self getFilePath] atomically:YES];
}
- (void)saveTicket:(NSString *)t
{
self.ticket = t;
}
- (NSString *)getTicket
{
return self.ticket;
}
- (NSString *)getUid
{
AccountModel *am = [self getCurrentAccountInfo];
if (am == nil) {
return @"";
}
return am.uid;
}
@end

View File

@@ -0,0 +1,24 @@
//
// TokenModel.h
// xplan-ios
//
// Created by zu on 2021/9/8.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AccountModel : NSObject<NSCopying, YYModel>
@property (nonatomic , assign) NSString *uid;
@property (nonatomic , copy) NSString *jti;
@property (nonatomic , copy) NSString *token_type;
@property (nonatomic , copy) NSString *refresh_token;
@property (nonatomic , copy) NSString *netEaseToken;
@property (nonatomic , copy) NSString *access_token;
@property (nonatomic , assign) NSNumber *expires_in;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// TokenModel.m
// xplan-ios
//
// Created by zu on 2021/9/8.
//
#import "AccountModel.h"
@implementation AccountModel
@end

View File

@@ -0,0 +1,20 @@
//
// BaseModel.h
// xplan-ios
//
// Created by zu on 2021/9/8.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface BaseModel : NSObject
@property (nonatomic , strong) id data;
@property (nonatomic , assign) NSInteger code;
@property (nonatomic , copy) NSString *message;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// BaseModel.m
// xplan-ios
//
// Created by zu on 2021/9/8.
//
#import "BaseModel.h"
@implementation BaseModel
@end

View File

@@ -0,0 +1,25 @@
//
// NSObject+AutoCoding.h
// YYMobileFramework
//
// Created by wuwei on 14/6/13.
// Copyright (c) 2014年 YY Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSObject (AutoCoding) <NSSecureCoding>
// Coding
+ (NSDictionary *)codableProperties;
- (void)setWithCoder:(NSCoder *)aDecoder;
// Properties access
- (NSDictionary *)codableProperties;
- (NSDictionary *)dictionaryRepresentation;
// Loading / Saving
+ (instancetype)objectWithContentsOfFile:(NSString *)path;
- (BOOL)writeToFile:(NSString *)filePath atomically:(BOOL)useAuxiliaryFile;
@end

View File

@@ -0,0 +1,245 @@
//
// NSObject+AutoCoding.m
// YYMobileFramework
//
// Created by wuwei on 14/6/13.
// Copyright (c) 2014 YY Inc. All rights reserved.
//
#import "NSObject+AutoCoding.h"
#import <objc/runtime.h>
#pragma GCC diagnostic ignored "-Wgnu"
static NSString *const AutocodingException = @"AutocodingException";
@implementation NSObject (AutoCoding)
+ (BOOL)supportsSecureCoding
{
return YES;
}
+ (instancetype)objectWithContentsOfFile:(NSString *)filePath
{
//load the file
NSData *data = [NSData dataWithContentsOfFile:filePath];
//attempt to deserialise data as a plist
id object = nil;
if (data)
{
NSPropertyListFormat format;
object = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:NULL];
//success?
if (object)
{
//check if object is an NSCoded unarchive
if ([object respondsToSelector:@selector(objectForKey:)] && [(NSDictionary *)object objectForKey:@"$archiver"])
{
object = [NSKeyedUnarchiver unarchiveObjectWithData:data];
}
}
else
{
//return raw data
object = data;
}
}
//return object
return object;
}
- (BOOL)writeToFile:(NSString *)filePath atomically:(BOOL)useAuxiliaryFile
{
//note: NSData, NSDictionary and NSArray already implement this method
//and do not save using NSCoding, however the objectWithContentsOfFile
//method will correctly recover these objects anyway
//archive object
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self];
return [data writeToFile:filePath atomically:useAuxiliaryFile];
}
+ (NSDictionary *)codableProperties
{
unsigned int propertyCount;
__autoreleasing NSMutableDictionary *codableProperties = [NSMutableDictionary dictionary];
objc_property_t *properties = class_copyPropertyList(self, &propertyCount);
for (unsigned int i = 0; i < propertyCount; i++)
{
//get property name
objc_property_t property = properties[i];
const char *propertyName = property_getName(property);
__autoreleasing NSString *key = @(propertyName);
//check if codable
//get property type
Class propertyClass = nil;
char *typeEncoding = property_copyAttributeValue(property, "T");
switch (typeEncoding[0])
{
case '@':
{
if (strlen(typeEncoding) >= 3)
{
char *className = strndup(typeEncoding + 2, strlen(typeEncoding) - 3);
__autoreleasing NSString *name = @(className);
NSRange range = [name rangeOfString:@"<"];
if (range.location != NSNotFound)
{
name = [name substringToIndex:range.location];
}
propertyClass = NSClassFromString(name) ?: [NSObject class];
free(className);
}
break;
}
case 'c':
case 'i':
case 's':
case 'l':
case 'q':
case 'C':
case 'I':
case 'S':
case 'L':
case 'Q':
case 'f':
case 'd':
case 'B':
{
propertyClass = [NSNumber class];
break;
}
case '{':
{
propertyClass = [NSValue class];
break;
}
default:
break;
}
free(typeEncoding);
if (propertyClass && [propertyClass conformsToProtocol:@protocol(NSSecureCoding)])
{
//check if there is a backing ivar
char *ivar = property_copyAttributeValue(property, "V");
if (ivar)
{
//check if ivar has KVC-compliant name
__autoreleasing NSString *ivarName = @(ivar);
if ([ivarName isEqualToString:key] || [ivarName isEqualToString:[@"_" stringByAppendingString:key]])
{
//no setter, but setValue:forKey: will still work
codableProperties[key] = propertyClass;
}
free(ivar);
}
else
{
//check if property is dynamic and readwrite
char *dynamic = property_copyAttributeValue(property, "D");
char *readonly = property_copyAttributeValue(property, "R");
if (dynamic && !readonly)
{
//no ivar, but setValue:forKey: will still work
codableProperties[key] = propertyClass;
}
free(dynamic);
free(readonly);
}
}
}
free(properties);
return codableProperties;
}
- (NSDictionary *)codableProperties
{
__autoreleasing NSDictionary *codableProperties = objc_getAssociatedObject([self class], _cmd);
if (!codableProperties)
{
codableProperties = [NSMutableDictionary dictionary];
Class subclass = [self class];
while (subclass != [NSObject class])
{
[(NSMutableDictionary *)codableProperties addEntriesFromDictionary:[subclass codableProperties]];
subclass = [subclass superclass];
}
codableProperties = [NSDictionary dictionaryWithDictionary:codableProperties];
//make the association atomically so that we don't need to bother with an @synchronize
objc_setAssociatedObject([self class], _cmd, codableProperties, OBJC_ASSOCIATION_RETAIN);
}
return codableProperties;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (__unsafe_unretained NSString *key in [self codableProperties])
{
id value = [self valueForKey:key];
if (value)
dict[key] = value;
else
dict[key] = @"nil";
}
return dict;
}
- (void)setWithCoder:(NSCoder *)aDecoder
{
BOOL secureAvailable = [aDecoder respondsToSelector:@selector(decodeObjectOfClass:forKey:)];
BOOL secureSupported = [[self class] supportsSecureCoding];
NSDictionary *properties = [self codableProperties];
for (NSString *key in properties)
{
id object = nil;
Class propertyClass = properties[key];
if (secureAvailable)
{
if ([propertyClass isEqual:[NSMutableAttributedString class]]) {
continue;
}
object = [aDecoder decodeObjectOfClass:propertyClass forKey:key];
}
else
{
if ([propertyClass isEqual:[NSMutableAttributedString class]]) {
continue;
}
object = [aDecoder decodeObjectForKey:key];
}
if (object)
{
if (secureSupported && ![object isKindOfClass:propertyClass])
{
[NSException raise:AutocodingException format:@"Expected '%@' to be a %@, but was actually a %@", key, propertyClass, [object class]];
}
[self setValue:object forKey:key];
}
}
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
[self setWithCoder:aDecoder];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
for (NSString *key in [self codableProperties])
{
id object = [self valueForKey:key];
if (object) [aCoder encodeObject:object forKey:key];
}
}
@end

View File

@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef void(^HttpSuccess)(id _Nonnull data); typedef void(^HttpSuccess)(BaseModel *data);
typedef void(^HttpFail)(NSNumber * _Nonnull code, NSString * _Nullable msg); typedef void(^HttpFail)(NSNumber * _Nonnull code, NSString * _Nullable msg);
@interface BaseMvpPresenter : NSObject @interface BaseMvpPresenter : NSObject

View File

@@ -28,7 +28,10 @@
if (loading) { if (loading) {
[XCHUDTool showLoading]; [XCHUDTool showLoading];
} }
return ^(id _Nullable data, NSNumber * _Nonnull code, NSString * _Nullable msg) { return ^(BaseModel *data, NSNumber * _Nonnull code, NSString * _Nullable msg) {
if (loading) {
[XCHUDTool hideHUD];
}
if (data != nil) { if (data != nil) {
NSString *message = [data valueForKey:@"message"]; NSString *message = [data valueForKey:@"message"];
NSNumber *resCode = [data valueForKey:@"code"]; NSNumber *resCode = [data valueForKey:@"code"];

View File

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MvpViewController<T> : BaseViewController<BaseMvpProtocol> @interface MvpViewController<T> : BaseViewController<BaseMvpProtocol>
@property (nonatomic,strong) __kindof T presenter; @property (nonatomic, strong) __kindof T presenter;
- (__kindof T)createPresenter; - (__kindof T)createPresenter;

View File

@@ -6,6 +6,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "BaseModel.h"
typedef NS_ENUM(NSUInteger, HttpRequestHelperMethod) { typedef NS_ENUM(NSUInteger, HttpRequestHelperMethod) {
HttpRequestHelperMethodPOST, HttpRequestHelperMethodPOST,
@@ -14,39 +15,27 @@ typedef NS_ENUM(NSUInteger, HttpRequestHelperMethod) {
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
typedef void(^HttpRequestHelperCompletion)(id _Nullable data, NSNumber * _Nullable code, NSString * _Nullable msg); typedef void(^HttpRequestHelperCompletion)(BaseModel* _Nullable data, NSNumber * _Nullable code, NSString * _Nullable msg);
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface HttpRequestHelper : NSObject @interface HttpRequestHelper : NSObject
+ (void)GET:(NSString *)method + (void)GET:(NSString *)method
params:(NSDictionary *)params params:(NSDictionary *)params
success:(void (^)(id data))success success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure;
+ (void)GET:(NSString *)interfaceUrl
method:(NSString *)method
params:(NSDictionary *)params
success:(void (^)(id data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure; failure:(void (^)(NSNumber *resCode, NSString *message))failure;
+ (void)POST:(NSString *)method + (void)POST:(NSString *)method
params:(NSDictionary *)params params:(NSDictionary *)params
success:(void (^)(id data))success success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure;
+ (void)POST:(NSString *)interfaceUrl
method:(NSString *)method
params:(NSDictionary *)params
success:(void (^)(id data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure; failure:(void (^)(NSNumber *resCode, NSString *message))failure;
+ (void)request:(NSString *)url + (void)request:(NSString *)url
method:(HttpRequestHelperMethod)method method:(HttpRequestHelperMethod)method
params:(NSDictionary *)params params:(NSDictionary *)params
success:(void (^)(id data))success success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure; failure:(void (^)(NSNumber *resCode, NSString *message))failure;
+ (void)request:(NSString *)path + (void)request:(NSString *)path

View File

@@ -8,6 +8,7 @@
#import "HttpRequestHelper.h" #import "HttpRequestHelper.h"
#import "ApiHost.h" #import "ApiHost.h"
#import "YYUtility.h" #import "YYUtility.h"
#import "AccountInfoStorage.h"
#import "YYReachability.h" #import "YYReachability.h"
#import <AFNetworking.h> #import <AFNetworking.h>
@@ -18,8 +19,7 @@
static AFHTTPSessionManager *manager = nil; static AFHTTPSessionManager *manager = nil;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
NSURLSessionConfiguration * config = [NSURLSessionConfiguration defaultSessionConfiguration]; manager = [[AFHTTPSessionManager manager]initWithBaseURL:[NSURL URLWithString:API_HOST_URL]];
manager = [[AFHTTPSessionManager alloc]initWithSessionConfiguration:config];
manager.requestSerializer.timeoutInterval = 15; manager.requestSerializer.timeoutInterval = 15;
manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.requestSerializer.HTTPShouldHandleCookies = YES; manager.requestSerializer.HTTPShouldHandleCookies = YES;
@@ -36,83 +36,72 @@
+ (void)GET:(NSString *)method + (void)GET:(NSString *)method
params:(NSDictionary *)params params:(NSDictionary *)params
success:(void (^)(id data))success success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure failure:(void (^)(NSNumber *resCode, NSString *message))failure
{
[self GET:API_HOST_URL method:method params:params success:success failure:failure];
}
+ (void)GET:(NSString *)interfaceUrl method:(NSString *)method params:(NSDictionary *)params success:(void (^)(id))success failure:(void (^)(NSNumber *, NSString *))failure
{ {
if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
failure([NSNumber numberWithInt:-1], @"请检查网络连接。");
}); });
return;
} }
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
NSString *url = [NSString stringWithFormat:@"%@/%@", interfaceUrl, method];
#ifdef DEBUG
NSLog(@"url:%@, parameter:%@", url, params);
#endif
[manager GET:url parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
}
+ (void)POST:(NSString *)method
params:(NSDictionary *)params
success:(void (^)(id data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure
{
[self POST:API_HOST_URL method:method params:params success:success failure:failure];
}
+ (void)POST:(NSString *)interfaceUrl
method:(NSString *)method
params:(NSDictionary *)params
success:(void (^)(id data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure
{
if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
});
}
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
NSString *url = [NSString stringWithFormat:@"%@/%@", interfaceUrl, method];
params = [self configBaseParmars:params]; params = [self configBaseParmars:params];
#ifdef DEBUG #ifdef DEBUG
NSLog(@"\nurl:\n%@\nparameter:\n%@", url, params); NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params);
#endif #endif
[manager POST:url parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
[manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"\n%@", responseObject); NSLog(@"\n%@", [responseObject yy_modelToJSONString]);
#endif #endif
success(responseObject); success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"\n%@", error); NSLog(@"\n%@", error);
#endif #endif
failure([NSNumber numberWithLong:error.code], error.domain);
}];
}
+ (void)POST:(NSString *)method
params:(NSDictionary *)params
success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure
{
if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
failure([NSNumber numberWithInt:-1], @"请检查网络连接。");
});
return;
}
params = [self configBaseParmars:params];
#ifdef DEBUG
NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params);
#endif
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
[manager POST:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
#ifdef DEBUG
NSLog(@"\n%@", [responseObject yy_modelToJSONString]);
#endif
success([BaseModel yy_modelWithDictionary:responseObject]);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
#ifdef DEBUG
NSLog(@"\n%@", error);
#endif
failure([NSNumber numberWithLong:error.code], error.domain);
}]; }];
} }
+ (void)request:(NSString *)url + (void)request:(NSString *)url
method:(HttpRequestHelperMethod)method method:(HttpRequestHelperMethod)method
params:(NSDictionary *)params params:(NSDictionary *)params
success:(void (^)(id data))success success:(void (^)(BaseModel *data))success
failure:(void (^)(NSNumber *resCode, NSString *message))failure failure:(void (^)(NSNumber *resCode, NSString *message))failure
{ {
switch (method) { switch (method) {
case HttpRequestHelperMethodGET: { case HttpRequestHelperMethodGET: {
[self GET:url params:params success:success failure:failure]; [self GET:url params:params success:success failure:failure];
@@ -130,10 +119,7 @@
params:(NSDictionary *)params params:(NSDictionary *)params
completion:(HttpRequestHelperCompletion)completion completion:(HttpRequestHelperCompletion)completion
{ {
if ([path hasPrefix:@"/"]) { [self request:path method:method params:params success:^(BaseModel *data) {
path = [path substringFromIndex:1];
}
[self request:path method:method params:params success:^(id data) {
if (completion) { if (completion) {
completion(data, nil, nil); completion(data, nil, nil);
} }
@@ -144,7 +130,19 @@
}]; }];
} }
+ (NSDictionary*)configBaseParmars:(NSDictionary *)parmars { + (NSDictionary*)configBaseParmars:(NSDictionary *)parmars
{
AFHTTPSessionManager *client = [HttpRequestHelper requestManager];
if ([[AccountInfoStorage instance] getUid].length > 0) {
[client.requestSerializer setValue:[[AccountInfoStorage instance] getUid] forHTTPHeaderField:@"pub_uid"];
} else {
[client.requestSerializer setValue:nil forHTTPHeaderField:@"pub_uid"];
}
if ([[AccountInfoStorage instance] getTicket].length > 0) {
[client.requestSerializer setValue:[[AccountInfoStorage instance] getTicket] forHTTPHeaderField:@"pub_ticket"];
}else {
[client.requestSerializer setValue:nil forHTTPHeaderField:@"pub_ticket"];
}
NSDictionary *defaultBasciParame = @{ NSDictionary *defaultBasciParame = @{
@"os" : @"iOS", @"os" : @"iOS",
@"osVersion" : [YYUtility systemVersion], @"osVersion" : [YYUtility systemVersion],

View File

@@ -0,0 +1,16 @@
//
// BaseNavigationController.h
// xplan-ios
//
// Created by zu on 2021/9/7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BaseNavigationController : UINavigationController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// BaseNavigationController.m
// xplan-ios
//
// Created by zu on 2021/9/7.
//
#import "BaseNavigationController.h"
@interface BaseNavigationController ()
@end
@implementation BaseNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
[self themeConfig];
}
- (void)themeConfig {
self.navigationBar.shadowImage = [[UIImage alloc] init];
self.navigationBar.barTintColor = ThemeBackgroundColor;
self.navigationBar.tintColor = [UIColor whiteColor];
self.navigationBar.translucent = NO;
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = item;
[self.navigationBar setTitleTextAttributes:@{
NSFontAttributeName:[UIFont systemFontOfSize:18],
NSForegroundColorAttributeName:UIColor.whiteColor
}];
}
@end

View File

@@ -20,21 +20,7 @@
- (void)themeConfig { - (void)themeConfig {
self.view.backgroundColor = ThemeBackgroundColor; self.view.backgroundColor = ThemeBackgroundColor;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
self.navigationController.navigationBar.barTintColor = ThemeBackgroundColor;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.translucent = NO;
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = item;
[self.navigationController.navigationBar setTitleTextAttributes:@{
NSFontAttributeName:[UIFont systemFontOfSize:18],
NSForegroundColorAttributeName:UIColor.whiteColor
}];
self.navigationItem.title = @"音游";
} }
/** /**

View File

@@ -10,9 +10,7 @@
@implementation Api (Login) @implementation Api (Login)
+ (void)phoneQuickLogin:(HttpRequestHelperCompletion)completion accessToken:(NSString *)accessToken token:(NSString *)token { + (void)phoneQuickLogin:(HttpRequestHelperCompletion)completion accessToken:(NSString *)accessToken token:(NSString *)token {
[self makeRequest:@"acc/oneclick/login" method:HttpRequestHelperMethodPOST completion:^(id _Nullable data, NSNumber * _Nonnull code, NSString * _Nullable msg) { [self makeRequest:@"acc/oneclick/login" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, accessToken, token, nil];
completion(data, code, msg);
}, __FUNCTION__, accessToken, token, nil];
} }
@end @end

View File

@@ -8,6 +8,7 @@
#import "LoginPresenter.h" #import "LoginPresenter.h"
#import "LoginProtocol.h" #import "LoginProtocol.h"
#import "Api+Login.h" #import "Api+Login.h"
#import "AccountInfoStorage.h"
@implementation LoginPresenter @implementation LoginPresenter
@@ -16,7 +17,8 @@
} }
- (void)phoneQuickLogin:(NSString *)accessToken token:(NSString *)token { - (void)phoneQuickLogin:(NSString *)accessToken token:(NSString *)token {
[Api phoneQuickLogin:[self createHttpCompletion:^(id _Nonnull data) { [Api phoneQuickLogin:[self createHttpCompletion:^(BaseModel *data) {
[[AccountInfoStorage instance] saveAccountInfo:[AccountModel yy_modelWithDictionary:data.data]];
[[self getView] phoneQuickLoginSuccess]; [[self getView] phoneQuickLoginSuccess];
} fail:^(NSNumber * _Nonnull code, NSString * _Nullable msg) { } fail:^(NSNumber * _Nonnull code, NSString * _Nullable msg) {
// todo fail // todo fail

View File

@@ -41,9 +41,9 @@ typedef NS_ENUM(NSInteger,XYThirdLoginType) {
@interface LLButtonView : UIView @interface LLButtonView : UIView
//icon //icon
@property (nonatomic,strong) UIImageView *logoImageView; @property (nonatomic, strong) UIImageView *logoImageView;
//title //title
@property (nonatomic,strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *titleLabel;
@end @end
@implementation LLButtonView @implementation LLButtonView
@@ -106,13 +106,13 @@ typedef NS_ENUM(NSInteger,XYThirdLoginType) {
/** */ /** */
@property (nonatomic, strong) UIButton *loginButton; @property (nonatomic, strong) UIButton *loginButton;
@property (nonatomic,strong) UIStackView *stackView; @property (nonatomic, strong) UIStackView *stackView;
/// ///
@property (nonatomic,strong) LLButtonView *qqButtonView; @property (nonatomic, strong) LLButtonView *qqButtonView;
///wx ///wx
@property (nonatomic,strong) LLButtonView *wxButtonView; @property (nonatomic, strong) LLButtonView *wxButtonView;
///qq ///qq
@property (nonatomic,strong) LLButtonView *phoneButtonView; @property (nonatomic, strong) LLButtonView *phoneButtonView;
/** */ /** */
@property (nonatomic, strong) UIButton *agreeButton; @property (nonatomic, strong) UIButton *agreeButton;
@@ -132,7 +132,7 @@ typedef NS_ENUM(NSInteger,XYThirdLoginType) {
} }
- (void)phoneQuickLoginSuccess { - (void)phoneQuickLoginSuccess {
[XCHUDTool showSuccessWithMessage:@"一键登录成功。"]; [self.navigationController popToRootViewControllerAnimated:YES];
} }
- (void)viewDidLoad { - (void)viewDidLoad {

View File

@@ -0,0 +1,18 @@
//
// Api+Main.h
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import "Api.h"
NS_ASSUME_NONNULL_BEGIN
@interface Api (Main)
+ (void)requestTicket:(HttpRequestHelperCompletion)completion access_token:(NSString *)accessToken issue_type:(NSString *)issueType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// Api+Main.m
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import "Api+Main.h"
@implementation Api (Main)
+ (void)requestTicket:(HttpRequestHelperCompletion)completion access_token:(NSString *)accessToken issue_type:(NSString *)issueType {
[self makeRequest:@"oauth/ticket" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, accessToken, issueType, nil];
}
@end

View File

@@ -0,0 +1,18 @@
//
// MainPresenter.h
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface MainPresenter : BaseMvpPresenter
- (void)autoLogin;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,35 @@
//
// MainPresenter.m
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import "MainPresenter.h"
#import "AccountInfoStorage.h"
#import "AccountModel.h"
#import "Api+Main.h"
#import "MainProtocol.h"
@implementation MainPresenter
- (void)autoLogin {
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
if (accountModel == nil) {
[[self getView] tokenInvalid];
return;
}
if ([[AccountInfoStorage instance] getTicket] != nil) {
return;
}
[Api requestTicket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *tickets = [data.data valueForKey:@"tickets"];
NSString *ticket = [tickets[0] valueForKey:@"ticket"];
[[AccountInfoStorage instance] saveTicket:ticket];
[[self getView] autoLoginSuccess];
} fail:^(NSNumber * _Nonnull code, NSString * _Nullable msg) {
} showLoading:NO errorToast:YES] access_token:accountModel.access_token issue_type:@"multi"];
}
@end

View File

@@ -0,0 +1,18 @@
//
// MainProtocol.h
// xplan-ios
//
// Created by apple on 2021/9/8.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MainProtocol <NSObject>
- (void)autoLoginSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -5,9 +5,7 @@
// Created by zu on 2021/8/31. // Created by zu on 2021/8/31.
// //
#import "MvpViewController.h" @interface TabbarViewController : UITabBarController
@interface TabbarViewController : MvpViewController
@end @end

View File

@@ -0,0 +1,85 @@
//
// ViewController.m
// xplan-ios
//
// Created by zu on 2021/8/31.
//
#import <UIKit/UIKit.h>
#import "TabbarViewController.h"
#import "BaseViewController.h"
#import "UIImage+Utils.h"
#import "LoginViewController.h"
#import "MainPresenter.h"
#import "MainProtocol.h"
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol>
@property (nonatomic, strong) MainPresenter *presenter;
@end
@implementation TabbarViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self configTheme];
[self initTabs];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.presenter autoLogin];
}
- (MainPresenter *)presenter {
if (_presenter == nil) {
_presenter = [[MainPresenter alloc] init];
[_presenter attatchView:self];
}
return _presenter;
}
- (void)tokenInvalid {
LoginViewController *lvc = [[LoginViewController alloc] init];
[self.navigationController pushViewController:lvc animated:YES];
}
- (void)completeUserInfo {
}
- (void)autoLoginSuccess {
}
- (void)configTheme {
[[UITabBar appearance] setBackgroundImage:[UIImage imageWithColor:ThemeTabbarBackgroundColor size:CGSizeMake(KScreenWidth, kTabBarHeight)]];
[[UITabBar appearance] setShadowImage:[[UIImage alloc]init]];
if (@available(iOS 10.0, *)) {
[[UITabBar appearance] setUnselectedItemTintColor:ThemeTabbarNormalColor];
}
}
- (void)initTabs {
NSArray *normalImageNames = @[@"tab_game_normal", @"tab_mine_normal"];
NSArray *selectImageNames = @[@"tab_game_selected", @"tab_mine_selected"];
NSArray *tabLabel = @[@"赛事", @"我的"];
BaseViewController *bvcGame = [[BaseViewController alloc] init];
[self createTabBarItem:bvcGame title:tabLabel[0] image:normalImageNames[0] selectedImage:selectImageNames[0]];
[self addChildViewController:bvcGame];
BaseViewController *bvcMe = [[BaseViewController alloc] init];
[self createTabBarItem:bvcMe title:tabLabel[1] image:normalImageNames[1] selectedImage:selectImageNames[1]];
[self addChildViewController:bvcMe];
}
- (void)createTabBarItem:(UIViewController *)itemVc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
itemVc.title = title;
itemVc.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
itemVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[itemVc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:ThemeTabbarSelectedColor} forState:UIControlStateSelected];
[itemVc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:ThemeTabbarNormalColor} forState:UIControlStateNormal];
}
@end

View File

@@ -1,22 +0,0 @@
//
// ViewController.m
// xplan-ios
//
// Created by zu on 2021/8/31.
//
#import "TabbarViewController.h"
#import "LoginViewController.h"
@interface TabbarViewController ()
@end
@implementation TabbarViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self tokenInvalid];
}
@end