Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit 88c5368

Browse files
committed
Fix for Workers/Context
1 parent 47102b9 commit 88c5368

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/changelog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ v2.2.5 - Fix CopyDatabase indexOf to lastIndexOf - Thanks Webleaf
2727
v2.2.6 - Forgot to include the ios sqlite helper in v2.2.4/v2.2.5
2828
v2.3.0 - Several minor issues fixed, Multi-threading added to Sqlite
2929
v2.3.1 - iOS SQLExec bind returns the wrong error value
30-
v2.3.2 - Added Promise tests, started ES6 updated.
30+
v2.3.2 - Added Promise tests, started ES6 updated.
31+
v2.3.3 - In some worker situations, the context cannot be retrieved, added additional method to get context.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-sqlite",
3-
"version": "2.3.2",
3+
"version": "2.3.3",
44
"description": "A sqlite NativeScript module for Android and iOS",
55
"main": "sqlite",
66
"nativescript": {

src/sqlite.android.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Any questions please feel free to put a issue up on github
77
* Nathan@master-technology.com http://nativescript.tools
8-
* Version 2.3.1 - Android
8+
* Version 2.3.2 - Android
99
*************************************************************************************/
1010

1111
/* global global, require, module */
@@ -975,12 +975,22 @@ function _getContext() {
975975
if (appModule.android.context) {
976976
return (appModule.android.context);
977977
}
978+
if (typeof appModule.getNativeApplication === 'function') {
979+
let ctx = appModule.getNativeApplication();
980+
if (ctx) {
981+
return ctx;
982+
}
983+
}
984+
985+
978986
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
979-
let ctx = java.lang.Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", null).invoke(null, null);
987+
ctx = java.lang.Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", null).invoke(null, null);
980988
if (ctx) return ctx;
981989

982990
//noinspection JSUnresolvedFunction,JSUnresolvedVariable
983991
ctx = java.lang.Class.forName("android.app.ActivityThread").getMethod("currentApplication", null).invoke(null, null);
992+
if (ctx) return ctx;
993+
984994
return ctx;
985995
}
986996

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy