mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 00:59:28 +01:00
fix net state not being right on startup
This commit is contained in:
parent
5af187ba48
commit
46eb293f98
@ -35,6 +35,7 @@ const rebuildQueue = () => {
|
||||
}
|
||||
|
||||
let serviceCreated = false
|
||||
|
||||
const createService = async () => {
|
||||
useStore.subscribe(
|
||||
(currentTrack?: TrackExt) => {
|
||||
@ -46,6 +47,10 @@ const createService = async () => {
|
||||
(prev, next) => prev?.id === next?.id,
|
||||
)
|
||||
|
||||
NetInfo.fetch().then(state => {
|
||||
setNetState(state.type === NetInfoStateType.cellular ? 'mobile' : 'wifi')
|
||||
})
|
||||
|
||||
NetInfo.addEventListener(state => {
|
||||
const currentType = useStore.getState().netState
|
||||
const newType = state.type === NetInfoStateType.cellular ? 'mobile' : 'wifi'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user