Skip to content

Commit

Permalink
feat: 共有されるリンクを対応しているインスタンスの種別に応じて返すようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Jan 4, 2024
1 parent 463079d commit 8cec0bb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import net.pantasystem.milktea.common.Logger
import net.pantasystem.milktea.model.account.Account
import net.pantasystem.milktea.model.account.AccountRepository
import net.pantasystem.milktea.model.account.CurrentAccountWatcher
import net.pantasystem.milktea.model.account.page.Pageable
Expand Down Expand Up @@ -127,7 +128,10 @@ class NoteDetailViewModel @Inject constructor(

suspend fun getUrl(): String {
val account = currentAccountWatcher.getAccount()
return "${account.normalizedInstanceUri}/notes/${pageable.noteId}"
return when(account.instanceType) {
Account.InstanceType.MISSKEY, Account.InstanceType.FIREFISH -> "${account.normalizedInstanceUri}/notes/${pageable.noteId}"
Account.InstanceType.PLEROMA, Account.InstanceType.MASTODON -> "${account.normalizedInstanceUri}/web/statuses/${pageable.noteId}"
}
}


Expand Down

0 comments on commit 8cec0bb

Please sign in to comment.