Merge pull request #1554 from Bnyro/master

fix sharing channels
This commit is contained in:
Bnyro 2022-10-14 12:26:30 +02:00 committed by GitHub
commit 493ac68ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() Toast.makeText(root.context, R.string.copied, Toast.LENGTH_SHORT).show()
true true
} }
// if (isRepliesAdapter && comments)
} }
} }

View File

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

View File

@ -127,7 +127,7 @@ class ChannelFragment : BaseFragment() {
} }
binding.channelShare.setOnClickListener { 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) shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
} }
} }