파이어베이스 다이나믹 링크 제거

This commit is contained in:
klaus 2025-03-02 15:50:02 +09:00
parent fb60574f3d
commit 9cef92199d
10 changed files with 10 additions and 363 deletions

View File

@ -139,7 +139,6 @@ dependencies {
// Firebase // Firebase
implementation platform('com.google.firebase:firebase-bom:32.2.2') implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-dynamic-links-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx' implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-messaging-ktx' implementation 'com.google.firebase:firebase-messaging-ktx'

View File

@ -122,6 +122,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
viewModel.getAudioContentDetail(audioContentId = audioContentId) { finish() } viewModel.getAudioContentDetail(audioContentId = audioContentId) { finish() }
} }
@SuppressLint("UnspecifiedRegisterReceiverFlag")
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
val intentFilter = IntentFilter(Constants.ACTION_AUDIO_CONTENT_RECEIVER) val intentFilter = IntentFilter(Constants.ACTION_AUDIO_CONTENT_RECEIVER)
@ -775,20 +776,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
} }
binding.tvShare.visibility = View.VISIBLE binding.tvShare.visibility = View.VISIBLE
binding.tvShare.setOnClickListener { binding.tvShare.setOnClickListener {}
viewModel.shareAudioContent(
audioContentId = audioContentId,
contentImage = response.coverImageUrl,
contentTitle = "${response.title} - ${response.creator.nickname}"
) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "오디오콘텐츠 공유")
startActivity(shareIntent)
}
}
} else { } else {
binding.svActionButtons.visibility = View.GONE binding.svActionButtons.visibility = View.GONE
binding.llLike.visibility = View.GONE binding.llLike.visibility = View.GONE

View File

@ -1,16 +1,7 @@
package kr.co.vividnext.sodalive.audio_content.detail package kr.co.vividnext.sodalive.audio_content.detail
import android.net.Uri
import androidx.core.net.toUri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.google.firebase.dynamiclinks.ShortDynamicLink
import com.google.firebase.dynamiclinks.ktx.androidParameters
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
import com.google.firebase.dynamiclinks.ktx.iosParameters
import com.google.firebase.dynamiclinks.ktx.shortLinkAsync
import com.google.firebase.dynamiclinks.ktx.socialMetaTagParameters
import com.google.firebase.ktx.Firebase
import com.orhanobut.logger.Logger import com.orhanobut.logger.Logger
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
@ -139,72 +130,6 @@ class AudioContentDetailViewModel(
) )
} }
fun registerNotification(contentId: Long, creatorId: Long) {
isLoading.value = true
compositeDisposable.add(
repository.registerNotification(
creatorId,
"Bearer ${SharedPreferenceManager.token}"
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
if (it.success && it.data != null) {
getAudioContentDetail(contentId)
} else {
if (it.message != null) {
_toastLiveData.postValue(it.message)
} else {
_toastLiveData.postValue(
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
)
}
}
isLoading.value = false
},
{
isLoading.value = false
it.message?.let { message -> Logger.e(message) }
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
}
)
)
}
fun unRegisterNotification(contentId: Long, creatorId: Long) {
isLoading.value = true
compositeDisposable.add(
repository.unRegisterNotification(
creatorId,
"Bearer ${SharedPreferenceManager.token}"
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
if (it.success && it.data != null) {
getAudioContentDetail(contentId)
} else {
if (it.message != null) {
_toastLiveData.postValue(it.message)
} else {
_toastLiveData.postValue(
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
)
}
}
isLoading.value = false
},
{
isLoading.value = false
it.message?.let { message -> Logger.e(message) }
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
}
)
)
}
fun toggleExpandDetail() { fun toggleExpandDetail() {
_isExpandDetail.value = !_isExpandDetail.value!! _isExpandDetail.value = !_isExpandDetail.value!!
} }
@ -371,40 +296,6 @@ class AudioContentDetailViewModel(
) )
} }
fun shareAudioContent(
audioContentId: Long,
contentImage: String,
contentTitle: String,
onSuccess: (String) -> Unit
) {
isLoading.value = true
Firebase.dynamicLinks.shortLinkAsync(ShortDynamicLink.Suffix.SHORT) {
link = Uri.parse("https://sodalive.net/?audio_content_id=$audioContentId")
domainUriPrefix = "https://sodalive.page.link"
androidParameters { }
iosParameters("kr.co.vividnext.sodalive") {
appStoreId = "6461721697"
}
socialMetaTagParameters {
title = contentTitle
description = "지금 보이스온에서 이 콘텐츠 감상하기"
imageUrl = contentImage.toUri()
}
}.addOnSuccessListener {
val uri = it.shortLink
if (uri != null) {
val message = uri.toString()
onSuccess(message)
} else {
_toastLiveData.postValue("공유링크를 생성하지 못했습니다.\n다시 시도해 주세요.")
}
}.addOnFailureListener {
_toastLiveData.postValue("공유링크를 생성하지 못했습니다.\n다시 시도해 주세요.")
}.addOnCompleteListener {
isLoading.value = false
}
}
fun deleteAudioContent(audioContentId: Long, onSuccess: () -> Unit) { fun deleteAudioContent(audioContentId: Long, onSuccess: () -> Unit) {
isLoading.value = true isLoading.value = true

View File

@ -116,16 +116,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
binding.ivMenu, binding.ivMenu,
) )
} }
binding.layoutUserProfile.ivShare.setOnClickListener { binding.layoutUserProfile.ivShare.setOnClickListener {}
viewModel.shareChannel(userId = userId) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "채널 공유")
startActivity(shareIntent)
}
}
setupLiveView() setupLiveView()
setupDonationView() setupDonationView()
@ -621,7 +612,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
binding.tvContentCount.text = activitySummary.contentCount.moneyFormat() binding.tvContentCount.text = activitySummary.contentCount.moneyFormat()
} }
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged", "SetTextI18n")
private fun setCheers(cheers: GetCheersResponse) { private fun setCheers(cheers: GetCheersResponse) {
binding.layoutUserProfileFanTalk.etCheer.setText("") binding.layoutUserProfileFanTalk.etCheer.setText("")
cheersAdapter.items.clear() cheersAdapter.items.clear()

View File

@ -1,14 +1,7 @@
package kr.co.vividnext.sodalive.explorer.profile package kr.co.vividnext.sodalive.explorer.profile
import android.net.Uri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.google.firebase.dynamiclinks.ShortDynamicLink
import com.google.firebase.dynamiclinks.ktx.androidParameters
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
import com.google.firebase.dynamiclinks.ktx.iosParameters
import com.google.firebase.dynamiclinks.ktx.shortLinkAsync
import com.google.firebase.ktx.Firebase
import com.orhanobut.logger.Logger import com.orhanobut.logger.Logger
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
@ -181,39 +174,6 @@ class UserProfileViewModel(
) )
} }
fun unFollow(creatorId: Long) {
_isLoading.value = true
compositeDisposable.add(
userRepository.creatorUnFollow(
creatorId,
"Bearer ${SharedPreferenceManager.token}"
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
if (it.success && it.data != null) {
getCreatorProfile(creatorId)
} else {
if (it.message != null) {
_toastLiveData.postValue(it.message)
} else {
_toastLiveData.postValue(
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
)
}
}
_isLoading.value = false
},
{
_isLoading.value = false
it.message?.let { message -> Logger.e(message) }
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
}
)
)
}
fun writeCheers(parentCheersId: Long? = null, creatorId: Long, cheersContent: String) { fun writeCheers(parentCheersId: Long? = null, creatorId: Long, cheersContent: String) {
if (cheersContent.isBlank()) { if (cheersContent.isBlank()) {
_toastLiveData.postValue("내용을 입력하세요") _toastLiveData.postValue("내용을 입력하세요")
@ -306,27 +266,6 @@ class UserProfileViewModel(
) )
} }
fun shareChannel(userId: Long, onSuccess: (String) -> Unit) {
_isLoading.value = true
Firebase.dynamicLinks.shortLinkAsync(ShortDynamicLink.Suffix.SHORT) {
link = Uri.parse("https://sodalive.net/?channel_id=$userId")
domainUriPrefix = "https://sodalive.page.link"
androidParameters { }
iosParameters("kr.co.vividnext.sodalive") {
appStoreId = "6461721697"
}
}.addOnSuccessListener {
val uri = it.shortLink
if (uri != null) {
onSuccess("보이스온 ${creatorNickname}님의 채널입니다.\n$uri")
}
}.addOnFailureListener {
_toastLiveData.postValue("공유링크를 생성하지 못했습니다.\n다시 시도해 주세요.")
}.addOnCompleteListener {
_isLoading.value = false
}
}
fun userBlock(userId: Long) { fun userBlock(userId: Long) {
_isLoading.value = true _isLoading.value = true
compositeDisposable.add( compositeDisposable.add(

View File

@ -1001,20 +1001,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
binding.ivEdit.visibility = View.GONE binding.ivEdit.visibility = View.GONE
} }
binding.ivShare.setOnClickListener { binding.ivShare.setOnClickListener {}
viewModel.shareRoomLink(
response.roomId,
response.isPrivateRoom,
response.password
) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "라이브 공유")
startActivity(shareIntent)
}
}
if (response.creatorId == SharedPreferenceManager.userId) { if (response.creatorId == SharedPreferenceManager.userId) {
binding.llViewUsers.visibility = View.VISIBLE binding.llViewUsers.visibility = View.VISIBLE

View File

@ -3,12 +3,6 @@ package kr.co.vividnext.sodalive.live.room
import android.net.Uri import android.net.Uri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.google.firebase.dynamiclinks.ShortDynamicLink
import com.google.firebase.dynamiclinks.ktx.androidParameters
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
import com.google.firebase.dynamiclinks.ktx.iosParameters
import com.google.firebase.dynamiclinks.ktx.shortLinkAsync
import com.google.firebase.ktx.Firebase
import com.google.gson.Gson import com.google.gson.Gson
import com.orhanobut.logger.Logger import com.orhanobut.logger.Logger
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
@ -301,43 +295,6 @@ class LiveRoomViewModel(
) )
} }
fun shareRoomLink(
roomId: Long,
isPrivateRoom: Boolean,
password: String?,
onSuccess: (String) -> Unit
) {
_isLoading.value = true
Firebase.dynamicLinks.shortLinkAsync(ShortDynamicLink.Suffix.SHORT) {
link = Uri.parse("https://sodalive.net/?room_id=$roomId")
domainUriPrefix = "https://sodalive.page.link"
androidParameters { }
iosParameters("kr.co.vividnext.sodalive") {
appStoreId = "6461721697"
}
}.addOnSuccessListener {
val uri = it.shortLink
if (uri != null) {
val message = if (isPrivateRoom) {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 비공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $uri\n" +
"(입장 비밀번호 : $password)"
} else {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $uri"
}
onSuccess(message)
}
}.addOnFailureListener {
_toastLiveData.postValue("공유링크를 생성하지 못했습니다.\n다시 시도해 주세요.")
}.addOnCompleteListener {
_isLoading.value = false
}
}
fun creatorFollow(creatorId: Long, roomId: Long, isGetUserProfile: Boolean = false) { fun creatorFollow(creatorId: Long, roomId: Long, isGetUserProfile: Boolean = false) {
_isLoading.value = true _isLoading.value = true
compositeDisposable.add( compositeDisposable.add(

View File

@ -349,17 +349,5 @@ class LiveRoomDetailFragment(
} }
private fun shareRoom(response: GetRoomDetailResponse) { private fun shareRoom(response: GetRoomDetailResponse) {
viewModel.shareRoomLink(
response.roomId,
response.isPrivateRoom,
response.password
) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "라이브 공유")
startActivity(shareIntent)
}
} }
} }

View File

@ -1,14 +1,7 @@
package kr.co.vividnext.sodalive.live.room.detail package kr.co.vividnext.sodalive.live.room.detail
import android.net.Uri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.google.firebase.dynamiclinks.ShortDynamicLink
import com.google.firebase.dynamiclinks.ktx.androidParameters
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
import com.google.firebase.dynamiclinks.ktx.iosParameters
import com.google.firebase.dynamiclinks.ktx.shortLinkAsync
import com.google.firebase.ktx.Firebase
import com.orhanobut.logger.Logger import com.orhanobut.logger.Logger
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
@ -63,41 +56,4 @@ class LiveRoomDetailViewModel(private val repository: LiveRepository) : BaseView
) )
) )
} }
fun shareRoomLink(
roomId: Long,
isPrivateRoom: Boolean,
password: Int?,
onSuccess: (String) -> Unit
) {
_isLoading.value = true
Firebase.dynamicLinks.shortLinkAsync(ShortDynamicLink.Suffix.SHORT) {
link = Uri.parse("https://sodalive.net/?room_id=$roomId")
domainUriPrefix = "https://sodalive.page.link"
androidParameters { }
iosParameters("kr.co.vividnext.sodalive") {
appStoreId = "6461721697"
}
}.addOnSuccessListener {
val uri = it.shortLink
if (uri != null) {
val message = if (isPrivateRoom) {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 비공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $uri\n" +
"(입장 비밀번호 : $password)"
} else {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $uri"
}
onSuccess(message)
}
}.addOnFailureListener {
_toastLiveData.postValue("공유링크를 생성하지 못했습니다.\n다시 시도해 주세요.")
}.addOnCompleteListener {
_isLoading.value = false
}
}
} }

