-
-
Notifications
You must be signed in to change notification settings - Fork 106
Opt-in weekly sending of statistics #6851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bfdbf01
a1c8beb
dd3ef4b
a152d8e
3ba68a6
4f973be
23b8fda
e283df8
8e3f2e5
7986b11
228eda8
e478341
5fac395
a3a02e9
ebf0a2d
7d6aebf
c21b8d3
7ef56d6
b77c815
3295ed4
6c592d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,11 +383,6 @@ impl CommandApi { | |
Ok(BlobObject::create_and_deduplicate(&ctx, file, file)?.to_abs_path()) | ||
} | ||
|
||
async fn draft_self_report(&self, account_id: u32) -> Result<u32> { | ||
let ctx = self.get_context(account_id).await?; | ||
Ok(ctx.draft_self_report().await?.to_u32()) | ||
} | ||
|
||
/// Sets the given configuration key. | ||
async fn set_config(&self, account_id: u32, key: String, value: Option<String>) -> Result<()> { | ||
let ctx = self.get_context(account_id).await?; | ||
|
@@ -886,6 +881,54 @@ impl CommandApi { | |
Ok(chat_id.to_u32()) | ||
} | ||
|
||
/// Like `secure_join()`, but allows to pass a source and a UI-path. | ||
/// You only need this if your UI has an option to send statistics | ||
/// to Delta Chat's developers. | ||
/// | ||
/// **source**: The source where the QR code came from. One of: | ||
/// ```rust | ||
/// enum SecurejoinSource { | ||
/// /// Because of some problem, it is unknown where the QR code came from. | ||
/// Unknown = 0, | ||
/// /// The user opened a link somewhere outside Delta Chat | ||
/// ExternalLink = 1, | ||
/// /// The user clicked on a link in a message inside Delta Chat | ||
/// InternalLink = 2, | ||
/// /// The user clicked "Paste from Clipboard" in the QR scan activity | ||
/// Clipboard = 3, | ||
/// /// The user clicked "Load QR code as image" in the QR scan activity | ||
/// ImageLoaded = 4, | ||
/// /// The user scanned a QR code | ||
/// Scan = 5, | ||
/// } | ||
/// ``` | ||
/// | ||
/// **uipath**: Which UI path did the user use to arrive at the QR code screen. | ||
/// If the SecurejoinSource was ExternalLink or InternalLink, | ||
/// you can just pass 0 here, because the QR code screen wasn't even opened. | ||
/// ```rust | ||
/// enum SecurejoinUIPath { | ||
/// /// The UI path is unknown, or the user didn't open the QR code screen at all. | ||
/// Unknown = 0, | ||
/// /// The user directly clicked on the QR icon in the main screen | ||
/// QrIcon = 1, | ||
/// /// The user first clicked on the `+` button in the main screen, | ||
/// /// and then on "New Contact" | ||
/// NewContact = 2, | ||
/// } | ||
/// ``` | ||
async fn secure_join_with_ux_info( | ||
&self, | ||
account_id: u32, | ||
qr: String, | ||
source: Option<u32>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not at all, I first thought that making them an Option will make them optional parameters in the JsonRPC, but this didn't actually work. I'll just make them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTOH, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this |
||
uipath: Option<u32>, | ||
) -> Result<u32> { | ||
let ctx = self.get_context(account_id).await?; | ||
let chat_id = securejoin::join_securejoin_with_ux_info(&ctx, &qr, source, uipath).await?; | ||
Ok(chat_id.to_u32()) | ||
} | ||
|
||
async fn leave_group(&self, account_id: u32, chat_id: u32) -> Result<()> { | ||
let ctx = self.get_context(account_id).await?; | ||
remove_contact_from_chat(&ctx, ChatId::new(chat_id), ContactId::SELF).await | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ use tokio::fs; | |
|
||
use crate::blob::BlobObject; | ||
use crate::configure::EnteredLoginParam; | ||
use crate::constants; | ||
use crate::context::Context; | ||
use crate::events::EventType; | ||
use crate::log::{LogExt, info}; | ||
|
@@ -23,6 +22,7 @@ use crate::mimefactory::RECOMMENDED_FILE_SIZE; | |
use crate::provider::{Provider, get_provider_by_id}; | ||
use crate::sync::{self, Sync::*, SyncData}; | ||
use crate::tools::get_abs_path; | ||
use crate::{constants, statistics}; | ||
|
||
/// The available configuration keys. | ||
#[derive( | ||
|
@@ -431,9 +431,25 @@ pub enum Config { | |
/// used for signatures, encryption to self and included in `Autocrypt` header. | ||
KeyId, | ||
|
||
/// This key is sent to the self_reporting bot so that the bot can recognize the user | ||
/// Send statistics to Delta Chat's developers. | ||
/// Can be exposed to the user as a setting. | ||
StatsSending, | ||
|
||
/// Last time statistics were sent to Delta Chat's developers | ||
StatsLastSent, | ||
|
||
/// This key is sent to the statistics bot so that the bot can recognize the user | ||
/// without storing the email address | ||
SelfReportingId, | ||
StatsId, | ||
|
||
/// The last message id that was already included in the previously sent statistics, | ||
/// or that already existed before the user opted in. | ||
/// Only messages with an id larger than this | ||
/// will be counted in the next statistics. | ||
StatsLastCountedMsgId, | ||
|
||
/// The last contact id that already existed when statistics-sending was enabled. | ||
StatsLastOldContactId, | ||
|
||
/// MsgId of webxdc map integration. | ||
WebxdcIntegration, | ||
|
@@ -827,6 +843,11 @@ impl Context { | |
.await?; | ||
} | ||
} | ||
Config::StatsSending => { | ||
self.sql.set_raw_config(key.as_ref(), value).await?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe do this as the last step so as if Also if |
||
statistics::set_last_counted_msg_id(self).await?; | ||
statistics::set_last_old_contact_id(self).await?; | ||
} | ||
_ => { | ||
self.sql.set_raw_config(key.as_ref(), value).await?; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.