Skip to content

Commit

Permalink
fix(ios): detect when ios has service
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Jan 13, 2021
1 parent 6c17d12 commit 7fe9cf4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions common/Resources/ti.internal/bootstrap/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function bootstrap (global, kroll) {
return wrapper;
}

const sourceUrl = `app://${this.filename}`;
const sourceUrl = `app://${this.filename}`; // FIXME: If this.filename starts with '/', we need to drop it, I think?
Ti.API.info(sourceUrl);
wrapper = this.createModuleWrapper(externalModule, sourceUrl);

Expand Down Expand Up @@ -604,8 +604,9 @@ function bootstrap (global, kroll) {
// FIXME: I don't know why instanceof for Titanium.Service works here!
// On Android, it's an apiname of Ti.Android.Service
// On iOS, we don't yet pass in the value, but we do set Ti.App.currentService property beforehand!
module.isService = OS_ANDROID ? (activityOrService instanceof Titanium.Service) : false;
if (module.isService) {
// Can we remove the preload stuff in KrollBridge.m to pass along the service instance into this like we do on Andorid?
module.isService = OS_ANDROID ? (activityOrService instanceof Titanium.Service) : Ti.App.currentService !== null;
if (OS_ANDROID && module.isService) {
Object.defineProperty(Ti.Android, 'currentService', {
value: activityOrService,
writable: false,
Expand All @@ -619,7 +620,7 @@ function bootstrap (global, kroll) {
filename = filename.replace('Resources/', '/'); // normalize back to absolute paths (which really are relative to Resources under the hood)
module.load(filename, source);

if (module.isService) {
if (OS_ANDROID && module.isService) {
Object.defineProperty(Ti.Android, 'currentService', {
value: undefined,
writable: false,
Expand Down

0 comments on commit 7fe9cf4

Please sign in to comment.