Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24021] [TIMOB-24022] (2_0_X) Fixes for Android hyperloop #85

Merged
merged 2 commits into from
Oct 12, 2016

Conversation

sgtcoolguy
Copy link
Contributor

@sgtcoolguy sgtcoolguy commented Oct 12, 2016

Specifically this fixes two issues:

  • using proper require paths now that we're on Ti SDK 6+
  • Handling the Map we receive on Java side for arguments to instantiating an instance of a Java class. We used to receive a Map<Integer, Object>, but because of a bug fix in the SDK we now get Map<String, Object> where the Strings are string representations of integers.

….content.Intent fails on SDK 6+

- use proper require paths with correct prefixes for internal hyperloop wrappers ('./' prefix)
… classes

- Fix conversion of arguments to ClassProxy.newInstance when Map. Because of fix for TIMOB-23966 we always get String keys in maps, where before we relied on auto conversion to Integer
@sgtcoolguy
Copy link
Contributor Author

To test, try out this app:

var Intent = require('android.content.Intent');
var Activity = require('android.app.Activity');
var Uri = require("android.net.Uri");

var win = Ti.UI.createWindow({
    backgroundColor: "#fff"
});

var btn = Ti.UI.createButton({
    title: "Trigger"
});

btn.addEventListener("click", openIntent);

win.add(btn);
win.open();

function openIntent() {
    var activity = new Activity(Ti.Android.currentActivity);

    var intent = Ti.Android.createIntent({
        action: Ti.Android.ACTION_VIEW
    });

    var nativeIntent = new Intent(intent);
    nativeIntent.setData(Uri.parse("sms://"));
    nativeIntent.putExtra("sms_body", "Hello world!");

    activity.startActivity(nativeIntent);
}

@sgtcoolguy
Copy link
Contributor Author

Once approved, this PR should be cherry-picked to master as well. (but not 1_2_X)

@hansemannn
Copy link
Contributor

LGTM. Travis failed because of a timeout, so I re-triggered it. Will merge after it succeeds. Thx!

@hansemannn
Copy link
Contributor

Travis succeeds. But there are a couple of errors related to the open keyword which was introduced in Swift 3:

❌  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:10:1: expressions are not allowed at the top level
open class TestView : UIView {
^
❌  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:10:5: consecutive statements on a line must be separated by ';'
open class TestView : UIView {
    ^
❌  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:12:2: expected declaration
        open func foo (_ x : CGFloat, y : CGFloat) -> CGFloat {
        ^
❌  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:12:6: consecutive declarations on a line must be separated by ';'
        open func foo (_ x : CGFloat, y : CGFloat) -> CGFloat {
            ^
⚠️  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:12:17: extraneous '_' in parameter: 'x' has no keyword argument name
        open func foo (_ x : CGFloat, y : CGFloat) -> CGFloat {
                       ^~
❌  /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift:10:1: ambiguous use of 'open'
open class TestView : UIView {
^
Testing failed:
    Expressions are not allowed at the top level
    Consecutive statements on a line must be separated by ';'
    Expected declaration
    Consecutive declarations on a line must be separated by ';'
    Ambiguous use of 'open'
** TEST FAILED **
The following build commands failed:
    CompileSwift normal x86_64 /Users/travis/build/appcelerator/hyperloop.next/iphone/tests/TestView.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

It indicates that Travis builds with an incorrect Swift version, so it should be checked against that. In addition, the travis build should fail if any unit-test fails. As it doesn't affect this PR and the core is still correct, I will merge this PR and it's backport. Thx!

@hansemannn hansemannn merged commit d74cf03 into tidev:2_0_X Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants