iOS module dir

This commit is contained in:
pengfei.zhou
2019-07-30 15:20:11 +08:00
parent 6e6dc4edef
commit c1fde16bee
77 changed files with 610 additions and 305 deletions

View 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

View 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

View 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

View File

@@ -0,0 +1,12 @@
//
// DoricNativePlugin.m
// Doric
//
// Created by pengfei.zhou on 2019/7/29.
//
#import "DoricNativePlugin.h"
@implementation DoricNativePlugin
@end

View 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

View 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

View 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

View 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