Skip to content

Commit

Permalink
Change: use in-app youtube player only if official youtube app is onl…
Browse files Browse the repository at this point in the history
…y detected app
  • Loading branch information
mateuszkwiecinski committed Feb 5, 2022
1 parent 88f4101 commit 4fdb714
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/framework/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<queries>
<package android:name="com.google.android.youtube" />
<package android:name="com.vanced.android.youtube" />
<package android:name="org.schabi.newpipe" />

<package android:name="com.google.android.apps.authenticator2" />
<package android:name="com.authy.authy" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private fun knownAppId(app: ExternalApp) =
when (app) {
YoutubeApp.Official -> "com.google.android.youtube"
YoutubeApp.Vanced -> "com.vanced.android.youtube"
YoutubeApp.NewPipe -> "org.schabi.newpipe"
AuthenticatorApp.Google -> "com.google.android.apps.authenticator2"
AuthenticatorApp.Microsoft -> "com.azure.authenticator"
AuthenticatorApp.Authy -> "com.authy.authy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ sealed interface ExternalApp
enum class YoutubeApp : ExternalApp {
Official,
Vanced,
NewPipe,
}

enum class AuthenticatorApp : ExternalApp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ internal class GetMediaPreferences @Inject constructor(
appStorage.get(UserSettings.useYoutubePlayer)
.flatMapLatest { savedValue ->
if (savedValue == null) {
appGateway.getInstalledYoutubeApps().map { it.contains(YoutubeApp.Official) }
appGateway.getInstalledYoutubeApps()
.map { apps -> apps.singleOrNull() == YoutubeApp.Official }
} else {
flowOf(savedValue)
}
Expand Down

0 comments on commit 4fdb714

Please sign in to comment.