-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
source 'https://cdn.cocoapods.org/' | ||
|
||
target 'SJRouter_Example' do | ||
pod 'SJRouter', :path => '../' | ||
pod 'ModuleA', :path => '../ModuleA' | ||
pod 'ModuleB', :path => '../ModuleB' | ||
pod 'ModuleB', :path => '../ModuleB' | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,9 @@ pod 'SJRouter' | |
|
||
## Author | ||
|
||
SanJiang, [email protected] | ||
Email: [email protected] | ||
|
||
## Contact | ||
|
||
* Email: [email protected] | ||
* QQGroup: 719616775 <img src="https://github.com/changsanjiang/SJVideoPlayer/blob/master/SJVideoPlayerProject/SJVideoPlayerProject/Group.jpeg" width="100" /> | ||
QQGroup: 930508201 (iOS 开发) | ||
|
||
## License | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// SJRouteInterceptor.h | ||
// Pods | ||
// | ||
// Created by 畅三江 on 2020/4/11. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "SJRouteHandler.h" | ||
|
||
typedef enum : NSUInteger { | ||
SJRouterInterceptionPolicyCancel, | ||
SJRouterInterceptionPolicyAllow, | ||
} SJRouterInterceptionPolicy; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
typedef void(^SJRouterInterceptionPolicyDecisionHandler)(SJRouterInterceptionPolicy policy); | ||
typedef void(^SJRouteInterceptHandler)(SJRouteRequest *request, SJRouterInterceptionPolicyDecisionHandler decisionHandler); | ||
|
||
|
||
@interface SJRouteInterceptor : NSObject | ||
+ (instancetype)interceptorWithPaths:(NSArray<NSString *> *)paths handler:(SJRouteInterceptHandler)handler; | ||
- (instancetype)initWithPaths:(NSArray<NSString *> *)paths handler:(SJRouteInterceptHandler)handler; | ||
|
||
+ (instancetype)interceptorWithPath:(NSString *)path handler:(SJRouteInterceptHandler)handler; | ||
- (instancetype)initWithPath:(NSString *)path handler:(SJRouteInterceptHandler)handler; | ||
|
||
@property (nonatomic, copy, nullable) NSArray<NSString *> *paths; | ||
@property (nonatomic, copy, nullable) SJRouteInterceptHandler handler; | ||
|
||
@end | ||
NS_ASSUME_NONNULL_END |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// SJRouteInterceptor.m | ||
// Pods | ||
// | ||
// Created by 畅三江 on 2020/4/11. | ||
// | ||
|
||
#import "SJRouteInterceptor.h" | ||
|
||
@implementation SJRouteInterceptor | ||
+ (instancetype)interceptorWithPaths:(NSArray<NSString *> *)paths handler:(SJRouteInterceptHandler)handler { | ||
return [SJRouteInterceptor.alloc initWithPaths:paths handler:handler]; | ||
} | ||
- (instancetype)initWithPaths:(NSArray<NSString *> *)paths handler:(SJRouteInterceptHandler)handler { | ||
self = [super init]; | ||
if ( self ) { | ||
_paths = paths; | ||
_handler = handler; | ||
} | ||
return self; | ||
} | ||
|
||
+ (instancetype)interceptorWithPath:(NSString *)path handler:(SJRouteInterceptHandler)handler { | ||
return [SJRouteInterceptor.alloc initWithPath:path handler:handler]; | ||
} | ||
- (instancetype)initWithPath:(NSString *)path handler:(SJRouteInterceptHandler)handler { | ||
return [self initWithPaths:@[path ?: @""] handler:handler]; | ||
} | ||
@end |