public FingerprintService(IObservable <Unit> applicationActivated, FuncAsync <string> description, IScheduler dispatcher, IScheduler backgroundScheduler, bool fallbackOnPasscodeAuthentication = false) { applicationActivated.Validation().NotNull(nameof(applicationActivated)); description.Validation().NotNull(nameof(description)); dispatcher.Validation().NotNull(nameof(dispatcher)); backgroundScheduler.Validation().NotNull(nameof(backgroundScheduler)); _description = description; _dispatcher = dispatcher; _asyncLock = new AsyncLock(); _isSupported = applicationActivated .ObserveOn(backgroundScheduler) .StartWith(backgroundScheduler, Unit.Default) .Select(_ => CheckSupport()) .Replay(1, backgroundScheduler) .RefCount(); _isEnabled = _isSupported .Select(isSupported => isSupported && CheckEnrollment()) .Replay(1, backgroundScheduler) .RefCount(); _fallbackOnPasscodeAuthentication = fallbackOnPasscodeAuthentication; }