Closed mkeeda closed 4 years ago
๐
I commented in this ๐ https://github.com/DroidKaigi/conference-app-2020/issues/429#issuecomment-578519980
I applied some fixes. Can you check it? ๐ https://github.com/DroidKaigi/conference-app-2020/commit/4a2de2517c3f9534ca0f1d34283caeecab2fd9c1
@takahirom Thank you for fix my code I checked your code, but I caught the permission error too. https://github.com/DroidKaigi/conference-app-2020/pull/626#discussion_r373835072 286d6bd debugging code is used by me.
Now, it is failure to retrieve shards and to create shards.
I cannot access to thumbsup_counters
collection, probably.
Is my development enviroment some wrong?
I tried the simple code that retrieves documents of thumbsup_counters
, but I cannot retrieve documents and catch the error.
code
FirebaseFirestore
.getInstance()
.collection("confsched/2020/sessions/155510/thumbsup_counters")
.get()
.addOnFailureListener {
println(it)
}
.addOnSuccessListener {
println(it.documents)
}
We haven't changed any rules since we created the issue. Perhaps you can create that collection, but you don't have permission to get it, so it is expected that isEmpty will be true. I am thinking about rule settings that can only get the size.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /confsched/2020 {
...
match /sessions/{sessionId} {
match /{allSubcollections=**} {
allow create
}
// Allow to increment only the 'shards' field and only by 1.
match /thumbsup_counters/{counterId} {
allow get;
allow write: if request.resource.data.keys() == ["shards"]
&& (resource == null || request.resource.data.shards ==
resource.data.shards + 1);
}
}
}
}
}
I changed the rule ๐
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /confsched/2020 {
...
match /sessions/{sessionId} {
match /{allSubcollections=**} {
allow create
}
match /thumbsup_counters {
allow read
// Allow to increment only the 'shards' field and only by 1.
match /{counterId} {
allow write: if request.resource.data.keys() == ["shards"]
&& (resource == null || request.resource.data.shards ==
resource.data.shards + 1);
}
}
}
}
}
}
I changed!
match /sessions/{sessionId} {
match /{allSubcollections=**} {
allow create
}
match /thumbsup_counters/{counterId} {
allow read;
// Allow to increment only the 'shards' field and only by 1.
allow write: if request.resource.data.keys() == ["shards"]
&& (resource == null || request.resource.data.shards ==
resource.data.shards + 1);
}
}
The code fail to create shards... I misunderstood that I successed to create shards...? I will find out the cause tomorrow.
Maybe even if there is a value, I think that isEmpty is true. Personally, I think it's a good idea to check if there are 9 counters so that the process can die during creation. Or it might be better to use something like a transaction https://firebase.google.com/docs/firestore/manage-data/transactions
I changed the rule ๐
request.resource.data.shards > resource.data.shards &&
request.resource.data.shards < resource.data.shards + 51
I implemented debounce logic ๐ https://github.com/DroidKaigi/conference-app-2020/commit/be331b0421f750d8ade541c5c1be3d3b36ef8dd5
@takahirom
I moved the debouce processing ViewModel, and removed the code of checking index.
Probably, the debounce processing is a bussiness logic, soFirestore
should not have it.
67e699a
And I want to show own incrementd count like medium. So I separated increment flow from total thumbs up count flow. https://github.com/DroidKaigi/conference-app-2020/issues/429#issuecomment-582482685
:eyes:
As for business logic, it is difficult because there is a possibility that duplicate logic will be created by bringing it to the ViewModel. However, if you want to have incrementThumbsUpCount in UiModel, I think it is good.
For now, let's proceed with the implementation of displaying incrementThumbsUpCount! ๐ ใใฎๆน้ใฎใพใพใๅฎ่ฃ ใ้ฒใใฆใใใจๆใใพใ๏ผ
@mkeeda Any progress...? ๐
@takahirom Sorry, I made you wait ๐ ๐ ๐ I implemented popup animation!
๐
The popup animation is too moved? It is little hard to watch a incremented count for me.
@mkeeda Thanks as always ๐ Can you take time today? What are the remaining tasks now?
@takahirom Sorry, Iโm almost done! I will finish tasks today. The remaining tasks โ
I will write overviews at top of this PR when I finished all tasks.
Thanks! I want to merge this today!! ๐
Can you delete WIP? ๐
Yes! I'm writing overviews now!
Your apk has been deployed to https://deploygate.com/distributions/1f10badbf5012479d46a7dffcc44c18b5a4c3beb. Anyone can try your changes via the link.
Generated by :no_entry_sign: Danger
No error was reported but at least one warning was found.
Generated by :no_entry_sign: Danger
@takahirom All tasks is done! Please review again ๐ ๐ ๐
LGTM ๐๐๐๐
Issue
Overview (Required)
Links
-
Screenshot