logout google account when user sign out

This commit is contained in:
Xuan Sang LE
2018-03-04 12:35:19 +01:00
parent aeecaa4e81
commit b35096bcca
5 changed files with 36 additions and 11 deletions

View File

@ -43,7 +43,7 @@ class GoogleDriveHandler extends this.OS.API.VFS.BaseFileHandler
_GUI.openDialog "YesNoDialog", (d) ->
return _courrier.osinfo "User abort the authentification" unless d
fn(gapi.auth2.getAuthInstance().isSignedIn.get())
, "Authentification", { text: "Do you want to login to Google Drive ?" }
, "Authentification", { text: "Would you like to login to Google Drive ?" }
.catch (err) ->
_API.loaded q, "FAIL"
_courrier.oserror "VFS cannot init GAPI: #{err.error}", (_API.throwe "OS.VFS"), err
@ -316,4 +316,21 @@ self.OS.API.onsearch "Google Drive", (t) ->
file.complex = true
file.detail = [{ text: file.path }]
arr.push file
return arr
return arr
self.OS.onexit "cleanUpGoogleDrive", () ->
G_CACHE = { "gdv:///": { id: "root", mime: 'dir' } }
return unless _OS.setting.VFS.gdrive and _API.libready _OS.setting.VFS.gdrive.apilink
auth2 = gapi.auth2.getAuthInstance()
return unless auth2
if auth2.isSignedIn.get()
el = $ '<iframe/>', {
src: 'https://www.google.com/accounts/Logout',
frameborder: 0,
onload: () ->
#console.log("disconnect")
auth2.disconnect()
#$(this).remove()
}
#($ "body").append(el)