1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-23 12:15:48 +02:00

Implement a notification about previously enabled anonymous data sending

This commit is contained in:
chylex 2017-11-07 21:37:41 +01:00
parent 5b2daf9746
commit 296626f7c7
3 changed files with 42 additions and 2 deletions

View File

@ -34,8 +34,9 @@ static UserConfig(){
// CONFIGURATION DATA
public bool FirstRun { get; set; } = true;
public bool AllowDataCollection { get; set; } = false;
public bool FirstRun { get; set; } = true;
public bool AllowDataCollection { get; set; } = false;
public bool ShowDataCollectionNotification { get; set; } = true;
public WindowState BrowserWindow { get; set; } = new WindowState();
public WindowState PluginsWindow { get; set; } = new WindowState();

View File

@ -68,6 +68,8 @@ public FormBrowser(UpdaterSettings updaterSettings){
this.notification.Show();
this.browser = new TweetDeckBrowser(this, plugins, new TweetDeckBridge(this, notification));
this.browser.PageLoaded += browser_PageLoaded;
this.contextMenu = ContextMenuBrowser.CreateMenu(this);
Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
@ -205,6 +207,38 @@ private void trayIcon_ClickRestore(object sender, EventArgs e){
private void trayIcon_ClickClose(object sender, EventArgs e){
ForceClose();
}
private void browser_PageLoaded(object sender, EventArgs e){
if (Config.ShowDataCollectionNotification){
this.InvokeAsyncSafe(() => {
if (!Config.FirstRun && Config.AllowDataCollection){
FormMessage form = new FormMessage("Anonymous Data Update", "Hi! You can now review your anonymous data report, and opt-out if you've changed your mind. Collected data will be used to focus development on most commonly used features. If you want to opt-out but still support the project, any feedback and donations are appreciated.", MessageBoxIcon.Information);
form.AddButton("OK", ControlType.Accept | ControlType.Focused);
Button btnReviewSettings = new Button{
Anchor = AnchorStyles.Bottom | AnchorStyles.Left,
Font = SystemFonts.MessageBoxFont,
Location = new Point(9, 12),
Margin = new Padding(0, 0, 48, 0),
Size = new Size(160, 26),
Text = "Review Feedback Options",
UseVisualStyleBackColor = true
};
btnReviewSettings.Click += (sender2, args2) => {
form.Close();
OpenSettings(typeof(TabSettingsFeedback));
};
form.AddActionControl(btnReviewSettings);
ShowChildForm(form);
}
Config.ShowDataCollectionNotification = false;
Config.Save();
});
}
}
private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
if (e.HasErrors){
@ -327,6 +361,7 @@ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
if (Config.FirstRun){
Config.FirstRun = false;
Config.AllowDataCollection = allowDataCollection;
Config.ShowDataCollectionNotification = false;
Config.Save();
if (allowDataCollection && analytics == null){

View File

@ -32,6 +32,8 @@ public bool IsTweetDeckWebsite{
}
}
public event EventHandler PageLoaded;
private readonly ChromiumWebBrowser browser;
private readonly PluginManager plugins;
private readonly MemoryUsageTracker memoryUsageTracker;
@ -145,6 +147,8 @@ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (Program.UserConfig.FirstRun){
ScriptLoader.ExecuteFile(e.Frame, "introduction.js");
}
PageLoaded?.Invoke(this, EventArgs.Empty);
}
}