iOS module dir
This commit is contained in:
16
iOS/Pod/Classes/Plugin/DoricModalPlugin.h
Normal file
16
iOS/Pod/Classes/Plugin/DoricModalPlugin.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricModalPlugin.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricNativePlugin.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricModalPlugin : DoricNativePlugin
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
21
iOS/Pod/Classes/Plugin/DoricModalPlugin.m
Normal file
21
iOS/Pod/Classes/Plugin/DoricModalPlugin.m
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// DoricModalPlugin.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import "DoricModalPlugin.h"
|
||||
#import "DoricRegistry.h"
|
||||
|
||||
|
||||
@implementation DoricModalPlugin
|
||||
|
||||
- (void)toast:(NSString *)message withPromise:(DoricPromise *)promise {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSLog(@"toast:%@",message);
|
||||
[promise resolve:@"Resolved"];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
19
iOS/Pod/Classes/Plugin/DoricNativePlugin.h
Normal file
19
iOS/Pod/Classes/Plugin/DoricNativePlugin.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// DoricNativePlugin.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricContextHolder.h"
|
||||
#import "DoricPromise.h"
|
||||
#import "DoricRegistry.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricNativePlugin : DoricContextHolder
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
iOS/Pod/Classes/Plugin/DoricNativePlugin.m
Normal file
12
iOS/Pod/Classes/Plugin/DoricNativePlugin.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// DoricNativePlugin.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import "DoricNativePlugin.h"
|
||||
|
||||
@implementation DoricNativePlugin
|
||||
|
||||
@end
|
21
iOS/Pod/Classes/Plugin/DoricPromise.h
Normal file
21
iOS/Pod/Classes/Plugin/DoricPromise.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// DoricPromise.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricContext.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricPromise : NSObject
|
||||
- (instancetype)initWithContext: (DoricContext *)context callbackId:(NSString *)callbackId;
|
||||
|
||||
- (void)resolve:(id) result;
|
||||
|
||||
- (void)reject:(id) result;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
34
iOS/Pod/Classes/Plugin/DoricPromise.m
Normal file
34
iOS/Pod/Classes/Plugin/DoricPromise.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// DoricPromise.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import "DoricPromise.h"
|
||||
#import "DoricConstant.h"
|
||||
|
||||
@interface DoricPromise()
|
||||
@property (nonatomic,strong) DoricContext *context;
|
||||
@property (nonatomic,strong) NSString *callbackId;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DoricPromise
|
||||
|
||||
- (instancetype)initWithContext:(DoricContext *)context callbackId:(NSString *)callbackId {
|
||||
if(self = [super init]) {
|
||||
_context = context;
|
||||
_callbackId = callbackId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)resolve:(id)result {
|
||||
[self.context.driver invokeDoricMethod:DORIC_BRIDGE_RESOLVE, self.context.contextId, self.callbackId, result,nil];
|
||||
}
|
||||
|
||||
- (void)reject:(id)result {
|
||||
[self.context.driver invokeDoricMethod:DORIC_BRIDGE_REJECT, self.context.contextId, self.callbackId, result,nil];
|
||||
}
|
||||
@end
|
17
iOS/Pod/Classes/Plugin/DoricShaderPlugin.h
Normal file
17
iOS/Pod/Classes/Plugin/DoricShaderPlugin.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// DoricShaderPlugin.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricNativePlugin.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricShaderPlugin : DoricNativePlugin
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
iOS/Pod/Classes/Plugin/DoricShaderPlugin.m
Normal file
16
iOS/Pod/Classes/Plugin/DoricShaderPlugin.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricShaderPlugin.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/29.
|
||||
//
|
||||
|
||||
#import "DoricShaderPlugin.h"
|
||||
|
||||
@implementation DoricShaderPlugin
|
||||
|
||||
- (void)render:(NSDictionary *)argument withPromise:(DoricPromise *)promise {
|
||||
NSLog(@"%@",argument);
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user