-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1987 from PaulWoitaschek/onboarding
Add an Onboarding
- Loading branch information
Showing
48 changed files
with
1,344 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package voice.app | ||
|
||
import androidx.datastore.core.DataStore | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.runBlocking | ||
import voice.common.navigation.Destination | ||
import voice.common.pref.OnboardingCompleted | ||
import voice.data.folders.AudiobookFolders | ||
import javax.inject.Inject | ||
|
||
class StartDestinationProvider | ||
@Inject constructor( | ||
@OnboardingCompleted | ||
private val onboardingCompleted: DataStore<Boolean>, | ||
private val audiobookFolders: AudiobookFolders, | ||
) { | ||
|
||
operator fun invoke(): Destination.Compose { | ||
return runBlocking { | ||
if (showOnboarding()) { | ||
Destination.OnboardingWelcome | ||
} else { | ||
Destination.BookOverview | ||
} | ||
} | ||
} | ||
|
||
private suspend fun showOnboarding(): Boolean { | ||
return when { | ||
onboardingCompleted.data.first() -> false | ||
audiobookFolders.hasAnyFolders() -> false | ||
else -> true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.