Skip to content

Commit fe79c19

Browse files
author
Luca
committed
Merge branch 'release/0.1.1' into main
2 parents 9f48227 + 5c9f78b commit fe79c19

4 files changed

Lines changed: 56 additions & 11 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ jobs:
4040

4141
- name: Deploy and Restart Service
4242
run: |
43+
sudo systemctl stop pi-touch-date.service || true
4344
mkdir -p /home/pi/pi-touch-date
4445
cp -r ./deploy/* /home/pi/pi-touch-date/
4546
chmod +x /home/pi/pi-touch-date/PiTouchDate
46-
sudo systemctl restart pi-touch-date.service
47+
sudo systemctl start pi-touch-date.service

PiTouchDate/Controls/ScreenKeyboard/ScreenKeyboard.axaml.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public event EventHandler<ScreenKeyPressEventArgs> KeyPress
3333
remove => RemoveHandler(KeyPressEvent, value);
3434
}
3535

36-
private enum KeyboardMode { Lower, Upper, Symbols }
36+
private enum KeyboardMode { Lower, Upper, Symbols, Symbols2 }
3737

3838
// label, action, column width multiplier
3939
private record struct KeyDef(string Label, string Action, double Width = 1.0);
@@ -59,7 +59,15 @@ private record struct KeyDef(string Label, string Action, double Width = 1.0);
5959
[K("1"), K("2"), K("3"), K("4"), K("5"), K("6"), K("7"), K("8"), K("9"), K("0")],
6060
[K("!"), K("@"), K("#"), K("$"), K("%"), K("&"), K("*"), K("("), K(")"), K("-"), K("?")],
6161
[K("_"), K("="), K("+"), K("["), K("]"), K("{"), K("}"), K(";"), K(":"), K("'")],
62-
[Sp("abc", "ModeLower", 2.0), Sp("spazio", "Space", 6.0), Sp("⌫", "Backspace", 2.0)],
62+
[Sp("abc", "ModeLower", 1.5), Sp("▸", "ModeSymbols2", 1.5), Sp("spazio", "Space", 5.0), Sp(".", ".", 0.75), Sp("⌫", "Backspace", 1.25)],
63+
];
64+
65+
private static readonly KeyDef[][] SymbolRows2 =
66+
[
67+
[K("^"), K("~"), K("`"), K("\""), K("<"), K(">"), K("/"), K("\\"), K("|"), K(",")],
68+
[K("."), K("€"), K("£"), K("¥"), K("°"), K("•"), K("–"), K("—"), K("×"), K("÷")],
69+
[K("±"), K("™"), K("©"), K("®"), K("←"), K("→"), K("↑"), K("↓"), K("§"), K("¶")],
70+
[Sp("◀", "ModeSymbols", 1.5), Sp("abc", "ModeLower", 1.5), Sp("spazio", "Space", 5.0), Sp("⌫", "Backspace", 2.0)],
6371
];
6472

6573
private static KeyDef K(string key) => new(key, key);
@@ -89,6 +97,7 @@ private void BuildKeyboard()
8997
{
9098
KeyboardMode.Upper => UpperRows,
9199
KeyboardMode.Symbols => SymbolRows,
100+
KeyboardMode.Symbols2 => SymbolRows2,
92101
_ => LowerRows,
93102
};
94103

@@ -134,7 +143,7 @@ private Button CreateKeyButton(KeyDef key)
134143
var button = new Button { Content = key.Label };
135144
button.Classes.Add("key");
136145

137-
bool isSpecial = key.Action is "ModeUpper" or "ModeLower" or "ModeSymbols"
146+
bool isSpecial = key.Action is "ModeUpper" or "ModeLower" or "ModeSymbols" or "ModeSymbols2"
138147
or "Backspace" or "Space" or "123" or "abc";
139148

140149
if (isSpecial) button.Classes.Add("key-special");
@@ -148,9 +157,10 @@ private void HandleKeyPress(string action)
148157
{
149158
switch (action)
150159
{
151-
case "ModeUpper": _mode = KeyboardMode.Upper; BuildKeyboard(); return;
152-
case "ModeLower": _mode = KeyboardMode.Lower; BuildKeyboard(); return;
153-
case "ModeSymbols": _mode = KeyboardMode.Symbols; BuildKeyboard(); return;
160+
case "ModeUpper": _mode = KeyboardMode.Upper; BuildKeyboard(); return;
161+
case "ModeLower": _mode = KeyboardMode.Lower; BuildKeyboard(); return;
162+
case "ModeSymbols": _mode = KeyboardMode.Symbols; BuildKeyboard(); return;
163+
case "ModeSymbols2": _mode = KeyboardMode.Symbols2; BuildKeyboard(); return;
154164
}
155165

156166
var key = action == "Space" ? " " : action;

PiTouchDate/ViewModels/Overlays/WifiSettingsOverlayViewModel.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,29 @@ public string WifiPassword
5050
set => this.RaiseAndSetIfChanged(ref _wifiPassword, value);
5151
}
5252

53+
private bool _showPassword = false;
54+
public bool ShowPassword
55+
{
56+
get => _showPassword;
57+
set
58+
{
59+
this.RaiseAndSetIfChanged(ref _showPassword, value);
60+
this.RaisePropertyChanged(nameof(PasswordMaskChar));
61+
}
62+
}
63+
64+
public char PasswordMaskChar => ShowPassword ? '\0' : '●';
65+
5366
public ObservableCollection<WifiNetwork> Networks { get; } = new();
5467

5568
// ---------- Commands ----------
5669
public ReactiveCommand<Unit, bool> ConnectCommand { get; }
5770

5871
public ReactiveCommand<string, Unit> KeyPressCommand { get; }
5972

60-
public ReactiveCommand<Unit, Unit> CancelConnectionCommand {get; }
73+
public ReactiveCommand<Unit, Unit> CancelConnectionCommand { get; }
74+
75+
public ReactiveCommand<Unit, Unit> ToggleShowPasswordCommand { get; }
6176

6277

6378

@@ -68,6 +83,7 @@ public WifiSettingsViewModel()
6883
KeyPressCommand = ReactiveCommand.Create<string>(OnKeyPress);
6984
ConnectCommand = ReactiveCommand.CreateFromTask(ConnectCommandHandler);
7085
CancelConnectionCommand = ReactiveCommand.Create(CancelConnectionCommandHandler);
86+
ToggleShowPasswordCommand = ReactiveCommand.Create(() => { ShowPassword = !ShowPassword; });
7187

7288
_isConnecting = ConnectCommand.IsExecuting
7389
.ToProperty(this, x => x.IsConnecting, scheduler: RxApp.MainThreadScheduler);
@@ -130,6 +146,7 @@ public void SelectNetwork(WifiNetwork network)
130146
{
131147
SelectedNetwork = network;
132148
WifiPassword = string.Empty;
149+
ShowPassword = false;
133150
}
134151

135152
// ---------- Commands handlers ----------

PiTouchDate/Views/Overlays/WifiSettingsView.axaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,26 @@
8888
</Button>
8989
</Grid>
9090

91-
<!-- Passord input -->
92-
<TextBox Grid.Row="1" HorizontalAlignment="Stretch" Margin="0,10,0,0" PasswordChar=""
93-
Text="{Binding WifiPassword, UpdateSourceTrigger=PropertyChanged}"/>
91+
<!-- Password input -->
92+
<Panel Grid.Row="1" Margin="0,10,0,0">
93+
<TextBox HorizontalAlignment="Stretch"
94+
PasswordChar="{Binding PasswordMaskChar}"
95+
Text="{Binding WifiPassword, UpdateSourceTrigger=PropertyChanged}"
96+
Padding="12,8,44,8"/>
97+
<Button HorizontalAlignment="Right" VerticalAlignment="Center"
98+
Margin="0,0,6,0" Padding="6"
99+
Background="Transparent" BorderThickness="0"
100+
Command="{Binding ToggleShowPasswordCommand}">
101+
<Panel>
102+
<PathIcon Data="{DynamicResource SemiIconEyeOpened}"
103+
Width="18" Height="18" Opacity="0.6"
104+
IsVisible="{Binding !ShowPassword}"/>
105+
<PathIcon Data="{DynamicResource SemiIconEyeClosedSolid}"
106+
Width="18" Height="18" Opacity="0.6"
107+
IsVisible="{Binding ShowPassword}"/>
108+
</Panel>
109+
</Button>
110+
</Panel>
94111

95112
<!-- Screen keyboard -->
96113
<controls:ScreenKeyboard Grid.Row="2" Margin="0,10,0,0" KeyPressCommand="{Binding KeyPressCommand}"/>

0 commit comments

Comments
 (0)