diff --git a/GIGA.xcodeproj/project.pbxproj b/GIGA.xcodeproj/project.pbxproj index f445430..1ff3679 100644 --- a/GIGA.xcodeproj/project.pbxproj +++ b/GIGA.xcodeproj/project.pbxproj @@ -29,7 +29,6 @@ 8357ADC52123BEBD000816F2 /* GiGaUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADC42123BEBD000816F2 /* GiGaUser.m */; }; 8357ADC92123BFCA000816F2 /* GiGaUserManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADC82123BFCA000816F2 /* GiGaUserManager.m */; }; 8357ADCD2123C091000816F2 /* GiGaNetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADCC2123C091000816F2 /* GiGaNetManager.m */; }; - 8357ADD02123C5F7000816F2 /* GiGaAPIRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADCF2123C5F7000816F2 /* GiGaAPIRequest.m */; }; 8357ADD32123C7C6000816F2 /* GiGaAPIResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADD22123C7C6000816F2 /* GiGaAPIResult.m */; }; 8357ADD52123F5EC000816F2 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8357ADD42123F5EC000816F2 /* libsqlite3.tbd */; }; 8357ADD82124027D000816F2 /* GiGaUserDefault.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357ADD72124027D000816F2 /* GiGaUserDefault.m */; }; @@ -59,6 +58,9 @@ 8361B4322121832800238FEB /* GiGaBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8361B4312121832800238FEB /* GiGaBaseViewController.m */; }; 8361B4352121836700238FEB /* GiGaBaseNavViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8361B4342121836700238FEB /* GiGaBaseNavViewController.m */; }; 8361B4382121847600238FEB /* UINavigationBar+Custom.m in Sources */ = {isa = PBXBuildFile; fileRef = 8361B4372121847600238FEB /* UINavigationBar+Custom.m */; }; + 836EE5D42136454500F0ABB2 /* RegistGetSMSCodeRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D32136454500F0ABB2 /* RegistGetSMSCodeRequest.m */; }; + 836EE5D7213645E300F0ABB2 /* GiGaBaseAPiRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */; }; + 836EE5DA2136716100F0ABB2 /* NSTimer+Convenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */; }; 83835BA0212E43BD001480F2 /* GiGaMasssagesVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83835B9F212E43BD001480F2 /* GiGaMasssagesVC.m */; }; 83835BA7212E4748001480F2 /* MAssaageCenterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83835BA5212E4748001480F2 /* MAssaageCenterCell.m */; }; 83835BA8212E4748001480F2 /* MAssaageCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83835BA6212E4748001480F2 /* MAssaageCenterCell.xib */; }; @@ -79,6 +81,7 @@ 838388D3212FB7D700D14C53 /* JXTAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 838388CE212FB7D700D14C53 /* JXTAlertController.m */; }; 838388D4212FB7D700D14C53 /* JXTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 838388D2212FB7D700D14C53 /* JXTAlertView.m */; }; 838388DA2130046D00D14C53 /* emojizone.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 838388D92130046D00D14C53 /* emojizone.mp4 */; }; + 838500DC2137F3F7003514A3 /* GiGaAttributedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 838500DB2137F3F7003514A3 /* GiGaAttributedLabel.m */; }; 83928FFA2134D8F60077D2E8 /* GiGaFlyingCommitInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83928FF92134D8F60077D2E8 /* GiGaFlyingCommitInputView.m */; }; 83928FFE2134F37D0077D2E8 /* GiGaSocketRocketUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 83928FFD2134F37D0077D2E8 /* GiGaSocketRocketUtility.m */; }; 839290052134F4240077D2E8 /* LXDanMuTrackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 839290002134F4230077D2E8 /* LXDanMuTrackView.m */; }; @@ -151,8 +154,6 @@ 8357ADC82123BFCA000816F2 /* GiGaUserManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaUserManager.m; sourceTree = ""; }; 8357ADCB2123C091000816F2 /* GiGaNetManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaNetManager.h; sourceTree = ""; }; 8357ADCC2123C091000816F2 /* GiGaNetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaNetManager.m; sourceTree = ""; }; - 8357ADCE2123C5F7000816F2 /* GiGaAPIRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAPIRequest.h; sourceTree = ""; }; - 8357ADCF2123C5F7000816F2 /* GiGaAPIRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAPIRequest.m; sourceTree = ""; }; 8357ADD12123C7C6000816F2 /* GiGaAPIResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAPIResult.h; sourceTree = ""; }; 8357ADD22123C7C6000816F2 /* GiGaAPIResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAPIResult.m; sourceTree = ""; }; 8357ADD42123F5EC000816F2 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; @@ -202,6 +203,12 @@ 8361B4342121836700238FEB /* GiGaBaseNavViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaBaseNavViewController.m; sourceTree = ""; }; 8361B4362121847600238FEB /* UINavigationBar+Custom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+Custom.h"; sourceTree = ""; }; 8361B4372121847600238FEB /* UINavigationBar+Custom.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+Custom.m"; sourceTree = ""; }; + 836EE5D22136454500F0ABB2 /* RegistGetSMSCodeRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistGetSMSCodeRequest.h; sourceTree = ""; }; + 836EE5D32136454500F0ABB2 /* RegistGetSMSCodeRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RegistGetSMSCodeRequest.m; sourceTree = ""; }; + 836EE5D5213645E300F0ABB2 /* GiGaBaseAPiRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaBaseAPiRequest.h; sourceTree = ""; }; + 836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaBaseAPiRequest.m; sourceTree = ""; }; + 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+Convenience.m"; sourceTree = ""; }; + 836EE5D92136716000F0ABB2 /* NSTimer+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+Convenience.h"; sourceTree = ""; }; 83835B9E212E43BD001480F2 /* GiGaMasssagesVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMasssagesVC.h; sourceTree = ""; }; 83835B9F212E43BD001480F2 /* GiGaMasssagesVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMasssagesVC.m; sourceTree = ""; }; 83835BA4212E4748001480F2 /* MAssaageCenterCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MAssaageCenterCell.h; sourceTree = ""; }; @@ -238,6 +245,8 @@ 838388D1212FB7D700D14C53 /* JXTAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JXTAlertView.h; sourceTree = ""; }; 838388D2212FB7D700D14C53 /* JXTAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JXTAlertView.m; sourceTree = ""; }; 838388D92130046D00D14C53 /* emojizone.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = emojizone.mp4; sourceTree = ""; }; + 838500DA2137F3F7003514A3 /* GiGaAttributedLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAttributedLabel.h; sourceTree = ""; }; + 838500DB2137F3F7003514A3 /* GiGaAttributedLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAttributedLabel.m; sourceTree = ""; }; 83928FF82134D8F60077D2E8 /* GiGaFlyingCommitInputView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaFlyingCommitInputView.h; sourceTree = ""; }; 83928FF92134D8F60077D2E8 /* GiGaFlyingCommitInputView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaFlyingCommitInputView.m; sourceTree = ""; }; 83928FFC2134F37D0077D2E8 /* GiGaSocketRocketUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiGaSocketRocketUtility.h; sourceTree = ""; }; @@ -419,12 +428,12 @@ children = ( 8357ADCB2123C091000816F2 /* GiGaNetManager.h */, 8357ADCC2123C091000816F2 /* GiGaNetManager.m */, - 8357ADCE2123C5F7000816F2 /* GiGaAPIRequest.h */, - 8357ADCF2123C5F7000816F2 /* GiGaAPIRequest.m */, 8357ADD12123C7C6000816F2 /* GiGaAPIResult.h */, 8357ADD22123C7C6000816F2 /* GiGaAPIResult.m */, 8314D20F2133ABE500B458BF /* WeiIXinApiManager.h */, 8314D2102133ABE500B458BF /* WeiIXinApiManager.m */, + 836EE5D5213645E300F0ABB2 /* GiGaBaseAPiRequest.h */, + 836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */, ); path = GiGaNetTool; sourceTree = ""; @@ -529,6 +538,8 @@ 8361B3FE21215C8A00238FEB /* Category */ = { isa = PBXGroup; children = ( + 836EE5D92136716000F0ABB2 /* NSTimer+Convenience.h */, + 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */, 83A22711212A9EA900B3E75C /* UIView+Sizes.h */, 83A22710212A9EA900B3E75C /* UIView+Sizes.m */, 8361B4362121847600238FEB /* UINavigationBar+Custom.h */, @@ -537,6 +548,8 @@ 83A22717212ABDFF00B3E75C /* GiGaBlockButton.m */, 83835BCB212E856A001480F2 /* NSString+MD5.h */, 83835BCC212E856A001480F2 /* NSString+MD5.m */, + 838500DA2137F3F7003514A3 /* GiGaAttributedLabel.h */, + 838500DB2137F3F7003514A3 /* GiGaAttributedLabel.m */, ); path = Category; sourceTree = ""; @@ -644,6 +657,15 @@ path = BaseVC; sourceTree = ""; }; + 836EE5D121363C9A00F0ABB2 /* APi */ = { + isa = PBXGroup; + children = ( + 836EE5D22136454500F0ABB2 /* RegistGetSMSCodeRequest.h */, + 836EE5D32136454500F0ABB2 /* RegistGetSMSCodeRequest.m */, + ); + path = APi; + sourceTree = ""; + }; 83835B9D212E4335001480F2 /* MessageCenter */ = { isa = PBXGroup; children = ( @@ -831,6 +853,7 @@ 83E40B2C21218B7E008149C4 /* LogIn */ = { isa = PBXGroup; children = ( + 836EE5D121363C9A00F0ABB2 /* APi */, 83A2271B212AC81800B3E75C /* Controller */, 83A2271A212AC80D00B3E75C /* Model */, 83A22719212AC7FC00B3E75C /* View */, @@ -1089,6 +1112,7 @@ 83346AC5212BBC8C0054D597 /* GiGaRegistViewController.m in Sources */, 83346AD7212C18F50054D597 /* GiGaAppGaurdVC.m in Sources */, 8349585C212511040064DB6C /* AppDelegate+ThirdParty.m in Sources */, + 838500DC2137F3F7003514A3 /* GiGaAttributedLabel.m in Sources */, 8314D2112133ABE500B458BF /* WeiIXinApiManager.m in Sources */, 83835BCA212E8045001480F2 /* GIGAQuetionView.m in Sources */, 8361B3CE212155C200238FEB /* ViewController.m in Sources */, @@ -1110,7 +1134,7 @@ 83928FFA2134D8F60077D2E8 /* GiGaFlyingCommitInputView.m in Sources */, 838388D3212FB7D700D14C53 /* JXTAlertController.m in Sources */, 833DA7762122A62000A5C614 /* GiGaMaskTaskViewController.m in Sources */, - 8357ADD02123C5F7000816F2 /* GiGaAPIRequest.m in Sources */, + 836EE5D7213645E300F0ABB2 /* GiGaBaseAPiRequest.m in Sources */, 83835BD0212E8B9C001480F2 /* GiGaQuestionModel.m in Sources */, 83835BAF212E4FCD001480F2 /* MessageListViewCell.m in Sources */, 8361B3D9212155C300238FEB /* main.m in Sources */, @@ -1135,7 +1159,9 @@ 835060A5212D3536007E6220 /* AppDelegate+GiGaConfig.m in Sources */, 83E40B2B21218B6F008149C4 /* GiGaExercisesViewController.m in Sources */, 83835BA7212E4748001480F2 /* MAssaageCenterCell.m in Sources */, + 836EE5D42136454500F0ABB2 /* RegistGetSMSCodeRequest.m in Sources */, 8361B42E2121812000238FEB /* GiGaServerConfig.m in Sources */, + 836EE5DA2136716100F0ABB2 /* NSTimer+Convenience.m in Sources */, 83A22712212A9EA900B3E75C /* UIView+Sizes.m in Sources */, 839290092134F4C40077D2E8 /* GiGaFlingCommitVC.m in Sources */, 83A22718212ABDFF00B3E75C /* GiGaBlockButton.m in Sources */, diff --git a/GIGA/Assets.xcassets/login/Contents.json b/GIGA/Assets.xcassets/login/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/GIGA/Assets.xcassets/login/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json new file mode 100644 index 0000000..130483e --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_back.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_back@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_back@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@2x.png b/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@2x.png new file mode 100644 index 0000000..15675b5 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@3x.png b/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@3x.png new file mode 100644 index 0000000..8125e74 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_back.imageset/btn_back@3x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_load.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_load.imageset/Contents.json new file mode 100644 index 0000000..ef3cc84 --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_load.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_load@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_load@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@2x.png b/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@2x.png new file mode 100644 index 0000000..fbcec5a Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@3x.png b/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@3x.png new file mode 100644 index 0000000..8786bc3 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_load.imageset/btn_load@3x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json new file mode 100644 index 0000000..e67fafe --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_moment_back@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_moment_back@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@2x.png b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@2x.png new file mode 100644 index 0000000..d33febd Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@3x.png b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@3x.png new file mode 100644 index 0000000..0c11463 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_moment_back.imageset/btn_moment_back@3x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json new file mode 100644 index 0000000..5db27e6 --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_tab_desplay@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_tab_desplay@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@2x.png b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@2x.png new file mode 100644 index 0000000..1120697 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@3x.png b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@3x.png new file mode 100644 index 0000000..011c019 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_tab_desplay.imageset/btn_tab_desplay@3x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json new file mode 100644 index 0000000..f9fd4bf --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_tab_notselect@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_tab_notselect@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@2x.png b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@2x.png new file mode 100644 index 0000000..b8f8c13 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@3x.png b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@3x.png new file mode 100644 index 0000000..0a9c529 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_tab_notselect.imageset/btn_tab_notselect@3x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_wechat.imageset/Contents.json b/GIGA/Assets.xcassets/login/btn_wechat.imageset/Contents.json new file mode 100644 index 0000000..ae50195 --- /dev/null +++ b/GIGA/Assets.xcassets/login/btn_wechat.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "btn_wechat@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "btn_wechat@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@2x.png b/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@2x.png new file mode 100644 index 0000000..e4e16ff Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@2x.png differ diff --git a/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@3x.png b/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@3x.png new file mode 100644 index 0000000..7fa1bb7 Binary files /dev/null and b/GIGA/Assets.xcassets/login/btn_wechat.imageset/btn_wechat@3x.png differ diff --git a/GIGA/Assets.xcassets/login/ic_number.imageset/Contents.json b/GIGA/Assets.xcassets/login/ic_number.imageset/Contents.json new file mode 100644 index 0000000..cd292cf --- /dev/null +++ b/GIGA/Assets.xcassets/login/ic_number.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_number@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_number@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@2x.png b/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@2x.png new file mode 100644 index 0000000..fa1e753 Binary files /dev/null and b/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@2x.png differ diff --git a/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@3x.png b/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@3x.png new file mode 100644 index 0000000..1279963 Binary files /dev/null and b/GIGA/Assets.xcassets/login/ic_number.imageset/ic_number@3x.png differ diff --git a/GIGA/Assets.xcassets/login/ic_wechat.imageset/Contents.json b/GIGA/Assets.xcassets/login/ic_wechat.imageset/Contents.json new file mode 100644 index 0000000..3ab92c6 --- /dev/null +++ b/GIGA/Assets.xcassets/login/ic_wechat.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_wechat@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_wechat@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@2x.png b/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@2x.png new file mode 100644 index 0000000..8415564 Binary files /dev/null and b/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@2x.png differ diff --git a/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@3x.png b/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@3x.png new file mode 100644 index 0000000..7038ae7 Binary files /dev/null and b/GIGA/Assets.xcassets/login/ic_wechat.imageset/ic_wechat@3x.png differ diff --git a/GIGA/Assets.xcassets/login/icon_key.imageset/Contents.json b/GIGA/Assets.xcassets/login/icon_key.imageset/Contents.json new file mode 100644 index 0000000..b18d6e8 --- /dev/null +++ b/GIGA/Assets.xcassets/login/icon_key.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_key@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "icon_key@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@2x.png b/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@2x.png new file mode 100644 index 0000000..331c9ca Binary files /dev/null and b/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@2x.png differ diff --git a/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@3x.png b/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@3x.png new file mode 100644 index 0000000..b575c14 Binary files /dev/null and b/GIGA/Assets.xcassets/login/icon_key.imageset/icon_key@3x.png differ diff --git a/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/Contents.json b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/Contents.json new file mode 100644 index 0000000..41d853b --- /dev/null +++ b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "img_circle_avatar@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "img_circle_avatar@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@2x.png b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@2x.png new file mode 100644 index 0000000..0933fe9 Binary files /dev/null and b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@2x.png differ diff --git a/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@3x.png b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@3x.png new file mode 100644 index 0000000..1ed9a02 Binary files /dev/null and b/GIGA/Assets.xcassets/login/img_circle_avatar.imageset/img_circle_avatar@3x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/exerc_answer_option_nor.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/exerc_answer_option_nor.imageset/Contents.json index db7bdf5..94052a8 100644 --- a/GIGA/Assets.xcassets/maskTime/exerc_answer_option_nor.imageset/Contents.json +++ b/GIGA/Assets.xcassets/maskTime/exerc_answer_option_nor.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "exerc_answer_option_nor@2x.png", diff --git a/GIGA/Assets.xcassets/maskTime/exerc_answer_option_sel.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/exerc_answer_option_sel.imageset/Contents.json index 7234bb0..8cb9d81 100644 --- a/GIGA/Assets.xcassets/maskTime/exerc_answer_option_sel.imageset/Contents.json +++ b/GIGA/Assets.xcassets/maskTime/exerc_answer_option_sel.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "exerc_answer_option_sel@2x.png", diff --git a/GIGA/Category/GiGaAttributedLabel.h b/GIGA/Category/GiGaAttributedLabel.h new file mode 100644 index 0000000..9c6bf33 --- /dev/null +++ b/GIGA/Category/GiGaAttributedLabel.h @@ -0,0 +1,19 @@ +// +// GiGaAttributedLabel.h +// GIGA +// +// Created by lianxiang on 2018/8/30. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import +#ifndef IB_DESIGNABLE +#define IB_DESIGNABLE +#endif + +@class TTTAttributedLabel; +IB_DESIGNABLE @interface GiGaAttributedLabel : TTTAttributedLabel{ + +} + +@end diff --git a/GIGA/Category/GiGaAttributedLabel.m b/GIGA/Category/GiGaAttributedLabel.m new file mode 100644 index 0000000..7152537 --- /dev/null +++ b/GIGA/Category/GiGaAttributedLabel.m @@ -0,0 +1,21 @@ +// +// GiGaAttributedLabel.m +// GIGA +// +// Created by lianxiang on 2018/8/30. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "GiGaAttributedLabel.h" + +@implementation GiGaAttributedLabel + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/GIGA/Category/NSTimer+Convenience.h b/GIGA/Category/NSTimer+Convenience.h new file mode 100644 index 0000000..fea6710 --- /dev/null +++ b/GIGA/Category/NSTimer+Convenience.h @@ -0,0 +1,50 @@ +// +// NSTimer+Convenience.h +// ISCTest +// +// Created by imac on 16/3/23. +// Copyright © 2016年 xiang. All rights reserved. +// + +#import + +@interface NSTimer (Convenience) +typedef void (^LXVoidBlock)(void); + +/** + * 创建Timer---Block版本 + * + * @param interval 每隔interval秒就回调一次callback + * @param repeats 是否重复 + * @param callback 回调block + * + * @return NSTimer对象 + */ ++ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval + repeats:(BOOL)repeats + callback:(LXVoidBlock)callback; + +/** + * 创建Timer---Block版本 + * + * @param interval 每隔interval秒就回调一次callback + * @param count 回调多少次后自动暂停,如果count <= 0,则表示无限次,否则表示具体的次数 + * @param callback 回调block + * + * @return NSTimer对象 + */ ++ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval + count:(NSInteger)count + callback:(LXVoidBlock)callback; +/** + * 开始启动定时器 + */ +- (void)fireTimer; + +/** + * 暂停定时器 + */ +- (void)unfireTimer; + + +@end diff --git a/GIGA/Category/NSTimer+Convenience.m b/GIGA/Category/NSTimer+Convenience.m new file mode 100644 index 0000000..35d5e24 --- /dev/null +++ b/GIGA/Category/NSTimer+Convenience.m @@ -0,0 +1,78 @@ +// +// NSTimer+Convenience.m +// ISCTest +// +// Created by imac on 16/3/23. +// Copyright © 2016年 xiang. All rights reserved. +// + +#import "NSTimer+Convenience.h" + +@implementation NSTimer (Convenience) + ++ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval + repeats:(BOOL)repeats + callback:(LXVoidBlock)callback { + return [NSTimer scheduledTimerWithTimeInterval:interval + target:self + selector:@selector(onTimerUpdateBlock:) + userInfo:[callback copy] + repeats:repeats]; +} + ++ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval + count:(NSInteger)count + callback:(LXVoidBlock)callback { + NSDictionary *userInfo = @{@"callback" : [callback copy], + @"count" : @(count)}; + return [NSTimer scheduledTimerWithTimeInterval:interval + target:self + selector:@selector(onTimerUpdateCountBlock:) + userInfo:userInfo + repeats:YES]; +} + ++ (void)onTimerUpdateBlock:(NSTimer *)timer { + LXVoidBlock block = timer.userInfo; + + if (block) { + block(); + } +} + ++ (void)onTimerUpdateCountBlock:(NSTimer *)timer { + static NSUInteger currentCount = 0; + + NSDictionary *userInfo = timer.userInfo; + LXVoidBlock callback = userInfo[@"callback"]; + NSNumber *count = userInfo[@"count"]; + + if (count.integerValue <= 0) { + if (callback) { + callback(); + } + } else { + if (currentCount < count.integerValue) { + currentCount++; + if (callback) { + callback(); + } + } else { + currentCount = 0; + + [timer unfireTimer]; + [timer invalidate]; + timer = nil; + } + } +} + +- (void)fireTimer { + [self setFireDate:[NSDate distantPast]]; +} + +- (void)unfireTimer { + [self setFireDate:[NSDate distantFuture]]; +} + +@end diff --git a/GIGA/Category/UINavigationBar+Custom.m b/GIGA/Category/UINavigationBar+Custom.m index 0afce13..b116ef3 100644 --- a/GIGA/Category/UINavigationBar+Custom.m +++ b/GIGA/Category/UINavigationBar+Custom.m @@ -56,8 +56,8 @@ static char overlayKey; -(void)resetBackgroundImage{ - [self setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault]; - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; + //[self setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault]; + //[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; } diff --git a/GIGA/Common/BaseVC/GiGaBaseNavViewController.m b/GIGA/Common/BaseVC/GiGaBaseNavViewController.m index a55bd63..a44be06 100644 --- a/GIGA/Common/BaseVC/GiGaBaseNavViewController.m +++ b/GIGA/Common/BaseVC/GiGaBaseNavViewController.m @@ -36,12 +36,13 @@ if (self.viewControllers.count > 1 ) { //自定义返回按钮 UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - [backBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; - backBtn.backgroundColor = [UIColor redColor]; + backBtn.frame = CGRectMake(0, 0, 40, 40); + [backBtn setImage:[UIImage imageNamed:@"btn_moment_back"] forState:UIControlStateNormal]; + [backBtn setImageEdgeInsets:UIEdgeInsetsMake(0,-14, 0, 14)]; + //backBtn.backgroundColor = [UIColor redColor]; [backBtn addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; viewController.navigationItem.leftBarButtonItem = backItem; - } } @@ -55,14 +56,4 @@ // Dispose of any resources that can be recreated. } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - @end diff --git a/GIGA/Common/BaseVC/GiGaBaseViewController.m b/GIGA/Common/BaseVC/GiGaBaseViewController.m index c1fd5df..01703ba 100644 --- a/GIGA/Common/BaseVC/GiGaBaseViewController.m +++ b/GIGA/Common/BaseVC/GiGaBaseViewController.m @@ -28,7 +28,7 @@ [super viewDidLoad]; // Do any additional setup after loading the view. [self.view addSubview:_tableView]; - [self testNetworkStatus]; + //[self testNetworkStatus]; } -(void)addNavTitile:(NSString *)title{ diff --git a/GIGA/Common/GiGaLocalNotificationManager/GiGaLocalNotificationManager.m b/GIGA/Common/GiGaLocalNotificationManager/GiGaLocalNotificationManager.m index 2859fc7..7d4f65d 100644 --- a/GIGA/Common/GiGaLocalNotificationManager/GiGaLocalNotificationManager.m +++ b/GIGA/Common/GiGaLocalNotificationManager/GiGaLocalNotificationManager.m @@ -36,12 +36,12 @@ NSURL *imageUrl = [[NSBundle mainBundle] URLForResource:@"MaskTime" withExtension:@"png"]; UNNotificationAttachment *attach = [UNNotificationAttachment attachmentWithIdentifier:@"photo" URL:imageUrl options:nil error:nil]; - NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"4481" withExtension:@"wav"]; - UNNotificationAttachment *attachAudio = [UNNotificationAttachment attachmentWithIdentifier:@"audio" URL:audioUrl options:nil error:nil]; +// NSURL *audioUrl = [[NSBundle mainBundle] URLForResource:@"4481" withExtension:@"wav"]; +// UNNotificationAttachment *attachAudio = [UNNotificationAttachment attachmentWithIdentifier:@"audio" URL:audioUrl options:nil error:nil]; - NSURL *vedioUrl = [[NSBundle mainBundle] URLForResource:@"emojizone" withExtension:@"mp4"]; - UNNotificationAttachment *vedioAudio = [UNNotificationAttachment attachmentWithIdentifier:@"vedio" URL:vedioUrl options:nil error:nil]; - content.attachments = @[attachAudio]; +// NSURL *vedioUrl = [[NSBundle mainBundle] URLForResource:@"emojizone" withExtension:@"mp4"]; +// UNNotificationAttachment *vedioAudio = [UNNotificationAttachment attachmentWithIdentifier:@"vedio" URL:vedioUrl options:nil error:nil]; + content.attachments = @[attach]; //延迟通知 第一个参数是重复的时间间隔,最小60s,第二个参数是是否重复。 UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:timeInterval repeats:NO]; diff --git a/GIGA/Common/GiGaNetTool/GiGaAPIRequest.h b/GIGA/Common/GiGaNetTool/GiGaAPIRequest.h deleted file mode 100644 index 30451ad..0000000 --- a/GIGA/Common/GiGaNetTool/GiGaAPIRequest.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// GiGaAPIRequest.h -// GIGA -// -// Created by lianxiang on 2018/8/15. -// Copyright © 2018年 com.giga.ios. All rights reserved. -// - -#import -#import "GiGaAPIResult.h" -@class GiGaAPIRequest; -#define DEFALUT_APIREQUEST_TIMEOUT 20 - -typedef enum GiGaRequestType { - kRequestTypeGet, - kRequestTypePost, - kRequestTypeUpload, - kRequestTypeMultiUpload -}GiGaRequestTyp; - -typedef enum ApiResultFormat { - kApiResultJson, - kApiResultXml, -}ApiResultFormat; - -@protocol GiGaApiRquestDelegate -@optional - -- (void)serverApiFinishedSuccessed:(GiGaAPIRequest *)api result:(GiGaAPIResult *)result; -- (void)serverApiRequestFailed:(GiGaAPIRequest *)api error:(NSError *)error; -- (void)serverApiFinishedFailed:(GiGaAPIRequest *)api result:(GiGaAPIResult *)result; - -@end - -@interface GiGaAPIRequest : NSObject - -#pragma mark - porperty -/** 请求类型 */ -@property (nonatomic, readonly) GiGaRequestTyp requestType; -/** 请求返回的格式 */ -@property (nonatomic, readonly) ApiResultFormat resultFormat; -/** 请求超时时间 */ -@property (nonatomic, readonly) NSTimeInterval timeout; -/** 服务器地址 */ -@property (nonatomic, readonly) NSString *serviceUrl; -/** 请求路径 */ -@property (nonatomic, readonly) NSString *fullUrl; -/** 代理 */ -@property (nonatomic, weak) id delegate; -/** 请求参数数组 */ -@property (nonatomic, strong) NSMutableArray *params; - -#pragma mark - Method -- (id)initWithDelegate:(id)delegate; -/** - * 拼接公共参数 - */ -- (void)appendBaseParams; - -#pragma mark - APIRequestDelegate -/** - * 返回数据调用方法 - */ -- (void)callBackFinishedWithDictionary:(NSDictionary *)dic; -/** - * 返回数据错误 - */ -- (void)callBackFailed:(NSError *)error; - - -@end diff --git a/GIGA/Common/GiGaNetTool/GiGaAPIRequest.m b/GIGA/Common/GiGaNetTool/GiGaAPIRequest.m deleted file mode 100644 index b61ffb8..0000000 --- a/GIGA/Common/GiGaNetTool/GiGaAPIRequest.m +++ /dev/null @@ -1,81 +0,0 @@ -// -// GiGaAPIRequest.m -// GIGA -// -// Created by lianxiang on 2018/8/15. -// Copyright © 2018年 com.giga.ios. All rights reserved. -// - -#import "GiGaAPIRequest.h" -#import "GiGaServerConfig.h" -@implementation GiGaAPIRequest - -- (id)initWithDelegate:(id)delegate -{ - if (self = [super init]) { - self.params = [NSMutableArray array]; - self.delegate = delegate; - } - - return self; -} -//默认Get访问 -- (GiGaRequestTyp)requestType -{ - return kRequestTypeGet; -} - -//默认超时时间 -- (NSTimeInterval)timeout -{ - return DEFALUT_APIREQUEST_TIMEOUT; -} - -//服务器地址 --(NSString *)serviceUrl{ - return [GiGaServerConfig getMainUrl]; -} - -/** 拼接的请求地址 */ - -// -- (NSString *)fullUrl -{ - // 服务器地址 和 接口名 - NSString *url = [NSString stringWithFormat:@"%@",self.serviceUrl]; - - return url; -} -// 数据请求完成的 回调 -- (void)callBackFinishedWithDictionary:(NSDictionary *)dic -{ - // 处理 responseObject - GiGaAPIResult *resu = [[GiGaAPIResult alloc] initWithDictionary:dic]; - // error ID = 0 - if (resu.success) { - if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiFinishedSuccessed: result:)]) { - // - [self.delegate serverApiFinishedSuccessed:self result:resu]; - } - // error ID = 1 - } else { - if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiFinishedFailed:result:)]) { - [self.delegate serverApiFinishedFailed:self result:resu]; - } - } -} - -// 数据请求失败的回调 -- (void)callBackFailed:(NSError *)error -{ - if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiRequestFailed:error:)]) { - [self.delegate serverApiRequestFailed:self error:error]; - } -} - -// 拼接的基本参数 -- (void)appendBaseParams -{ - -} -@end diff --git a/GIGA/Common/GiGaNetTool/GiGaAPIResult.h b/GIGA/Common/GiGaNetTool/GiGaAPIResult.h index 3089b82..0789933 100644 --- a/GIGA/Common/GiGaNetTool/GiGaAPIResult.h +++ b/GIGA/Common/GiGaNetTool/GiGaAPIResult.h @@ -12,8 +12,8 @@ /** 提示信息 */ @property (nonatomic, copy) NSString *message; -/** 请求状态 */ -@property (nonatomic, assign) NSInteger status; +/** 状态码 */ +@property (nonatomic, assign) NSInteger code; /** 请求是否成功 */ @property (nonatomic, readonly) BOOL success; /** 接收数据的字典 */ diff --git a/GIGA/Common/GiGaNetTool/GiGaAPIResult.m b/GIGA/Common/GiGaNetTool/GiGaAPIResult.m index 61d7ce0..20f5739 100644 --- a/GIGA/Common/GiGaNetTool/GiGaAPIResult.m +++ b/GIGA/Common/GiGaNetTool/GiGaAPIResult.m @@ -12,7 +12,7 @@ -(BOOL)success{ - return self.status == 0; + return self.code == 0? YES : NO; } @@ -21,21 +21,21 @@ if (self = [super init]) { @try { if (dic && ![dic isKindOfClass:[NSNull class]]) { - self.status = [[dic objectForKey:@"errorcode"] intValue];//待定 - self.message = [dic objectForKey:@""];//待定 + self.code = [[dic objectForKey:@"code"] integerValue]; + self.message = [dic objectForKey:@"msg"]; NSDictionary *data = [[dic objectForKey:@"result"] objectForKey:@"data"]; self.dic = data; }else{ - self.message = @"网络错误"; + self.message = @"请求异常"; self.dic = nil; - self.status = 1; + self.code = -1; } } @catch(NSException *exception) { self.dic = dic; - self.status = 0; + self.code = -1; } @finally { diff --git a/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.h b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.h new file mode 100644 index 0000000..8ae5754 --- /dev/null +++ b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.h @@ -0,0 +1,134 @@ +// +// GiGaBaseAPiRequest.h +// GIGA +// +// Created by lianxiang on 2018/8/29. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import +#import "GiGaAPIResult.h" + +typedef NS_ENUM(NSInteger, GIGARequestStatus) { + NotAvailable = 1, //不可用 + RequestSuccess = 2, //请求成功 + RequestFailed = 4, //请求失败 + RequestLocalData = 8, //本地请求 + RequestNoMoreContent = 16, //没有更多数据 +}; + +typedef NS_ENUM(NSInteger, GIGARequestNetStatus) { + + NetStatusWifi = 1, + NetStatusWWAN = 2, + NetStatusUnKown= 4,//不可用 +}; + +typedef NS_ENUM(NSInteger, RequestMethod) { + RequestPostMethod = 1, //post 请求 + RequestGetMethod = 2, //get 请求 + RequestPutMethod = 3, //put 请求 + RequestDelMethod = 4, //del 请求 +}; + +typedef NS_ENUM(NSInteger ,GiGAErrorCode){ + GiGAErrorCode_SUCCESS = 0,//成功 + GiGAErrorCode_USER_EXIST = 500,//用户已存在 + +}; + +@class GiGaBaseAPiRequest; + +typedef void (^GiGaRequestResultBlock)(GiGaAPIResult *result); + +@interface GiGaBaseAPiRequest : NSObject + +#pragma mark - porperty + +@property (nonatomic,assign) GIGARequestNetStatus statu; + +//@property (nonatomic, copy) GIGARequestSuccessBlock successBlock; +//@property (nonatomic, copy) GIGARequetFailBlock failBlock; +@property (nonatomic,copy) GiGaRequestResultBlock blockresult; + +/** 请求类型 */ +@property (nonatomic, assign) RequestMethod requestMethod; +/** 请求超时时间 */ +@property (nonatomic, readonly) NSTimeInterval timeout; +/** 服务器地址 */ +@property (nonatomic, readonly) NSString *serviceUrl; +/** 请求路径 */ +@property (nonatomic, copy) NSString *fullUrl; + +/** 请求参数 */ +@property (nonatomic, strong) NSMutableDictionary *params; + +/** + * 请求得到的全部数据 + */ +@property (strong, nonatomic) NSDictionary *resultDict; + +@property (strong, nonatomic) NSDictionary *responseHeaderFields; + +@property (nonatomic, assign) BOOL needToken; // 是否需要带上token + +/** + * 检查网络 + */ +- (void)checkNetwork; + + +/** + 发起请求 + + @param result 。 + */ +- (void)requstDataWithResult:(GiGaRequestResultBlock)result; + + +/** + * 发起本地存储数据请求 + * + * @param success 成功block + * @param failure 失败block + */ +//- (void)loadLocalDataAsyncWithSuccess:(GIGARequestSuccessBlock)success + // failure:(GIGARequetFailBlock)failure; +/** + * 分析错误信息 + * + * @param requestDict 服务器返回数据 + * @param error error信息 + */ +- (void)analyseResponseInfo:(NSDictionary *)requestDict error:(NSError *)error; + +- (void)analyseResponseInfo:(NSDictionary *)requestDict + headerFileds:(NSDictionary *)headerFields + error:(NSError *)error; + + +/** + API convenience constructor + @param path request path + @param method method + @param parms parms + @return model + */ ++ (instancetype)initWithRequestPath:(NSString *)path + method:(RequestMethod)method + parms:(NSDictionary *)parms; + ++ (instancetype)initWithRequestAbsoluteURLString:(NSString *)absoluteString + method:(RequestMethod)method + parms:(NSDictionary *)parms; + +//+ (instancetype)uploadImage:(NSString *)url +// imgData:(NSData *)imgData +// parms:(NSDictionary *)parms +// success:(GIGARequestSuccessBlock)success +// failure:(GIGARequetFailBlock)failure; + +//+ (NSString *)resizeImageUrl:(NSString *)originImageUrl + // size:(CGSize)size; + +@end diff --git a/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m new file mode 100644 index 0000000..73bbbe0 --- /dev/null +++ b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m @@ -0,0 +1,163 @@ +// +// GiGaBaseAPiRequest.m +// GIGA +// +// Created by lianxiang on 2018/8/29. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "GiGaBaseAPiRequest.h" +#import "GiGaServerConfig.h" +#import +#import "GiGaNetManager.h" + +@implementation GiGaBaseAPiRequest + +- (NSString *)serviceUrl +{ + return [GiGaServerConfig getMainUrl]; +} + +- (id)init +{ + self = [super init]; + if (self) { + _needToken = NO; + self.requestMethod = RequestGetMethod; + + } + return self; +} + ++(instancetype)initWithRequestPath:(NSString *)path method:(RequestMethod)method parms:(NSDictionary *)parms +{ + NSString *absoluteURLString = [NSString stringWithFormat:@"%@%@", [GiGaServerConfig getMainUrl], path]; + return [self initWithRequestAbsoluteURLString:absoluteURLString + method:method + parms:parms]; +} + ++ (instancetype)initWithRequestAbsoluteURLString:(NSString *)absoluteString + method:(RequestMethod)method + parms:(NSDictionary *)parms +{ + GiGaBaseAPiRequest *request = [[self alloc] init]; + request.fullUrl = absoluteString; + request.requestMethod = method; + + [request buildRequestDictWithDepedency:parms]; + return request; +} + ++ (NSArray *)mergeOriginalArray:(NSArray *)orgArr withOtherArray:(NSArray *)otherArr; +{ + if (otherArr.count == 0) { + return orgArr; + } + + NSMutableArray *array = [NSMutableArray arrayWithArray:orgArr]; + for (int i = 0; i < otherArr.count; i++) { + id object = [otherArr objectAtIndex:i]; + if (!orgArr || [orgArr indexOfObject:object] == NSNotFound) { + [array addObject:object]; + } + } + + return array; +} + +- (NSMutableDictionary *)buildRequestDict +{ + if (!_params) { + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + _params = dict; + } + return _params; +} +- (NSMutableDictionary *)buildRequestDictWithDepedency:(NSDictionary *)dict +{ + self.params = dict.mutableCopy; + return self.params; +} + +- (void)requstDataWithResult:(GiGaRequestResultBlock)result +{ + self.blockresult = result; + [self checkNetwork]; + if (self.statu == NetStatusUnKown) { + return; + } + NSLog(@" %@", _fullUrl); + // NSMutableDictionary *postDict = [self buildRequestDict]; + + [GiGaNetManager requestMethod:self.requestMethod Url:self.fullUrl params:self.params responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) { + + [self analyseResponseInfo:responseDict headerFileds:responseHeaderFields error:error]; + }]; + +} + +- (void)analyseResponseInfo:(NSDictionary *)responseData error:(NSError *)error +{ + [self analyseResponseInfo:responseData + headerFileds:nil + error:error]; +} + +- (void)analyseResponseInfo:(NSDictionary *)responseData headerFileds:(NSDictionary *)headerFields error:(NSError *)error +{ + self.responseHeaderFields = headerFields; + NSString *token = headerFields[@"access-token"]; + if (token && token.length > 0) { + //更新token + //[FFBMSConfig shareInstance].token = token; + } + + GILog(@"headerFileds%@",headerFields); + if (error) { + GILog(@"err:%@",error.localizedDescription); + [[UIApplication sharedApplication].keyWindow makeToast:@"请求错误" duration:1 position:CSToastPositionCenter]; + self.blockresult(nil); + return; + } + + self.resultDict =responseData; + GiGaAPIResult *res = [[GiGaAPIResult alloc] initWithDictionary:responseData]; + if (self.blockresult) { + self.blockresult(res); + } + + +} + + +- (void)checkNetwork{ + AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager]; + [manager startMonitoring]; + [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + + switch (status) { + case AFNetworkReachabilityStatusReachableViaWWAN: + { + GILog(@"2/3/4G"); + self.statu = NetStatusWWAN; + } + break; + case AFNetworkReachabilityStatusReachableViaWiFi: + { + GILog(@"WiFi"); + self.statu = NetStatusWifi; + } + break; + default: + [[UIApplication sharedApplication].keyWindow makeToast:@"网络异常" duration:1.0 position:CSToastPositionCenter]; + self.statu = NetStatusUnKown; + GILog(@"Unkown Net"); + break; + } + + }]; + +} + +@end diff --git a/GIGA/Common/GiGaNetTool/GiGaNetManager.h b/GIGA/Common/GiGaNetTool/GiGaNetManager.h index c524b0d..d494fe8 100644 --- a/GIGA/Common/GiGaNetTool/GiGaNetManager.h +++ b/GIGA/Common/GiGaNetTool/GiGaNetManager.h @@ -7,11 +7,18 @@ // #import -#import "GiGaAPIRequest.h" -@interface GiGaNetManager : NSObject -+(GiGaNetManager *)shareInstance; -+(void)request:(GiGaAPIRequest*)api; +#import "GiGaBaseAPiRequest.h" +typedef void (^responseBlock)(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error); + +@interface GiGaNetManager : NSObject + ++ (void)requestMethod:(RequestMethod)requestMethod Url:(NSString *)url params:(NSDictionary *)params responseBlock:(responseBlock)block; + ++(void)request:(NSString *)url params:(NSDictionary *)param + success:(void (^)(id response))success + failure:(void (^)(NSError *err))failure; ++(void)userLoginrequest:(NSString *)url params:(NSDictionary *)param completionHandler:(nullable void (^)(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error))completionHandler; @end diff --git a/GIGA/Common/GiGaNetTool/GiGaNetManager.m b/GIGA/Common/GiGaNetTool/GiGaNetManager.m index 355ee8d..40913f3 100644 --- a/GIGA/Common/GiGaNetTool/GiGaNetManager.m +++ b/GIGA/Common/GiGaNetTool/GiGaNetManager.m @@ -9,54 +9,58 @@ #import "GiGaNetManager.h" #import "AFNetworking.h" #import "GiGaServerConfig.h" + @interface GiGaNetManager() @end @implementation GiGaNetManager -+ (GiGaNetManager *)shareInstance{ - static GiGaNetManager *instance = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - instance = [[self alloc] init]; - }); - return instance; -} - -+ (void)request:(GiGaAPIRequest *)api{ - - NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; - NSURL *baseUrl = [NSURL URLWithString:[GiGaServerConfig getMainUrl]]; - AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] initWithBaseURL:baseUrl sessionConfiguration:configuration]; ++ (void)requestMethod:(RequestMethod)requestMethod Url:(NSString *)url params:(NSDictionary *)params responseBlock:(responseBlock)block{ +// NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +// NSURL *baseUrl = [NSURL URLWithString:[GiGaServerConfig getMainUrl]]; +// AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] initWithBaseURL:baseUrl sessionConfiguration:configuration]; + AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] init]; manager.responseSerializer=[AFHTTPResponseSerializer serializer]; - switch (api.requestType) { - case kRequestTypeGet: + + switch (requestMethod) { + case RequestGetMethod: { - [manager GET:api.fullUrl parameters:api.params progress:^(NSProgress * _Nonnull downloadProgress) { + [manager GET:url parameters:params progress:^(NSProgress * _Nonnull downloadProgress) { } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - NSDictionary *outDic = (NSDictionary *)responseObject; - [api callBackFinishedWithDictionary:outDic]; + + NSLog(@"%@", responseObject); + NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil]; + NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields]; + block(dict, headerFields, nil); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - [api callBackFailed:error]; + NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields]; + block(nil, headerFields, error); }]; } break; - case kRequestTypePost: + case RequestPostMethod: { - [manager POST:api.fullUrl parameters:api.params progress:^(NSProgress * _Nonnull uploadProgress) { + + [manager POST:url parameters:params progress:^(NSProgress * _Nonnull uploadProgress) { } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - NSDictionary *outDic = (NSDictionary *)responseObject; - [api callBackFinishedWithDictionary:outDic]; + + NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"%@", dict); + NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields]; + block(dict, headerFields, nil); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - [api callBackFailed:error]; + NSDictionary *headerFields = [(NSHTTPURLResponse *)task.response allHeaderFields]; + block(nil, headerFields, error); }]; } break; @@ -67,6 +71,58 @@ } } ++(void)request:(NSString *)url params:(NSDictionary *)param + success:(void (^)(id response))success + failure:(void (^)(NSError *err))failure +{ + AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] init]; + + manager.responseSerializer=[AFHTTPResponseSerializer serializer]; + + [manager POST:url parameters:param progress:^(NSProgress * _Nonnull uploadProgress) { + + } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + + NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil]; + NSLog(@"%@", dict); + if (success) { + success(responseObject); + } + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSLog(@"%@",error); + if (failure) { + failure(error); + } + }]; +} +//登录body传参数 ++(void)userLoginrequest:(NSString *)url params:(NSDictionary *)param completionHandler:(nullable void (^)(NSURLResponse *response,NSDictionary *resDic, NSError * _Nullable error))completionHandler +{ + + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + NSURL *baseUrl = [NSURL URLWithString:[GiGaServerConfig getMainUrl]]; + AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] initWithBaseURL:baseUrl sessionConfiguration:configuration]; + NSMutableURLRequest *requst = [[AFJSONRequestSerializer serializer] + requestWithMethod:@"POST" URLString:url parameters:param error:nil]; + requst.timeoutInterval = 10.f; + [requst setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; + [requst setValue:@"application/json" forHTTPHeaderField:@"Accept"]; + NSURLSessionDataTask *task = [manager dataTaskWithRequest:requst uploadProgress:^(NSProgress * _Nonnull uploadProgress) { + + } downloadProgress:^(NSProgress * _Nonnull downloadProgress) { + + } completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { + + if (completionHandler) { + completionHandler(response,responseObject,error); + } + + }]; + + [task resume]; + +} @end diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.h b/GIGA/Common/GiGaUserDB/GiGaUserDefault.h index 0489720..4ac2cb9 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.h +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.h @@ -12,8 +12,10 @@ @interface GiGaUserDefault : NSObject - +// +(void)saveUserId:(NSString *)userId; ++(void)saveToken:(NSString *)token; ++(NSString *)getCurentToken; +(NSString *)getCurentUserId; +(void)removeUserId;//退出登录 +(BOOL)isUserLogin; @@ -48,4 +50,5 @@ +(NSDictionary *)getWeiXinAccessToenDic; + @end diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m index 4d9261c..fe0c604 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m @@ -13,13 +13,12 @@ NSString *const GIGADEFAULTKEY_USERID = @"GiGaUserId"; NSString *const kShowUserGuard = @"ShowUserGuard"; NSString *const kShowAppGuard = @"ShowAppGuard"; NSString *const kWeiXinSaveToken = @"WeiXinSaveToken"; +NSString *const kGiGaToken = @"GiGatoken"; @implementation GiGaUserDefault +(void)saveUserId:(NSString *)userId{ - UD_SET_KEY_VALUE(GIGADEFAULTKEY_USERID, userId); - } +(NSString*)getCurentUserId{ @@ -28,12 +27,24 @@ NSString *const kWeiXinSaveToken = @"WeiXinSaveToken"; return userid; } ++(void)saveToken:(NSString *)token{ + [UD_STADARDUD setObject:token forKey: kGiGaToken]; + [UD_STADARDUD synchronize]; +} + +(void)removeUserId{ UD_REMOVE_KEY(GIGADEFAULTKEY_USERID); } ++(NSString *)getCurentToken{ + + NSString *token = [UD_STADARDUD objectForKey:kGiGaToken]; + [UD_STADARDUD synchronize]; + return token; +} + +(BOOL)isUserLogin{ NSString *uid = UD_GET_VALUE(GIGADEFAULTKEY_USERID); diff --git a/GIGA/Config/GIGA.h b/GIGA/Config/GIGA.h index b35d391..2be15ac 100644 --- a/GIGA/Config/GIGA.h +++ b/GIGA/Config/GIGA.h @@ -41,6 +41,9 @@ UD_SYNC //app 挂起 #define kLOCALNotifiID_APPTERMINAL @"GIGALocalNotificationAppTerminal" +//注册成功 +#define kUserRegistSucccess @"userRegistSuccess" + //微信登陆授权成功 #define kWeiXinAuthrization_Success @"WXAuthSuccess" #define WXin_APPID @"wx1fa33defa5cbc8dd" @@ -75,5 +78,6 @@ alpha:((float)(rgbValue & 0xFF))/255.0] #define textFontWeightSize(X,W) [UIFont systemFontOfSize:X *([UIScreen mainScreen].bounds.size.width / 320.0) weight:W] #define GIGA_ShowToast(__toast__) [self.view makeToast:(__toast__) duration:1.5 position:CSToastPositionCenter]; +#define GIGA_WIndowTost(__toast__) [[UIApplication sharedApplication].keyWindow makeToast:(__toast__) duration:1.5 position:CSToastPositionCenter]; #endif /* GIGA_h */ diff --git a/GIGA/Config/GiGaServerConfig.m b/GIGA/Config/GiGaServerConfig.m index 4626236..726b9b1 100644 --- a/GIGA/Config/GiGaServerConfig.m +++ b/GIGA/Config/GiGaServerConfig.m @@ -18,7 +18,7 @@ case 0://测试环境 { - [[NSUserDefaults standardUserDefaults] setValue:@"https://" forKey:@"MainUrl"]; + [[NSUserDefaults standardUserDefaults] setValue:@"http://apiyts.s1.natapp.cc/v1/" forKey:@"MainUrl"]; } break; case 1: //生产环境 { diff --git a/GIGA/GIGA.pch b/GIGA/GIGA.pch index 8fc21ca..ec80429 100644 --- a/GIGA/GIGA.pch +++ b/GIGA/GIGA.pch @@ -13,6 +13,7 @@ // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. #import "GIGA.h" #import "AFNetworking.h" +#import #import "UIView+Toast.h" #import "JXTAlertManagerHeader.h" #import "Masonry.h" @@ -20,6 +21,7 @@ #import #import #import "MobClickList.h" +#import "TTTAttributedLabel.h" #ifdef DEBUG #define GILog(fmt,...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/GIGA/Info.plist b/GIGA/Info.plist index 3b10a93..081700e 100644 --- a/GIGA/Info.plist +++ b/GIGA/Info.plist @@ -4,14 +4,19 @@ BuglyAppIDString 8f49773330 - LSApplicationQueriesSchemes - - weixin - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + cn CFBundleDisplayName MaskTime + CFBundleDocumentTypes + + + CFBundleTypeIconFiles + + CFBundleTypeName + + + CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -39,6 +44,10 @@ CFBundleVersion 1 + LSApplicationQueriesSchemes + + weixin + LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.h b/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.h new file mode 100644 index 0000000..0e3a633 --- /dev/null +++ b/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.h @@ -0,0 +1,13 @@ +// +// RegistGetSMSCodeRequest.h +// GIGA +// +// Created by lianxiang on 2018/8/29. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + + +#import "GiGaBaseAPiRequest.h" +@interface RegistGetSMSCodeRequest : GiGaBaseAPiRequest + +@end diff --git a/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.m b/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.m new file mode 100644 index 0000000..ab6d535 --- /dev/null +++ b/GIGA/Modules/LogIn/APi/RegistGetSMSCodeRequest.m @@ -0,0 +1,13 @@ +// +// RegistGetSMSCodeRequest.m +// GIGA +// +// Created by lianxiang on 2018/8/29. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "RegistGetSMSCodeRequest.h" + +@implementation RegistGetSMSCodeRequest + +@end diff --git a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m index 27a9831..1b71b98 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m +++ b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m @@ -9,6 +9,12 @@ #import "GiGaRegistViewController.h" #import "TTTAttributedLabel.h" #import "GiGaWebViewController.h" +#import "NSTimer+Convenience.h" +#import "GiGaBaseAPiRequest.h" +#import "GiGaNetManager.h" +#import "MBProgressHUD.h" +#import "GiGaAttributedLabel.h" + @interface GiGaRegistViewController () @property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField; @property (weak, nonatomic) IBOutlet UITextField *codeTextField; @@ -17,7 +23,9 @@ @property (weak, nonatomic) IBOutlet UIButton *checkBtn; @property (weak, nonatomic) IBOutlet UIButton *registBtn; -@property (weak, nonatomic) IBOutlet TTTAttributedLabel *useragreementLabel; +@property (weak, nonatomic) IBOutlet GiGaAttributedLabel *useragreementLabel; +@property(nonatomic,strong) NSTimer*timer; +@property(nonatomic) NSInteger time; @end @@ -26,10 +34,73 @@ - (void)viewDidLoad { [super viewDidLoad]; self.title = @"注册"; + _time = 60; + // Do any additional setup after loading the view from its nib. [self confirmUI]; - + [self.sendCodeBtn addTarget:self action:@selector(sendCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.registBtn addTarget:self action:@selector(registBtnAction:) forControlEvents:UIControlEventTouchUpInside]; +} +-(void)dealloc{ + if (_timer) { + [_timer unfireTimer]; + [_timer invalidate]; + _timer = nil; + + } +} +-(void)sendCodeBtnAction:(UIButton *)btn{ + + if (self.phoneNumberTextField.text == nil) { + GIGA_ShowToast(@"请输入手机号"); + return; + } + if (![GiGaHelper isPhoneNumber:self.phoneNumberTextField.text]) { + GIGA_ShowToast(@"请输入正确手机号"); + return; + } + btn.userInteractionEnabled = NO; + [self startTimer:btn]; + [self sendVerifiCode:btn]; +} +-(void)startTimer:(UIButton *)btn{ + + if (_time>0) { + _timer = [NSTimer scheduledTimerWithTimeInterval:1 count:60 callback:^{ + NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)self->_time]; + [btn setTitle:timeStr forState:UIControlStateNormal]; + self->_time--; + + if (self->_time==0) { + [self.sendCodeBtn setTitle:@"发送短信" forState:UIControlStateNormal]; + [btn setBackgroundColor:GIGAUIColorFromRGBA(0x28b9ff)]; + self->_time =60; + btn.userInteractionEnabled = YES; + } + + }]; + [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; + } +} + +#pragma mark 发送短信验证码 +-(void)sendVerifiCode:(UIButton *)btn{ + + [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + + NSString *phoneNumber = self.phoneNumberTextField.text; + NSDictionary *param = @{ + @"mobile":phoneNumber + }; + GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:@"msg/sms/v1/sendcode" method:RequestPostMethod parms:param]; + + [api requstDataWithResult:^(GiGaAPIResult *result) { + [MBProgressHUD hideHUDForView:self.view animated:YES]; + GILog(@"短信获取%@",result.message); + btn.userInteractionEnabled = YES; + }]; + } -(void)confirmUI{ @@ -79,6 +150,57 @@ webView.souceType = WebSourceTypeUrlLink; webView.url = @"http://www.youtansu.com"; [self.navigationController pushViewController:webView animated:YES]; + +} + +#pragma mark 注册 +-(void)registBtnAction:(UIButton *)btn{ + + if (self.phoneNumberTextField.text.length ==0) { + GIGA_ShowToast(@"请输入手机号"); + return; + } + if (![GiGaHelper isPhoneNumber:self.phoneNumberTextField.text]) { + GIGA_ShowToast(@"请输入正确手机号"); + return; + } + if (self.codeTextField.text.length == 0) { + GIGA_ShowToast(@"请输入验证码"); + return; + } + if (!(self.passTexFied.text.length >=6 && self.passTexFied.text.length <=20) || self.passTexFied.text.length == 0) { + GIGA_ShowToast(@"请输入6~20位密码"); + return; + } + + [self regeist:btn]; +} + +//注册 +-(void)regeist:(UIButton *)btn{ + + btn.userInteractionEnabled = NO; + NSDictionary *param = @{@"username":self.phoneNumberTextField.text,@"verifiedCode":self.codeTextField.text,@"password":self.passTexFied.text}; + GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:@"sys/v1/phoneregister" method:RequestPostMethod parms:param]; + + [api requstDataWithResult:^(GiGaAPIResult *result) { + + btn.userInteractionEnabled = YES; + GILog(@"注册->%@",result.message); + if (result.code == 0) { + + NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text); + + + }else if (result.code == GiGAErrorCode_USER_EXIST){ + GIGA_ShowToast(@"用户已存在"); + NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text); + + }else{ + GIGA_ShowToast(result.message); + } + }]; + } - (void)didReceiveMemoryWarning { diff --git a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.xib b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.xib index 90c5348..fbad89d 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.xib +++ b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.xib @@ -42,7 +42,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -110,7 +110,7 @@ - + + + + + + diff --git a/GIGA/Modules/LogIn/Controller/PassWordResetVC.m b/GIGA/Modules/LogIn/Controller/PassWordResetVC.m index 28b5381..f714860 100644 --- a/GIGA/Modules/LogIn/Controller/PassWordResetVC.m +++ b/GIGA/Modules/LogIn/Controller/PassWordResetVC.m @@ -29,7 +29,7 @@ -(void)confirmUI{ - [self.phoneNumberTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"]; + UIView *phoneView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; phoneView.backgroundColor = [UIColor redColor]; UIImageView *phoneIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)]; @@ -38,7 +38,6 @@ self.phoneNumberTextField.leftView = phoneView; self.phoneNumberTextField.leftViewMode = UITextFieldViewModeAlways; - [self.codeTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"]; UIView *codeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; codeView.backgroundColor = [UIColor redColor]; UIImageView *codeIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)]; diff --git a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m index 871f3b1..16930bf 100644 --- a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m +++ b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m @@ -55,11 +55,13 @@ -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [IQKeyboardManager sharedManager].enable = NO; + [[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO]; } - (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; [IQKeyboardManager sharedManager].enable = YES; + [[IQKeyboardManager sharedManager] setEnableAutoToolbar:YES]; } -(void)showFlyingCommit{ diff --git a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m index 428b477..d100cbd 100644 --- a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m +++ b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m @@ -356,10 +356,7 @@ #pragma mark 开始测试 -(void)testBtnAcion:(UIButton *)btn{ - -// [self startMaskTime]; -// return ; - + BOOL isUserLogin = [GiGaUserDefault isUserLogin]; if (isUserLogin) { @@ -447,7 +444,7 @@ UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; leftBtn.frame = CGRectMake(0, 0, 40, 40); leftBtn.backgroundColor = [UIColor redColor]; - [leftBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; + [leftBtn setImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal]; [leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn]; //rightItem @@ -465,7 +462,6 @@ BOOL isUserLogin = [GiGaUserDefault isUserLogin]; if (isUserLogin) { - GIGA_ShowToast(@"userLogin!"); GiGaMasssagesVC *masageVC= [[GiGaMasssagesVC alloc] init]; [self.navigationController pushViewController:masageVC animated:YES]; diff --git a/GIGA/Modules/Mask/View/GiGaCommentView.m b/GIGA/Modules/Mask/View/GiGaCommentView.m index 55f95f2..68f3c87 100644 --- a/GIGA/Modules/Mask/View/GiGaCommentView.m +++ b/GIGA/Modules/Mask/View/GiGaCommentView.m @@ -4,7 +4,7 @@ // // Created by lianxiang on 2018/8/14. // Copyright © 2018年 com.giga.ios. All rights reserved. -// +//弹幕评论视图 #import "GiGaCommentView.h" #import "Masonry.h" @@ -81,8 +81,7 @@ make.top.mas_equalTo(self.userAvtar.mas_bottom).mas_offset(3); make.left.mas_equalTo(self.mas_left).mas_offset(5); - - + }]; float width = msglabel.frame.size.width > namelabel.frame.size.width ? msglabel.frame.size.width:namelabel.frame.size.width ; diff --git a/GIGA/Modules/Mask/View/GiGaFlyingCommitInputView.m b/GIGA/Modules/Mask/View/GiGaFlyingCommitInputView.m index 747f36e..29ae811 100644 --- a/GIGA/Modules/Mask/View/GiGaFlyingCommitInputView.m +++ b/GIGA/Modules/Mask/View/GiGaFlyingCommitInputView.m @@ -19,10 +19,9 @@ self = [super initWithFrame:frame]; if (self) { -// self.backgroundColor = [UIColor blackColor]; self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1]; -// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissSelfViewTap)]; -// [self addGestureRecognizer:tap]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissSelfViewTap)]; + [self addGestureRecognizer:tap]; [self creatInputView]; [self bringSubviewToFront:_commitInputView]; @@ -54,6 +53,7 @@ textField.backgroundColor = [UIColor lightGrayColor]; textField.clearButtonMode = UITextFieldViewModeWhileEditing; textField.delegate = self; + textField.returnKeyType = UIReturnKeySend; [commitView addSubview:textField]; self.inputTextField = textField; @@ -71,7 +71,8 @@ } -(void)dismissSelfViewTap{ - [self removeFromSuperview]; + //[self removeFromSuperview]; + [self.inputTextField resignFirstResponder]; } -(void)sendBtnAction:(UIButton *)btn{ @@ -95,7 +96,8 @@ self.SendCommentHandler(self.inputTextField.text); } - [self dismissKeyboard]; + if (![self.inputTextField isFirstResponder]) return; + [self dismissKeyboard]; } @@ -138,7 +140,6 @@ // get a rect for the textView frame CGRect commentInputViewFrame = self.commitInputView.frame; commentInputViewFrame.origin.y = self.bounds.size.height - (keyboardBounds.size.height + commentInputViewFrame.size.height); - // animations settings [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; @@ -147,7 +148,6 @@ // set views with new info self.commitInputView.frame = commentInputViewFrame; - [UIView commitAnimations]; diff --git a/GIGA/Modules/Me/Model/GiGaUser.h b/GIGA/Modules/Me/Model/GiGaUser.h index 89e7721..de62b91 100644 --- a/GIGA/Modules/Me/Model/GiGaUser.h +++ b/GIGA/Modules/Me/Model/GiGaUser.h @@ -12,7 +12,9 @@ @property(nonatomic,copy) NSString *userId; @property(nonatomic,copy) NSString *name; -@property(nonatomic,copy) NSString *avatar; +@property(nonatomic,copy) NSString *avatar;//头像 @property(nonatomic,copy) NSString *tel; +@property(nonatomic,copy) NSString *token; + @end