Skip to content

Commit

Permalink
Merge pull request #3027 from UnigramDev/develop
Browse files Browse the repository at this point in the history
v9.6.2
  • Loading branch information
FrayxRulez authored May 2, 2023
2 parents 3c15a14 + 5a2cef4 commit 06458eb
Show file tree
Hide file tree
Showing 147 changed files with 2,248 additions and 1,559 deletions.
Binary file modified Libraries/rlottie/ARM64/RLottie.dll
Binary file not shown.
Binary file modified Libraries/rlottie/ARM64/RLottie.winmd
Binary file not shown.
Binary file modified Libraries/rlottie/x64/RLottie.dll
Binary file not shown.
Binary file modified Libraries/rlottie/x64/RLottie.winmd
Binary file not shown.
Binary file modified Libraries/rlottie/x86/RLottie.dll
Binary file not shown.
Binary file modified Libraries/rlottie/x86/RLottie.winmd
Binary file not shown.
42 changes: 30 additions & 12 deletions Telegram/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
//
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Telegram.Common;
using Telegram.Navigation;
Expand Down Expand Up @@ -55,6 +57,7 @@
using Windows.ApplicationModel.DataTransfer.ShareTarget;
using Windows.ApplicationModel.ExtendedExecution;
using Windows.Foundation;
using Windows.Storage;
using Windows.System.Profile;
using Windows.UI.Core;
using Windows.UI.Notifications;
Expand All @@ -79,6 +82,18 @@ sealed partial class App : BootStrapper

private ExtendedExecutionSession _extendedSession;

private static readonly List<string> _lastCalls = new();

public static void Track([CallerMemberName] string member = "", [CallerFilePath] string filePath = "")
{
_lastCalls.Add(string.Format("[{0}] {1} --- {2}", member, filePath, Environment.TickCount));

if (_lastCalls.Count > 50)
{
_lastCalls.RemoveAt(0);
}
}

/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// Initializes the singleton application object. This is the first line of authored code
Expand All @@ -93,7 +108,7 @@ public App()
SettingsService.Current.Diagnostics.UpdateCount++;
}

TLContainer.Current.Configure(out int count);
TLContainer.Current.Configure();

RequestedTheme = SettingsService.Current.Appearance.GetCalculatedApplicationTheme();
InitializeComponent();
Expand All @@ -103,16 +118,25 @@ public App()
UnhandledException += (s, args) =>
{
args.Handled = args.Exception is not LayoutCycleException;
SettingsService.Current.Diagnostics.LastNavigatedPageType = FrameFacade.LastNavigatedPageType;
Client.Execute(new AddLogMessage(1, "Unhandled exception:\n" + args.Exception.ToString()));
var path = System.IO.Path.Combine(ApplicationData.Current.LocalFolder.Path, "crash.txt");
var data = $"Unhandled exception:\n{args.Exception}\n\n{string.Join('\n', _lastCalls)}";
System.IO.File.WriteAllText(path, data);
Client.Execute(new AddLogMessage(1, data));
};

#if !DEBUG
Microsoft.AppCenter.Crashes.Crashes.GetErrorAttachments = report =>
{
var lastPageType = SettingsService.Current.Diagnostics.LastNavigatedPageType;
SettingsService.Current.Diagnostics.LastNavigatedPageType = null;
return new[] { Microsoft.AppCenter.Crashes.ErrorAttachmentLog.AttachmentWithText(lastPageType, "page.txt") };
var path = System.IO.Path.Combine(ApplicationData.Current.LocalFolder.Path, "crash.txt");
if (System.IO.File.Exists(path))
{
var data = System.IO.File.ReadAllText(path);
return new[] { Microsoft.AppCenter.Crashes.ErrorAttachmentLog.AttachmentWithText(data, "crash.txt") };
}
return Array.Empty<Microsoft.AppCenter.Crashes.ErrorAttachmentLog>();
};

Microsoft.AppCenter.AppCenter.Start(Constants.AppCenterId,
Expand All @@ -126,12 +150,6 @@ public App()
{ "Architecture", Package.Current.Id.Architecture.ToString() }
});

Microsoft.AppCenter.Analytics.Analytics.TrackEvent("Instance",
new System.Collections.Generic.Dictionary<string, string>
{
{ "ActiveSessions", $"{count}" },
});

static void FatalErrorCallback(int verbosityLevel, string message)
{
if (verbosityLevel == 0)
Expand Down
Loading

0 comments on commit 06458eb

Please sign in to comment.