Skip to content

Commit

Permalink
RELEASE 1.2.1
Browse files Browse the repository at this point in the history
Closes #23
  • Loading branch information
dcantelar committed Oct 6, 2014
2 parents f4dc3e8 + ef955ff commit 6d6fa98
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 48 deletions.
4 changes: 2 additions & 2 deletions Hybridge.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Hybridge"
s.version = "1.2.0"
s.version = "1.2.1"
s.summary = "Yet another javascript / mobile native simple bridge for hybrid apps, back and forth..."

s.description = <<-DESC
Expand All @@ -16,7 +16,7 @@ Pod::Spec.new do |s|

s.platform = :ios
s.ios.deployment_target = "6.0"
s.source = { :git => "https://github.com/telefonicaid/tdigital-hybridge.git", :tag => "1.2.0" }
s.source = { :git => "https://github.com/telefonicaid/tdigital-hybridge.git", :tag => "1.2.1" }

s.source_files = "ios/Hybridge/Hybridge/*.{h,m}"
s.private_header_files = "ios/Hybridge/Hybridge/HYBURLProtocol.h", "ios/Hybridge/Hybridge/NSString+Hybridge.h"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You'll also need [JQuery](http://jquery.com) (version 1.8.3 or newer) for the Ja

### <a name='installation_android'>Android</a>

You can build your own Hybridge, but you can start with the latest version included at [hybridge.jar](boilerplate/android/HybridgeBoilerplate/libs/hybridge-1.2.0.jar) in the boilerplate code.
You can build your own Hybridge, but you can start with the latest version included at [hybridge.jar](boilerplate/android/HybridgeBoilerplate/libs/hybridge-1.2.1.jar) in the boilerplate code.

### <a name='installation_ios'>iOS</a>

Expand Down
2 changes: 1 addition & 1 deletion android/Hybridge/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pdi.hybridge"
android:versionCode="120"
android:versionName="1.2.0" >
android:versionName="1.2.1" >

<uses-sdk android:minSdkVersion="12" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public void initJs(WebView view, JSONArray actions, JSONArray events) {
+ "window.HybridgeGlobal = {" + " isReady : true" + ", version : "
+ HybridgeConst.VERSION + ", versionMinor : " + HybridgeConst.VERSION_MINOR
+ ", actions : " + actions.toString() + ", events : " + events.toString() + "};"
+ "(window.document.getElementById('hybridgeTrigger') || {}).className = 'switch';"
+ "},0)");
mIsInitialized = true;
}
Expand Down
2 changes: 1 addition & 1 deletion android/Hybridge/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

build.revision.number=1
build.major.number=2
build.minor.number=0
build.minor.number=1
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion boilerplate/ios/HybridgeSample/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Hybridge (1.2.0)
- Hybridge (1.2.1)

DEPENDENCIES:
- Hybridge (from `../../..`)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hybridge",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://github.com/telefonicaid/tdigital-hybridge",
"description": "javascript / mobile native simple bridge for hybrid apps, back and forth...",
"main": "js/hybridge.js",
Expand Down
3 changes: 1 addition & 2 deletions ios/Hybridge/Hybridge/HYBBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ - (NSString *)prepareWebView:(UIWebView *)webView {
@" actions:%@,"
@" events:%@"
@" };"
@" (window.document.getElementById('hybridgeTrigger') || {}).className = 'switch';"
@"}, 500);";
@"}, 0);";

NSArray *actions = [@[@"init"] arrayByAddingObjectsFromArray:[self.delegate bridgeActions:self]];
NSString *actionsString = [NSString hyb_JSONStringWithObject:actions];
Expand Down
3 changes: 1 addition & 2 deletions ios/Hybridge/HybridgeTests/HYBBridgeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ - (void)testPrepareWebView {
@" actions:[\"init\",\"test\",\"do_something\"],"
@" events:[\"pause\",\"resume\",\"message\",\"ready\"]"
@" };"
@" (window.document.getElementById('hybridgeTrigger') || {}).className = 'switch';"
@"}, 500);";
@"}, 0);";

[[[webView expect] andReturn:@"true"] stringByEvaluatingJavaScriptFromString:javascript];

Expand Down
54 changes: 18 additions & 36 deletions js/hybridge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* tdigital-hybridge - v1.2.0
* tdigital-hybridge - v1.2.1
* Bridge for mobile hybrid application between Javascript and native environment
* (iOS & Android)
*
Expand Down Expand Up @@ -341,33 +341,9 @@
actions: [INIT_ACTION, 'message'],
events: [READY_EVENT, 'message']
};
(window.document.getElementById('hybridgeTrigger') || {}).className = 'switch';
}, 0);
};

/**
* Enables transitionend hack in to trigger callbacks directly from native
*/
var _setCSSTrigger = function (callback) {
var transitionEnd = $.support.transition ? $.support.transition.end : 'webkitTransitionEnd';
var trigger = document.createElement('div');
trigger.id = 'hybridgeTrigger';
var style = document.createElement('style');
style.id = 'triggerStyle';
style.type = 'text/css';
style.innerHTML = '#hybridgeTrigger{top:0;-webkit-transition:top 0.0001s;' +
'transition:top 0.0001s;' +
'position:absolute;visibility:hidden}' +
'#hybridgeTrigger.switch{top:1px;}';
document.getElementsByTagName('head')[0].appendChild(style);
document.getElementsByTagName('body')[0].appendChild(trigger);
$('#hybridgeTrigger').one(transitionEnd, function() {
callback();
$('#hybridgeTrigger').remove();
$('#triggerStyle').remove();
});
};

/**
* Attach methods to global object in order to initialize the Hybridge properly
* _events: Hybridge events triggered from native for client handling
Expand Down Expand Up @@ -486,21 +462,27 @@
};

/**
* Since HybridgeGlobal is set from native just add the client methods
* Inits ready event
*/
// AMD/defer load (requirejs), native bridge already loaded
if (typeof window.HybridgeGlobal !== 'undefined') {
_attachToGlobal();
}
// Minified/inmediate load, native bridge loads after
else {
_setCSSTrigger(_attachToGlobal);
}
_events.ready = _createEvent(READY_EVENT);

/**
* Inits ready event
* window.HybridgeGlobal is set by the Native code in other thread outside
* the browser event loop.
* Lets going to poll for it and then we can be sure native has done
* its part in the handshake
*
* TODO: Refactor the handshake protocol, forcing native to start once the
* webview is DOMReady and a document the minimun initial DOM for using
* the old CSS trigger from version 1.2.0
*/
_events.ready = _createEvent(READY_EVENT);
(function _checkForGlobal() {
if (window.HybridgeGlobal) {
_attachToGlobal();
} else {
setTimeout(_checkForGlobal, 10);
}
})();

/**
* Initialize both native and javascript
Expand Down

0 comments on commit 6d6fa98

Please sign in to comment.