mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
Added tip for error message
This commit is contained in:
parent
cbc9fc4fa6
commit
0453b9b9c1
3 changed files with 25 additions and 3 deletions
|
|
@ -21,6 +21,7 @@ interface CustomAlertProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
message: string;
|
message: string;
|
||||||
|
subtitle?: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
actions?: Array<{
|
actions?: Array<{
|
||||||
label: string;
|
label: string;
|
||||||
|
|
@ -33,6 +34,7 @@ export const CustomAlert = ({
|
||||||
visible,
|
visible,
|
||||||
title,
|
title,
|
||||||
message,
|
message,
|
||||||
|
subtitle,
|
||||||
onClose,
|
onClose,
|
||||||
actions = [
|
actions = [
|
||||||
{ label: 'OK', onPress: onClose }
|
{ label: 'OK', onPress: onClose }
|
||||||
|
|
@ -110,6 +112,13 @@ export const CustomAlert = ({
|
||||||
{message}
|
{message}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
{/* Subtitle / tooltip */}
|
||||||
|
{subtitle ? (
|
||||||
|
<Text style={styles.subtitle}>
|
||||||
|
{subtitle}
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<View style={[
|
<View style={[
|
||||||
styles.actionsRow,
|
styles.actionsRow,
|
||||||
|
|
@ -200,11 +209,19 @@ const styles = StyleSheet.create({
|
||||||
message: {
|
message: {
|
||||||
color: '#AAAAAA',
|
color: '#AAAAAA',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
marginBottom: 24,
|
marginBottom: 8,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
lineHeight: 22,
|
lineHeight: 22,
|
||||||
letterSpacing: 0.1,
|
letterSpacing: 0.1,
|
||||||
},
|
},
|
||||||
|
subtitle: {
|
||||||
|
color: '#666666',
|
||||||
|
fontSize: 12,
|
||||||
|
marginBottom: 24,
|
||||||
|
textAlign: 'center',
|
||||||
|
lineHeight: 18,
|
||||||
|
letterSpacing: 0.1,
|
||||||
|
},
|
||||||
actionsRow: {
|
actionsRow: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export const StreamsScreen = () => {
|
||||||
alertVisible,
|
alertVisible,
|
||||||
alertTitle,
|
alertTitle,
|
||||||
alertMessage,
|
alertMessage,
|
||||||
|
alertSubtitle,
|
||||||
alertActions,
|
alertActions,
|
||||||
openAlert,
|
openAlert,
|
||||||
closeAlert,
|
closeAlert,
|
||||||
|
|
@ -206,6 +207,7 @@ export const StreamsScreen = () => {
|
||||||
visible={alertVisible}
|
visible={alertVisible}
|
||||||
title={alertTitle}
|
title={alertTitle}
|
||||||
message={alertMessage}
|
message={alertMessage}
|
||||||
|
subtitle={alertSubtitle}
|
||||||
actions={alertActions}
|
actions={alertActions}
|
||||||
onClose={closeAlert}
|
onClose={closeAlert}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ export const useStreamsScreen = () => {
|
||||||
const [alertVisible, setAlertVisible] = useState(false);
|
const [alertVisible, setAlertVisible] = useState(false);
|
||||||
const [alertTitle, setAlertTitle] = useState('');
|
const [alertTitle, setAlertTitle] = useState('');
|
||||||
const [alertMessage, setAlertMessage] = useState('');
|
const [alertMessage, setAlertMessage] = useState('');
|
||||||
|
const [alertSubtitle, setAlertSubtitle] = useState('');
|
||||||
const [alertActions, setAlertActions] = useState<AlertAction[]>([]);
|
const [alertActions, setAlertActions] = useState<AlertAction[]>([]);
|
||||||
|
|
||||||
// Loading and provider state
|
// Loading and provider state
|
||||||
|
|
@ -174,12 +175,13 @@ export const useStreamsScreen = () => {
|
||||||
|
|
||||||
// Open alert helper
|
// Open alert helper
|
||||||
const openAlert = useCallback(
|
const openAlert = useCallback(
|
||||||
(title: string, message: string, actions?: AlertAction[]) => {
|
(title: string, message: string, actions?: AlertAction[], subtitle?: string) => {
|
||||||
if (!isMounted.current) return;
|
if (!isMounted.current) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setAlertTitle(title);
|
setAlertTitle(title);
|
||||||
setAlertMessage(message);
|
setAlertMessage(message);
|
||||||
|
setAlertSubtitle(subtitle ?? '');
|
||||||
setAlertActions(actions && actions.length > 0 ? actions : [{ label: 'OK', onPress: () => { } }]);
|
setAlertActions(actions && actions.length > 0 ? actions : [{ label: 'OK', onPress: () => { } }]);
|
||||||
setAlertVisible(true);
|
setAlertVisible(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -465,7 +467,7 @@ export const useStreamsScreen = () => {
|
||||||
|
|
||||||
// Block magnet links
|
// Block magnet links
|
||||||
if (typeof stream.url === 'string' && stream.url.startsWith('magnet:')) {
|
if (typeof stream.url === 'string' && stream.url.startsWith('magnet:')) {
|
||||||
openAlert('Not supported', 'Torrent streaming is not supported yet.');
|
openAlert('Not supported', 'Torrent streaming is not supported yet.', undefined, 'You need a Debrid provider.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1145,6 +1147,7 @@ export const useStreamsScreen = () => {
|
||||||
alertVisible,
|
alertVisible,
|
||||||
alertTitle,
|
alertTitle,
|
||||||
alertMessage,
|
alertMessage,
|
||||||
|
alertSubtitle,
|
||||||
alertActions,
|
alertActions,
|
||||||
openAlert,
|
openAlert,
|
||||||
closeAlert,
|
closeAlert,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue