Skip to content

Server needs to accept at least one post to allow offline capabilities #10

@maberer

Description

@maberer

Thanks for the great demo!

Nevertheless, I think there is an issue related to the offline capabilities of the app when
the server is not running while a first message is posted.

In this case, the new post is stored but the user is not.

https://github.com/yigit/dev-summit-architecture-demo/blob/master/client/app/src/main/java/com/android/example/devsummit/archdemo/job/post/SaveNewPostJob.java#L98

When the "NewPostEvent " event is fired and the post should be added to the list, the user is not found because it has not been saved to the datastore. As a consequence, "user" is null in the following line:

https://github.com/yigit/dev-summit-architecture-demo/blob/master/client/app/src/main/java/com/android/example/devsummit/archdemo/model/FeedModel.java#L74

Because "users" is empty, the result array is empty.

https://github.com/yigit/dev-summit-architecture-demo/blob/master/client/app/src/main/java/com/android/example/devsummit/archdemo/model/FeedModel.java#L73

So the post is never added to the list.

To get the expected behavior, the server has to run/respond at least the first time
a post is made. If this is the case, the returned user is added to the local datastore.

https://github.com/yigit/dev-summit-architecture-demo/blob/master/client/app/src/main/java/com/android/example/devsummit/archdemo/job/post/SaveNewPostJob.java#L116

In the case outlined above, this line never runs and posts never appear.

I do not think that this is intended behavior.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions