Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[av] audio: refactor interruption modes to enums, export missing type #16145

Merged
merged 6 commits into from
Feb 9, 2022

Conversation

Simek
Copy link
Collaborator

@Simek Simek commented Jan 31, 2022

Why

This PR starts the effort to prepare the Audio module for the docs autogeneration.

There will be more breaking changes to come in the future PRs, see:

How

The first parts refactors the interruption modes constants to the newly added InterruptionModeAndroid and InterruptionModeIOS enum types.

I have also spotted during fixes for NCL screens, that AudioMode type is not properly exported by av package, which forced users to define those object types manually. This problem also has been fixed, and for the clarity, I have moved all the Audio related types to the new Audio.types.ts file.

Test Plan

yarn and yarn lint commands ended with a success.

NCL apps build and runs on the iOS device. Audio screen are working as expected.

Checklist

  • Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
  • This diff will work correctly for expo build (eg: updated @expo/xdl).
  • This diff will work correctly for expo prebuild & EAS Build (eg: updated a module plugin).

[ncl] fix and improve Audio screens after changes
@Simek Simek requested a review from bbarthec as a code owner January 31, 2022 17:36
@Simek Simek requested a review from tsapeta January 31, 2022 17:36
@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jan 31, 2022
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jan 31, 2022
Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful work 👏

packages/expo-av/src/index.ts Outdated Show resolved Hide resolved
@Simek Simek merged commit 8f746ee into expo:main Feb 9, 2022
@Simek Simek deleted the av-audio-types-changes branch February 9, 2022 11:43
@Kudo Kudo mentioned this pull request Feb 14, 2022
10 tasks
@lpgm
Copy link

lpgm commented May 11, 2022

Hello. Could you help?

So what do I need to put now if I've got this at the moment:

interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX

@Simek
Copy link
Collaborator Author

Simek commented May 11, 2022

Hi @lpgm, you need to use InterruptionModeIOS exported from av:

import { InterruptionModeIOS } from 'expo-av';
interruptionModeIOS: InterruptionModeIOS.DoNotMix;

Also it looks like Audio docs are not updated yet, I will look into that soon. 🙂

However, this change has been mentioned in package changelog, where the current enum names were listed:

@lpgm
Copy link

lpgm commented May 11, 2022

Thanks a lot, @Simek . I was directed to that changelog, but I wasn't sure about the format of what was needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants