Skip to content

Commit

Permalink
[TIMOB-25942] : iOS 11: Screen orientation not working in navigation …
Browse files Browse the repository at this point in the history
…window (#10104)

* [TIMOB-25942] : iOS 11: Screen orientation not working in navigation window

* [TIMOB-25942] : Condition updated for ios 11 only
  • Loading branch information
vijaysingh-axway authored and hansemannn committed Sep 27, 2018
1 parent 33f2052 commit 863fae6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
11 changes: 9 additions & 2 deletions iphone/Classes/TiRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,15 @@ - (void)refreshOrientationWithDuration:(id)unused
#ifdef FORCE_WITH_MODAL
[self forceRotateToOrientation:target];
#else
[self rotateHostingViewToOrientation:target
fromOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
if ([TiUtils isIOSVersionOrGreater:@"11.0"] && [TiUtils isIOSVersionLower:@"12.0"]) {
forcingStatusBarOrientation = YES;
[[UIApplication sharedApplication] setStatusBarOrientation:target animated:NO];
[UIViewController attemptRotationToDeviceOrientation];
forcingStatusBarOrientation = NO;
} else {
[self rotateHostingViewToOrientation:target
fromOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
}
forcingRotation = NO;
#endif
} else {
Expand Down
63 changes: 63 additions & 0 deletions tests/Resources/ti.ui.window.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* global Ti */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');

describe('Titanium.UI.Window', function () {
var win,
rootWindow;

this.timeout(5000);

// Create and open a root window for the rest of the below child window tests to use as a parent.
// We're not going to close this window until the end of this test suite.
// Note: Android needs this so that closing the last window won't back us out of the app.
before(function (finish) {
rootWindow = Ti.UI.createWindow();
rootWindow.addEventListener('open', function () {
finish();
});
rootWindow.open();
});

after(function (finish) {
rootWindow.addEventListener('close', function () {
finish();
});
rootWindow.close();
});

afterEach(function () {
if (win) {
win.close();
}
win = null;
});

it.ios('.statusBarStyle', function (finish) {
win = Ti.UI.createWindow({
title: 'This is status bar style test',
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
});

win.addEventListener('open', function () {
try {
should(win.statusBarStyle).be.a.Number;
should(win.statusBarStyle).eql(Ti.UI.iOS.StatusBar.LIGHT_CONTENT);
win.setStatusBarStyle(Ti.UI.iOS.StatusBar.GRAY);
should(win.statusBarStyle).eql(Ti.UI.iOS.StatusBar.GRAY);
finish();
} catch (err) {
finish(err);
}
});
win.open();
});
});

0 comments on commit 863fae6

Please sign in to comment.