Bunch of feedback: renames, simple functions, no cow

This commit is contained in:
Floris Bruynooghe
2021-02-11 22:24:56 +01:00
parent 29f184b4c4
commit 46a3226e43
22 changed files with 1216 additions and 1814 deletions

View File

@@ -22,7 +22,7 @@ use crate::context::Context;
use crate::events::EventType;
use crate::message::Message;
use crate::provider::get_provider_update_timestamp;
use crate::stock::{BadTimeMsgBody, UpdateReminderMsgBody};
use crate::stock_str;
/// Shortens a string to a specified length and adds "[...]" to the
/// end of the shortened string.
@@ -169,15 +169,14 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
if now < known_past_timestamp {
let mut msg = Message::new(Viewtype::Text);
msg.text = Some(
BadTimeMsgBody::stock_str(
stock_str::bad_time_msg_body(
context,
Local
.timestamp(now, 0)
.format("%Y-%m-%d %H:%M:%S")
.to_string(),
)
.await
.to_string(),
.await,
);
add_device_msg_with_importance(
context,
@@ -201,7 +200,7 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
async fn maybe_warn_on_outdated(context: &Context, now: i64, approx_compile_time: i64) {
if now > approx_compile_time + DC_OUTDATED_WARNING_DAYS * 24 * 60 * 60 {
let mut msg = Message::new(Viewtype::Text);
msg.text = Some(UpdateReminderMsgBody::stock_str(context).await.into());
msg.text = Some(stock_str::update_reminder_msg_body(context).await);
add_device_msg(
context,
Some(