Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PolycentricAndroid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoStreaming
PolycentricAndroid
Commits
ae36bbd9
Commit
ae36bbd9
authored
1 year ago
by
Koen
Browse files
Options
Downloads
Patches
Plain Diff
Implemented new claim types.
parent
fff2157d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/com/futo/polycentric/core/Claims.kt
+121
-10
121 additions, 10 deletions
app/src/main/java/com/futo/polycentric/core/Claims.kt
app/src/main/java/com/futo/polycentric/core/Models.kt
+15
-1
15 additions, 1 deletion
app/src/main/java/com/futo/polycentric/core/Models.kt
with
136 additions
and
11 deletions
app/src/main/java/com/futo/polycentric/core/Claims.kt
+
121
−
10
View file @
ae36bbd9
...
@@ -40,6 +40,70 @@ class Claims {
...
@@ -40,6 +40,70 @@ class Claims {
return
claim
(
ClaimType
.
BITCOIN
.
value
,
id
);
return
claim
(
ClaimType
.
BITCOIN
.
value
,
id
);
}
}
fun
twitter
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
TWITTER
.
value
,
id
)
}
fun
generic
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
GENERIC
.
value
,
id
)
}
fun
github
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
GITHUB
.
value
,
id
)
}
fun
minds
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
MINDS
.
value
,
id
)
}
fun
patreon
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
PATREON
.
value
,
id
)
}
fun
substack
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
SUBSTACK
.
value
,
id
)
}
fun
website
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
WEBSITE
.
value
,
id
)
}
fun
kick
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
KICK
.
value
,
id
)
}
fun
soundcloud
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
SOUNDCLOUD
.
value
,
id
)
}
fun
vimeo
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
VIMEO
.
value
,
id
)
}
fun
nebula
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
NEBULA
.
value
,
id
)
}
fun
occupation
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
OCCUPATION
.
value
,
id
)
}
fun
skill
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
SKILL
.
value
,
id
)
}
fun
spotify
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
SPOTIFY
.
value
,
id
)
}
fun
spreadshop
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
SPREADSHOP
.
value
,
id
)
}
fun
polycentric
(
id
:
String
):
Protocol
.
Claim
{
return
claim
(
ClaimType
.
POLYCENTRIC
.
value
,
id
)
}
fun
claim
(
claimType
:
Long
,
id
:
String
?):
Protocol
.
Claim
{
fun
claim
(
claimType
:
Long
,
id
:
String
?):
Protocol
.
Claim
{
return
Protocol
.
Claim
.
newBuilder
()
return
Protocol
.
Claim
.
newBuilder
()
.
setClaimType
(
claimType
)
.
setClaimType
(
claimType
)
...
@@ -54,18 +118,65 @@ class Claims {
...
@@ -54,18 +118,65 @@ class Claims {
fun
Protocol
.
Claim
.
toUrl
():
String
?
{
fun
Protocol
.
Claim
.
toUrl
():
String
?
{
return
when
(
claimType
)
{
return
when
(
claimType
)
{
ClaimType
.
HACKER_NEWS
.
value
->
"https://news.ycombinator.com/user?id=${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
YOUTUBE
.
value
->
{
ClaimType
.
YOUTUBE
.
value
->
{
val
c
=
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
;
val
c
=
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
if
(
c
.
startsWith
(
'@'
))
"https://www.youtube.com/$c"
else
"https://www.youtube.com/channel/$c"
;
if
(
c
.
startsWith
(
'@'
))
"https://www.youtube.com/$c"
else
"https://www.youtube.com/channel/$c"
}
}
ClaimType
.
ODYSEE
.
value
->
"https://odysee.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
ODYSEE
.
value
->
"https://odysee.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
RUMBLE
.
value
->
"https://rumble.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
RUMBLE
.
value
->
"https://rumble.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
TWITTER
.
value
->
"https://twitter.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
TWITTER
.
value
->
"https://twitter.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
DISCORD
.
value
->
"https://discordapp.com/users/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
BITCOIN
.
value
->
"bitcoin:${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
INSTAGRAM
.
value
->
"https://instagram.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
GENERIC
.
value
->
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
ClaimType
.
TWITCH
.
value
->
"https://www.twitch.tv/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
DISCORD
.
value
->
"https://discordapp.com/users/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
PATREON
.
value
->
"https://www.patreon.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
INSTAGRAM
.
value
->
"https://instagram.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
GITHUB
.
value
->
"https://github.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
MINDS
.
value
->
"https://www.minds.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
PATREON
.
value
->
"https://www.patreon.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
SUBSTACK
.
value
->
"https://${Protocol.ClaimIdentifier.parseFrom(claim).identifier}.substack.com"
//TODO: Check this
ClaimType
.
TWITCH
.
value
->
"https://www.twitch.tv/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
WEBSITE
.
value
->
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
ClaimType
.
KICK
.
value
->
"https://www.kickstarter.com/profile/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
//TODO: Check this
ClaimType
.
SOUNDCLOUD
.
value
->
"https://soundcloud.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
VIMEO
.
value
->
"https://vimeo.com/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
NEBULA
.
value
->
"https://nebula.tv/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
URL
.
value
->
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
ClaimType
.
URL
.
value
->
Protocol
.
ClaimIdentifier
.
parseFrom
(
claim
).
identifier
ClaimType
.
OCCUPATION
.
value
->
null
ClaimType
.
SKILL
.
value
->
null
ClaimType
.
SPOTIFY
.
value
->
"https://open.spotify.com/user/${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
ClaimType
.
SPREADSHOP
.
value
->
"https://${Protocol.ClaimIdentifier.parseFrom(claim).identifier}.spreadshop.com"
//TODO: Check this
ClaimType
.
POLYCENTRIC
.
value
->
"polycentric://${Protocol.ClaimIdentifier.parseFrom(claim).identifier}"
else
->
null
else
->
null
}
}
}
}
fun
Protocol
.
Claim
.
toName
():
String
?
{
return
when
(
claimType
)
{
ClaimType
.
HACKER_NEWS
.
value
->
"HackerNews"
ClaimType
.
YOUTUBE
.
value
->
"YouTube"
ClaimType
.
ODYSEE
.
value
->
"Odysee"
ClaimType
.
RUMBLE
.
value
->
"Rumble"
ClaimType
.
TWITTER
.
value
->
"Twitter"
ClaimType
.
BITCOIN
.
value
->
"Bitcoin"
ClaimType
.
GENERIC
.
value
->
"Generic"
ClaimType
.
DISCORD
.
value
->
"Discord"
ClaimType
.
INSTAGRAM
.
value
->
"Instagram"
ClaimType
.
GITHUB
.
value
->
"GitHub"
ClaimType
.
MINDS
.
value
->
"Minds"
ClaimType
.
PATREON
.
value
->
"Patreon"
ClaimType
.
SUBSTACK
.
value
->
"Substack"
ClaimType
.
TWITCH
.
value
->
"Twitch"
ClaimType
.
WEBSITE
.
value
->
"Website"
ClaimType
.
KICK
.
value
->
"Kick"
ClaimType
.
SOUNDCLOUD
.
value
->
"Soundcloud"
ClaimType
.
VIMEO
.
value
->
"Vimeo"
ClaimType
.
NEBULA
.
value
->
"Nebula"
ClaimType
.
URL
.
value
->
"URL"
ClaimType
.
OCCUPATION
.
value
->
"Occupation"
ClaimType
.
SKILL
.
value
->
"Skill"
ClaimType
.
SPOTIFY
.
value
->
"Spotify"
ClaimType
.
SPREADSHOP
.
value
->
"Spreadshop"
ClaimType
.
POLYCENTRIC
.
value
->
"Polycentric"
else
->
"unknown"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/src/main/java/com/futo/polycentric/core/Models.kt
+
15
−
1
View file @
ae36bbd9
...
@@ -34,11 +34,25 @@ enum class ClaimType(val value: Long) {
...
@@ -34,11 +34,25 @@ enum class ClaimType(val value: Long) {
GENERIC
(
7
),
GENERIC
(
7
),
DISCORD
(
8
),
DISCORD
(
8
),
INSTAGRAM
(
9
),
INSTAGRAM
(
9
),
GITHUB
(
10
),
MINDS
(
11
),
PATREON
(
12
),
PATREON
(
12
),
SUBSTACK
(
13
),
TWITCH
(
14
),
TWITCH
(
14
),
URL
(
20
)
WEBSITE
(
15
),
KICK
(
16
),
SOUNDCLOUD
(
17
),
VIMEO
(
18
),
NEBULA
(
19
),
URL
(
20
),
OCCUPATION
(
21
),
SKILL
(
22
),
SPOTIFY
(
23
),
SPREADSHOP
(
24
),
POLYCENTRIC
(
25
)
}
}
class
Blob
(
val
mime
:
String
,
val
content
:
ByteArray
)
{
}
class
Blob
(
val
mime
:
String
,
val
content
:
ByteArray
)
{
}
@Serializable
@Serializable
class
Digest
(
val
digestType
:
Long
,
@Serializable
(
with
=
ByteArraySerializer
::
class
)
val
digest
:
ByteArray
)
{
class
Digest
(
val
digestType
:
Long
,
@Serializable
(
with
=
ByteArraySerializer
::
class
)
val
digest
:
ByteArray
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment