mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-05-18 06:47:29 +08:00
Implement toggle functionality for intro and outro time settings with user feedback
This commit is contained in:
@@ -188,11 +188,22 @@ const usePlayerStore = create<PlayerState>((set, get) => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setIntroEndTime: () => {
|
setIntroEndTime: () => {
|
||||||
const { status, detail } = get();
|
const { status, detail, introEndTime: existingIntroEndTime } = get();
|
||||||
if (status?.isLoaded && detail) {
|
if (!status?.isLoaded || !detail) return;
|
||||||
const introEndTime = status.positionMillis;
|
|
||||||
set({ introEndTime });
|
if (existingIntroEndTime) {
|
||||||
get()._savePlayRecord({ introEndTime });
|
// Clear the time
|
||||||
|
set({ introEndTime: undefined });
|
||||||
|
get()._savePlayRecord({ introEndTime: undefined });
|
||||||
|
Toast.show({
|
||||||
|
type: "info",
|
||||||
|
text1: "已清除片头时间",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Set the time
|
||||||
|
const newIntroEndTime = status.positionMillis;
|
||||||
|
set({ introEndTime: newIntroEndTime });
|
||||||
|
get()._savePlayRecord({ introEndTime: newIntroEndTime });
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
text1: "设置成功",
|
text1: "设置成功",
|
||||||
@@ -202,11 +213,22 @@ const usePlayerStore = create<PlayerState>((set, get) => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setOutroStartTime: () => {
|
setOutroStartTime: () => {
|
||||||
const { status, detail } = get();
|
const { status, detail, outroStartTime: existingOutroStartTime } = get();
|
||||||
if (status?.isLoaded && detail) {
|
if (!status?.isLoaded || !detail) return;
|
||||||
const outroStartTime = status.positionMillis;
|
|
||||||
set({ outroStartTime });
|
if (existingOutroStartTime) {
|
||||||
get()._savePlayRecord({ outroStartTime });
|
// Clear the time
|
||||||
|
set({ outroStartTime: undefined });
|
||||||
|
get()._savePlayRecord({ outroStartTime: undefined });
|
||||||
|
Toast.show({
|
||||||
|
type: "info",
|
||||||
|
text1: "已清除片尾时间",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Set the time
|
||||||
|
const newOutroStartTime = status.positionMillis;
|
||||||
|
set({ outroStartTime: newOutroStartTime });
|
||||||
|
get()._savePlayRecord({ outroStartTime: newOutroStartTime });
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
text1: "设置成功",
|
text1: "设置成功",
|
||||||
|
|||||||
Reference in New Issue
Block a user