commit
6ec560bca3
3 changed files with 15 additions and 6 deletions
|
@ -3,7 +3,13 @@ export default class IndicatorPresenter {
|
||||||
let path = enabled
|
let path = enabled
|
||||||
? 'resources/enabled_32x32.png'
|
? 'resources/enabled_32x32.png'
|
||||||
: 'resources/disabled_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 {
|
onClick(listener: (arg: browser.tabs.Tab) => void): void {
|
||||||
|
|
|
@ -52,13 +52,15 @@ export default class CompletionsUseCase {
|
||||||
if (engines.length > 0) {
|
if (engines.length > 0) {
|
||||||
groups.push({ name: 'Search Engines', items: engines });
|
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
|
// eslint-disable-next-line no-await-in-loop
|
||||||
let histories = await this.queryHistoryItems(name, keywords);
|
let histories = await this.queryHistoryItems(name, keywords);
|
||||||
if (histories.length > 0) {
|
if (histories.length > 0) {
|
||||||
groups.push({ name: 'History', items: histories });
|
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
|
// eslint-disable-next-line no-await-in-loop
|
||||||
let bookmarks = await this.queryBookmarkItems(name, keywords);
|
let bookmarks = await this.queryBookmarkItems(name, keywords);
|
||||||
if (bookmarks.length > 0) {
|
if (bookmarks.length > 0) {
|
||||||
|
|
|
@ -12,8 +12,9 @@ export default class LinkUseCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
openNewTab(url: string, openerId: number, background: boolean): Promise<any> {
|
openNewTab(url: string, openerId: number, background: boolean): Promise<any> {
|
||||||
return this.tabPresenter.create(url, {
|
// openerTabId not supported on Android
|
||||||
openerTabId: openerId, active: !background
|
let properties = typeof browser.tabs.Tab === "object" ?
|
||||||
});
|
{ openerTabId: openerId, active: !background } : { active: !background };
|
||||||
|
return this.tabPresenter.create(url, properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue