fix sharing channels

This commit is contained in:
Bnyro 2022-10-14 12:25:43 +02:00
parent 899e7b78a0
commit 206a24ad7d
3 changed files with 6 additions and 8 deletions

View File

@ -117,8 +117,6 @@ class CommentsAdapter(
Toast.makeText(root.context, R.string.copied, Toast.LENGTH_SHORT).show()
true
}
// if (isRepliesAdapter && comments)
}
}

View File

@ -32,9 +32,9 @@ class ShareDialog(
// add instanceUrl option if custom instance frontend url available
if (instanceUrl != "") shareOptions += getString(R.string.instance)
if (position != null) {
if (shareObjectType == ShareObjectType.VIDEO && position != null) {
binding = DialogShareBinding.inflate(layoutInflater)
binding!!.timeCodeSwitch.isChecked = PreferenceHelper.getBoolean(
binding?.timeCodeSwitch?.isChecked = PreferenceHelper.getBoolean(
PreferenceKeys.SHARE_WITH_TIME_CODE,
true
)
@ -51,14 +51,14 @@ class ShareDialog(
// only available for custom instances
else -> instanceUrl
}
var path = when (shareObjectType) {
val path = when (shareObjectType) {
ShareObjectType.VIDEO -> "/watch?v=$id"
ShareObjectType.PLAYLIST -> "/playlist?list=$id"
else -> "/c/$id"
else -> "/channel/$id"
}
var url = "$host$path"
if (binding != null && binding!!.timeCodeSwitch.isChecked) {
if (shareObjectType == ShareObjectType.VIDEO && binding!!.timeCodeSwitch.isChecked) {
url += "&t=$position"
}

View File

@ -127,7 +127,7 @@ class ChannelFragment : BaseFragment() {
}
binding.channelShare.setOnClickListener {
val shareDialog = ShareDialog(response.name!!, ShareObjectType.CHANNEL)
val shareDialog = ShareDialog(response.id!!.toID(), ShareObjectType.CHANNEL)
shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
}
}