File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -138,9 +138,19 @@ export default class ObsidianGit extends Plugin {
138
138
}
139
139
}
140
140
141
+ async handleOnlineStatusChange ( ) {
142
+ if ( ! this . offlineMode ) return ;
143
+
144
+ if ( navigator . onLine ) {
145
+ this . offlineMode = false ;
146
+ this . promiseQueue . addTask ( ( ) => this . pullChangesFromRemote ( ) ) ;
147
+ }
148
+ }
149
+
141
150
async loadPlugin ( ) {
142
151
addEventListener ( "git-refresh" , this . refresh . bind ( this ) ) ;
143
152
addEventListener ( "git-head-update" , this . refreshUpdatedHead . bind ( this ) ) ;
153
+ addEventListener ( "online" , this . handleOnlineStatusChange . bind ( this ) ) ;
144
154
145
155
this . registerView ( SOURCE_CONTROL_VIEW_CONFIG . type , ( leaf ) => {
146
156
return new GitView ( leaf , this ) ;
@@ -742,6 +752,7 @@ export default class ObsidianGit extends Plugin {
742
752
743
753
hasConnectivity ( ) {
744
754
if ( navigator . onLine ) return true ;
755
+ this . offlineMode = true ;
745
756
return ( new Notice ( 'No Connectivity' ) , false )
746
757
}
747
758
You can’t perform that action at this time.
0 commit comments