Commit dabb460d2600744bd2814848157c151f7b5f3380
1 parent
a3731631
no message
Showing
4 changed files
with
95 additions
and
64 deletions
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
| ... | ... | @@ -12,6 +12,9 @@ |
| 12 | 12 | #import "QMUIKit.h" |
| 13 | 13 | |
| 14 | 14 | #import "CNLiveServices.h" |
| 15 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 16 | +#import "CNUserInfoManager.h" | |
| 17 | +#import "CNLiveEnvironment.h" | |
| 15 | 18 | |
| 16 | 19 | #import "CNLiveMineNavigationBar.h" |
| 17 | 20 | #import "CNLiveMineHeaderView.h" |
| ... | ... | @@ -37,6 +40,7 @@ |
| 37 | 40 | |
| 38 | 41 | @implementation CNLiveMineController |
| 39 | 42 | static const NSInteger kHEIGHT = 250; |
| 43 | +static const CGFloat timeValue = 1.5; | |
| 40 | 44 | |
| 41 | 45 | #pragma mark - 加载数据 |
| 42 | 46 | - (void)loadData { |
| ... | ... | @@ -161,8 +165,7 @@ static const NSInteger kHEIGHT = 250; |
| 161 | 165 | break; |
| 162 | 166 | case CNLiveMineHeaderViewTypeSign: |
| 163 | 167 | { |
| 164 | - id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)]; | |
| 165 | - [service showSignInViewWithScore:@"100" scores:@"" day:1 url:@"http://www.baidu.com"]; | |
| 168 | + [self requestSignIn]; | |
| 166 | 169 | } |
| 167 | 170 | break; |
| 168 | 171 | case CNLiveMineHeaderViewTypeWintess: |
| ... | ... | @@ -173,6 +176,38 @@ static const NSInteger kHEIGHT = 250; |
| 173 | 176 | } |
| 174 | 177 | } |
| 175 | 178 | |
| 179 | +- (void)requestSignIn{ | |
| 180 | + NSDictionary *params = @{@"sid":CNUserShareModel.uid}; | |
| 181 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 182 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralSignInUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 183 | + | |
| 184 | + if (error.code == -1001 || error.code == -1009) { | |
| 185 | + [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:timeValue]; | |
| 186 | + return ; | |
| 187 | + } | |
| 188 | + if (!error) { | |
| 189 | + if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){ | |
| 190 | + id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)]; | |
| 191 | + NSDictionary *dic = responseObject[@"data"]; | |
| 192 | + NSInteger status = [dic[@"status"] integerValue]; | |
| 193 | + if (status == 1) { | |
| 194 | + [service showGoldWhereaboutsViewWithDic:dic]; | |
| 195 | + | |
| 196 | + }else{ | |
| 197 | + [service showSignInViewWithDic:dic]; | |
| 198 | + } | |
| 199 | + | |
| 200 | + } | |
| 201 | + | |
| 202 | + }else{ | |
| 203 | + [QMUITips showError:@"签到失败" inView:self.view hideAfterDelay:timeValue]; | |
| 204 | + return ; | |
| 205 | + | |
| 206 | + } | |
| 207 | + | |
| 208 | + }]; | |
| 209 | +} | |
| 210 | + | |
| 176 | 211 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { |
| 177 | 212 | CGPoint point = scrollView.contentOffset; |
| 178 | 213 | if (point.y < -kHEIGHT) { | ... | ... |
Example/CNLiveMineModule.xcodeproj/project.pbxproj
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | 1D378110366292D6352968E4 /* Pods-CNLiveMineModule_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveMineModule_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveMineModule_Tests/Pods-CNLiveMineModule_Tests.release.xcconfig"; sourceTree = "<group>"; }; |
| 57 | 57 | 218A75B2DA9772C6C6C9B5D8 /* Pods_CNLiveMineModule_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveMineModule_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 58 | 58 | 4E117669F0B64F8E94994BBB /* CNLiveMineModule.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveMineModule.podspec; path = ../CNLiveMineModule.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; |
| 59 | - 6003F58A195388D20070C39A /* CNLiveMineModule_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveMineModule_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; | |
| 59 | + 6003F58A195388D20070C39A /* 我的模块.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "我的模块.app"; sourceTree = BUILT_PRODUCTS_DIR; }; | |
| 60 | 60 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; |
| 61 | 61 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; |
| 62 | 62 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; |
| ... | ... | @@ -126,7 +126,7 @@ |
| 126 | 126 | 6003F58B195388D20070C39A /* Products */ = { |
| 127 | 127 | isa = PBXGroup; |
| 128 | 128 | children = ( |
| 129 | - 6003F58A195388D20070C39A /* CNLiveMineModule_Example.app */, | |
| 129 | + 6003F58A195388D20070C39A /* 我的模块.app */, | |
| 130 | 130 | 6003F5AE195388D20070C39A /* CNLiveMineModule_Tests.xctest */, |
| 131 | 131 | ); |
| 132 | 132 | name = Products; |
| ... | ... | @@ -234,8 +234,8 @@ |
| 234 | 234 | 6003F586195388D20070C39A /* Sources */, |
| 235 | 235 | 6003F587195388D20070C39A /* Frameworks */, |
| 236 | 236 | 6003F588195388D20070C39A /* Resources */, |
| 237 | - 99C363EEF6A14DCC1038EC13 /* [CP] Embed Pods Frameworks */, | |
| 238 | - 9ABA762C0C8EC0CA879C4F52 /* [CP] Copy Pods Resources */, | |
| 237 | + 2E3F32B2D2B892B11EBB1C63 /* [CP] Embed Pods Frameworks */, | |
| 238 | + 1E6224051C3016E67E3E81EE /* [CP] Copy Pods Resources */, | |
| 239 | 239 | ); |
| 240 | 240 | buildRules = ( |
| 241 | 241 | ); |
| ... | ... | @@ -243,7 +243,7 @@ |
| 243 | 243 | ); |
| 244 | 244 | name = CNLiveMineModule_Example; |
| 245 | 245 | productName = CNLiveMineModule; |
| 246 | - productReference = 6003F58A195388D20070C39A /* CNLiveMineModule_Example.app */; | |
| 246 | + productReference = 6003F58A195388D20070C39A /* 我的模块.app */; | |
| 247 | 247 | productType = "com.apple.product-type.application"; |
| 248 | 248 | }; |
| 249 | 249 | 6003F5AD195388D20070C39A /* CNLiveMineModule_Tests */ = { |
| ... | ... | @@ -326,7 +326,27 @@ |
| 326 | 326 | /* End PBXResourcesBuildPhase section */ |
| 327 | 327 | |
| 328 | 328 | /* Begin PBXShellScriptBuildPhase section */ |
| 329 | - 99C363EEF6A14DCC1038EC13 /* [CP] Embed Pods Frameworks */ = { | |
| 329 | + 1E6224051C3016E67E3E81EE /* [CP] Copy Pods Resources */ = { | |
| 330 | + isa = PBXShellScriptBuildPhase; | |
| 331 | + buildActionMask = 2147483647; | |
| 332 | + files = ( | |
| 333 | + ); | |
| 334 | + inputPaths = ( | |
| 335 | + "${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-resources.sh", | |
| 336 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveMineModule/CNLiveMineModule.bundle", | |
| 337 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveSettingModule/CNLiveSettingModule.bundle", | |
| 338 | + ); | |
| 339 | + name = "[CP] Copy Pods Resources"; | |
| 340 | + outputPaths = ( | |
| 341 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveMineModule.bundle", | |
| 342 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveSettingModule.bundle", | |
| 343 | + ); | |
| 344 | + runOnlyForDeploymentPostprocessing = 0; | |
| 345 | + shellPath = /bin/sh; | |
| 346 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-resources.sh\"\n"; | |
| 347 | + showEnvVarsInLog = 0; | |
| 348 | + }; | |
| 349 | + 2E3F32B2D2B892B11EBB1C63 /* [CP] Embed Pods Frameworks */ = { | |
| 330 | 350 | isa = PBXShellScriptBuildPhase; |
| 331 | 351 | buildActionMask = 2147483647; |
| 332 | 352 | files = ( |
| ... | ... | @@ -402,26 +422,6 @@ |
| 402 | 422 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-frameworks.sh\"\n"; |
| 403 | 423 | showEnvVarsInLog = 0; |
| 404 | 424 | }; |
| 405 | - 9ABA762C0C8EC0CA879C4F52 /* [CP] Copy Pods Resources */ = { | |
| 406 | - isa = PBXShellScriptBuildPhase; | |
| 407 | - buildActionMask = 2147483647; | |
| 408 | - files = ( | |
| 409 | - ); | |
| 410 | - inputPaths = ( | |
| 411 | - "${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-resources.sh", | |
| 412 | - "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveMineModule/CNLiveMineModule.bundle", | |
| 413 | - "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveSettingModule/CNLiveSettingModule.bundle", | |
| 414 | - ); | |
| 415 | - name = "[CP] Copy Pods Resources"; | |
| 416 | - outputPaths = ( | |
| 417 | - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveMineModule.bundle", | |
| 418 | - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveSettingModule.bundle", | |
| 419 | - ); | |
| 420 | - runOnlyForDeploymentPostprocessing = 0; | |
| 421 | - shellPath = /bin/sh; | |
| 422 | - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-resources.sh\"\n"; | |
| 423 | - showEnvVarsInLog = 0; | |
| 424 | - }; | |
| 425 | 425 | A9B5D0EFC5B6FCA241FAE929 /* [CP] Check Pods Manifest.lock */ = { |
| 426 | 426 | isa = PBXShellScriptBuildPhase; |
| 427 | 427 | buildActionMask = 2147483647; |
| ... | ... | @@ -613,9 +613,10 @@ |
| 613 | 613 | GCC_PREFIX_HEADER = "CNLiveMineModule/CNLiveMineModule-Prefix.pch"; |
| 614 | 614 | INFOPLIST_FILE = "CNLiveMineModule/CNLiveMineModule-Info.plist"; |
| 615 | 615 | MODULE_NAME = ExampleApp; |
| 616 | - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | |
| 617 | - PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 616 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveMineModule; | |
| 617 | + PRODUCT_NAME = "我的模块"; | |
| 618 | 618 | SWIFT_VERSION = 4.0; |
| 619 | + TARGETED_DEVICE_FAMILY = 1; | |
| 619 | 620 | WRAPPER_EXTENSION = app; |
| 620 | 621 | }; |
| 621 | 622 | name = Debug; |
| ... | ... | @@ -630,9 +631,10 @@ |
| 630 | 631 | GCC_PREFIX_HEADER = "CNLiveMineModule/CNLiveMineModule-Prefix.pch"; |
| 631 | 632 | INFOPLIST_FILE = "CNLiveMineModule/CNLiveMineModule-Info.plist"; |
| 632 | 633 | MODULE_NAME = ExampleApp; |
| 633 | - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | |
| 634 | - PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 634 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.CNLiveMineModule; | |
| 635 | + PRODUCT_NAME = "我的模块"; | |
| 635 | 636 | SWIFT_VERSION = 4.0; |
| 637 | + TARGETED_DEVICE_FAMILY = 1; | |
| 636 | 638 | WRAPPER_EXTENSION = app; |
| 637 | 639 | }; |
| 638 | 640 | name = Release; | ... | ... |
Example/CNLiveMineModule.xcodeproj/xcshareddata/xcschemes/CNLiveMineModule-Example.xcscheme
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | <BuildableReference |
| 16 | 16 | BuildableIdentifier = "primary" |
| 17 | 17 | BlueprintIdentifier = "6003F589195388D20070C39A" |
| 18 | - BuildableName = "CNLiveMineModule_Example.app" | |
| 18 | + BuildableName = "我的模块.app" | |
| 19 | 19 | BlueprintName = "CNLiveMineModule_Example" |
| 20 | 20 | ReferencedContainer = "container:CNLiveMineModule.xcodeproj"> |
| 21 | 21 | </BuildableReference> |
| ... | ... | @@ -27,6 +27,15 @@ |
| 27 | 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
| 28 | 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
| 29 | 29 | shouldUseLaunchSchemeArgsEnv = "YES"> |
| 30 | + <MacroExpansion> | |
| 31 | + <BuildableReference | |
| 32 | + BuildableIdentifier = "primary" | |
| 33 | + BlueprintIdentifier = "6003F589195388D20070C39A" | |
| 34 | + BuildableName = "我的模块.app" | |
| 35 | + BlueprintName = "CNLiveMineModule_Example" | |
| 36 | + ReferencedContainer = "container:CNLiveMineModule.xcodeproj"> | |
| 37 | + </BuildableReference> | |
| 38 | + </MacroExpansion> | |
| 30 | 39 | <Testables> |
| 31 | 40 | <TestableReference |
| 32 | 41 | skipped = "NO"> |
| ... | ... | @@ -39,17 +48,6 @@ |
| 39 | 48 | </BuildableReference> |
| 40 | 49 | </TestableReference> |
| 41 | 50 | </Testables> |
| 42 | - <MacroExpansion> | |
| 43 | - <BuildableReference | |
| 44 | - BuildableIdentifier = "primary" | |
| 45 | - BlueprintIdentifier = "6003F589195388D20070C39A" | |
| 46 | - BuildableName = "CNLiveMineModule_Example.app" | |
| 47 | - BlueprintName = "CNLiveMineModule_Example" | |
| 48 | - ReferencedContainer = "container:CNLiveMineModule.xcodeproj"> | |
| 49 | - </BuildableReference> | |
| 50 | - </MacroExpansion> | |
| 51 | - <AdditionalOptions> | |
| 52 | - </AdditionalOptions> | |
| 53 | 51 | </TestAction> |
| 54 | 52 | <LaunchAction |
| 55 | 53 | buildConfiguration = "Debug" |
| ... | ... | @@ -66,13 +64,11 @@ |
| 66 | 64 | <BuildableReference |
| 67 | 65 | BuildableIdentifier = "primary" |
| 68 | 66 | BlueprintIdentifier = "6003F589195388D20070C39A" |
| 69 | - BuildableName = "CNLiveMineModule_Example.app" | |
| 67 | + BuildableName = "我的模块.app" | |
| 70 | 68 | BlueprintName = "CNLiveMineModule_Example" |
| 71 | 69 | ReferencedContainer = "container:CNLiveMineModule.xcodeproj"> |
| 72 | 70 | </BuildableReference> |
| 73 | 71 | </BuildableProductRunnable> |
| 74 | - <AdditionalOptions> | |
| 75 | - </AdditionalOptions> | |
| 76 | 72 | </LaunchAction> |
| 77 | 73 | <ProfileAction |
| 78 | 74 | buildConfiguration = "Release" |
| ... | ... | @@ -85,7 +81,7 @@ |
| 85 | 81 | <BuildableReference |
| 86 | 82 | BuildableIdentifier = "primary" |
| 87 | 83 | BlueprintIdentifier = "6003F589195388D20070C39A" |
| 88 | - BuildableName = "CNLiveMineModule_Example.app" | |
| 84 | + BuildableName = "我的模块.app" | |
| 89 | 85 | BlueprintName = "CNLiveMineModule_Example" |
| 90 | 86 | ReferencedContainer = "container:CNLiveMineModule.xcodeproj"> |
| 91 | 87 | </BuildableReference> | ... | ... |
Example/CNLiveMineModule/CNLiveMineModule-Info.plist
| ... | ... | @@ -2,23 +2,10 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | - <key>NSAppTransportSecurity</key> | |
| 6 | - <dict> | |
| 7 | - <key>NSAllowsArbitraryLoads</key> | |
| 8 | - <true/> | |
| 9 | - </dict> | |
| 10 | - <key>NSCameraUsageDescription</key> | |
| 11 | - <string>App需要您的同意,才能访问相机</string> | |
| 12 | - <key>NSMicrophoneUsageDescription</key> | |
| 13 | - <string>App需要您的同意,才能访问麦克风</string> | |
| 14 | - <key>NSPhotoLibraryAddUsageDescription</key> | |
| 15 | - <string>App需要您的同意,才能访问相册</string> | |
| 16 | - <key>NSPhotoLibraryUsageDescription</key> | |
| 17 | - <string>App需要您的同意,才能访问相册</string> | |
| 18 | 5 | <key>CFBundleDevelopmentRegion</key> |
| 19 | 6 | <string>en</string> |
| 20 | 7 | <key>CFBundleDisplayName</key> |
| 21 | - <string>${PRODUCT_NAME}</string> | |
| 8 | + <string>$(PRODUCT_NAME)</string> | |
| 22 | 9 | <key>CFBundleExecutable</key> |
| 23 | 10 | <string>${EXECUTABLE_NAME}</string> |
| 24 | 11 | <key>CFBundleIdentifier</key> |
| ... | ... | @@ -37,6 +24,19 @@ |
| 37 | 24 | <string>1.0</string> |
| 38 | 25 | <key>LSRequiresIPhoneOS</key> |
| 39 | 26 | <true/> |
| 27 | + <key>NSAppTransportSecurity</key> | |
| 28 | + <dict> | |
| 29 | + <key>NSAllowsArbitraryLoads</key> | |
| 30 | + <true/> | |
| 31 | + </dict> | |
| 32 | + <key>NSCameraUsageDescription</key> | |
| 33 | + <string>App需要您的同意,才能访问相机</string> | |
| 34 | + <key>NSMicrophoneUsageDescription</key> | |
| 35 | + <string>App需要您的同意,才能访问麦克风</string> | |
| 36 | + <key>NSPhotoLibraryAddUsageDescription</key> | |
| 37 | + <string>App需要您的同意,才能访问相册</string> | |
| 38 | + <key>NSPhotoLibraryUsageDescription</key> | |
| 39 | + <string>App需要您的同意,才能访问相册</string> | |
| 40 | 40 | <key>UILaunchStoryboardName</key> |
| 41 | 41 | <string>LaunchScreen</string> |
| 42 | 42 | <key>UIMainStoryboardFile</key> |
| ... | ... | @@ -48,8 +48,6 @@ |
| 48 | 48 | <key>UISupportedInterfaceOrientations</key> |
| 49 | 49 | <array> |
| 50 | 50 | <string>UIInterfaceOrientationPortrait</string> |
| 51 | - <string>UIInterfaceOrientationLandscapeLeft</string> | |
| 52 | - <string>UIInterfaceOrientationLandscapeRight</string> | |
| 53 | 51 | </array> |
| 54 | 52 | <key>UISupportedInterfaceOrientations~ipad</key> |
| 55 | 53 | <array> | ... | ... |