()
| 177 | } |
| 178 | |
| 179 | export function getWindow(): UIWindow { |
| 180 | let window: UIWindow; |
| 181 | if (SDK_VERSION >= 15 && typeof NativeScriptViewFactory !== 'undefined') { |
| 182 | // UIWindowScene.keyWindow is only available 15+ |
| 183 | window = NativeScriptViewFactory.getKeyWindow(); |
| 184 | } |
| 185 | if (window) { |
| 186 | return window; |
| 187 | } |
| 188 | const app = UIApplication.sharedApplication; |
| 189 | if (!app) { |
| 190 | return; |
| 191 | } |
| 192 | return app.keyWindow || (app.windows && app.windows.count > 0 && app.windows.objectAtIndex(0)); |
| 193 | } |
| 194 | |
| 195 | function getMainScreen(): UIScreen { |
| 196 | const window = getWindow(); |
no outgoing calls
no test coverage detected