From f60961947fc9471024081c3c76f940b864336e5f Mon Sep 17 00:00:00 2001 From: robsmith11 Date: Fri, 17 May 2019 14:51:04 +0000 Subject: [PATCH 1/3] Fix setIcon warning on Android --- src/background/presenters/IndicatorPresenter.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/background/presenters/IndicatorPresenter.ts b/src/background/presenters/IndicatorPresenter.ts index d9a615a..5d9c21f 100644 --- a/src/background/presenters/IndicatorPresenter.ts +++ b/src/background/presenters/IndicatorPresenter.ts @@ -3,7 +3,13 @@ export default class IndicatorPresenter { let path = enabled ? 'resources/enabled_32x32.png' : 'resources/disabled_32x32.png'; - return browser.browserAction.setIcon({ path }); + if (typeof browser.browserAction.setIcon === "function") { + return browser.browserAction.setIcon({ path }); + } + else { + // setIcon not supported on Android + return Promise.resolve(); + } } onClick(listener: (arg: browser.tabs.Tab) => void): void { From 59dd41b47901f4096d88ce549b00d3157e1866d7 Mon Sep 17 00:00:00 2001 From: robsmith11 Date: Fri, 17 May 2019 15:37:13 +0000 Subject: [PATCH 2/3] Fix history and bookmarks warnings on Android --- src/background/usecases/CompletionsUseCase.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/background/usecases/CompletionsUseCase.ts b/src/background/usecases/CompletionsUseCase.ts index ae1ceed..7f6322e 100644 --- a/src/background/usecases/CompletionsUseCase.ts +++ b/src/background/usecases/CompletionsUseCase.ts @@ -52,13 +52,15 @@ export default class CompletionsUseCase { if (engines.length > 0) { groups.push({ name: 'Search Engines', items: engines }); } - } else if (c === 'h') { + // browser.history not supported on Android + } else if (c === 'h' && typeof browser.history === "object") { // eslint-disable-next-line no-await-in-loop let histories = await this.queryHistoryItems(name, keywords); if (histories.length > 0) { groups.push({ name: 'History', items: histories }); } - } else if (c === 'b') { + // browser.bookmarks not supported on Android + } else if (c === 'b' && typeof browser.bookmarks === "object") { // eslint-disable-next-line no-await-in-loop let bookmarks = await this.queryBookmarkItems(name, keywords); if (bookmarks.length > 0) { From 127247ca34566ac67afec71b4bbf4b937291f721 Mon Sep 17 00:00:00 2001 From: robsmith11 Date: Fri, 17 May 2019 16:14:17 +0000 Subject: [PATCH 3/3] Fix openerTabId warning on Android --- src/background/usecases/LinkUseCase.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/background/usecases/LinkUseCase.ts b/src/background/usecases/LinkUseCase.ts index 2f4df7b..21cf0e7 100644 --- a/src/background/usecases/LinkUseCase.ts +++ b/src/background/usecases/LinkUseCase.ts @@ -12,8 +12,9 @@ export default class LinkUseCase { } openNewTab(url: string, openerId: number, background: boolean): Promise { - return this.tabPresenter.create(url, { - openerTabId: openerId, active: !background - }); + // openerTabId not supported on Android + let properties = typeof browser.tabs.Tab === "object" ? + { openerTabId: openerId, active: !background } : { active: !background }; + return this.tabPresenter.create(url, properties); } }