Fix android sound notifications

This commit is contained in:
Reckless_Satoshi 2023-05-27 02:08:00 -07:00
parent cf9ad31ac9
commit f6601922b8
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 16 additions and 6 deletions

4
.gitignore vendored
View File

@ -649,5 +649,7 @@ docs/.jekyll-cache*
docs/_site* docs/_site*
node node
# mobile frontend js # mobile frontend statics
mobile/html/Web.bundle/js* mobile/html/Web.bundle/js*
mobile/html/Web.bundle/css*
mobile/html/Web.bundle/assets*

View File

@ -31,11 +31,15 @@ interface NotificationMessage {
pageTitle: string; pageTitle: string;
} }
const path =
window.NativeRobosats === undefined
? '/static/assets/sounds'
: 'file:///android_asset/Web.bundle/assets/sounds';
const audio = { const audio = {
chat: new Audio(`/static/assets/sounds/chat-open.mp3`), chat: new Audio(`${path}/chat-open.mp3`),
takerFound: new Audio(`/static/assets/sounds/taker-found.mp3`), takerFound: new Audio(`${path}/taker-found.mp3`),
ding: new Audio(`/static/assets/sounds/locked-invoice.mp3`), ding: new Audio(`${path}/locked-invoice.mp3`),
successful: new Audio(`/static/assets/sounds/successful.mp3`), successful: new Audio(`${path}/successful.mp3`),
}; };
const emptyNotificationMessage: NotificationMessage = { const emptyNotificationMessage: NotificationMessage = {

View File

@ -67,6 +67,10 @@ const configMobile: Configuration = {
from: path.resolve(__dirname, 'static/css'), from: path.resolve(__dirname, 'static/css'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'), to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'),
}, },
{
from: path.resolve(__dirname, 'static/assets/sounds'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/sounds'),
},
], ],
}), }),
], ],

View File

@ -176,7 +176,7 @@ const App = () => {
allowingReadAccessToURL={uri} allowingReadAccessToURL={uri}
allowFileAccess={true} allowFileAccess={true}
allowsBackForwardNavigationGestures={true} allowsBackForwardNavigationGestures={true}
mediaPlaybackRequiresUserAction={false} mediaPlaybackRequiresUserAction={false} // Allow autoplay
allowsLinkPreview={false} allowsLinkPreview={false}
renderLoading={() => <Text></Text>} renderLoading={() => <Text></Text>}
onError={(syntheticEvent) => <Text>{syntheticEvent.type}</Text>} onError={(syntheticEvent) => <Text>{syntheticEvent.type}</Text>}