aboutsummaryrefslogtreecommitdiff
path: root/src/background/completion/CompletionUseCase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/completion/CompletionUseCase.ts')
-rw-r--r--src/background/completion/CompletionUseCase.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/background/completion/CompletionUseCase.ts b/src/background/completion/CompletionUseCase.ts
index 898efd4..fd3c279 100644
--- a/src/background/completion/CompletionUseCase.ts
+++ b/src/background/completion/CompletionUseCase.ts
@@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
import HistoryRepository from "./HistoryRepository";
import BookmarkRepository from "./BookmarkRepository";
import CachedSettingRepository from "../repositories/CachedSettingRepository";
+import CompletionType from "../../shared/CompletionType";
export type BookmarkItem = {
title: string
@@ -23,6 +24,26 @@ export default class CompletionUseCase {
) {
}
+ async getCompletionTypes(): Promise<CompletionType[]> {
+ const settings = await this.cachedSettingRepository.get();
+ const types: CompletionType[] = [];
+ for (const c of settings.properties.complete) {
+ switch (c) {
+ case 's':
+ types.push(CompletionType.SearchEngines);
+ break;
+ case 'h':
+ types.push(CompletionType.History);
+ break;
+ case 'b':
+ types.push(CompletionType.Bookmarks);
+ break;
+ }
+ // ignore invalid characters in the complete property
+ }
+ return types;
+ }
+
async requestSearchEngines(query: string): Promise<string[]> {
const settings = await this.cachedSettingRepository.get();
return Object.keys(settings.search.engines)