deltachat-core-rust
deltachat-core-rust copied to clipboard
feat: Donation request device message (#6913)
No tests yet, have done a quick check in Desktop. Close #6913
EDIT: I think the logic may be simplified and we can just ask for donation once a month if there are >= 10 outgoing delivered encrypted messages and the user sends a new one. It won't be that annoying i think. A simple approach may be left w/o tests, many other device messages are also not tested and that's ok. EDIT: Done. The initial period is 14 days now, then messages appear every 60 days. Existing users will receive the first message immediately, this shouldn't affect many users installed Delta Chat recently.
days_until_first_donation_request,days_until_next_donation_requestandLastDonationRequestTimestamp(instead of period_check, period_msg, DonationRequestTs)?
Renamed to secs_between_checks (it's only a consequence that the first request appears after this time), secs_between_requests, DonationRequestNextCheck (we don't always add Timestamp, e.g. see LastHousekeeping).
also, not sure if it is needed to check on every sending of a message
We have the config cache, so looking at Config::DonationRequestNextCheck even on every sending is fine.
for the expensive sql command: the mentioned corner case in the issue is about shared-usage or classic-usage, if ppl are doing that they seem to be into delta chat as well, as we do not download history. if would keep it simple here and look at all messages
Removed the check for whether a message is encrypted. Now it should be fast because we have msgs_index7 ON msgs (state, hidden, chat_id). Anyway i'm going to add a new OutRcvd message state in #5813 (it's needed to fix the remaining message sorting issues that e.g. i have with Gmail) that will fix corner cases, i.e. we can only count locally sent messages.
also, i would add the message only if there are more messages, eg. 100, 10 messages is not really real usage.
Made it 50. 100 looks too much for me personally, maybe on average people chat more, idk.
finally, the stock string is missing in the deltachat.h
Fixed.
after some internal discussions with @adbenitez and others:
- for now, we do not want the message to re-appear every some time, we can add that at some point, but initially it is not wanted - the "device chat" bubbles up anyways after some time. better to consider a completely new message that is re-added then
- instead, the 14 days should be at least 4 weeks, and the number of messages that should be there should be more, say, 100. if the 100 is not reached after 30 days, but only after 50 days, that is fine, the message will appear then (@iequidoo it is like that, right?)
- the wording "X cost time and time cost money" should be shortened to "X cost money" - ppl do not read much, so no need to be too nerdy and pretentious here. ppl also do not say "bread does not cost money. making a bread cost time, and time may cost money" ...
- "seems you're using Delta Chat" was indeed a bad suggestion from my side, what @adbenitez suggested in the issue is better, "❤️ Seems you're enjoying Delta Chat!" the final wording is anyway in android, but it seems good to have a not-so-bad-fallback
- for now, we do not want the message to re-appear every some time, we can add that at some point, but initially it is not wanted - the "device chat" bubbles up anyways after some time. better to consider a completely new message that is re-added then
Done (DonationRequestNextCheck is set to i64::MAX after adding the device message).
if the 100 is not reached after 30 days, but only after 50 days, that is fine, the message will appear then (@iequidoo it is like that, right?)
After 60 days then, it checks every 30 days now (instead of 14).
- the wording "X cost time and time cost money" should be shortened to "X cost money" - ppl do not read much, so no need to be too nerdy and pretentious here. ppl also do not say "bread does not cost money. making a bread cost time, and time may cost money" ...
Changed to "development costs money", but for me "development takes/requires money" sounds better. "costs money" is like wanting to charge the reader at market price. But it's just my personal perception.
- "seems you're using Delta Chat" was indeed a bad suggestion from my side, what @adbenitez suggested in the issue is better, "❤️ Seems you're enjoying Delta Chat!"
Done.