Skip to content

Commit 1c5d43c

Browse files
committed
Fix bugs on Kiwi browser
1 parent f43fbe8 commit 1c5d43c

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

src/api/chrome/context-menu.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { IS_FIREFOX_ANDROID } from "@util/constant/environment"
1+
import { IS_ANDROID } from "@util/constant/environment"
22
import { handleError } from "./common"
33

44
function onClick(id: string, handler: Function) {
5-
if (IS_FIREFOX_ANDROID) {
5+
if (IS_ANDROID) {
66
return
77
}
88
chrome.contextMenus?.onClicked?.addListener(({ menuItemId }) => menuItemId === id && handler?.())
99
}
1010

1111
export function createContextMenu(props: ChromeContextMenuCreateProps): Promise<void> {
12-
if (IS_FIREFOX_ANDROID) {
12+
if (IS_ANDROID) {
1313
return
1414
}
1515
// Add listener by param
@@ -25,7 +25,7 @@ export function createContextMenu(props: ChromeContextMenuCreateProps): Promise<
2525
}
2626

2727
export function updateContextMenu(menuId: string, props: ChromeContextMenuUpdateProps): Promise<void> {
28-
if (IS_FIREFOX_ANDROID) {
28+
if (IS_ANDROID) {
2929
return
3030
}
3131
return new Promise(resolve => chrome.contextMenus?.update?.(menuId, props, () => {

src/api/chrome/window.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { IS_FIREFOX_ANDROID } from "@util/constant/environment"
1+
import { IS_ANDROID } from "@util/constant/environment"
22
import { handleError } from "./common"
33

44
export function listAllWindows(): Promise<chrome.windows.Window[]> {
5-
if (IS_FIREFOX_ANDROID) {
5+
if (IS_ANDROID) {
66
// windows API not supported on Firefox for Android
77
return Promise.resolve([])
88
}
@@ -13,14 +13,14 @@ export function listAllWindows(): Promise<chrome.windows.Window[]> {
1313
}
1414

1515
export function isNoneWindowId(windowId: number) {
16-
if (IS_FIREFOX_ANDROID) {
16+
if (IS_ANDROID) {
1717
return false
1818
}
1919
return !windowId || windowId === chrome.windows.WINDOW_ID_NONE
2020
}
2121

2222
export function getFocusedNormalWindow(): Promise<chrome.windows.Window> {
23-
if (IS_FIREFOX_ANDROID) {
23+
if (IS_ANDROID) {
2424
return Promise.resolve(null)
2525
}
2626
return new Promise(resolve => chrome.windows.getLastFocused(
@@ -38,7 +38,7 @@ export function getFocusedNormalWindow(): Promise<chrome.windows.Window> {
3838
}
3939

4040
export function getWindow(id: number): Promise<chrome.windows.Window> {
41-
if (IS_FIREFOX_ANDROID) {
41+
if (IS_ANDROID) {
4242
return Promise.resolve(null)
4343
}
4444
return new Promise(resolve => chrome.windows.get(id, win => resolve(win)))
@@ -47,7 +47,7 @@ export function getWindow(id: number): Promise<chrome.windows.Window> {
4747
type _Handler = (windowId: number) => void
4848

4949
export function onNormalWindowFocusChanged(handler: _Handler) {
50-
if (IS_FIREFOX_ANDROID) {
50+
if (IS_ANDROID) {
5151
return
5252
}
5353
chrome.windows.onFocusChanged.addListener(windowId => {

src/background/track-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import optionHolder from "@service/components/option-holder"
44
import itemService from "@service/item-service"
55
import limitService from "@service/limit-service"
66
import periodService from "@service/period-service"
7-
import { IS_FIREFOX_ANDROID } from "@util/constant/environment"
7+
import { IS_ANDROID } from "@util/constant/environment"
88
import { extractHostname } from "@util/pattern"
99
import { formatTimeYMD, getStartOfDay, MILL_PER_DAY } from "@util/time"
1010
import badgeManager from "./badge-manager"
@@ -48,7 +48,7 @@ async function handleTrackTimeEvent(event: timer.core.Event, sender: ChromeMessa
4848
}
4949

5050
async function windowNotFocused(winId: number): Promise<boolean> {
51-
if (IS_FIREFOX_ANDROID) return false
51+
if (IS_ANDROID) return false
5252
if (!winId) return true
5353
const window = await getWindow(winId)
5454
return !window?.focused

src/util/constant/environment.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ export const IS_CHROME: boolean = isChrome
5151
*/
5252
export const IS_ANDROID: boolean = !!userAgent?.toLowerCase()?.includes("android")
5353

54-
/**
55-
* @since 3.3.0
56-
*/
57-
export const IS_FIREFOX_ANDROID = IS_FIREFOX && IS_ANDROID
58-
5954
/**
6055
* @since 0.8.0
6156
*/

0 commit comments

Comments
 (0)