feat:add NavigatorPlugin for iOS ,only files and protocol

This commit is contained in:
pengfei.zhou 2019-11-23 17:22:27 +08:00
parent 27d601c326
commit 656e72c174
4 changed files with 59 additions and 1 deletions

View File

@ -22,13 +22,14 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "DoricDriver.h" #import "DoricDriver.h"
#import "DoricNavigatorProtocol.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class DoricRootNode; @class DoricRootNode;
@interface DoricContext : NSObject @interface DoricContext : NSObject
@property(nonatomic, weak) id <DoricNavigatorProtocol> navigator;
@property(nonatomic, strong) NSString *contextId; @property(nonatomic, strong) NSString *contextId;
@property(nonatomic, strong) DoricDriver *driver; @property(nonatomic, strong) DoricDriver *driver;
@property(nonatomic, strong) NSMutableDictionary *pluginInstanceMap; @property(nonatomic, strong) NSMutableDictionary *pluginInstanceMap;

View File

@ -35,6 +35,7 @@
#import "DoricSliderNode.h" #import "DoricSliderNode.h"
#import "DoricSlideItemNode.h" #import "DoricSlideItemNode.h"
#import "DoricStoragePlugin.h" #import "DoricStoragePlugin.h"
#import "DoricNavigatorPlugin.h"
@interface DoricRegistry () @interface DoricRegistry ()
@ -61,6 +62,7 @@ - (void)innerRegister {
[self registerNativePlugin:DoricModalPlugin.class withName:@"modal"]; [self registerNativePlugin:DoricModalPlugin.class withName:@"modal"];
[self registerNativePlugin:DoricNetworkPlugin.class withName:@"network"]; [self registerNativePlugin:DoricNetworkPlugin.class withName:@"network"];
[self registerNativePlugin:DoricStoragePlugin.class withName:@"storage"]; [self registerNativePlugin:DoricStoragePlugin.class withName:@"storage"];
[self registerNativePlugin:DoricNavigatorPlugin.class withName:@"navigator"];
[self registerViewNode:DoricStackNode.class withName:@"Stack"]; [self registerViewNode:DoricStackNode.class withName:@"Stack"];
[self registerViewNode:DoricVLayoutNode.class withName:@"VLayout"]; [self registerViewNode:DoricVLayoutNode.class withName:@"VLayout"];

View File

@ -0,0 +1,24 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// Created by pengfei.zhou on 2019/11/23.
//
#import <Foundation/Foundation.h>
#import "DoricNativePlugin.h"
@interface DoricNavigatorPlugin : DoricNativePlugin
@end

View File

@ -0,0 +1,31 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// Created by pengfei.zhou on 2019/11/23.
//
#import "DoricNavigatorPlugin.h"
@implementation DoricNavigatorPlugin
- (void)push:(NSDictionary *)params {
[self.doricContext.navigator push:params[@"scheme"] alias:params[@"alias"]];
}
- (void)pop {
[self.doricContext.navigator pop];
}
@end