#settings.sound.volume seems to store the old state

13 messages · Page 1 of 1 (latest)

honest saffron
#

Product: LB-Phone
Issue: getSettings() and onSettingsChange() seems to send the old value
How to recreate: Use the following react component. This was taken from the custom app react template

import React, { useEffect, useRef } from 'react'
import './App.css'

export const devMode = !window?.['invokeNative']

const App = () => {
    const appDiv = useRef(null)

    const { getSettings, onSettingsChange, fetchNui, sendNotification } = window as any

    useEffect(() => {
        if (devMode) {
            document.getElementsByTagName('html')[0].style.visibility = 'visible'
            document.getElementsByTagName('body')[0].style.visibility = 'visible'

            return
        } else {
            getSettings().then((settings: any) => {
                sendNotification({ content: `${settings.sound.volume}`, title: "App open" })
            })
            onSettingsChange((settings: any) => {
                sendNotification({ content: `${settings.sound.volume}`, title: 'Settings changed' })
            })

        }
    }, [])

    return (
        <AppProvider>
            <div className='app' ref={appDiv}>
                <p>TEST</p>
            </div>
        </AppProvider>
    )
}

interface Props {
    children: React.ReactNode
}

const AppProvider: React.FC<Props> = ({ children }) => {
    if (devMode) {
        return <div className='dev-wrapper'>{children}</div>
    } else return children
}

export default App

Attachment: https://streamable.com/8anln9
Version: 1.7.2
Framework: Standalone
Has this bug appeared more than once? Everytime

Watch "2024-04-24-13-08-57" on Streamable.

▶ Play video
#

While we are on this topic, may i suggest that when using the volume bar either by using the buttons or dragging it triggers onSettingsChange everytime it changes instead of only when it disappears?

#

Use case: Im creating a custom app that uses the youtube iframe api and wanted to use the phone volume as the video volume

#

This allows me to hide the youtube controls and provides a much better user experience in terms players adjusting volume

quasi ridge
#

But i'll look into the bug

honest saffron
#

Any chance you can provide an alternative function that we can subscribe with a maybe a timeout
so while dragging it triggers every 500ms or so?

#

Just because it takes a lot of a time between the wait to close and the animation

half stone
honest saffron
#

thank you!

honest saffron
#

Any progress on this issue?

half stone
#

We're working on a big update of the phone, and this will be included in it

#

hopefully it will be out in the next couple of weeks