Skip to content

Commit

Permalink
Observe onIneligibleForVoiceToContent events and launch upgrade link
Browse files Browse the repository at this point in the history
  • Loading branch information
zwarm committed Jun 13, 2024
1 parent a1a1063 commit e1c3b3a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ import org.wordpress.android.R
import org.wordpress.android.util.audio.IAudioRecorder.Companion.REQUIRED_RECORDING_PERMISSIONS
import android.provider.Settings
import androidx.compose.material.ExperimentalMaterialApi
import org.wordpress.android.ui.ActivityNavigator
import javax.inject.Inject

@AndroidEntryPoint
class VoiceToContentDialogFragment : BottomSheetDialogFragment() {
@Inject
lateinit var activityNavigator: ActivityNavigator

private val viewModel: VoiceToContentViewModel by viewModels()

@ExperimentalMaterialApi
Expand Down Expand Up @@ -49,6 +54,10 @@ class VoiceToContentDialogFragment : BottomSheetDialogFragment() {
viewModel.dismiss.observe(viewLifecycleOwner) {
dismiss()
}

viewModel.onIneligibleForVoiceToContent.observe(viewLifecycleOwner) { url ->
launchIneligibleForVoiceToContent(url)
}
}

private val requestMultiplePermissionsLauncher = registerForActivityResult(
Expand Down Expand Up @@ -84,6 +93,12 @@ class VoiceToContentDialogFragment : BottomSheetDialogFragment() {
.show()
}

private fun launchIneligibleForVoiceToContent(url: String) {
context?.let {
activityNavigator.openIneligibleForVoiceToContent(it, url)
}
}

companion object {
const val TAG = "voice_to_content_fragment_tag"

Expand Down

0 comments on commit e1c3b3a

Please sign in to comment.