View File

@ -9,10 +9,7 @@ import android.os.Looper
import android.widget.ImageView import android.widget.ImageView
import androidx.annotation.OptIn import androidx.annotation.OptIn
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.os.bundleOf
import androidx.media3.common.util.UnstableApi import androidx.media3.common.util.UnstableApi
import com.google.firebase.dynamiclinks.PendingDynamicLinkData
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
import com.google.firebase.remoteconfig.ktx.get import com.google.firebase.remoteconfig.ktx.get
import com.google.firebase.remoteconfig.ktx.remoteConfig import com.google.firebase.remoteconfig.ktx.remoteConfig
@ -98,7 +95,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
} }
} }
} else { } else {
checkFirebaseDynamicLink() startNextActivity()
} }
} }
} }
@ -121,10 +118,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
} else if (latestMajor == major && latestMinor == minor && latestPatch > patch) { } else if (latestMajor == major && latestMinor == minor && latestPatch > patch) {
showUpdateDialog(isEssential = false) showUpdateDialog(isEssential = false)
} else { } else {
checkFirebaseDynamicLink() startNextActivity()
} }
} else { } else {
checkFirebaseDynamicLink() startNextActivity()
} }
} }
@ -136,7 +133,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
} }
val cancelButtonClick = if (!isEssential) { val cancelButtonClick = if (!isEssential) {
{ checkFirebaseDynamicLink() } { startNextActivity() }
} else { } else {
null null
} }
@ -165,49 +162,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
).show(screenWidth) ).show(screenWidth)
} }
private fun checkFirebaseDynamicLink() { private fun startNextActivity() {
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener(this) { getDynamicLinkSuccess(it) }
.addOnFailureListener(this) { getDynamicLinkFailure() }
}
private fun getDynamicLinkSuccess(pendingDynamicLinkData: PendingDynamicLinkData?) {
var deepLink: Uri? = null
if (pendingDynamicLinkData != null) {
deepLink = pendingDynamicLinkData.link
}
val extras = if (deepLink != null) {
val roomIdString = deepLink.getQueryParameter("room_id")
val channelIdString = deepLink.getQueryParameter("channel_id")
val audioContentIdString = deepLink.getQueryParameter("audio_content_id")
if (roomIdString != null) {
bundleOf(
Constants.EXTRA_ROOM_ID to roomIdString.toLong()
)
} else if (channelIdString != null) {
bundleOf(
Constants.EXTRA_USER_ID to channelIdString.toLong()
)
} else if (audioContentIdString != null) {
bundleOf(
Constants.EXTRA_AUDIO_CONTENT_ID to audioContentIdString.toLong()
)
} else {
null
}
} else if (intent.extras != null) {
intent.extras
} else {
null
}
startNextActivity(extras = extras)
}
private fun getDynamicLinkFailure() {
val extras = intent.getBundleExtra(Constants.EXTRA_DATA) val extras = intent.getBundleExtra(Constants.EXTRA_DATA)
?: if (intent.extras != null) { ?: if (intent.extras != null) {
intent.extras intent.extras
@ -215,10 +170,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
null null
} }
startNextActivity(extras = extras)
}
private fun startNextActivity(extras: Bundle? = null) {
if (SharedPreferenceManager.isViewedOnboardingTutorial) { if (SharedPreferenceManager.isViewedOnboardingTutorial) {
if (SharedPreferenceManager.token.isBlank()) { if (SharedPreferenceManager.token.isBlank()) {
showLoginActivity(extras) showLoginActivity(extras)