mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Partial fix #90
Now playing gifv won't interrupt existing audio playing. But when switching app state, it still will.
This commit is contained in:
		
							
								
								
									
										12
									
								
								Gemfile.lock
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Gemfile.lock
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ GEM | |||||||
|   remote: https://rubygems.org/ |   remote: https://rubygems.org/ | ||||||
|   specs: |   specs: | ||||||
|     CFPropertyList (3.0.3) |     CFPropertyList (3.0.3) | ||||||
|     activesupport (5.2.4.5) |     activesupport (5.2.5) | ||||||
|       concurrent-ruby (~> 1.0, >= 1.0.2) |       concurrent-ruby (~> 1.0, >= 1.0.2) | ||||||
|       i18n (>= 0.7, < 2) |       i18n (>= 0.7, < 2) | ||||||
|       minitest (~> 5.1) |       minitest (~> 5.1) | ||||||
| @@ -15,7 +15,7 @@ GEM | |||||||
|     artifactory (3.0.15) |     artifactory (3.0.15) | ||||||
|     atomos (0.1.3) |     atomos (0.1.3) | ||||||
|     aws-eventstream (1.1.1) |     aws-eventstream (1.1.1) | ||||||
|     aws-partitions (1.432.0) |     aws-partitions (1.436.0) | ||||||
|     aws-sdk-core (3.113.0) |     aws-sdk-core (3.113.0) | ||||||
|       aws-eventstream (~> 1, >= 1.0.2) |       aws-eventstream (~> 1, >= 1.0.2) | ||||||
|       aws-partitions (~> 1, >= 1.239.0) |       aws-partitions (~> 1, >= 1.239.0) | ||||||
| @@ -24,7 +24,7 @@ GEM | |||||||
|     aws-sdk-kms (1.43.0) |     aws-sdk-kms (1.43.0) | ||||||
|       aws-sdk-core (~> 3, >= 3.112.0) |       aws-sdk-core (~> 3, >= 3.112.0) | ||||||
|       aws-sigv4 (~> 1.1) |       aws-sigv4 (~> 1.1) | ||||||
|     aws-sdk-s3 (1.91.0) |     aws-sdk-s3 (1.93.0) | ||||||
|       aws-sdk-core (~> 3, >= 3.112.0) |       aws-sdk-core (~> 3, >= 3.112.0) | ||||||
|       aws-sdk-kms (~> 1) |       aws-sdk-kms (~> 1) | ||||||
|       aws-sigv4 (~> 1.1) |       aws-sigv4 (~> 1.1) | ||||||
| @@ -97,7 +97,7 @@ GEM | |||||||
|     faraday_middleware (1.0.0) |     faraday_middleware (1.0.0) | ||||||
|       faraday (~> 1.0) |       faraday (~> 1.0) | ||||||
|     fastimage (2.2.3) |     fastimage (2.2.3) | ||||||
|     fastlane (2.178.0) |     fastlane (2.179.0) | ||||||
|       CFPropertyList (>= 2.3, < 4.0.0) |       CFPropertyList (>= 2.3, < 4.0.0) | ||||||
|       addressable (>= 2.3, < 3.0.0) |       addressable (>= 2.3, < 3.0.0) | ||||||
|       artifactory (~> 3.0) |       artifactory (~> 3.0) | ||||||
| @@ -196,7 +196,7 @@ GEM | |||||||
|     jwt (2.2.2) |     jwt (2.2.2) | ||||||
|     memoist (0.16.2) |     memoist (0.16.2) | ||||||
|     mini_magick (4.11.0) |     mini_magick (4.11.0) | ||||||
|     mini_mime (1.0.2) |     mini_mime (1.0.3) | ||||||
|     minitest (5.14.4) |     minitest (5.14.4) | ||||||
|     molinillo (0.6.6) |     molinillo (0.6.6) | ||||||
|     multi_json (1.15.0) |     multi_json (1.15.0) | ||||||
| @@ -260,7 +260,7 @@ GEM | |||||||
|       xcpretty (~> 0.2, >= 0.0.7) |       xcpretty (~> 0.2, >= 0.0.7) | ||||||
|  |  | ||||||
| PLATFORMS | PLATFORMS | ||||||
|   ruby |   universal-darwin-20 | ||||||
|  |  | ||||||
| DEPENDENCIES | DEPENDENCIES | ||||||
|   cocoapods |   cocoapods | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| fastlane_version "2.178.0" | fastlane_version "2.179.0" | ||||||
| skip_docs | skip_docs | ||||||
|  |  | ||||||
| ensure_env_vars( | ensure_env_vars( | ||||||
|   | |||||||
| @@ -138,6 +138,23 @@ const ComponentInstance: React.FC<Props> = ({ | |||||||
|       ) : null} |       ) : null} | ||||||
|       <View style={styles.base}> |       <View style={styles.base}> | ||||||
|         <View style={styles.inputRow}> |         <View style={styles.inputRow}> | ||||||
|  |           <TextInput | ||||||
|  |             style={[ | ||||||
|  |               styles.prefix, | ||||||
|  |               { | ||||||
|  |                 borderBottomColor: instanceQuery.isError | ||||||
|  |                   ? theme.red | ||||||
|  |                   : theme.border | ||||||
|  |               } | ||||||
|  |             ]} | ||||||
|  |             editable={false} | ||||||
|  |             children={ | ||||||
|  |               <Text | ||||||
|  |                 style={{ color: theme.primaryDefault }} | ||||||
|  |                 children='https://' | ||||||
|  |               /> | ||||||
|  |             } | ||||||
|  |           /> | ||||||
|           <TextInput |           <TextInput | ||||||
|             style={[ |             style={[ | ||||||
|               styles.textInput, |               styles.textInput, | ||||||
| @@ -246,6 +263,11 @@ const styles = StyleSheet.create({ | |||||||
|     flexDirection: 'row', |     flexDirection: 'row', | ||||||
|     marginHorizontal: StyleConstants.Spacing.Global.PagePadding |     marginHorizontal: StyleConstants.Spacing.Global.PagePadding | ||||||
|   }, |   }, | ||||||
|  |   prefix: { | ||||||
|  |     borderBottomWidth: 1, | ||||||
|  |     ...StyleConstants.FontStyle.M, | ||||||
|  |     paddingRight: StyleConstants.Spacing.XS | ||||||
|  |   }, | ||||||
|   textInput: { |   textInput: { | ||||||
|     flex: 1, |     flex: 1, | ||||||
|     borderBottomWidth: 1, |     borderBottomWidth: 1, | ||||||
|   | |||||||
| @@ -139,7 +139,7 @@ const Timeline: React.FC<Props> = ({ | |||||||
|         ref={customFLRef || flRef} |         ref={customFLRef || flRef} | ||||||
|         scrollEventThrottle={16} |         scrollEventThrottle={16} | ||||||
|         onScroll={onScroll} |         onScroll={onScroll} | ||||||
|         windowSize={10} |         windowSize={7} | ||||||
|         data={flattenData} |         data={flattenData} | ||||||
|         initialNumToRender={6} |         initialNumToRender={6} | ||||||
|         maxToRenderPerBatch={3} |         maxToRenderPerBatch={3} | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| import Button from '@components/Button' | import Button from '@components/Button' | ||||||
| import { StyleConstants } from '@utils/styles/constants' | import { StyleConstants } from '@utils/styles/constants' | ||||||
| import { Video } from 'expo-av' | import { Video } from 'expo-av' | ||||||
| import React, { useCallback, useEffect, useRef, useState } from 'react' | import React, { useCallback, useRef, useState } from 'react' | ||||||
| import { Pressable, StyleSheet, View } from 'react-native' | import { Pressable, StyleSheet, View } from 'react-native' | ||||||
| import { Blurhash } from 'react-native-blurhash' | import { Blurhash } from 'react-native-blurhash' | ||||||
| import attachmentAspectRatio from './aspectRatio' | import attachmentAspectRatio from './aspectRatio' | ||||||
| @@ -54,12 +54,6 @@ const AttachmentVideo: React.FC<Props> = ({ | |||||||
|     }) |     }) | ||||||
|   }, [videoLoaded, videoPosition]) |   }, [videoLoaded, videoPosition]) | ||||||
|  |  | ||||||
|   useEffect(() => { |  | ||||||
|     if (gifv) { |  | ||||||
|       videoPlayer.current?.setIsLoopingAsync(true) |  | ||||||
|     } |  | ||||||
|   }, []) |  | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
|     <View |     <View | ||||||
|       style={[ |       style={[ | ||||||
| @@ -76,7 +70,12 @@ const AttachmentVideo: React.FC<Props> = ({ | |||||||
|         }} |         }} | ||||||
|         usePoster |         usePoster | ||||||
|         {...(gifv |         {...(gifv | ||||||
|           ? { shouldPlay: true, source: { uri: video.url } } |           ? { | ||||||
|  |               shouldPlay: true, | ||||||
|  |               isMuted: true, | ||||||
|  |               isLooping: true, | ||||||
|  |               source: { uri: video.url } | ||||||
|  |             } | ||||||
|           : { |           : { | ||||||
|               resizeMode: 'cover', |               resizeMode: 'cover', | ||||||
|               posterSource: { uri: video.preview_url }, |               posterSource: { uri: video.preview_url }, | ||||||
|   | |||||||
| @@ -34,7 +34,9 @@ const prefetchEmojis = ( | |||||||
|       requestedIndex++ |       requestedIndex++ | ||||||
|     }) |     }) | ||||||
|   }) |   }) | ||||||
|   FastImage.preload(prefetches) |   try { | ||||||
|  |     FastImage.preload(prefetches) | ||||||
|  |   } catch {} | ||||||
| } | } | ||||||
|  |  | ||||||
| const ComposeRoot = React.memo( | const ComposeRoot = React.memo( | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ const ComposeEmojis: React.FC = () => { | |||||||
|         keyExtractor={item => item.shortcode} |         keyExtractor={item => item.shortcode} | ||||||
|         renderSectionHeader={listHeader} |         renderSectionHeader={listHeader} | ||||||
|         renderItem={listItem} |         renderItem={listItem} | ||||||
|         windowSize={3} |         windowSize={2} | ||||||
|       /> |       /> | ||||||
|     </View> |     </View> | ||||||
|   ) |   ) | ||||||
|   | |||||||
| @@ -38,10 +38,8 @@ const TabSharedUsers = React.memo( | |||||||
|  |  | ||||||
|     return ( |     return ( | ||||||
|       <FlatList |       <FlatList | ||||||
|         windowSize={11} |         windowSize={7} | ||||||
|         data={flattenData} |         data={flattenData} | ||||||
|         initialNumToRender={5} |  | ||||||
|         maxToRenderPerBatch={5} |  | ||||||
|         style={styles.flatList} |         style={styles.flatList} | ||||||
|         renderItem={renderItem} |         renderItem={renderItem} | ||||||
|         onEndReached={onEndReached} |         onEndReached={onEndReached} | ||||||
|   | |||||||
| @@ -1,11 +1,14 @@ | |||||||
| import { Audio } from 'expo-av' | import { Audio } from 'expo-av' | ||||||
| import log from "./log" | import log from './log' | ||||||
|  |  | ||||||
| const audio = () => { | const audio = () => { | ||||||
|   log('log', 'audio', 'setting audio playback default options') |   log('log', 'audio', 'setting audio playback default options') | ||||||
|   Audio.setAudioModeAsync({ |   Audio.setAudioModeAsync({ | ||||||
|     playsInSilentModeIOS: true, |     playsInSilentModeIOS: true, | ||||||
|     interruptionModeIOS: 1 |     interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, | ||||||
|  |     interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, | ||||||
|  |     shouldDuckAndroid: true, | ||||||
|  |     playThroughEarpieceAndroid: true | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user