feat:分享邀请支持动态配置:标题、图片

This commit is contained in:
Max
2024-03-14 19:08:22 +08:00
parent d4f65da89e
commit 74a7ccecfc
3 changed files with 13 additions and 6 deletions

View File

@@ -80,16 +80,17 @@ class ShareInviteDialog(val data: ShareInviteInfo) : BottomSheetDialogFragment()
private fun share(platform: Platform, data: ShareInviteInfo) {
val url = data.toUrl
val sp = Platform.ShareParams()
sp.imageUrl = data.shareImg
when (platform.name) {
Facebook.NAME -> {
sp.title = data.shareText
sp.title = data.shareTitle
sp.text = data.shareText
sp.url = url
sp.shareType = Platform.SHARE_WEBPAGE
}
Line.NAME -> {
sp.text = "${data.shareText}[$url]"
sp.text = "${data.shareTitle}[$url]"
}
}

View File

@@ -18,6 +18,10 @@ data class ShareInviteInfo(
val text: String? = null,
// 分享文案
val shareText: String? = null,
// 分享图片
val shareImg: String? = null,
// 分享标题
val shareTitle: String? = null,
// 跳转网页地址
val toUrl: String? = null,
// 1分享2保存

View File

@@ -223,7 +223,7 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
private fun debug() {
// CommonWebViewActivity.start(
// this,
// "http://192.168.19.136:5502/view/peko/activity/2024-invitationFission/index.html"
// "http://192.168.19.136:5502/view/peko/activity/2024-invitationFission/share.html"
// )
val qrcodeUrl =
"https://img0.baidu.com/it/u=4220524728,2310074610&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1710349200&t=39faa005691f3ebde5b8bf2b99708f1b"
@@ -231,11 +231,13 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
qrCodeUrl = qrcodeUrl,
invitationCode = Random.nextInt().toString(),
text = "扫码下载PiKO并填写我的邀请码立得1000钻石!!",
shareText = null,
shareTitle = "分享标题",
shareText = "分享文本",
shareImg = qrcodeUrl,
toUrl = "https://www.baidu.com",
)
InviteImageHelper().saveToAlbum(this, rxPermissions, data)
// ShareInviteDialog(data).show(supportFragmentManager, "A")
// InviteImageHelper().saveToAlbum(this, rxPermissions, data)
ShareInviteDialog(data).show(supportFragmentManager, "A")
// val json = "{\"data\":{\"diamonds\":225000,\"itemId\":32,\"itemMultiple\":45,\"nick\":\"XG001\",\"roomUid\":2881,\"uid\":2881},\"first\":95,\"second\":955}"
// RedPackageOpenDialog2().show(this)
// val json = "{\"first\":85,\"second\":855,\"data\":{\"nick\":\"66丢丢丢丢丢多多多的hhhh\",\"preVipName\":\"子爵\",\"floatPic\":\"https://image.hfighting.com/Fq3JtbK2acO3FN-3vWZo8ldtHfse\",\"uid\":2735,\"currVipName\":\"侯爵\",\"erbanNo\":66,\"roomUid\":2734,\"avatar\":\"https://img.pekolive.com/default_avatar.png\",\"currVipLevel\":5}}"