Skip to content

Commit 2a842f8

Browse files
committed
rename to timeoutMs and move to install options
1 parent 4d40cbc commit 2a842f8

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/services/ios/installation-proxy/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -193,73 +193,73 @@ export class InstallationProxyService extends BaseService {
193193
* @param packagePath Path to the IPA file on the device (e.g., '/PublicStaging/app.ipa')
194194
* @param options Installation options
195195
* @param progressCallback Optional callback for progress updates
196-
* @param operationTimeout Optional timeout in milliseconds for the entire operation (default: 10 minutes)
197196
*/
198197
async install(
199198
packagePath: string,
200199
options: InstallOptions = {},
201200
progressCallback?: ProgressCallback,
202-
operationTimeout?: number,
203201
): Promise<void> {
204202
log.debug(`Installing app from: ${packagePath}`);
205203

204+
const { timeoutMs, ...clientOptions } = options;
205+
206206
const request: PlistDictionary = {
207207
Command: 'Install',
208208
PackagePath: packagePath,
209-
ClientOptions: options as PlistDictionary,
209+
ClientOptions: clientOptions as PlistDictionary,
210210
};
211211

212-
await this.executeWithProgress(request, progressCallback, operationTimeout);
212+
await this.executeWithProgress(request, progressCallback, timeoutMs);
213213
log.info('Installation complete');
214214
}
215215

216216
/**
217217
* Uninstall an application by bundle identifier
218218
* @param bundleIdentifier Bundle ID of the app to uninstall
219-
* @param options Uninstallation options
219+
* @param options Uninstallation options (including optional timeoutMs)
220220
* @param progressCallback Optional callback for progress updates
221-
* @param operationTimeout Optional timeout in milliseconds for the entire operation (default: 10 minutes)
222221
*/
223222
async uninstall(
224223
bundleIdentifier: string,
225224
options: UninstallOptions = {},
226225
progressCallback?: ProgressCallback,
227-
operationTimeout?: number,
228226
): Promise<void> {
229227
log.debug(`Uninstalling app: ${bundleIdentifier}`);
230228

229+
const { timeoutMs, ...clientOptions } = options;
230+
231231
const request: PlistDictionary = {
232232
Command: 'Uninstall',
233233
ApplicationIdentifier: bundleIdentifier,
234-
ClientOptions: options as PlistDictionary,
234+
ClientOptions: clientOptions as PlistDictionary,
235235
};
236236

237-
await this.executeWithProgress(request, progressCallback, operationTimeout);
237+
await this.executeWithProgress(request, progressCallback, timeoutMs);
238238
log.info('Uninstallation complete');
239239
}
240240

241241
/**
242242
* Upgrade an existing application
243243
* @param packagePath Path to the IPA file on the device (e.g., '/PublicStaging/app.ipa')
244-
* @param options Installation options
244+
* @param options Installation options (including optional timeoutMs)
245245
* @param progressCallback Optional callback for progress updates
246-
* @param operationTimeout Optional timeout in milliseconds for the entire operation (default: 10 minutes)
247246
*/
248247
async upgrade(
249248
packagePath: string,
250249
options: InstallOptions = {},
251250
progressCallback?: ProgressCallback,
252-
operationTimeout?: number,
253251
): Promise<void> {
254252
log.debug(`Upgrading app from: ${packagePath}`);
255253

254+
const { timeoutMs, ...clientOptions } = options;
255+
256256
const request: PlistDictionary = {
257257
Command: 'Upgrade',
258258
PackagePath: packagePath,
259-
ClientOptions: options as PlistDictionary,
259+
ClientOptions: clientOptions as PlistDictionary,
260260
};
261261

262-
await this.executeWithProgress(request, progressCallback, operationTimeout);
262+
await this.executeWithProgress(request, progressCallback, timeoutMs);
263263
log.info('Upgrade complete');
264264
}
265265

@@ -361,17 +361,17 @@ export class InstallationProxyService extends BaseService {
361361
private async executeWithProgress(
362362
request: PlistDictionary,
363363
progressCallback?: ProgressCallback,
364-
operationTimeout: number = MAX_INSTALL_DURATION_MS,
364+
timeoutMs: number = MAX_INSTALL_DURATION_MS,
365365
): Promise<void> {
366366
const conn = await this.getConnection();
367367
conn.sendPlist(request);
368368

369369
const startTime = performance.now();
370370

371371
while (true) {
372-
if (performance.now() - startTime > operationTimeout) {
372+
if (performance.now() - startTime > timeoutMs) {
373373
throw new Error(
374-
`Operation exceeded maximum duration (${operationTimeout / 1000}s). ` +
374+
`Operation exceeded maximum duration (${timeoutMs / 1000}s). ` +
375375
'This likely indicates a stalled operation or API issue.',
376376
);
377377
}

src/services/ios/installation-proxy/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ export interface BrowseOptions {
1212

1313
export interface InstallOptions {
1414
packageType?: string;
15+
timeoutMs?: number;
1516
[key: string]: string | number | boolean | undefined;
1617
}
1718

1819
export interface UninstallOptions {
20+
timeoutMs?: number;
1921
[key: string]: string | number | boolean | undefined;
2022
}
2123

0 commit comments

Comments
 (0)