add custom url schema web+activitypub://post/{encoded post URI}

This commit is contained in:
tateisu 2023-02-17 02:52:22 +09:00
parent efcf888b93
commit 55965dd654
2 changed files with 27 additions and 0 deletions

View File

@ -136,6 +136,17 @@
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="post"
android:scheme="web+activitypub" />
</intent-filter>
<!-- https://mstdn.kemono-friends.info/users/tocchi/updates/695489 -->
<!-- URLの数字部分はstatus_id「ではない」ようだ。謎なのでまだ対応できない。。。 -->
<!--<intent-filter>-->

View File

@ -68,6 +68,22 @@ fun ActMain.handleIntentUri(uri: Uri) {
fun ActMain.handleOtherUri(uri: Uri): Boolean {
val url = uri.toString()
if( uri.scheme == "web+activitypub" && uri.authority == "post"){
val postUri = uri.pathSegments?.elementAtOrNull(0)
log.i("postUri=$postUri")
if(!postUri.isNullOrEmpty()){
conversationOtherInstance(
pos = defaultInsertPosition,
urlArg = postUri,
statusIdOriginal = null,
hostAccess = null,
statusIdAccess = null,
isReference =false,
)
return true
}
}
url.findStatusIdFromUrl()?.let { statusInfo ->
// ステータスをアプリ内で開く
conversationOtherInstance(