diff --git a/cli/lib/webpack/service.js b/cli/lib/webpack/service.js index c4f53197070..df148f18db3 100644 --- a/cli/lib/webpack/service.js +++ b/cli/lib/webpack/service.js @@ -225,6 +225,20 @@ class WebpackService extends EventEmitter { await this.subcribeToWebpackStatusChanges(); return new Promise((resolve, reject) => { + const showTimeoutInfo = () => { + const buildUrl = `${this.webUiUrl}/build/${this.jobIdentifier}`.cyan; + const logcatCommand = `${process.env.APPC_ENV ? 'appc ' : ''}appcd logcat "*webpack*"`; + this.logger.info('Did not receive any Webpack status updates in the last 30 seconds while waiting'); + this.logger.info('for the build to complete.'); + this.logger.info(''); + this.logger.info(` - Open ${buildUrl.cyan} to see full build details`); + this.logger.info(` - Use ${'--force'.grey} to restart the Webpack build`); + this.logger.info(` - View Daemon logs from Webpack with ${logcatCommand.grey}`); + this.logger.info(''); + const error = new Error('Timeout while waiting for the Webpack build to complete.'); + reject(error); + }; + const handler = e => { if (e.state === STATE_READY || e.state === STATE_ERROR) { this.off('status', handler); @@ -240,19 +254,7 @@ class WebpackService extends EventEmitter { return reject(new Error('Webpack compilation failed.')); } }; - const showTimeoutInfo = () => { - const buildUrl = `${this.webUiUrl}/build/${this.jobIdentifier}`.cyan; - const logcatCommand = `${process.env.APPC_ENV ? 'appc ' : ''}appcd logcat "*webpack*"`; - this.logger.info('Did not receive any Webpack status updates in the last 30 seconds while waiting'); - this.logger.info('for the build to complete.'); - this.logger.info(''); - this.logger.info(` - Open ${buildUrl.cyan} to see full build details`); - this.logger.info(` - Use ${'--force'.grey} to restart the Webpack build`); - this.logger.info(` - View Daemon logs from Webpack with ${logcatCommand.grey}`); - this.logger.info(''); - const error = new Error('Timeout while waiting for the Webpack build to complete.'); - reject(error); - }; + this.on('status', handler); this.on('timeout', showTimeoutInfo); }); diff --git a/common/Resources/ti.internal/extensions/node/slowbuffer.js b/common/Resources/ti.internal/extensions/node/slowbuffer.js index f0aa25621c2..9dc4feb48a9 100644 --- a/common/Resources/ti.internal/extensions/node/slowbuffer.js +++ b/common/Resources/ti.internal/extensions/node/slowbuffer.js @@ -1,6 +1,43 @@ import { isBuffer } from './internal/util'; import { stringToHexBytes } from './internal/buffer'; +// Use a Proxy to hack array style index accessors +const arrayIndexHandler = { + get(target, propKey, receiver) { + if (typeof propKey === 'string') { + const num = Number(propKey); + if (Number.isSafeInteger(num)) { + return getAdjustedIndex(target, num); + } + } else if (propKey === isBuffer) { + return true; + } + return Reflect.get(target, propKey, receiver); + }, + + set(target, propKey, value, receiver) { + if (typeof propKey === 'string') { + const num = Number(propKey); + if (Number.isSafeInteger(num)) { + setAdjustedIndex(target, num, value); + return true; + } + } + return Reflect.set(target, propKey, value, receiver); + }, + + has(target, key) { + if (typeof key === 'string') { + const num = Number(key); + if (Number.isSafeInteger(num)) { + // ensure it's a positive "safe" integer within the range of the buffer + return num >= 0 && num < target._tiBuffer.length; + } + } + return key in target; + } +}; + // This is a special Buffer that wraps Ti.Buffer // as a result it is *much* slower to read/write values // because we need to go across the JS/Native boundary per-byte! @@ -140,43 +177,6 @@ export default class SlowBuffer { } } -// Use a Proxy to hack array style index accessors -const arrayIndexHandler = { - get(target, propKey, receiver) { - if (typeof propKey === 'string') { - const num = Number(propKey); - if (Number.isSafeInteger(num)) { - return getAdjustedIndex(target, num); - } - } else if (propKey === isBuffer) { - return true; - } - return Reflect.get(target, propKey, receiver); - }, - - set(target, propKey, value, receiver) { - if (typeof propKey === 'string') { - const num = Number(propKey); - if (Number.isSafeInteger(num)) { - setAdjustedIndex(target, num, value); - return true; - } - } - return Reflect.set(target, propKey, value, receiver); - }, - - has(target, key) { - if (typeof key === 'string') { - const num = Number(key); - if (Number.isSafeInteger(num)) { - // ensure it's a positive "safe" integer within the range of the buffer - return num >= 0 && num < target._tiBuffer.length; - } - } - return key in target; - } -}; - function getAdjustedIndex(buf, index) { if (index < 0) { return undefined; diff --git a/iphone/cli/commands/_build.js b/iphone/cli/commands/_build.js index ab4b7f6afb1..b13c84a5e36 100644 --- a/iphone/cli/commands/_build.js +++ b/iphone/cli/commands/_build.js @@ -5776,6 +5776,8 @@ iOSBuilder.prototype.createAppIconSetAndiTunesArtwork = async function createApp let defaultIconChanged = false; let defaultIconHasAlpha = false; const defaultIcon = this.defaultIcons.find(icon => fs.existsSync(icon)); + const flattenedDefaultIconDest = path.join(this.buildDir, 'DefaultIcon.png'); + if (defaultIcon) { const defaultIconPrev = this.previousBuildManifest.files && this.previousBuildManifest.files['DefaultIcon.png'], defaultIconContents = fs.readFileSync(defaultIcon), @@ -5942,7 +5944,6 @@ iOSBuilder.prototype.createAppIconSetAndiTunesArtwork = async function createApp missingIcons = missingIcons.concat(await this.processLaunchLogos(launchLogos, resourcesToCopy, defaultIcon, defaultIconChanged)); // Do we need to flatten the default icon? - const flattenedDefaultIconDest = path.join(this.buildDir, 'DefaultIcon.png'); if (missingIcons.length !== 0 && defaultIcon && defaultIconChanged && defaultIconHasAlpha) { this.defaultIcons = [ flattenedDefaultIconDest ]; flattenIcons.push({ diff --git a/tests/Resources/ti.ui.listview.test.js b/tests/Resources/ti.ui.listview.test.js index 19348461efb..4d9a922e1c7 100644 --- a/tests/Resources/ti.ui.listview.test.js +++ b/tests/Resources/ti.ui.listview.test.js @@ -1016,6 +1016,8 @@ describe('Titanium.UI.ListView', function () { extendEdges: [ Ti.UI.EXTEND_EDGE_ALL ] }); + const control = Ti.UI.createRefreshControl(); + window.addEventListener('open', function () { control.beginRefreshing(); }); @@ -1024,8 +1026,6 @@ describe('Titanium.UI.ListView', function () { window: window }); - const control = Ti.UI.createRefreshControl(); - const listView = Ti.UI.createListView({ refreshControl: control });