Commit 3c8a296e7b3627a9620f2915689dd3f4f917de08

Authored by zhangxiaowen
1 parent bc654c0b

no message

CNLiveServices.podspec
@@ -32,6 +32,11 @@ TODO: Add long description of the pod here. @@ -32,6 +32,11 @@ TODO: Add long description of the pod here.
32 32
33 s.source_files = 'CNLiveServices/Classes/CNLiveServices.h' 33 s.source_files = 'CNLiveServices/Classes/CNLiveServices.h'
34 34
  35 + # 跟控制器
  36 + s.subspec 'Manager' do |ss|
  37 + ss.source_files = 'CNLiveServices/Classes/Manager/*.{h,m}'
  38 + end
  39 +
35 # 首页 40 # 首页
36 s.subspec 'NetHome' do |ss| 41 s.subspec 'NetHome' do |ss|
37 ss.source_files = 'CNLiveServices/Classes/NetHome/*.{h,m}' 42 ss.source_files = 'CNLiveServices/Classes/NetHome/*.{h,m}'
CNLiveServices/Classes/CNLiveServices.h
@@ -11,6 +11,9 @@ @@ -11,6 +11,9 @@
11 11
12 #import "CNLiveBeeHive.h" 12 #import "CNLiveBeeHive.h"
13 13
  14 +// 页面跳转
  15 +#import "CNLivePageJumpManager.h"
  16 +
14 // 首页 17 // 首页
15 #import "CNLiveNetHomeServiceProtocol.h" 18 #import "CNLiveNetHomeServiceProtocol.h"
16 19
CNLiveServices/Classes/Manager/CNLivePageJumpManager.h 0 → 100644
  1 +//
  2 +// CNLivePageJumpManager.h
  3 +// CNLiveServices
  4 +//
  5 +// Created by 153993236@qq.com on 07/22/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLivePageJumpManager : NSObject
  14 +
  15 +// jump
  16 ++ (void)jumpViewController:(UIViewController *)controller;
  17 ++ (void)jumpViewController:(UIViewController *)controller animated:(BOOL)animated;
  18 +
  19 +// push
  20 ++ (void)pushViewController:(UIViewController *)controller;
  21 ++ (void)pushViewController:(UIViewController *)controller animated:(BOOL)animated;
  22 +
  23 +// pop
  24 ++ (void)popViewController;
  25 ++ (void)popViewControllerAnimated:(BOOL)animated;
  26 ++ (void)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
  27 ++ (void)popToRootViewControllerAnimated:(BOOL)animated;
  28 +
  29 +// present
  30 ++ (void)presentViewController:(UIViewController *)controller;
  31 ++ (void)presentViewController:(UIViewController *)controller animated:(BOOL)animated;
  32 ++ (void)presentViewController:(UIViewController *)controller animated:(BOOL)animated completion:(nullable void(^)(void))completion;
  33 +
  34 +// dismiss
  35 ++ (void)dismissViewController;
  36 ++ (void)dismissViewControllerAnimated:(BOOL)animated completion:(nullable void(^)(void))completion;
  37 +
  38 +@end
  39 +
  40 +NS_ASSUME_NONNULL_END
CNLiveServices/Classes/Manager/CNLivePageJumpManager.m 0 → 100644
  1 +//
  2 +// CNLivePageJumpManager.h
  3 +// CNLiveServices
  4 +//
  5 +// Created by 153993236@qq.com on 07/22/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLivePageJumpManager.h"
  10 +
  11 +@interface CNLivePageJumpManager ()
  12 +
  13 +@end
  14 +@implementation CNLivePageJumpManager
  15 +#pragma mark - 获取跟控制器
  16 ++ (UINavigationController *)getNavigationController{
  17 + UIViewController *vc = [UIApplication sharedApplication].delegate.window.rootViewController;
  18 + if ([vc isKindOfClass:[UINavigationController class]]){
  19 + return (UINavigationController *)vc;
  20 + }
  21 + else if ([vc isKindOfClass:[UITabBarController class]]){
  22 + UIViewController *select = [((UITabBarController *)vc) selectedViewController];
  23 + if ([select isKindOfClass:[UINavigationController class]]){
  24 + return (UINavigationController *)select;
  25 + }
  26 + }
  27 + return nil;
  28 +}
  29 +
  30 +#pragma mark - jump
  31 ++ (void)jumpViewController:(UIViewController *)controller{
  32 + [self jumpViewController:controller animated:YES];
  33 +}
  34 ++ (void)jumpViewController:(UIViewController *)controller animated:(BOOL)animated{
  35 + UINavigationController *nav = [self getNavigationController];
  36 + if(nav){
  37 + [nav pushViewController:controller animated:animated];
  38 + }
  39 + else{
  40 + UIViewController *vc = [UIApplication sharedApplication].delegate.window.rootViewController;
  41 + [vc presentViewController:controller animated:animated completion:nil];
  42 + }
  43 +}
  44 +
  45 +#pragma mark - Push
  46 ++ (void)pushViewController:(UIViewController *)controller{
  47 + [self pushViewController:controller animated:YES];
  48 +}
  49 ++ (void)pushViewController:(UIViewController *)controller animated:(BOOL)animated{
  50 + [[self getNavigationController] pushViewController:controller animated:animated];
  51 +}
  52 +
  53 +#pragma mark - Pop
  54 ++ (void)popViewController{
  55 + [self popViewControllerAnimated:YES];
  56 +}
  57 ++ (void)popViewControllerAnimated:(BOOL)animated{
  58 + [[self getNavigationController] popViewControllerAnimated:animated];
  59 +}
  60 ++ (void)popToViewController:(UIViewController *)viewController animated:(BOOL)animated{
  61 + [[self getNavigationController] popToViewController:viewController animated:animated];
  62 +}
  63 ++ (void)popToRootViewControllerAnimated:(BOOL)animated{
  64 + [[self getNavigationController] popToRootViewControllerAnimated:animated];
  65 +}
  66 +
  67 +#pragma mark - Present
  68 ++ (void)presentViewController:(UIViewController *)controller{
  69 + [self presentViewController:controller animated:YES];
  70 +}
  71 ++ (void)presentViewController:(UIViewController *)controller animated:(BOOL)animated{
  72 + [self presentViewController:controller animated:animated completion:nil];
  73 +}
  74 ++ (void)presentViewController:(UIViewController *)controller animated:(BOOL)animated completion:(nullable void(^)(void))completion{
  75 + [[self getNavigationController] presentViewController:controller animated:animated completion:completion];
  76 +}
  77 +
  78 +#pragma mark - Dismiss
  79 ++ (void)dismissViewController{
  80 + [self dismissViewControllerAnimated:YES completion:nil];
  81 +}
  82 ++ (void)dismissViewControllerAnimated:(BOOL)animated completion:(nullable void(^)(void))completion{
  83 + [[self getNavigationController] dismissViewControllerAnimated:animated completion:completion];
  84 +
  85 +}
  86 +
  87 +@end
