Skip to content

Commit

Permalink
upgrade to v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
duwen committed Feb 2, 2018
1 parent 7727cb5 commit eb9708a
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 19 deletions.
Binary file modified Build/Products/Debug-iphonesimulator/libdsbridge.a
Binary file not shown.
408 changes: 402 additions & 6 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dsBridge.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "dsBridge"
s.version = "2.0.5"
s.version = "3.0.0"
s.summary = "An ios bridge for calling functions synchronously and asynchronously between JavaScript and Object-C in WKWebView/UIWebView"

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -64,11 +64,11 @@ Pod::Spec.new do |s|
# the deployment target. You can optionally include the target after the platform.
#

s.platform = :ios
s.platform = :ios, "8.0"
# s.platform = :ios, "5.0"

# When using multiple platforms
# s.ios.deployment_target = "5.0"
s.ios.deployment_target = "8.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"
Expand Down Expand Up @@ -117,7 +117,7 @@ Pod::Spec.new do |s|
# the lib prefix of their name.
#

s.frameworks = "UIKit","JavaScriptCore"
s.frameworks = "UIKit"
# s.frameworks = "SomeFramework", "AnotherFramework"

# s.library = "iconv"
Expand Down
4 changes: 2 additions & 2 deletions dsbridge/DWKWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
// Test whether the handler exist in javascript
- (void) hasJavascriptMethod:(NSString * _Nonnull) handlerName methodExistCallback:(void(^ _Nullable)(bool exist))callback;

// Set debug model. if in debug model, some errors will be prompted by a dialog
// Set debug mode. if in debug mode, some errors will be prompted by a dialog
// and the exception caused by the native handlers will not be captured.
- (void) setDebugModel:(bool) debug;
- (void) setDebugMode:(bool) debug;

- (void) disableJavascriptDialogBlock:(bool) disable;

Expand Down
2 changes: 1 addition & 1 deletion dsbridge/DWKWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ - (void)setJavascriptCloseWindowListener:(void (^)(void))callback
javascriptCloseWindowListener=callback;
}

- (void)setDebugModel:(bool)debug{
- (void)setDebugMode:(bool)debug{
isDebug=debug;
}

Expand Down
6 changes: 3 additions & 3 deletions dsbridgedemo/JsApiTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@interface JsApiTest(){
NSTimer * timer ;
void(^hanlder)(NSString *s,BOOL isComplete);
void(^hanlder)(id value,BOOL isComplete);
int value;
}
@end
Expand All @@ -36,7 +36,7 @@ - ( void )testNoArgAsyn:(NSDictionary *) args :(void (^)(NSString * _Nullable re
completionHandler(@"testNoArgAsyn called [ asyn call]",YES);
}

- ( void )callProgress:(NSDictionary *) args :(void (^)(NSString * _Nullable result,BOOL complete))completionHandler
- ( void )callProgress:(NSDictionary *) args :(void (^)(NSNumber * _Nullable result,BOOL complete))completionHandler
{
value=10;
hanlder=completionHandler;
Expand All @@ -49,7 +49,7 @@ - ( void )callProgress:(NSDictionary *) args :(void (^)(NSString * _Nullable res

-(void)onTimer:t{
if(value!=-1){
hanlder([NSString stringWithFormat:@"%d",value--],NO);
hanlder([NSNumber numberWithInt:value--],NO);
}else{
hanlder(@"",YES);
[timer invalidate];
Expand Down
4 changes: 2 additions & 2 deletions dsbridgedemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ - (void)viewDidLoad {
// register api object with namespace "echo"
[dwebview addJavascriptObject:[[JsEchoApi alloc] init] namespace:@"echo"];

// open debug model
[dwebview setDebugModel:true];
// open debug mode
[dwebview setDebugMode:true];

[dwebview customJavascriptDialogLabelTitles:@{@"alertTitle":@"Notification",@"alertBtn":@"OK"}];

Expand Down
2 changes: 1 addition & 1 deletion dsbridgedemo/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=0.5,user-scalable=no"/>
<!--require dsbridge init js-->
<!--<script src="https://unpkg.com/dsbridge/dist/dsbridge.js"> </script>-->
<script src="https://unpkg.com/dsbridge/dist/dsbridge.js"> </script>
</head>
<style>
.btn {
Expand Down

0 comments on commit eb9708a

Please sign in to comment.