Skip to content

Commit e3edac1

Browse files
authored
Merge pull request #28 from GoodDay360/window
Window
2 parents d168d8c + e161d3d commit e3edac1

File tree

6 files changed

+78
-73
lines changed

6 files changed

+78
-73
lines changed

bin.manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
}
2929
},
3030
"extension-package":{
31-
"url": "https://github.com/GoodDay360/HyperionBox-Extensions/releases/download/Package/Package-Latest.zip",
32-
"version": "1.1.4"
31+
"url": "https://github.com/GoodDay360/HyperionBox-Extensions/releases/download/Package/package-latest.zip",
32+
"version": "1.1.5"
3333
},
3434
"browser":{
3535
"windows": {

snapcraft.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ parts:
8383
stage-packages:
8484
- libwebkit2gtk-4.1-0
8585
- libayatana-appindicator3-1
86-
- gstreamer1.0-plugins-bad
86+
- gstreamer1.0-plugins-base
8787
- gstreamer1.0-plugins-good
88+
- gstreamer1.0-plugins-bad
89+
- gstreamer1.0-plugins-ugly
8890
- gstreamer1.0-libav
91+
8992
source: .
9093
override-build: |
9194
set -eu

src/[preview]/components/main.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -613,26 +613,27 @@ const Preview = () => {
613613
}</>
614614
}</>
615615

616-
617-
<>{selected_tag.length > 0 &&
618-
<IconButton color="primary" size="large"
619-
onClick={()=>{
620-
621-
set_download_mode({...download_mode,state:!download_mode.state,select_type:"manual"});
622-
if (download_mode.state) {
623-
selected_download_data.current = []
624-
}else{
625-
const element = document.getElementById('ep_container');
626-
element?.scrollIntoView({ behavior: 'smooth' });
627-
}
628-
}}
629-
>
630-
{download_mode.state
631-
? <CloseRoundedIcon sx={{color:"red"}} fontSize="large"/>
632-
: <DownloadRoundedIcon sx={{color:"var(--icon-color-1)"}} fontSize="large"/>
616+
<IconButton color="primary" size="large"
617+
onClick={()=>{
618+
if (selected_tag.length === 0) {
619+
set_feedback_snackbar({state:true,type:"warning",text:"Required to add this content to Watchlist before download."});
620+
return;
633621
}
634-
</IconButton>
635-
}</>
622+
set_download_mode({...download_mode,state:!download_mode.state,select_type:"manual"});
623+
if (download_mode.state) {
624+
selected_download_data.current = []
625+
}else{
626+
const element = document.getElementById('ep_container');
627+
element?.scrollIntoView({ behavior: 'smooth' });
628+
}
629+
}}
630+
>
631+
{download_mode.state
632+
? <CloseRoundedIcon sx={{color:"red"}} fontSize="large"/>
633+
: <DownloadRoundedIcon sx={{color:"var(--icon-color-1)"}} fontSize="large"/>
634+
}
635+
</IconButton>
636+
636637
</div>
637638
</div>
638639
<div className={styles.body}>

src/[watch]/components/main.tsx

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Tauri Plugins
44
import { path } from "@tauri-apps/api";
5-
import { getCurrentWindow } from "@tauri-apps/api/window"
5+
import { getCurrentWindow } from "@tauri-apps/api/window";
66
import { BaseDirectory, exists, readTextFile } from "@tauri-apps/plugin-fs";
77

88
// React Imports
@@ -54,13 +54,14 @@ import check_internet_connection from "../../global/scripts/check_internet_conne
5454
import rephrase_local_hls from "../scripts/rephrase_local_hls";
5555
import open_external from "../scripts/open_external";
5656
import { get_source_info } from "../../global/scripts/manage_extension";
57+
import { read_config } from "../../global/scripts/manage_config";
5758

5859
const FETCH_UPDATE_INTERVAL = 6; // In hours
5960
let FIRST_RUN_TIMEOUT:any;
6061

6162
function Watch() {
6263
const navigate = useNavigate();
63-
const {app_ready} = useContext<any>(global_context);
64+
const {app_ready, set_feedback_snackbar} = useContext<any>(global_context);
6465

6566
const { source_id, preview_id, season_id, watch_id }:any = useParams();
6667
console.log(season_id, watch_id);
@@ -97,16 +98,20 @@ function Watch() {
9798
useEffect(()=>{
9899
(async ()=>{
99100
if (isFullscreen){
100-
await getCurrentWindow().setFullscreen(true)
101-
sessionStorage.setItem("fullscreen", "yes")
101+
sessionStorage.setItem("allow_auto_config_screen", "0");
102102
}else{
103-
await getCurrentWindow().setFullscreen(false)
104-
sessionStorage.setItem("fullscreen", "no")
103+
sessionStorage.setItem("allow_auto_config_screen", "1");
104+
const config = await read_config();
105+
if (config.options.fullscreen){
106+
await getCurrentWindow().setFullscreen(true);
107+
}
108+
105109
}
106110
})();
107111
return;
108112
},[isFullscreen])
109113

114+
110115
let update_state_interval:any = null;
111116
let is_updating_state = false
112117
useEffect(() => {
@@ -441,50 +446,46 @@ function Watch() {
441446
</div>
442447
<div className={styles.body}>
443448
<div className={styles.body_box_1}>
444-
<div
449+
450+
<MediaPlayer ref={media_player_ref}
445451
style={{
452+
boxSizing:"border-box",
446453
flex:1,
447454
minWidth:"200px",
448455
display:"flex",
449-
boxSizing:"border-box",
450456
}}
457+
title={`Watching: ${preview_id}-${TYPE_SCHEMA=== 2 ? `Season ${SEASON_INDEX+1}-` : ""}Episode ${watch_id}`}
458+
onProviderChange={onProviderChange}
459+
src={MEDIA_SRC}
460+
onLoadedData={()=>{
461+
set_is_media_ready(true);
462+
}}
463+
storage="vidstack"
464+
streamType='on-demand'
465+
viewType='video'
466+
playsInline crossOrigin
451467
>
452-
<MediaPlayer ref={media_player_ref}
453-
style={{
454-
boxSizing:"border-box",
455-
}}
456-
title={`Watching: ${preview_id}-${TYPE_SCHEMA=== 2 ? `Season ${SEASON_INDEX+1}-` : ""}Episode ${watch_id}`}
457-
onProviderChange={onProviderChange}
458-
src={MEDIA_SRC}
459-
onLoadedData={()=>{
460-
set_is_media_ready(true);
461-
}}
462-
storage="vidstack"
463-
streamType='on-demand'
464-
viewType='video'
465-
playsInline crossOrigin
466-
>
467-
<MediaProvider>
468-
{MEDIA_TRACK.map((track:any, index:any) => {
469-
return (
470-
<track
471-
key={index}
472-
kind={track.kind}
473-
src={MEDIA_TYPE === "local" ? convertFileSrc(track.url) : track.url}
474-
srcLang={track.label}
475-
label={track.label}
476-
default={track.default}
477-
478-
/>
479-
);
480-
})}
481-
</MediaProvider>
482-
<DefaultVideoLayout
483-
colorScheme="dark"
484-
icons={defaultLayoutIcons}
485-
/>
486-
</MediaPlayer>
487-
</div>
468+
<MediaProvider>
469+
{MEDIA_TRACK.map((track:any, index:any) => {
470+
return (
471+
<track
472+
key={index}
473+
kind={track.kind}
474+
src={MEDIA_TYPE === "local" ? convertFileSrc(track.url) : track.url}
475+
srcLang={track.label}
476+
label={track.label}
477+
default={track.default}
478+
479+
/>
480+
);
481+
})}
482+
</MediaProvider>
483+
<DefaultVideoLayout
484+
colorScheme="dark"
485+
icons={defaultLayoutIcons}
486+
/>
487+
</MediaPlayer>
488+
488489
<div
489490
style={{
490491
width:"auto",

src/app/components/main.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function App() {
117117
<>{menu.state &&
118118
<div className={styles.menu_container}>
119119
<div className={styles.menu}>
120-
{menu_button_top.map((item:any, index:number) => (
120+
{menu_button_top.map((item:any, index:number) =>
121121
<Tooltip title={item.title} placement="right" key={index}>
122122
<IconButton disabled={menu.path === item.path}
123123
sx={{
@@ -132,10 +132,10 @@ function App() {
132132
<item.icon sx={{color: "var(--color)", fontSize: "1.5rem"}}/>
133133
</IconButton>
134134
</Tooltip>
135-
))}
135+
)}
136136
</div>
137137
<div className={styles.menu} style={{alignSelf: "flex-end"}}>
138-
{menu_button_bottom.map((item:any, index:number) => (
138+
{menu_button_bottom.map((item:any, index:number) =>
139139
<Tooltip title={item.title} placement="right" key={index}>
140140
<IconButton disabled={menu.path === item.path}
141141
sx={{
@@ -150,7 +150,7 @@ function App() {
150150
<item.icon sx={{color: "var(--color)", fontSize: "1.5rem"}}/>
151151
</IconButton>
152152
</Tooltip>
153-
))}
153+
)}
154154
</div>
155155
</div>
156156
}</>

src/app/scripts/keys_event_listener.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ export const check_fullscreen = async ({fullscreen_snackbar, set_fullscreen_snac
66
if (!Object.keys(config.options)) config.options = {};
77
if (!config.options.fullscreen) config.options.fullscreen = false;
88
if (event.key === 'F11') {
9-
9+
sessionStorage.setItem("allow_auto_config_screen", "0");
1010
set_fullscreen_snackbar({
1111
...fullscreen_snackbar, state: true,
1212
text: config.options.fullscreen ? 'Exit fullscreen' : 'Enter fullscreen, press F11 to exit.',
1313
});
14-
config.options.fullscreen || sessionStorage.getItem("fullscreen") === "yes" ? await getCurrentWindow().setFullscreen(false) : await getCurrentWindow().setFullscreen(true);
14+
config.options.fullscreen ? await getCurrentWindow().setFullscreen(false) : await getCurrentWindow().setFullscreen(true);
1515
config.options.fullscreen = !config.options.fullscreen
16-
sessionStorage.getItem("fullscreen") === "yes" ? sessionStorage.setItem("fullscreen", "no") : null
1716
await write_config(config);
1817
}
1918
});
@@ -25,6 +24,7 @@ export const check_resize = async () => {
2524
await getCurrentWindow().onResized(({ payload: size }) => {
2625
clearTimeout(check_resize_timeout);
2726
check_resize_timeout = setTimeout(async () => {
27+
if (sessionStorage.getItem("allow_auto_config_screen") === "0") return;
2828
const config = await read_config();
2929
if (!config.options) config.options = {};
3030

0 commit comments

Comments
 (0)