1
1
import { connectEnabled , disconnectEnabled , reconnectEnabled } from '../shared/connect-helper' ;
2
- import { ILocation , TunnelState } from '../shared/daemon-rpc-types' ;
2
+ import { ErrorStateCause , ILocation , TunnelState } from '../shared/daemon-rpc-types' ;
3
3
import { Scheduler } from '../shared/scheduler' ;
4
4
5
5
export interface TunnelStateProvider {
@@ -20,10 +20,15 @@ export default class TunnelStateHandler {
20
20
// Scheduler for discarding the assumed next state.
21
21
private tunnelStateFallbackScheduler = new Scheduler ( ) ;
22
22
23
+ private receivedFullDiskError = false ;
24
+
23
25
private lastKnownDisconnectedLocation : Partial < ILocation > | undefined ;
24
26
25
27
public constructor ( private delegate : TunnelStateHandlerDelegate ) { }
26
28
29
+ public get hasReceivedFullDiskError ( ) {
30
+ return this . receivedFullDiskError ;
31
+ }
27
32
public get tunnelState ( ) {
28
33
return this . tunnelStateValue ;
29
34
}
@@ -53,6 +58,12 @@ export default class TunnelStateHandler {
53
58
}
54
59
55
60
public handleNewTunnelState ( newState : TunnelState ) {
61
+ if ( newState . state === 'error' ) {
62
+ if ( newState . details . cause === ErrorStateCause . needFullDiskPermissions ) {
63
+ this . receivedFullDiskError = true ;
64
+ }
65
+ }
66
+
56
67
// If there's a fallback state set then the app is in an assumed next state and need to check
57
68
// if it's now reached or if the current state should be ignored and set as the fallback state.
58
69
if ( this . tunnelStateFallback ) {
0 commit comments