Skip to content

Commit

Permalink
Both examples working without any immediate bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lokimeyburg committed Nov 9, 2014
1 parent 7382589 commit e2bdcf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 0 additions & 3 deletions WebViewJavascriptBridge/WebViewJavascriptBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#import <Foundation/Foundation.h>

#define kCustomProtocolScheme @"wvjbscheme"
#define kQueueHasMessage @"__WVJB_QUEUE_MESSAGE__"

#if defined __MAC_OS_X_VERSION_MAX_ALLOWED
#import <WebKit/WebKit.h>
#define WVJB_PLATFORM_OSX
Expand Down
13 changes: 9 additions & 4 deletions WebViewJavascriptBridge/WebViewJavascriptBridgeBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ -(id)initWithWebViewType:(NSString*)webViewType handler:(WVJBHandler)messageHand
_resourceBundle = bundle;
self.messageHandler = messageHandler;
self.messageHandlers = [NSMutableDictionary dictionary];
self.startupMessageQueue = [NSMutableArray array];
self.responseCallbacks = [NSMutableDictionary dictionary];
_uniqueId = 0;
return(self);
}
Expand Down Expand Up @@ -184,11 +186,14 @@ - (void)injectJavascriptFile:(BOOL)shouldInject {
}

- (void) dispatchStartUpMessageQueue {
if (_startupMessageQueue) {
for (id queuedMessage in _startupMessageQueue) {
NSLog(@"0. Dispathing queue");
if (self.startupMessageQueue) {
NSLog(@"1. Startup queue found");

for (id queuedMessage in self.startupMessageQueue) {
[self _dispatchMessage:queuedMessage];
}
_startupMessageQueue = nil;
self.startupMessageQueue = nil;
}
}

Expand All @@ -211,7 +216,7 @@ -(BOOL)correctHost:(NSURL*)url {


-(void) logUnkownMessageFor:(NSURL*)url {
NSLog(@"WebViewJavascriptBridge: WARNING: Received unknown WKWebViewJavascriptBridge command %@://%@", kCustomProtocolScheme, [url path]);
NSLog(@"WebViewJavascriptBridge: WARNING: Received unknown WebViewJavascriptBridge command %@://%@", kCustomProtocolScheme, [url path]);
}


Expand Down

0 comments on commit e2bdcf5

Please sign in to comment.