forked from marcuswestin/WebViewJavascriptBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added JavascriptWebViewBridgeBase to WKWebViewJavascriptBridge
- Loading branch information
1 parent
95779d0
commit 859c823
Showing
5 changed files
with
308 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// WebViewJavascriptBridgeBase.h | ||
// ExampleApp-iOS | ||
// | ||
// Created by Loki Meyburg on 2014-10-29. | ||
// Copyright (c) 2014 Marcus Westin. All rights reserved. | ||
// | ||
#import <Foundation/Foundation.h> | ||
|
||
#define kCustomProtocolScheme @"wvjbscheme" | ||
#define kQueueHasMessage @"__WVJB_QUEUE_MESSAGE__" | ||
|
||
typedef void (^WVJBResponseCallback)(id responseData); | ||
typedef void (^WVJBHandler)(id data, WVJBResponseCallback responseCallback); | ||
typedef NSDictionary WVJBMessage; | ||
|
||
@interface WebViewJavascriptBridgeBase : NSObject | ||
|
||
@property (strong, nonatomic) NSMutableArray* startupMessageQueue; | ||
@property (strong, nonatomic) NSMutableDictionary* responseCallbacks; | ||
@property (strong, nonatomic) NSMutableDictionary* messageHandlers; | ||
@property (strong, nonatomic) WVJBHandler messageHandler; | ||
@property NSUInteger numRequestsLoading; | ||
|
||
|
||
+ (void)enableLogging; | ||
-(id)initWithWebViewType:(NSString*)webViewType handler:(WVJBHandler)messageHandler resourceBundle:(NSBundle*)bundle; | ||
-(void)reset; | ||
- (void)_sendData:(id)data responseCallback:(WVJBResponseCallback)responseCallback handlerName:(NSString*)handlerName; | ||
- (void)_queueMessage:(WVJBMessage*)message; | ||
- (void)_dispatchMessage:(WVJBMessage*)message; | ||
- (void)_flushMessageQueue:(NSString *)messageQueueString; | ||
|
||
// specific extractions | ||
- (void) injectJavascriptFile:(BOOL)shouldInject; | ||
-(BOOL) correctProcotocolScheme:(NSURL*)url; | ||
-(BOOL) correctHost:(NSURL*)urll; | ||
-(void) logUnkownMessage:(NSURL*)url; | ||
-(NSString *) webViewJavascriptCheckCommand; | ||
-(NSString *) webViewJavascriptFetchQueyCommand; | ||
|
||
|
||
// probably dont need to be public | ||
- (NSString *)_serializeMessage:(id)message; | ||
- (NSArray*)_deserializeMessageJSON:(NSString *)messageJSON; | ||
- (void)_log:(NSString *)action json:(id)json; | ||
|
||
|
||
@end |
Oops, something went wrong.