Closed jetaggart closed 4 years ago
@psylinse thanks! I'll check.
Hi @psylinse sorry for the delay. Is it still an issue? The client should use an actor as the current user.
I was able to solve this by wrapping the string as a User
. This is confusing to me as I'm not sure when a string type is allowed. I'm assuming it has to do with some actor type I need to register with Stream. For example, to get the same code to work in java I had to prefix the string with SU:
(which I assume is Stream User?). The docs are not clear to me what exactly the actor is and what is allowed.
Here is my swift code:
let activity = PostActivity(actor: User(id: "user"), verb: "post", object: UUID().uuidString, message: "message")
and the related java code:
Activity.builder().actor("SU:user").verb("post").`object`(UUID.randomUUID().toString()).extraField("message", "message").build()
@psylinse In Swift we use generics. It's a little bit hard at the beginning to setup, but then it's safer and easy to use. By default GetStream.Activity
has a type:
public typealias Activity = EnrichedActivity<User, String, DefaultReaction>
For your PostActivity
you can change the actor type as own User
type and for the ObjectType
. Then these types will be automatically encoded and decoded in the right way.
The value of serialized User
as SU:<id>
should be as internal work, you shouldn't worry about it as for SO:<id>
. Please let me know if you have more questions.
What did you do?
What did you expect to happen?
Activity is posted to feed
What happened instead?
I get a 404
Additional context
Is this caused because I'm using a string actor? The token is generated for the same user id (in this case "user") that the activity uses. When I use the
User
object, it works fine.