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

fix(android)(8_0_X): remove Ti.UI.currentWindow #10792

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// clang-format off
@Kroll.module
@Kroll.dynamicApis(properties = { "currentWindow" })

public class UIModule extends KrollModule
// clang-format on
{
Expand Down
6 changes: 2 additions & 4 deletions android/runtime/common/src/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ Module.runModule = function (source, filename, activityOrService) {
if (isService) {
module = new Module(id, null, {
currentService: activityOrService,
currentActivity: null,
currentWindow: null
currentActivity: null
});
} else {
module = new Module(id, null, {
currentService: null,
currentActivity: activityOrService,
currentWindow: activityOrService ? activityOrService.window : null
currentActivity: activityOrService
});
}

Expand Down
13 changes: 4 additions & 9 deletions android/runtime/common/src/js/titanium.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ bootstrap.defineLazyBinding(Titanium, 'API');
// Context-bound modules -------------------------------------------------
//
// Specialized modules that require binding context specific data
// within a script execution scope. This is how Ti.UI.currentWindow,
// Ti.Android.currentService, and others are implemented.
// within a script execution scope. This is how Ti.Android.currentService,
// and others are implemented.
function TitaniumWrapper(context) {
var sourceUrl = this.sourceUrl = context.sourceUrl;

// The "context" specific global object
this.global = context.global;

this.Android = new AndroidWrapper(context);
this.UI = new UIWrapper(context, this.Android);
this.UI = new UIWrapper(context);

var scopeVars = new kroll.ScopeVars({
sourceUrl: sourceUrl,
Expand All @@ -60,14 +60,9 @@ function TitaniumWrapper(context) {
TitaniumWrapper.prototype = Titanium;
Titanium.Wrapper = TitaniumWrapper;

function UIWrapper(context, Android) {
this.currentWindow = context.currentWindow;
function UIWrapper(context) {
this.currentTab = context.currentTab;
this.currentTabGroup = context.currentTabGroup;

if (!context.currentWindow && Android.currentActivity) {
this.currentWindow = Android.currentActivity.window;
}
}
UIWrapper.prototype = Titanium.UI;

Expand Down