mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
Merge pull request #6382 from Bnyro/master
feat: use watch position as timestamp when sharing
This commit is contained in:
commit
f30a37fab6
@ -82,7 +82,7 @@ class ShareDialog : DialogFragment() {
|
||||
binding.timeStamp.addTextChangedListener {
|
||||
binding.linkPreview.text = generateLinkText(binding, customInstanceUrl)
|
||||
}
|
||||
binding.timeStamp.setText((shareData.currentPosition ?: 0L).toString())
|
||||
binding.timeStamp.setText((shareData.currentPosition ?: getWatchPosition(id) ?: 0L).toString())
|
||||
if (binding.timeCodeSwitch.isChecked) {
|
||||
binding.timeStampInputLayout.isVisible = true
|
||||
}
|
||||
@ -145,6 +145,10 @@ class ShareDialog : DialogFragment() {
|
||||
return url
|
||||
}
|
||||
|
||||
private fun getWatchPosition(videoId: String) = runBlocking {
|
||||
Database.watchPositionDao().findById(videoId)
|
||||
}?.position?.div(1000)
|
||||
|
||||
companion object {
|
||||
const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
||||
const val YOUTUBE_SHORT_URL = "https://youtu.be"
|
||||
|
Loading…
Reference in New Issue
Block a user