Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139,297 changes: 0 additions & 139,297 deletions CollapseLauncher/Classes/AnimatedVisuals/Lottie/TempResetIndonesiaTaglineCrisis.cs

This file was deleted.

This file was deleted.

5 changes: 2 additions & 3 deletions CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Authors>$(Company). neon-nyan, Cry0, bagusnl, shatyuka, gablm.</Authors>
<Copyright>Copyright 2022-2025 $(Company)</Copyright>
<!-- Versioning -->
<Version>1.83.9</Version>
<Version>1.83.10</Version>
<LangVersion>preview</LangVersion>
<!-- Target Settings -->
<Platforms>x64</Platforms>
Expand Down Expand Up @@ -142,13 +142,12 @@
<IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>

<!-- Security and Resource Management -->
<AutoreleasePoolSupport>false</AutoreleasePoolSupport>
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
<EventSourceSupport>false</EventSourceSupport>
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
<MetricsSupport>false</MetricsSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<UseSystemResourceKeys>false</UseSystemResourceKeys>
<XmlResolverIsNetworkingEnabledByDefault>false</XmlResolverIsNetworkingEnabledByDefault>

<!-- Instruction Sets -->
Expand Down
41 changes: 0 additions & 41 deletions CollapseLauncher/XAMLs/MainApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,6 @@
<AnimatedVisualPlayer x:Name="IntroAnimation"
AutoPlay="False"
Visibility="Collapsed" />
<Grid x:Name="Temporary20250827CrisisIntro"
Margin="32"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ToggleSwitch Grid.Column="1"
HorizontalAlignment="Right"
IsOn="{x:Bind IsEnableCrisisIntro, Mode=TwoWay}"
OffContent="Disable this Crisis Intro Animation"
OnContent="Enable this Crisis Intro Animation" />
<Button Grid.Column="0"
Margin="0,0,32,0"
Click="Temporary20250827CrisisIntroButton_OnClick"
Opacity=".5"
PointerEntered="IntroSequenceToggle_PointerEntered"
PointerExited="IntroSequenceToggle_PointerExited"
Style="{ThemeResource TransparentDefaultButtonStyle}">
<Grid Margin="0,0"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="Learn more about &quot;Indonesian Government Untrust Protest&quot; Crisis (by The Jakarta Post &amp; Al Jazeera)"
TextWrapping="Wrap" />
<FontIcon Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="18"
Glyph="&#xE946;" />
</Grid>
</Button>
</Grid>
<CheckBox x:Name="IntroSequenceToggle"
Margin="32,32,16,24"
HorizontalAlignment="Right"
Expand Down
167 changes: 1 addition & 166 deletions CollapseLauncher/XAMLs/MainApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CollapseLauncher.AnimatedVisuals.Lottie;
using CollapseLauncher.CustomControls;
using CollapseLauncher.Extension;
using CollapseLauncher.Helper;
using CollapseLauncher.Helper.Animation;
Expand All @@ -23,8 +22,6 @@
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Animation;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -115,172 +112,10 @@ public void StartMainPage()
{
WindowUtility.SetWindowSize(WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Width, WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Height);

if (IsCrisisIntroEnabled())
{
RunCrisisIntroSequence();
}
else
{
RunIntroSequence();
}

RunIntroSequence();
RootFrame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo());
}

#region TEMPORARY: August 27th, 2025 Temporary Intro due to current Indonesian's crisis
public bool IsEnableCrisisIntro
{
get => GetAppConfigValue("Enable20250827CrisisIntro");
set => SetAndSaveConfigValue("Enable20250827CrisisIntro", value);
}

public bool IsShownCrisisIntroDialog
{
get => GetAppConfigValue("Enable20250827CrisisIntroDialog");
set => SetAndSaveConfigValue("Enable20250827CrisisIntroDialog", value);
}

// Starts the intro at 00:00 AM Jakarta Time - September 1st -> 00:00 AM Jakarta Time - September 8th.
private readonly DateTime _dateTimeCrisisOffsetStart
= new DateTimeOffset(2025, 9, 1, 0, 0, 0, TimeSpan.FromHours(7)).UtcDateTime;
private readonly DateTime _dateTimeCrisisOffsetEnd
= new DateTimeOffset(2025, 9, 8, 0, 0, 0, TimeSpan.FromHours(7)).UtcDateTime;

private bool IsCrisisIntroEnabled()
{
DateTime nowDateTimeOffset = DateTime.UtcNow;
if (nowDateTimeOffset < _dateTimeCrisisOffsetStart ||
nowDateTimeOffset >= _dateTimeCrisisOffsetEnd)
{
return false;
}

if (_isForceDisableIntro || !IsEnableCrisisIntro)
{
return false;
}

// Try to disable the intro if the user is using certain region/CultureInfo in their system.
(string langId, string countryId)[] disabledLocale = [
("zh", "cn")
];
string currentCulture = CultureInfo.CurrentUICulture.Name;


return !disabledLocale.Any(x => currentCulture.StartsWith(x.langId, StringComparison.OrdinalIgnoreCase) &&
currentCulture.EndsWith(x.countryId, StringComparison.OrdinalIgnoreCase));
}

