mirror of https://github.com/tooot-app/app
commit
98a24ce1d6
|
@ -119,6 +119,8 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
|||
routeRef.current = {
|
||||
name: currentRoute?.name,
|
||||
params: currentRoute?.params
|
||||
? JSON.stringify(currentRoute.params)
|
||||
: undefined
|
||||
}
|
||||
}, [])
|
||||
const navigationContainerOnStateChange = useCallback(() => {
|
||||
|
@ -144,7 +146,10 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<StatusBar barStyle={barStyle[mode]} backgroundColor={theme.backgroundDefault} />
|
||||
<StatusBar
|
||||
barStyle={barStyle[mode]}
|
||||
backgroundColor={theme.backgroundDefault}
|
||||
/>
|
||||
<NavigationContainer
|
||||
ref={navigationRef}
|
||||
theme={themes[mode]}
|
||||
|
|
|
@ -86,7 +86,7 @@ const HeaderRight: React.FC<Props> = ({
|
|||
: undefined,
|
||||
minHeight: 44,
|
||||
minWidth: 44,
|
||||
marginLeft: native
|
||||
marginRight: native
|
||||
? -StyleConstants.Spacing.S
|
||||
: StyleConstants.Spacing.S,
|
||||
...(type === 'icon' && {
|
||||
|
|
|
@ -95,35 +95,37 @@ const AttachmentAudio: React.FC<Props> = ({
|
|||
</>
|
||||
)}
|
||||
</View>
|
||||
<View
|
||||
style={{
|
||||
alignSelf: 'flex-end',
|
||||
width: '100%',
|
||||
height: StyleConstants.Spacing.M + StyleConstants.Spacing.S * 2,
|
||||
backgroundColor: theme.backgroundOverlayInvert,
|
||||
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding,
|
||||
borderRadius: 100,
|
||||
opacity: sensitiveShown ? 0.35 : undefined
|
||||
}}
|
||||
>
|
||||
<Slider
|
||||
minimumValue={0}
|
||||
maximumValue={audio.meta.original.duration * 1000}
|
||||
value={audioPosition}
|
||||
minimumTrackTintColor={theme.secondary}
|
||||
maximumTrackTintColor={theme.disabled}
|
||||
// onSlidingStart={() => {
|
||||
// audioPlayer?.pauseAsync()
|
||||
// setAudioPlaying(false)
|
||||
// }}
|
||||
// onSlidingComplete={value => {
|
||||
// setAudioPosition(value)
|
||||
// }}
|
||||
enabled={false} // Bug in above sliding actions
|
||||
thumbSize={StyleConstants.Spacing.M}
|
||||
thumbTintColor={theme.primaryOverlay}
|
||||
/>
|
||||
</View>
|
||||
{audio.meta.original.duration ? (
|
||||
<View
|
||||
style={{
|
||||
alignSelf: 'flex-end',
|
||||
width: '100%',
|
||||
height: StyleConstants.Spacing.M + StyleConstants.Spacing.S * 2,
|
||||
backgroundColor: theme.backgroundOverlayInvert,
|
||||
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding,
|
||||
borderRadius: 100,
|
||||
opacity: sensitiveShown ? 0.35 : undefined
|
||||
}}
|
||||
>
|
||||
<Slider
|
||||
minimumValue={0}
|
||||
maximumValue={audio.meta.original.duration * 1000}
|
||||
value={audioPosition}
|
||||
minimumTrackTintColor={theme.secondary}
|
||||
maximumTrackTintColor={theme.disabled}
|
||||
// onSlidingStart={() => {
|
||||
// audioPlayer?.pauseAsync()
|
||||
// setAudioPlaying(false)
|
||||
// }}
|
||||
// onSlidingComplete={value => {
|
||||
// setAudioPosition(value)
|
||||
// }}
|
||||
enabled={false} // Bug in above sliding actions
|
||||
thumbSize={StyleConstants.Spacing.M}
|
||||
thumbTintColor={theme.primaryOverlay}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -23,32 +23,35 @@ import ImageViewer from './ImageViewer/Root'
|
|||
const saveImage = async (
|
||||
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
|
||||
) => {
|
||||
const hasAndroidPermission = async () => {
|
||||
const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
|
||||
if (Platform.OS === 'ios') {
|
||||
CameraRoll.save(image.url)
|
||||
.then(() => haptics('Success'))
|
||||
.catch(() => {
|
||||
if (image.remote_url) {
|
||||
CameraRoll.save(image.remote_url)
|
||||
.then(() => haptics('Success'))
|
||||
.catch(() => haptics('Error'))
|
||||
} else {
|
||||
haptics('Error')
|
||||
}
|
||||
})
|
||||
} else if (Platform.OS === 'android') {
|
||||
const hasAndroidPermission = async () => {
|
||||
const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
|
||||
|
||||
const hasPermission = await PermissionsAndroid.check(permission)
|
||||
if (hasPermission) {
|
||||
return true
|
||||
const hasPermission = await PermissionsAndroid.check(permission)
|
||||
if (hasPermission) {
|
||||
return true
|
||||
}
|
||||
|
||||
const status = await PermissionsAndroid.request(permission)
|
||||
return status === 'granted'
|
||||
}
|
||||
|
||||
const status = await PermissionsAndroid.request(permission)
|
||||
return status === 'granted'
|
||||
if (!(await hasAndroidPermission())) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.OS === 'android' && !(await hasAndroidPermission())) {
|
||||
return
|
||||
}
|
||||
CameraRoll.save(image.url)
|
||||
.then(() => haptics('Success'))
|
||||
.catch(() => {
|
||||
if (image.remote_url) {
|
||||
CameraRoll.save(image.remote_url)
|
||||
.then(() => haptics('Success'))
|
||||
.catch(() => haptics('Error'))
|
||||
} else {
|
||||
haptics('Error')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const HeaderComponent = React.memo(
|
||||
|
@ -109,6 +112,7 @@ const HeaderComponent = React.memo(
|
|||
<HeaderLeft
|
||||
content='X'
|
||||
native={false}
|
||||
background
|
||||
onPress={() => navigation.goBack()}
|
||||
/>
|
||||
<HeaderCenter
|
||||
|
@ -118,6 +122,7 @@ const HeaderComponent = React.memo(
|
|||
<HeaderRight
|
||||
content='MoreHorizontal'
|
||||
native={false}
|
||||
background
|
||||
onPress={onPress}
|
||||
/>
|
||||
</View>
|
||||
|
|
|
@ -2,7 +2,7 @@ import { MenuContainer, MenuRow } from '@components/Menu'
|
|||
import { updateInstancePush } from '@utils/slices/instances/updatePush'
|
||||
import { updateInstancePushAlert } from '@utils/slices/instances/updatePushAlert'
|
||||
import { updateInstancePushDecode } from '@utils/slices/instances/updatePushDecode'
|
||||
import { getInstancePush } from '@utils/slices/instancesSlice'
|
||||
import { clearPushLoading, getInstancePush } from '@utils/slices/instancesSlice'
|
||||
import * as WebBrowser from 'expo-web-browser'
|
||||
import * as Notifications from 'expo-notifications'
|
||||
import React, { useEffect, useMemo, useState } from 'react'
|
||||
|
@ -36,6 +36,10 @@ const ScreenMeSettingsPush: React.FC = () => {
|
|||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(clearPushLoading())
|
||||
}, [])
|
||||
|
||||
const isLoading = instancePush?.global.loading || instancePush?.decode.loading
|
||||
|
||||
const alerts = useMemo(() => {
|
||||
|
|
|
@ -164,6 +164,16 @@ const instancesSlice = createSlice({
|
|||
draft => draft.timestamp !== action.payload
|
||||
)
|
||||
},
|
||||
clearPushLoading: ({ instances }) => {
|
||||
const activeIndex = findInstanceActive(instances)
|
||||
instances[activeIndex].push.global.loading = false
|
||||
instances[activeIndex].push.decode.loading = false
|
||||
instances[activeIndex].push.alerts.favourite.loading = false
|
||||
instances[activeIndex].push.alerts.follow.loading = false
|
||||
instances[activeIndex].push.alerts.mention.loading = false
|
||||
instances[activeIndex].push.alerts.poll.loading = false
|
||||
instances[activeIndex].push.alerts.reblog.loading = false
|
||||
},
|
||||
disableAllPushes: ({ instances }) => {
|
||||
instances = instances.map(instance => {
|
||||
let newInstance = instance
|
||||
|
@ -352,6 +362,7 @@ export const {
|
|||
updateInstanceNotificationsFilter,
|
||||
updateInstanceDraft,
|
||||
removeInstanceDraft,
|
||||
clearPushLoading,
|
||||
disableAllPushes
|
||||
} = instancesSlice.actions
|
||||
|
||||
|
|
Loading…
Reference in New Issue