@@ -204,7 +204,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
204
204
this . configOnDisk = new Lazy < any > ( ( ) => this . loadUpdateConfig ( ) )
205
205
}
206
206
207
- protected _isUpdateSupported : VerifyUpdateSupport = ( updateInfo : UpdateInfo ) : boolean | Promise < boolean > => this . checkIfUpdateSupported ( updateInfo )
207
+ protected _isUpdateSupported : VerifyUpdateSupport = updateInfo => this . checkIfUpdateSupported ( updateInfo )
208
208
209
209
/**
210
210
* Allows developer to override default logic for determining if an update is supported.
@@ -220,6 +220,23 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
220
220
}
221
221
}
222
222
223
+ protected _isUserWithinRollout : VerifyUpdateSupport = updateInfo => this . isStagingMatch ( updateInfo )
224
+
225
+ /**
226
+ * Allows developer to override default logic for determining if the user is below the rollout threshold.
227
+ * The default logic compares the staging percentage with numerical representation of user ID.
228
+ * An override can define custom logic, or bypass it if needed.
229
+ */
230
+ get isUserWithinRollout ( ) : VerifyUpdateSupport {
231
+ return this . _isUserWithinRollout
232
+ }
233
+
234
+ set isUserWithinRollout ( value : VerifyUpdateSupport ) {
235
+ if ( value ) {
236
+ this . _isUserWithinRollout = value
237
+ }
238
+ }
239
+
223
240
private clientPromise : Promise < Provider < any > > | null = null
224
241
225
242
protected readonly stagingUserIdPromise = new Lazy < string > ( ( ) => this . getOrCreateStagingUserId ( ) )
@@ -417,8 +434,8 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
417
434
return false
418
435
}
419
436
420
- const isStagingMatch = await this . isStagingMatch ( updateInfo )
421
- if ( ! isStagingMatch ) {
437
+ const isUserWithinRollout = await Promise . resolve ( this . isUserWithinRollout ( updateInfo ) )
438
+ if ( ! isUserWithinRollout ) {
422
439
return false
423
440
}
424
441
0 commit comments