|
1 | 1 | using CollapseLauncher.AnimatedVisuals.Lottie;
|
2 |
| -using CollapseLauncher.CustomControls; |
3 | 2 | using CollapseLauncher.Extension;
|
4 | 3 | using CollapseLauncher.Helper;
|
5 | 4 | using CollapseLauncher.Helper.Animation;
|
|
23 | 22 | using Microsoft.UI.Xaml.Media;
|
24 | 23 | using Microsoft.UI.Xaml.Media.Animation;
|
25 | 24 | using System;
|
26 |
| -using System.Diagnostics; |
27 |
| -using System.Globalization; |
28 | 25 | using System.Linq;
|
29 | 26 | using System.Threading;
|
30 | 27 | using System.Threading.Tasks;
|
@@ -115,172 +112,10 @@ public void StartMainPage()
|
115 | 112 | {
|
116 | 113 | WindowUtility.SetWindowSize(WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Width, WindowSize.WindowSize.CurrentWindowSize.WindowBounds.Height);
|
117 | 114 |
|
118 |
| - if (IsCrisisIntroEnabled()) |
119 |
| - { |
120 |
| - RunCrisisIntroSequence(); |
121 |
| - } |
122 |
| - else |
123 |
| - { |
124 |
| - RunIntroSequence(); |
125 |
| - } |
126 |
| - |
| 115 | + RunIntroSequence(); |
127 | 116 | RootFrame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo());
|
128 | 117 | }
|
129 | 118 |
|
130 |
| - #region TEMPORARY: August 27th, 2025 Temporary Intro due to current Indonesian's crisis |
131 |
| - public bool IsEnableCrisisIntro |
132 |
| - { |
133 |
| - get => GetAppConfigValue("Enable20250827CrisisIntro"); |
134 |
| - set => SetAndSaveConfigValue("Enable20250827CrisisIntro", value); |
135 |
| - } |
136 |
| - |
137 |
| - public bool IsShownCrisisIntroDialog |
138 |
| - { |
139 |
| - get => GetAppConfigValue("Enable20250827CrisisIntroDialog"); |
140 |
| - set => SetAndSaveConfigValue("Enable20250827CrisisIntroDialog", value); |
141 |
| - } |
142 |
| - |
143 |
| - // Starts the intro at 00:00 AM Jakarta Time - September 1st -> 00:00 AM Jakarta Time - September 8th. |
144 |
| - private readonly DateTime _dateTimeCrisisOffsetStart |
145 |
| - = new DateTimeOffset(2025, 9, 1, 0, 0, 0, TimeSpan.FromHours(7)).UtcDateTime; |
146 |
| - private readonly DateTime _dateTimeCrisisOffsetEnd |
147 |
| - = new DateTimeOffset(2025, 9, 8, 0, 0, 0, TimeSpan.FromHours(7)).UtcDateTime; |
148 |
| - |
149 |
| - private bool IsCrisisIntroEnabled() |
150 |
| - { |
151 |
| - DateTime nowDateTimeOffset = DateTime.UtcNow; |
152 |
| - if (nowDateTimeOffset < _dateTimeCrisisOffsetStart || |
153 |
| - nowDateTimeOffset >= _dateTimeCrisisOffsetEnd) |
154 |
| - { |
155 |
| - return false; |
156 |
| - } |
157 |
| - |
158 |
| - if (_isForceDisableIntro || !IsEnableCrisisIntro) |
159 |
| - { |
160 |
| - return false; |
161 |
| - } |
162 |
| - |
163 |
| - // Try to disable the intro if the user is using certain region/CultureInfo in their system. |
164 |
| - (string langId, string countryId)[] disabledLocale = [ |
165 |
| - ("zh", "cn") |
166 |
| - ]; |
167 |
| - string currentCulture = CultureInfo.CurrentUICulture.Name; |
168 |
| - |
169 |
| - |
170 |
| - return !disabledLocale.Any(x => currentCulture.StartsWith(x.langId, StringComparison.OrdinalIgnoreCase) && |
171 |
| - currentCulture.EndsWith(x.countryId, StringComparison.OrdinalIgnoreCase)); |
172 |
| - } |
173 |
| - |
174 |
| - private void Temporary20250827CrisisIntroButton_OnClick(object sender, RoutedEventArgs e) |
175 |
| - { |
176 |
| - string[] articles = [ |
177 |
| - "https://www.thejakartapost.com/indonesia/2025/08/31/five-things-to-know-about-indonesias-deadly-unrest.html", |
178 |
| - "https://www.aljazeera.com/news/2025/8/30/three-killed-in-fire-at-indonesian-government-building-blamed-on-protesters", |
179 |
| - "https://www.aljazeera.com/news/2025/8/26/indonesian-police-clash-with-students-protesting-lawmakers-salaries", |
180 |
| - "https://www.aljazeera.com/video/inside-story/2025/8/30/whats-behind-widespread-unrest-in-indonesia" |
181 |
| - ]; |
182 |
| - |
183 |
| - foreach (string article in articles) |
184 |
| - { |
185 |
| - Process.Start(new ProcessStartInfo |
186 |
| - { |
187 |
| - FileName = article, |
188 |
| - UseShellExecute = true |
189 |
| - }); |
190 |
| - } |
191 |
| - } |
192 |
| - |
193 |
| - private async void RunCrisisIntroSequence() |
194 |
| - { |
195 |
| - Temporary20250827CrisisIntro.Visibility = Visibility.Visible; |
196 |
| - IntroSequenceToggle.Visibility = Visibility.Collapsed; |
197 |
| - IntroAnimation.Visibility = Visibility.Visible; |
198 |
| - |
199 |
| - InputSystemCursor cursorType = InputSystemCursor.Create(InputSystemCursorShape.Hand); |
200 |
| - Temporary20250827CrisisIntro.SetAllControlsCursorRecursive(cursorType); |
201 |
| - |
202 |
| - RootFrameGrid.Opacity = 0; |
203 |
| - WindowUtility.SetWindowBackdrop(WindowBackdropKind.Mica); |
204 |
| - |
205 |
| - try |
206 |
| - { |
207 |
| - if (IsShownCrisisIntroDialog) |
208 |
| - { |
209 |
| - while (m_mainPage is null) |
210 |
| - { |
211 |
| - await Task.Delay(250); |
212 |
| - } |
213 |
| - |
214 |
| - TextBlock textBlock = new TextBlock |
215 |
| - { |
216 |
| - TextWrapping = TextWrapping.Wrap |
217 |
| - }.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.") |
218 |
| - .AddTextBlockNewLine(2) |
219 |
| - .AddTextBlockLine("Would you like to read the announcement? (Duration: ~1 minute 20 seconds)"); |
220 |
| - |
221 |
| - ContentDialogResult result = |
222 |
| - await SpawnDialog("[EN] Important Announcement", |
223 |
| - textBlock, |
224 |
| - closeText: "No, Skip it", |
225 |
| - primaryText: "Yes, I would like to read it", |
226 |
| - dialogTheme: ContentDialogTheme.Warning, |
227 |
| - defaultButton: ContentDialogButton.Close); |
228 |
| - |
229 |
| - if (result == ContentDialogResult.None) |
230 |
| - { |
231 |
| - IsEnableCrisisIntro = false; |
232 |
| - return; |
233 |
| - } |
234 |
| - } |
235 |
| - |
236 |
| - // in frames |
237 |
| - const double animAnnounceStart = 0d; |
238 |
| - const double animIntroStart = 4350d; |
239 |
| - const double animIntroPause = 4740d; |
240 |
| - const double animIntroDur = 4800d; |
241 |
| - |
242 |
| - IntroAnimation.Source = new TempResetIndonesiaTaglineCrisis(); // Directly create new instance and so it triggers SetSource early. |
243 |
| - { |
244 |
| - IntroAnimation.AnimationOptimization = PlayerAnimationOptimization.Resources; |
245 |
| - if (IsAppThemeLight) |
246 |
| - { |
247 |
| - ((TempResetIndonesiaTaglineCrisis)IntroAnimation.Source).Color_FFFFFF = Color.FromArgb(255, 30, 30, 30); |
248 |
| - } |
249 |
| - |
250 |
| - if (IsShownCrisisIntroDialog) |
251 |
| - { |
252 |
| - await IntroAnimation.PlayAsync(animAnnounceStart / animIntroDur, animIntroStart / animIntroDur, false); |
253 |
| - IsShownCrisisIntroDialog = false; |
254 |
| - } |
255 |
| - |
256 |
| - await IntroAnimation.PlayAsync(animIntroStart / animIntroDur, animIntroPause / animIntroDur, false); |
257 |
| - await Task.Delay(2500); |
258 |
| - await IntroAnimation.PlayAsync(animIntroPause / animIntroDur, animIntroDur / animIntroDur, false); |
259 |
| - IntroAnimation.Stop(); |
260 |
| - } |
261 |
| - IntroAnimation.Source = null; |
262 |
| - GC.Collect(); |
263 |
| - GC.WaitForPendingFinalizers(); |
264 |
| - } |
265 |
| - finally |
266 |
| - { |
267 |
| - Task rootFrameAnimTask = RootFrameGrid.StartAnimation(TimeSpan.FromSeconds(0.75), |
268 |
| - RootFrameGrid.GetElementCompositor().CreateScalarKeyFrameAnimation("Opacity", 1, 0) |
269 |
| - ); |
270 |
| - Task introFrameAnimTask = IntroAnimationGrid.StartAnimation(TimeSpan.FromSeconds(0.75), |
271 |
| - IntroAnimationGrid.GetElementCompositor().CreateScalarKeyFrameAnimation("Opacity", 0, 1) |
272 |
| - ); |
273 |
| - |
274 |
| - _ = Task.WhenAll(rootFrameAnimTask, introFrameAnimTask); |
275 |
| - WindowUtility.SetWindowBackdrop(WindowBackdropKind.None); |
276 |
| - |
277 |
| - _isForceDisableIntro = true; |
278 |
| - IntroSequenceToggle.Visibility = Visibility.Collapsed; |
279 |
| - IntroAnimationGrid.Visibility = Visibility.Collapsed; |
280 |
| - } |
281 |
| - } |
282 |
| - #endregion |
283 |
| - |
284 | 119 | private async void RunIntroSequence()
|
285 | 120 | {
|
286 | 121 | bool isIntroEnabled = IsIntroEnabled && !_isForceDisableIntro;
|
|
0 commit comments