Selaa lähdekoodia

fixed API issue on Android

Former-commit-id: c0dbe2d6861454de03694c7af6f7173ebf0d09a6
Gildas 6 vuotta sitten
vanhempi
sitoutus
68d278cf06
2 muutettua tiedostoa jossa 8 lisäystä ja 3 poistoa
  1. 6 1
      extension/core/bg/downloads.js
  2. 2 2
      extension/lib/gdrive/gdrive.js

+ 6 - 1
extension/core/bg/downloads.js

@@ -145,7 +145,12 @@ singlefile.extension.core.bg.downloads = (() => {
 				authInfo = await gDrive.auth(options);
 			} catch (error) {
 				if (!cancelled && error.message == "code_required" && !code) {
-					code = await singlefile.extension.core.bg.tabs.promptValue("Please enter the access code for Google Drive");
+					if (options.auto) {
+						options.auto = false;
+						await getAuthInfo(uploadOptions, force);
+					} else {
+						code = await singlefile.extension.core.bg.tabs.promptValue("Please enter the access code for Google Drive");
+					}
 				}
 				if (code) {
 					options.code = code;

+ 2 - 2
extension/lib/gdrive/gdrive.js

@@ -61,7 +61,7 @@ this.GDrive = this.GDrive || (() => {
 			}
 		}
 		managedToken(options) {
-			return Boolean(browser.identity.getAuthToken) && !options.forceWebAuthFlow;
+			return Boolean(browser.identity && browser.identity.getAuthToken) && !options.forceWebAuthFlow;
 		}
 		setAuthInfo(authInfo, options) {
 			if (!this.managedToken(options)) {
@@ -111,7 +111,7 @@ this.GDrive = this.GDrive || (() => {
 		}
 		async revokeAuthToken(accessToken) {
 			if (accessToken) {
-				if (browser.identity.removeCachedAuthToken) {
+				if (browser.identity && browser.identity.removeCachedAuthToken) {
 					try {
 						await browser.identity.removeCachedAuthToken({ token: accessToken });
 					} catch (error) {