Skip to content

Commit 166500a

Browse files
committed
fix(android): move rejection of closing unopened window up hierarchy so it applies to TabGroup too
1 parent b249730 commit 166500a

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java

-11
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,6 @@ public KrollPromise<Void> open(@Kroll.argument(optional = true) Object arg)
131131
return super.open(arg);
132132
}
133133

134-
@Override
135-
public KrollPromise<Void> close(@Kroll.argument(optional = true) Object arg)
136-
{
137-
if (!(opened || opening)) {
138-
return KrollPromise.create((promise) -> {
139-
promise.reject(new Throwable("Window is not open or opening, so cannot be closed."));
140-
});
141-
}
142-
return super.close(arg);
143-
}
144-
145134
@Override
146135
protected void handleOpen(KrollDict options)
147136
{

android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,14 @@ public boolean isFocused()
152152
@Kroll.method
153153
public KrollPromise<Void> close(@Kroll.argument(optional = true) Object arg)
154154
{
155+
if (!(opened || opening)) {
156+
return KrollPromise.create((promise) -> {
157+
promise.reject(new Throwable("Window is not open or opening, so cannot be closed."));
158+
});
159+
}
160+
155161
// FIXME: Can we "cancel" the open() promise if it's not finished?
156162
closePromise = KrollPromise.create((promise) -> {
157-
// TODO: if not opened, ignore? We do this in WindowProxy subclass, but not the other two...
158163
KrollDict options = null;
159164
TiAnimation animation = null;
160165

0 commit comments

Comments
 (0)