Skip to content

Commit

Permalink
Merge branch 'develop' into fix.commonmark-parser-code-block
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlsilva authored Feb 22, 2024
2 parents ac9dce3 + 06b8910 commit d2fbdc1
Show file tree
Hide file tree
Showing 145 changed files with 21,672 additions and 10,080 deletions.
27 changes: 25 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:

macos: &macos
macos:
xcode: "14.2.0"
xcode: "15.2.0"
resource_class: macos.m1.medium.gen1

bash-env: &bash-env
Expand Down Expand Up @@ -54,7 +54,6 @@ save-gems-cache: &save-gems-cache
update-fastlane-ios: &update-fastlane-ios
name: Update Fastlane
command: |
echo "ruby-2.7.7" > ~/.ruby-version
bundle install
working_directory: ios

Expand All @@ -78,6 +77,27 @@ restore_cache: &restore-gradle-cache
# COMMANDS
commands:

manage-ruby:
description: "Manage ruby version"
steps:
- restore_cache:
name: Restore ruby
key: ruby-v2-{{ checksum ".ruby-version" }}
- run:
name: Install ruby
command: |
echo "ruby-2.7.7" > ~/.ruby-version
if [ -d ~/.rbenv/versions/2.7.7 ]; then
echo "Ruby already installed"
else
rbenv install 2.7.7
fi
- save_cache:
name: Save ruby cache
key: ruby-v2-{{ checksum ".ruby-version" }}
paths:
- ~/.rbenv/versions/2.7.7

manage-pods:
description: "Restore/Get/Save cache of pods libs"
steps:
Expand Down Expand Up @@ -204,6 +224,7 @@ commands:
- checkout
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- manage-ruby
- run: *install-npm-modules
- run: *update-fastlane-ios
- manage-pods
Expand Down Expand Up @@ -328,6 +349,7 @@ commands:
at: ios
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- manage-ruby
- run: *install-npm-modules
- run: *update-fastlane-ios
- manage-pods
Expand Down Expand Up @@ -575,6 +597,7 @@ jobs:
- checkout
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- manage-ruby
- run: *install-npm-modules
- run: *update-fastlane-ios
- save_cache: *save-npm-cache-mac
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/organize_translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: organize translations

on:
push:
paths:
- 'app/i18n/locales/**.json'

jobs:
organize-and-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Run script to organize JSON keys
run: node scripts/organize-translations.js

- name: Get changed files
id: git-check
uses: tj-actions/changed-files@v42
with:
files: |
**.json
- name: List all changed files
if: steps.git-check.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.git-check.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Commit and push if changes
if: steps.git-check.outputs.any_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
message: 'action: organized translations'

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

40 changes: 24 additions & 16 deletions app/containers/AudioPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import styles from './styles';
import Seek from './Seek';
import PlaybackSpeed from './PlaybackSpeed';
import PlayButton from './PlayButton';
import EventEmitter from '../../lib/methods/helpers/events';
import audioPlayer, { AUDIO_FOCUSED } from '../../lib/methods/audioPlayer';
import AudioManager from '../../lib/methods/AudioManager';
import { AUDIO_PLAYBACK_SPEED, AVAILABLE_SPEEDS } from './constants';
import { TDownloadState } from '../../lib/methods/handleMediaDownload';
import { emitter } from '../../lib/methods/helpers';
import { TAudioState } from './types';
import { useUserPreferences } from '../../lib/methods';

Expand Down Expand Up @@ -86,23 +86,23 @@ const AudioPlayer = ({
};

const setPosition = async (time: number) => {
await audioPlayer.setPositionAsync(audioUri.current, time);
await AudioManager.setPositionAsync(audioUri.current, time);
};

const togglePlayPause = async () => {
try {
if (!paused) {
await audioPlayer.pauseAudio(audioUri.current);
await AudioManager.pauseAudio();
} else {
await audioPlayer.playAudio(audioUri.current);
await AudioManager.playAudio(audioUri.current);
}
} catch {
// Do nothing
}
};

useEffect(() => {
audioPlayer.setRateAsync(audioUri.current, playbackSpeed);
AudioManager.setRateAsync(audioUri.current, playbackSpeed);
}, [playbackSpeed]);

const onPress = () => {
Expand All @@ -116,11 +116,13 @@ const AudioPlayer = ({
};

useEffect(() => {
InteractionManager.runAfterInteractions(async () => {
audioUri.current = await audioPlayer.loadAudio({ msgId, rid, uri: fileUri });
audioPlayer.setOnPlaybackStatusUpdate(audioUri.current, onPlaybackStatusUpdate);
audioPlayer.setRateAsync(audioUri.current, playbackSpeed);
});
if (fileUri) {
InteractionManager.runAfterInteractions(async () => {
audioUri.current = await AudioManager.loadAudio({ msgId, rid, uri: fileUri });
AudioManager.setOnPlaybackStatusUpdate(audioUri.current, onPlaybackStatusUpdate);
AudioManager.setRateAsync(audioUri.current, playbackSpeed);
});
}
}, [fileUri]);

useEffect(() => {
Expand All @@ -133,20 +135,26 @@ const AudioPlayer = ({

useEffect(() => {
const unsubscribeFocus = navigation.addListener('focus', () => {
audioPlayer.setOnPlaybackStatusUpdate(audioUri.current, onPlaybackStatusUpdate);
AudioManager.setOnPlaybackStatusUpdate(audioUri.current, onPlaybackStatusUpdate);
AudioManager.addAudioRendered(audioUri.current);
});
const unsubscribeBlur = navigation.addListener('blur', () => {
AudioManager.removeAudioRendered(audioUri.current);
});

return () => {
unsubscribeFocus();
unsubscribeBlur();
};
}, [navigation]);

useEffect(() => {
const listener = EventEmitter.addEventListener(AUDIO_FOCUSED, ({ audioFocused }: { audioFocused: string }) => {
setFocused(audioFocused === audioUri.current);
});
const audioFocusedEventHandler = (audioFocused: string) => {
setFocused(!!audioFocused && audioFocused === audioUri.current);
};
emitter.on('audioFocused', audioFocusedEventHandler);
return () => {
EventEmitter.removeListener(AUDIO_FOCUSED, listener);
emitter.off('audioFocused', audioFocusedEventHandler);
};
}, []);

Expand Down
Loading

0 comments on commit d2fbdc1

Please sign in to comment.