Import apps/android/src/screens/bot/profile-page.tsx
This commit is contained in:
parent
79f27ad69a
commit
ddfdeda7be
|
|
@ -1,7 +1,6 @@
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Alert,
|
|
||||||
Animated,
|
Animated,
|
||||||
BackHandler,
|
BackHandler,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
|
|
@ -13,6 +12,7 @@ import {
|
||||||
Text,
|
Text,
|
||||||
View,
|
View,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
import { Alert } from '../../ui/alert'
|
||||||
import * as Clipboard from 'expo-clipboard'
|
import * as Clipboard from 'expo-clipboard'
|
||||||
import {
|
import {
|
||||||
ArrowLeftRight,
|
ArrowLeftRight,
|
||||||
|
|
@ -93,6 +93,7 @@ function groupBotModels(models: BotObject[]): { provider: string; label: string;
|
||||||
|
|
||||||
export function BotProfilePage({
|
export function BotProfilePage({
|
||||||
visible,
|
visible,
|
||||||
|
covered = false,
|
||||||
bot,
|
bot,
|
||||||
room,
|
room,
|
||||||
state,
|
state,
|
||||||
|
|
@ -105,6 +106,7 @@ export function BotProfilePage({
|
||||||
perform,
|
perform,
|
||||||
}: {
|
}: {
|
||||||
visible: boolean
|
visible: boolean
|
||||||
|
covered?: boolean
|
||||||
bot?: BotEntry
|
bot?: BotEntry
|
||||||
room?: BotRoom
|
room?: BotRoom
|
||||||
state: BotState
|
state: BotState
|
||||||
|
|
@ -213,10 +215,10 @@ export function BotProfilePage({
|
||||||
}, [moreOpen, subPage, closeSubPage, onClose])
|
}, [moreOpen, subPage, closeSubPage, onClose])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible) return
|
if (!visible || covered) return
|
||||||
const sub = BackHandler.addEventListener('hardwareBackPress', handleBack)
|
const sub = BackHandler.addEventListener('hardwareBackPress', handleBack)
|
||||||
return () => sub.remove()
|
return () => sub.remove()
|
||||||
}, [visible, handleBack])
|
}, [visible, covered, handleBack])
|
||||||
|
|
||||||
const reloadSchedules = useCallback(() => {
|
const reloadSchedules = useCallback(() => {
|
||||||
if (!visible || !client) return
|
if (!visible || !client) return
|
||||||
|
|
@ -464,10 +466,7 @@ export function BotProfilePage({
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={s.bots.botSettings}
|
accessibilityLabel={s.bots.botSettings}
|
||||||
disabled={busy || Boolean(state.readOnly)}
|
disabled={busy || Boolean(state.readOnly)}
|
||||||
onPress={() => {
|
onPress={onEdit}
|
||||||
onClose()
|
|
||||||
onEdit()
|
|
||||||
}}
|
|
||||||
hitSlop={8}
|
hitSlop={8}
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
styles.circleBtn,
|
styles.circleBtn,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue