Skip to content

Commit cb5a99f

Browse files
committed
Revert "Code Quality: Added debug logs for Omnibar (#17231)"
This reverts commit bd2f5f1.
1 parent 8e14702 commit cb5a99f

File tree

7 files changed

+2
-54
lines changed

7 files changed

+2
-54
lines changed

src/Files.App.Controls/Files.App.Controls.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<Platforms>x86;x64;arm64</Platforms>
1111
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13-
<DefineConstants>$(DefineConstants);OMNIBAR_DEBUG</DefineConstants>
1413
</PropertyGroup>
1514

1615
<ItemGroup>

src/Files.App.Controls/Omnibar/Omnibar.Events.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ private void AutoSuggestBox_GettingFocus(UIElement sender, GettingFocusEventArgs
2727
if (args.OldFocusedElement is null)
2828
return;
2929

30-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox is getting the focus.");
31-
3230
_previouslyFocusedElement = new(args.OldFocusedElement as UIElement);
3331
}
3432

@@ -44,8 +42,6 @@ private void AutoSuggestBox_LosingFocus(UIElement sender, LosingFocusEventArgs a
4442

4543
private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)
4644
{
47-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox got the focus.");
48-
4945
IsFocused = true;
5046
_textBox.SelectAll();
5147
}
@@ -56,8 +52,6 @@ private void AutoSuggestBox_LostFocus(object sender, RoutedEventArgs e)
5652
if (_textBox.ContextFlyout.IsOpen)
5753
return;
5854

59-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox lost the focus.");
60-
6155
IsFocused = false;
6256
}
6357

@@ -67,16 +61,12 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
6761
{
6862
e.Handled = true;
6963

70-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Enter key.");
71-
7264
SubmitQuery(_textBoxSuggestionsPopup.IsOpen && _textBoxSuggestionsListView.SelectedIndex is not -1 ? _textBoxSuggestionsListView.SelectedItem : null);
7365
}
7466
else if ((e.Key == VirtualKey.Up || e.Key == VirtualKey.Down) && _textBoxSuggestionsPopup.IsOpen)
7567
{
7668
e.Handled = true;
7769

78-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Up/Down key while the suggestions pop-up is open.");
79-
8070
var currentIndex = _textBoxSuggestionsListView.SelectedIndex;
8171
var nextIndex = currentIndex;
8272
var suggestionsCount = _textBoxSuggestionsListView.Items.Count;
@@ -105,8 +95,6 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
10595
{
10696
e.Handled = true;
10797

108-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Esc key.");
109-
11098
if (_textBoxSuggestionsPopup.IsOpen)
11199
{
112100
RevertTextToUserInput();
@@ -120,8 +108,6 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
120108
}
121109
else if (e.Key == VirtualKey.Tab && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
122110
{
123-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Tab key.");
124-
125111
// Focus on inactive content when pressing Tab instead of moving to the next control in the tab order
126112
e.Handled = true;
127113
IsFocused = false;
@@ -156,7 +142,6 @@ private void AutoSuggestBox_TextChanged(object sender, TextChangedEventArgs e)
156142

157143
private void AutoSuggestBoxSuggestionsPopup_GettingFocus(UIElement sender, GettingFocusEventArgs args)
158144
{
159-
// The suggestions popup is never wanted to be focused when it come to open.
160145
args.TryCancel();
161146
}
162147

src/Files.App.Controls/Omnibar/Omnibar.Properties.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ partial void OnCurrentSelectedModePropertyChanged(DependencyPropertyChangedEvent
2727
if (e.NewValue is not OmnibarMode newMode)
2828
return;
2929

30-
if (e.OldValue is OmnibarMode oldMode)
31-
GlobalHelper.WriteDebugStringForOmnibar($"The mode change from {oldMode} to {newMode} has been requested.");
32-
else
33-
GlobalHelper.WriteDebugStringForOmnibar($"The mode change to {newMode} has been requested.");
34-
3530
ChangeMode(e.OldValue as OmnibarMode, newMode);
3631
CurrentSelectedModeName = newMode.Name;
3732
}
@@ -56,8 +51,6 @@ partial void OnIsFocusedChanged(bool newValue)
5651
if (CurrentSelectedMode is null || _textBox is null)
5752
return;
5853

59-
GlobalHelper.WriteDebugStringForOmnibar($"{nameof(IsFocused)} has been changed to {IsFocused}");
60-
6154
if (newValue)
6255
{
6356
VisualStateManager.GoToState(CurrentSelectedMode, "Focused", true);

src/Files.App.Controls/Omnibar/Omnibar.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public Omnibar()
5151

5252
Modes = [];
5353
AutoSuggestBoxPadding = new(0, 0, 0, 0);
54-
55-
GlobalHelper.WriteDebugStringForOmnibar("Omnibar has been initialized.");
5654
}
5755

5856
// Methods
@@ -89,8 +87,6 @@ protected override void OnApplyTemplate()
8987

9088
// Set the default width
9189
_textBoxSuggestionsContainerBorder.Width = ActualWidth;
92-
93-
GlobalHelper.WriteDebugStringForOmnibar("The template and the events have been initialized.");
9490
}
9591

9692
public void PopulateModes()
@@ -200,8 +196,6 @@ protected void ChangeMode(OmnibarMode? oldMode, OmnibarMode newMode)
200196
mode.Transitions.Clear();
201197
mode.UpdateLayout();
202198
}
203-
204-
GlobalHelper.WriteDebugStringForOmnibar($"Successfully changed Mode from {oldMode} to {newMode}");
205199
}
206200

207201
internal protected void FocusTextBox()
@@ -217,16 +211,11 @@ internal protected bool TryToggleIsSuggestionsPopupOpen(bool wantToOpen)
217211
if (wantToOpen && (!IsFocused || CurrentSelectedMode?.ItemsSource is null || (CurrentSelectedMode?.ItemsSource is IList collection && collection.Count is 0)))
218212
{
219213
_textBoxSuggestionsPopup.IsOpen = false;
220-
221-
GlobalHelper.WriteDebugStringForOmnibar("The suggestions pop-up closed.");
222-
223214
return false;
224215
}
225216

226217
_textBoxSuggestionsPopup.IsOpen = wantToOpen;
227218

228-
GlobalHelper.WriteDebugStringForOmnibar("The suggestions pop-up is open.");
229-
230219
return false;
231220
}
232221

src/Files.App.Controls/Omnibar/OmnibarMode.Events.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ private void ModeButton_PointerEntered(object sender, PointerRoutedEventArgs e)
1212
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
1313
return;
1414

15-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has entered the UI area of this Mode ({this})");
16-
1715
VisualStateManager.GoToState(this, "PointerOver", true);
1816
}
1917

@@ -22,8 +20,6 @@ private void ModeButton_PointerPressed(object sender, PointerRoutedEventArgs e)
2220
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
2321
return;
2422

25-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has been pressed on the UI area of this Mode ({this})");
26-
2723
VisualStateManager.GoToState(this, "PointerPressed", true);
2824
}
2925

@@ -32,8 +28,6 @@ private void ModeButton_PointerReleased(object sender, PointerRoutedEventArgs e)
3228
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
3329
return;
3430

35-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has been unpressed from the UI area of this Mode ({this})");
36-
3731
VisualStateManager.GoToState(this, "PointerOver", true);
3832

3933
owner.IsModeButtonPressed = true;
@@ -44,8 +38,6 @@ private void ModeButton_PointerReleased(object sender, PointerRoutedEventArgs e)
4438

4539
private void ModeButton_PointerExited(object sender, PointerRoutedEventArgs e)
4640
{
47-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has moved away from the UI area of this Mode ({this})");
48-
4941
VisualStateManager.GoToState(this, "PointerNormal", true);
5042
}
5143
}

src/Files.App.Controls/Omnibar/OmnibarMode.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public partial class OmnibarMode : ItemsControl
2323
public OmnibarMode()
2424
{
2525
DefaultStyleKey = typeof(OmnibarMode);
26-
27-
GlobalHelper.WriteDebugStringForOmnibar($"Omnibar Mode ({this}) has been initialized.");
2826
}
2927

3028
// Methods
@@ -41,8 +39,6 @@ protected override void OnApplyTemplate()
4139
_modeButton.PointerPressed += ModeButton_PointerPressed;
4240
_modeButton.PointerReleased += ModeButton_PointerReleased;
4341
_modeButton.PointerExited += ModeButton_PointerExited;
44-
45-
GlobalHelper.WriteDebugStringForOmnibar($"The template and the events of the Omnibar Mode ({this}) have been initialized.");
4642
}
4743

4844
protected override void OnKeyUp(KeyRoutedEventArgs args)
@@ -92,7 +88,7 @@ public void SetOwner(Omnibar owner)
9288

9389
public override string ToString()
9490
{
95-
return Name ?? string.Empty;
91+
return ModeName ?? string.Empty;
9692
}
9793
}
9894
}

src/Files.App.Controls/GlobalHelper.cs renamed to src/Files.App.Controls/Util.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Files.App.Controls
55
{
6-
public static class GlobalHelper
6+
public static class Util
77
{
88
/// <summary>
99
/// Sets cursor when hovering on a specific element.
@@ -22,11 +22,5 @@ public static void ChangeCursor(this UIElement uiElement, InputCursor cursor)
2222
[cursor]
2323
);
2424
}
25-
26-
[Conditional("OMNIBAR_DEBUG")]
27-
public static void WriteDebugStringForOmnibar(string? message)
28-
{
29-
Debug.WriteLine($"OMNIBAR DEBUG: [{message}]");
30-
}
3125
}
3226
}

0 commit comments

Comments
 (0)