mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
feat: use watch position as timestamp when sharing
This commit is contained in:
parent
83f0823535
commit
f45eef43e4
@ -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…
x
Reference in New Issue
Block a user