From 6924bea181c86464e379091dd11778d5ec078a0d Mon Sep 17 00:00:00 2001
From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com>
Date: Fri, 7 Apr 2023 22:02:32 +0800
Subject: [PATCH] Last.fm: parse interval on need
---
plugins/Last.fm/src/Settings.tsx | 2 +-
plugins/Last.fm/src/utils.ts | 2 +-
plugins/defs.d.ts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/Last.fm/src/Settings.tsx b/plugins/Last.fm/src/Settings.tsx
index 4bbeed2..a0126e0 100644
--- a/plugins/Last.fm/src/Settings.tsx
+++ b/plugins/Last.fm/src/Settings.tsx
@@ -65,7 +65,7 @@ export default function Settings() {
settings.timeInterval = Number(value)}
+ onChangeText={(value: string) => settings.timeInterval = value}
title="Update interval (in seconds)"
placeholder={Constants.DEFAULT_TIME_INTERVAL.toString()}
keyboardType="numeric"
diff --git a/plugins/Last.fm/src/utils.ts b/plugins/Last.fm/src/utils.ts
index e65698c..e16102f 100644
--- a/plugins/Last.fm/src/utils.ts
+++ b/plugins/Last.fm/src/utils.ts
@@ -221,6 +221,6 @@ export async function initialize() {
flush();
}
}),
- (currentSettings.timeInterval || Constants.DEFAULT_TIME_INTERVAL) * 1000
+ (Number(currentSettings.timeInterval) || Constants.DEFAULT_TIME_INTERVAL) * 1000
);
}
diff --git a/plugins/defs.d.ts b/plugins/defs.d.ts
index e855bca..1587215 100644
--- a/plugins/defs.d.ts
+++ b/plugins/defs.d.ts
@@ -29,7 +29,7 @@ type LFMSettings = {
appName: string;
username: string;
showTimestamp: boolean;
- timeInterval: number;
+ timeInterval: number | string;
listeningTo: boolean;
ignoreSpotify: boolean;
verboseLogging: boolean;