private void Temporary20250827CrisisIntroButton_OnClick(object sender, RoutedEventArgs e)
{
string[] articles = [
"https://www.thejakartapost.com/indonesia/2025/08/31/five-things-to-know-about-indonesias-deadly-unrest.html",
"https://www.aljazeera.com/news/2025/8/30/three-killed-in-fire-at-indonesian-government-building-blamed-on-protesters",
"https://www.aljazeera.com/news/2025/8/26/indonesian-police-clash-with-students-protesting-lawmakers-salaries",
"https://www.aljazeera.com/video/inside-story/2025/8/30/whats-behind-widespread-unrest-in-indonesia"
];

foreach (string article in articles)
{
Process.Start(new ProcessStartInfo
{
FileName = article,
UseShellExecute = true
});
}
}

private async void RunCrisisIntroSequence()
{
Temporary20250827CrisisIntro.Visibility = Visibility.Visible;
IntroSequenceToggle.Visibility = Visibility.Collapsed;
IntroAnimation.Visibility = Visibility.Visible;

InputSystemCursor cursorType = InputSystemCursor.Create(InputSystemCursorShape.Hand);
Temporary20250827CrisisIntro.SetAllControlsCursorRecursive(cursorType);

RootFrameGrid.Opacity = 0;
WindowUtility.SetWindowBackdrop(WindowBackdropKind.Mica);

try
{
if (IsShownCrisisIntroDialog)
{
while (m_mainPage is null)
{
await Task.Delay(250);
}

TextBlock textBlock = new TextBlock
{
TextWrapping = TextWrapping.Wrap
}.AddTextBlockLine("Hi there, it's neon-nyan. Sorry to interrupt you here but we have some important announcement we would like to share with you regarding the current situation in Indonesia. Though, you can skip this announcement and use your launcher normally.")
.AddTextBlockNewLine(2)
.AddTextBlockLine("Would you like to read the announcement? (Duration: ~1 minute 20 seconds)");

ContentDialogResult result =
await SpawnDialog("[EN] Important Announcement",
textBlock,
closeText: "No, Skip it",
primaryText: "Yes, I would like to read it",
dialogTheme: ContentDialogTheme.Warning,
defaultButton: ContentDialogButton.Close);

if (result == ContentDialogResult.None)
{
IsEnableCrisisIntro = false;
return;
}
}

// in frames
const double animAnnounceStart = 0d;
const double animIntroStart = 4350d;
const double animIntroPause = 4740d;
const double animIntroDur = 4800d;

IntroAnimation.Source = new TempResetIndonesiaTaglineCrisis(); // Directly create new instance and so it triggers SetSource early.
{
IntroAnimation.AnimationOptimization = PlayerAnimationOptimization.Resources;
if (IsAppThemeLight)
{
((TempResetIndonesiaTaglineCrisis)IntroAnimation.Source).Color_FFFFFF = Color.FromArgb(255, 30, 30, 30);
}

if (IsShownCrisisIntroDialog)
{
await IntroAnimation.PlayAsync(animAnnounceStart / animIntroDur, animIntroStart / animIntroDur, false);
IsShownCrisisIntroDialog = false;
}

await IntroAnimation.PlayAsync(animIntroStart / animIntroDur, animIntroPause / animIntroDur, false);
await Task.Delay(2500);
await IntroAnimation.PlayAsync(animIntroPause / animIntroDur, animIntroDur / animIntroDur, false);
IntroAnimation.Stop();
}
IntroAnimation.Source = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
finally
{
Task rootFrameAnimTask = RootFrameGrid.StartAnimation(TimeSpan.FromSeconds(0.75),
RootFrameGrid.GetElementCompositor().CreateScalarKeyFrameAnimation("Opacity", 1, 0)
);
Task introFrameAnimTask = IntroAnimationGrid.StartAnimation(TimeSpan.FromSeconds(0.75),
IntroAnimationGrid.GetElementCompositor().CreateScalarKeyFrameAnimation("Opacity", 0, 1)
);

_ = Task.WhenAll(rootFrameAnimTask, introFrameAnimTask);
WindowUtility.SetWindowBackdrop(WindowBackdropKind.None);

_isForceDisableIntro = true;
IntroSequenceToggle.Visibility = Visibility.Collapsed;
IntroAnimationGrid.Visibility = Visibility.Collapsed;
}
}
#endregion

private async void RunIntroSequence()
{
bool isIntroEnabled = IsIntroEnabled && !_isForceDisableIntro;
Expand Down
3 changes: 1 addition & 2 deletions CollapseLauncher/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,7 @@
"hi3helper.plugin.core": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[9.0.9, )",
"Microsoft.NET.ILLink.Tasks": "[9.0.9, )"
"Microsoft.Extensions.Logging.Abstractions": "[9.0.9, )"
}
},
"hi3helper.sophon": {
Expand Down
2 changes: 1 addition & 1 deletion Hi3Helper.Sophon
Loading