Example/CNLiveServices.xcodeproj/project.pbxproj
@@ -365,10 +365,12 @@ @@ -365,10 +365,12 @@
365 inputPaths = ( 365 inputPaths = (
366 "${PODS_ROOT}/Target Support Files/Pods-CNLiveServices_Example/Pods-CNLiveServices_Example-frameworks.sh", 366 "${PODS_ROOT}/Target Support Files/Pods-CNLiveServices_Example/Pods-CNLiveServices_Example-frameworks.sh",
367 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", 367 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework",
  368 + "${BUILT_PRODUCTS_DIR}/CNLiveServices/CNLiveServices.framework",
368 ); 369 );
369 name = "[CP] Embed Pods Frameworks"; 370 name = "[CP] Embed Pods Frameworks";
370 outputPaths = ( 371 outputPaths = (
371 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", 372 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework",
  373 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveServices.framework",
372 ); 374 );
373 runOnlyForDeploymentPostprocessing = 0; 375 runOnlyForDeploymentPostprocessing = 0;
374 shellPath = /bin/sh; 376 shellPath = /bin/sh;
Example/CNLiveServices/CNLiveAppDelegate.m
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 // UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[login getLoginViewController]]; 34 // UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[login getLoginViewController]];
35 35
36 id<CNLiveNetHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveNetHomeServiceProtocol)]; 36 id<CNLiveNetHomeServiceProtocol> home = [[BeeHive shareInstance] createService:@protocol(CNLiveNetHomeServiceProtocol)];
37 - UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[home getHomeViewController]]; 37 + UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[home getNetHomeViewController]];
38 38
39 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 39 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
40 self.window.rootViewController = navCtrl; 40 self.window.rootViewController = navCtrl;
Example/CNLiveServices/Home/Module/CNLiveHomeModule.m
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 // 7 //
8 8
9 #import "CNLiveHomeModule.h" 9 #import "CNLiveHomeModule.h"
10 -#import "BeeHive.h" 10 +#import "CNLiveServices.h"
11 11
12 @BeeHiveMod(CNLiveHomeModule) 12 @BeeHiveMod(CNLiveHomeModule)
13 @interface CNLiveHomeModule()<BHModuleProtocol> 13 @interface CNLiveHomeModule()<BHModuleProtocol>
@@ -29,7 +29,6 @@ @@ -29,7 +29,6 @@
29 } 29 }
30 30
31 - (void)modSetUp:(BHContext *)context { 31 - (void)modSetUp:(BHContext *)context {
32 -// NSLog(@"CNLiveHomeModule setup");  
33 switch (context.env) { 32 switch (context.env) {
34 case BHEnvironmentDev: 33 case BHEnvironmentDev:
35 //....初始化开发环境 34 //....初始化开发环境
Example/CNLiveServices/Home/Module/CNLiveHomeService.m
@@ -18,13 +18,13 @@ @@ -18,13 +18,13 @@
18 18
19 @implementation CNLiveHomeService 19 @implementation CNLiveHomeService
20 20
21 -- (UIViewController *)getHomeViewController{ 21 +- (UIViewController *)getNetHomeViewController{
22 CNLiveHomeViewController *vc = [CNLiveHomeViewController new]; 22 CNLiveHomeViewController *vc = [CNLiveHomeViewController new];
23 return vc; 23 return vc;
24 24
25 } 25 }
26 26
27 -- (void)pushToHomeViewController{ 27 +- (void)pushToNetHomeViewController{
28 // UITabBarController *tab = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController; 28 // UITabBarController *tab = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
29 // UINavigationController *nav = tab.selectedViewController; 29 // UINavigationController *nav = tab.selectedViewController;
30 // CNLiveHomeViewController *vc = [CNLiveHomeViewController new]; 30 // CNLiveHomeViewController *vc = [CNLiveHomeViewController new];
@@ -50,4 +50,5 @@ @@ -50,4 +50,5 @@
50 50
51 } 51 }
52 52
  53 +
53 @end 54 @end