feat:add deprecated api
This commit is contained in:
parent
c51b03ae9c
commit
0a54a5a5e7
@ -22,6 +22,7 @@ import com.facebook.soloader.SoLoader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import pub.doric.loader.DoricJSLoaderManager;
|
||||||
import pub.doric.loader.IDoricJSLoader;
|
import pub.doric.loader.IDoricJSLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +66,7 @@ public class Doric {
|
|||||||
* @param jsLoader Which added in global
|
* @param jsLoader Which added in global
|
||||||
*/
|
*/
|
||||||
public static void addJSLoader(IDoricJSLoader jsLoader) {
|
public static void addJSLoader(IDoricJSLoader jsLoader) {
|
||||||
DoricSingleton.getInstance().getJsLoaderManager().addJSLoader(jsLoader);
|
DoricSingleton.getInstance().getJSLoaderManager().addJSLoader(jsLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnvironmentValue(Map<String, Object> value) {
|
public void setEnvironmentValue(Map<String, Object> value) {
|
||||||
@ -88,4 +89,7 @@ public class Doric {
|
|||||||
return DoricSingleton.getInstance().enableRenderSnapshot;
|
return DoricSingleton.getInstance().enableRenderSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DoricJSLoaderManager getJSLoaderManager() {
|
||||||
|
return DoricSingleton.getInstance().getJSLoaderManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,11 @@ public class DoricNativeDriver implements IDoricDriver {
|
|||||||
mJSHandler = doricJSEngine.getJSHandler();
|
mJSHandler = doricJSEngine.getJSHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public static DoricNativeDriver getInstance() {
|
||||||
|
return DoricSingleton.getInstance().getNativeDriver();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AsyncResult<JSDecoder> invokeContextEntityMethod(final String contextId, final String method, final Object... args) {
|
public AsyncResult<JSDecoder> invokeContextEntityMethod(final String contextId, final String method, final Object... args) {
|
||||||
final AsyncResult<JSDecoder> asyncResult = new AsyncResult<>();
|
final AsyncResult<JSDecoder> asyncResult = new AsyncResult<>();
|
||||||
|
@ -35,7 +35,6 @@ import java.util.concurrent.Callable;
|
|||||||
|
|
||||||
import pub.doric.async.AsyncCall;
|
import pub.doric.async.AsyncCall;
|
||||||
import pub.doric.async.AsyncResult;
|
import pub.doric.async.AsyncResult;
|
||||||
import pub.doric.loader.DoricJSLoaderManager;
|
|
||||||
import pub.doric.navbar.BaseDoricNavBar;
|
import pub.doric.navbar.BaseDoricNavBar;
|
||||||
import pub.doric.navigator.IDoricNavigator;
|
import pub.doric.navigator.IDoricNavigator;
|
||||||
import pub.doric.utils.DoricLog;
|
import pub.doric.utils.DoricLog;
|
||||||
@ -198,7 +197,7 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator {
|
|||||||
final String alias = argument.getString("alias");
|
final String alias = argument.getString("alias");
|
||||||
String source = argument.getString("source");
|
String source = argument.getString("source");
|
||||||
final String extra = argument.getString("extra");
|
final String extra = argument.getString("extra");
|
||||||
DoricSingleton.getInstance().getJsLoaderManager().loadJSBundle(source).setCallback(new AsyncResult.Callback<String>() {
|
DoricSingleton.getInstance().getJSLoaderManager().loadJSBundle(source).setCallback(new AsyncResult.Callback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResult(String result) {
|
public void onResult(String result) {
|
||||||
if (getActivity() == null) {
|
if (getActivity() == null) {
|
||||||
|
@ -77,7 +77,7 @@ public class DoricSingleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoricJSLoaderManager getJsLoaderManager() {
|
public DoricJSLoaderManager getJSLoaderManager() {
|
||||||
return jsLoaderManager;
|
return jsLoaderManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public class DoricJSLoaderManager {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static DoricJSLoaderManager getInstance() {
|
public static DoricJSLoaderManager getInstance() {
|
||||||
return DoricSingleton.getInstance().getJsLoaderManager();
|
return DoricSingleton.getInstance().getJSLoaderManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,4 +59,6 @@
|
|||||||
+ (BOOL)isEnableRenderSnapshot;
|
+ (BOOL)isEnableRenderSnapshot;
|
||||||
|
|
||||||
+ (void)setEnvironmentValue:(NSDictionary *)value;
|
+ (void)setEnvironmentValue:(NSDictionary *)value;
|
||||||
|
|
||||||
|
+ (DoricJSLoaderManager *)jsLoaderManager;
|
||||||
@end
|
@end
|
@ -51,4 +51,8 @@ + (BOOL)isEnableRenderSnapshot {
|
|||||||
+ (void)setEnvironmentValue:(NSDictionary *)value {
|
+ (void)setEnvironmentValue:(NSDictionary *)value {
|
||||||
[DoricSingleton.instance setEnvironmentValue:value];
|
[DoricSingleton.instance setEnvironmentValue:value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (DoricJSLoaderManager *)jsLoaderManager {
|
||||||
|
return DoricSingleton.instance.jsLoaderManager;
|
||||||
|
}
|
||||||
@end
|
@end
|
@ -32,6 +32,7 @@ typedef NS_ENUM(NSInteger, DoricQueueMode) {
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface DoricNativeDriver : NSObject <DoricDriverProtocol>
|
@interface DoricNativeDriver : NSObject <DoricDriverProtocol>
|
||||||
|
+ (instancetype)instance DEPRECATED_MSG_ATTRIBUTE("Do not use this api");;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#import "DoricConstant.h"
|
#import "DoricConstant.h"
|
||||||
#import "DoricContextManager.h"
|
#import "DoricContextManager.h"
|
||||||
#import "DoricPerformanceProfile.h"
|
#import "DoricPerformanceProfile.h"
|
||||||
|
#import "DoricSingleton.h"
|
||||||
|
|
||||||
@interface DoricNativeDriver ()
|
@interface DoricNativeDriver ()
|
||||||
@property(nonatomic, strong) DoricJSEngine *jsExecutor;
|
@property(nonatomic, strong) DoricJSEngine *jsExecutor;
|
||||||
@ -34,6 +35,10 @@ @implementation DoricNativeDriver
|
|||||||
|
|
||||||
@dynamic registry;
|
@dynamic registry;
|
||||||
|
|
||||||
|
+ (instancetype)instance {
|
||||||
|
return DoricSingleton.instance.nativeDriver;
|
||||||
|
}
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_jsExecutor = [[DoricJSEngine alloc] init];
|
_jsExecutor = [[DoricJSEngine alloc] init];
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#import "DoricAsyncResult.h"
|
#import "DoricAsyncResult.h"
|
||||||
|
|
||||||
@interface DoricJSLoaderManager : NSObject
|
@interface DoricJSLoaderManager : NSObject
|
||||||
+ (instancetype)instance;
|
+ (instancetype)instance DEPRECATED_MSG_ATTRIBUTE("Use Doric.jsLoaderManager instead");
|
||||||
|
|
||||||
- (void)addJSLoader:(id <DoricLoaderProtocol>)loader;
|
- (void)addJSLoader:(id <DoricLoaderProtocol>)loader;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user