Skip to content

Commit 54a56ef

Browse files
committed
feat: Show alert when breaking changes update detected, close #383
1 parent 3a72a73 commit 54a56ef

File tree

10 files changed

+181
-32
lines changed

10 files changed

+181
-32
lines changed

Ui/AppVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace _1RM
55
public static class AppVersion
66
{
77
public const uint Major = 0;
8-
public const uint Minor = 9;
8+
public const uint Minor = 4;
99
public const uint Patch = 0;
1010
public const uint Build = 0;
1111
public const string PreRelease = "alpha.01"; // e.g. "alpha" "beta.2"

Ui/Assert.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ internal static class Assert
2222

2323
public const string MS_APP_CENTER_SECRET = "===REPLACE_ME_WITH_APP_CENTER_SECRET===";
2424
public const string STRING_SALT = "===REPLACE_ME_WITH_SALT===";
25+
public const string MS_STORE_PATH = "ms-windows-store://review/?productid=9PNMNF92JNFP";
2526
}
2627
}

Ui/Service/ConfigurationService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ public class EngagementSettings
2626
public DateTime InstallTime = DateTime.Today;
2727
public bool DoNotShowAgain = false;
2828
public string DoNotShowAgainVersionString = "";
29+
public DateTime LastRequestRatingsTime = DateTime.MinValue;
2930
[Newtonsoft.Json.JsonIgnore]
3031
public VersionHelper.Version DoNotShowAgainVersion => VersionHelper.Version.FromString(DoNotShowAgainVersionString);
31-
public DateTime LastRequestRatingsTime = DateTime.MinValue;
32+
33+
34+
public string BreakingChangeAlertVersionString = "";
35+
[Newtonsoft.Json.JsonIgnore]
36+
public VersionHelper.Version BreakingChangeAlertVersion => VersionHelper.Version.FromString(BreakingChangeAlertVersionString);
3237
public int ConnectCount = 0;
3338
}
3439
public class GeneralConfig

Ui/View/AboutPageView.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
<TextBlock Text="Update" Margin="0"/>
106106
<TextBlock Grid.Column="1" Margin="0">
107-
<Hyperlink Name="HyperlinkUpdate" NavigateUri="{Binding NewVersionUrl}" TextDecorations="{x:Null}" controls:HyperlinkHelper.IsOpenExternal="True">
107+
<Hyperlink Name="HyperlinkUpdate" Command="{Binding CmdUpdate}" TextDecorations="{x:Null}">
108108
<Grid>
109109
<TextBlock Name="TbNewVersion" Margin="0" Text="{Binding NewVersion}" Foreground="{Binding ElementName=HyperlinkUpdate, Path=Foreground}" />
110110
<Path Data="F1 M 10 3.4375 C 10.605469 3.4375 11.186523 3.515625 11.743164 3.671875 C 12.299805 3.828125 12.822266 4.049479 13.310547 4.335938 C 13.798828 4.622396 14.241536 4.964193 14.638672 5.361328 C 15.035807 5.758464 15.377604 6.201172 15.664063 6.689453 C 15.950521 7.177734 16.171875 7.700195 16.328125 8.256836 C 16.484375 8.813477 16.5625 9.394531 16.5625 10 C 16.5625 10.605469 16.484375 11.186523 16.328125 11.743164 C 16.171875 12.299805 15.950521 12.822266 15.664063 13.310547 C 15.377604 13.798828 15.035807 14.241537 14.638672 14.638672 C 14.241536 15.035808 13.798828 15.377604 13.310547 15.664063 C 12.822266 15.950521 12.299805 16.171875 11.743164 16.328125 C 11.186523 16.484375 10.605469 16.5625 10 16.5625 C 9.394531 16.5625 8.813477 16.484375 8.256836 16.328125 C 7.700195 16.171875 7.177734 15.950521 6.689453 15.664063 C 6.201172 15.377604 5.758463 15.035808 5.361328 14.638672 C 4.964192 14.241537 4.622396 13.798828 4.335938 13.310547 C 4.049479 12.822266 3.828125 12.299805 3.671875 11.743164 C 3.515625 11.186523 3.4375 10.605469 3.4375 10 C 3.4375 9.394531 3.515625 8.813477 3.671875 8.256836 C 3.828125 7.700195 4.049479 7.177734 4.335938 6.689453 C 4.622396 6.201172 4.964192 5.758464 5.361328 5.361328 C 5.758463 4.964193 6.201172 4.622396 6.689453 4.335938 C 7.177734 4.049479 7.700195 3.828125 8.256836 3.671875 C 8.813477 3.515625 9.394531 3.4375 10 3.4375 Z "
@@ -145,9 +145,9 @@
145145
<StackPanel Orientation="Vertical" Margin="20 0 0 0">
146146
<StackPanel Orientation="Vertical">
147147
<TextBlock Style="{StaticResource EditorGroupTextBlockTitle}" Text="Support" Background="Transparent">
148-
<TextBlock.InputBindings>
148+
<!--<TextBlock.InputBindings>
149149
<MouseBinding Gesture="Control+WheelClick" Command="{Binding CmdConsoleToggle}"></MouseBinding>
150-
</TextBlock.InputBindings>
150+
</TextBlock.InputBindings>-->
151151
</TextBlock>
152152
<StackPanel>
153153
<Grid Style="{StaticResource RowGrid}">

Ui/View/AboutPageViewModel.cs

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System.Timers;
2-
using System.Windows.Input;
32
using _1RM.Service;
3+
using _1RM.View.Utils;
44
using Shawn.Utils;
55
using Shawn.Utils.Wpf;
6+
using Shawn.Utils.Wpf.Controls;
7+
using Stylet;
68

79
namespace _1RM.View
810
{
@@ -26,9 +28,6 @@ public AboutPageViewModel()
2628
checker.CheckUpdateAsync();
2729
};
2830
checker.CheckUpdateAsync();
29-
30-
31-
CurrentVersion = _1Remote.Security.Config.Salt;
3231
}
3332

3433
~AboutPageViewModel()
@@ -37,7 +36,7 @@ public AboutPageViewModel()
3736
_checkUpdateTimer?.Dispose();
3837
}
3938

40-
public string CurrentVersion { get; }
39+
public string CurrentVersion => AppVersion.Version;
4140

4241

4342
private string _newVersion = "";
@@ -55,10 +54,27 @@ public string NewVersionUrl
5554
set => SetAndNotifyIfChanged(ref _newVersionUrl, value);
5655
}
5756

58-
private void OnNewVersionRelease(string version, string url)
57+
private bool _isBreakingNewVersion;
58+
public bool IsBreakingNewVersion
59+
{
60+
get => _isBreakingNewVersion;
61+
set => SetAndNotifyIfChanged(ref _isBreakingNewVersion, value);
62+
}
63+
64+
private void OnNewVersionRelease(string version, string url, bool b)
5965
{
6066
this.NewVersion = version;
6167
this.NewVersionUrl = url;
68+
this.IsBreakingNewVersion = b;
69+
var v = IoC.Get<ConfigurationService>().Engagement.BreakingChangeAlertVersion;
70+
if (this.IsBreakingNewVersion
71+
&& VersionHelper.Version.FromString(version) > v)
72+
{
73+
Execute.OnUIThreadSync(() =>
74+
{
75+
IoC.Get<IWindowManager>().ShowDialog(IoC.Get<BreakingChangeUpdateViewModel>());
76+
});
77+
}
6278
}
6379

6480

@@ -74,7 +90,30 @@ public RelayCommand CmdClose
7490
}
7591
}
7692

77-
93+
private RelayCommand? _cmdUpdate;
94+
public RelayCommand CmdUpdate
95+
{
96+
get
97+
{
98+
return _cmdUpdate ??= new RelayCommand((o) =>
99+
{
100+
if (IsBreakingNewVersion)
101+
{
102+
MaskLayerController.ShowProcessingRing();
103+
IoC.Get<IWindowManager>().ShowDialog(IoC.Get<BreakingChangeUpdateViewModel>(), ownerViewModel: IoC.Get<MainWindowViewModel>());
104+
MaskLayerController.HideMask();
105+
}
106+
else
107+
{
108+
#if FOR_MICROSOFT_STORE_ONLY
109+
HyperlinkHelper.OpenUriBySystem("ms-windows-store://review/?productid=9PNMNF92JNFP");
110+
#else
111+
HyperlinkHelper.OpenUriBySystem(NewVersionUrl);
112+
#endif
113+
}
114+
});
115+
}
116+
}
78117

79118
private RelayCommand? _cmdConsoleToggle;
80119
public RelayCommand CmdConsoleToggle

Ui/View/Host/TabWindowView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
<Setter Property="HeaderPrefixContent">
289289
<Setter.Value>
290290
<Grid Margin="5 0" Height="{x:Static host:TabWindowBase.TITLE_BAR_HEIGHT}" VerticalAlignment="Center">
291-
<Grid Width="24" Height="24" VerticalAlignment="Center">
291+
<Grid Width="20" Height="20" VerticalAlignment="Center">
292292
<Image Source="/Resources/Image/Logo/logo32.png"></Image>
293293
</Grid>
294294
</Grid>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<styles:WindowChromeBase x:Class="_1RM.View.Utils.BreakingChangeUpdateView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:utils="clr-namespace:_1RM.View.Utils"
7+
xmlns:styles="clr-namespace:Shawn.Utils.WpfResources.Theme.Styles;assembly=Shawn.Utils.WpfResources"
8+
xmlns:s="https://github.com/canton7/Stylet"
9+
mc:Ignorable="d"
10+
d:DataContext="{d:DesignInstance utils:BreakingChangeUpdateViewModel}"
11+
ResizeMode="NoResize"
12+
WindowStyle="None"
13+
Background="Transparent"
14+
AllowsTransparency="True"
15+
ShowInTaskbar="False"
16+
Topmost="True"
17+
SizeToContent="WidthAndHeight">
18+
<Grid Background="Transparent">
19+
<Grid Background="Transparent" Margin="15">
20+
<Border Background="{DynamicResource PrimaryMidBrush}" BorderBrush="{DynamicResource DefaultBorderBrush}" BorderThickness="1"
21+
VerticalAlignment="Center" HorizontalAlignment="Center" Width="600" CornerRadius="15">
22+
<Border.Effect>
23+
<DropShadowEffect BlurRadius="10" Opacity="0.8" ></DropShadowEffect>
24+
</Border.Effect>
25+
<StackPanel HorizontalAlignment="Center" Margin="40 30 40 0">
26+
<Grid HorizontalAlignment="Center" Margin="0 0 0 10">
27+
<Image Source="/Resources/Image/Logo/logo64.png" Width="32" HorizontalAlignment="Left"></Image>
28+
</Grid>
29+
<TextBlock FontSize="16" Foreground="Red"
30+
FontWeight="Black" Margin="5"
31+
HorizontalAlignment="Center"
32+
TextWrapping="Wrap" Text="Breaking Change Alert!"></TextBlock>
33+
<TextBlock FontSize="16" FontWeight="Black" HorizontalAlignment="Center">
34+
<Hyperlink Name="HyperlinkUpdate" Command="{Binding AboutPageViewModel.CmdUpdate}" TextDecorations="{x:Null}">
35+
<Grid>
36+
<TextBlock Name="TbNewVersion" Margin="0" Text="{Binding AboutPageViewModel.NewVersion}" Foreground="{Binding ElementName=HyperlinkUpdate, Path=Foreground}" />
37+
</Grid>
38+
</Hyperlink>
39+
</TextBlock>
40+
<StackPanel Margin="10">
41+
<TextBlock FontSize="18" Opacity="0.7" TextWrapping="Wrap" Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center"
42+
Text="We have some breaking changes in the next version, please pay attention to backup your data before update." />
43+
</StackPanel>
44+
45+
46+
<StackPanel Margin="0 15 " VerticalAlignment="Bottom">
47+
<Button Command="{Binding CmdClose}" Content="{DynamicResource Dismiss}" Style="{DynamicResource ButtonPrimaryStyle}"></Button>
48+
</StackPanel>
49+
</StackPanel>
50+
</Border>
51+
</Grid>
52+
</Grid>
53+
</styles:WindowChromeBase>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using Stylet;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Drawing;
5+
using System.Linq;
6+
using System.Media;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows;
10+
using System.Windows.Input;
11+
using _1RM.Utils;
12+
using Shawn.Utils.Wpf;
13+
using _1RM.Service;
14+
using Shawn.Utils.Wpf.Controls;
15+
16+
namespace _1RM.View.Utils
17+
{
18+
/// <summary>
19+
/// Default implementation of IMessageBoxViewModel, and is therefore the ViewModel shown by default by ShowMessageBox
20+
/// </summary>
21+
public class BreakingChangeUpdateViewModel : NotifyPropertyChangedBaseScreen
22+
{
23+
public AboutPageViewModel AboutPageViewModel => IoC.Get<AboutPageViewModel>();
24+
25+
26+
private RelayCommand? _cmdUpdate;
27+
public RelayCommand CmdUpdate
28+
{
29+
get
30+
{
31+
return _cmdUpdate ??= new RelayCommand((o) =>
32+
{
33+
#if FOR_MICROSOFT_STORE_ONLY
34+
HyperlinkHelper.OpenUriBySystem("ms-windows-store://review/?productid=9PNMNF92JNFP");
35+
#else
36+
HyperlinkHelper.OpenUriBySystem(AboutPageViewModel.NewVersionUrl);
37+
#endif
38+
});
39+
}
40+
}
41+
private RelayCommand? _cmdClose;
42+
public RelayCommand CmdClose
43+
{
44+
get
45+
{
46+
return _cmdClose ??= new RelayCommand((o) =>
47+
{
48+
IoC.Get<ConfigurationService>().Engagement.BreakingChangeAlertVersionString = AboutPageViewModel.NewVersion;
49+
IoC.Get<ConfigurationService>().Save();
50+
this.RequestClose(true);
51+
});
52+
}
53+
}
54+
}
55+
}

readme.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,35 @@ This App Will Rename to 1Remote in the feature..
2727
- Customizable runners, in SFTP \ FTP \ VNC \ etc. protocols, you can replace the internal runner with your favourite tools.[wiki](https://github.com/1Remote/1Remote/wiki/%5BProtocol%5D--Protocol-Runners)
2828
- Portable - just unpack and run
2929

30-
## Installation
31-
32-
### Stable
30+
## 🚩Installation
3331

3432
Latest Version: 0.7.2.7
3533

36-
Use one of the following methods to install the application:
34+
|| Stable的 | Preview |
35+
|---| --- | --- |
36+
| Download | <li>[GitHub release](https://github.com/1Remote/1Remote/releases)</li><li>[Microsoft Store](https://www.microsoft.com/store/productId/9PNMNF92JNFP)</li><li>[Winget](https://github.com/microsoft/winget-cli): `winget install premotem`</li><li>[Chocolatey](https://chocolatey.org/packages/premotem): `choco install premotem`</li> | [Nightly](https://github.com/1Remote/1Remote/releases/tag/Nightly) |
3737

38-
- [GitHub release](https://github.com/1Remote/1Remote/releases)
39-
- [Microsoft Store](https://www.microsoft.com/store/productId/9PNMNF92JNFP)
40-
- [Winget](https://github.com/microsoft/winget-cli): `winget install premotem`
41-
- [Chocolatey](https://chocolatey.org/packages/premotem): `choco install premotem`
4238

43-
### Nightly-Preview
39+
💥New Features in Preview:
4440

45-
- [Nightly](https://github.com/1Remote/1Remote/releases/tag/Nightly)
41+
- [x] [MySQL support](https://1remote.github.io/usage/database/data-synchronization/#by-using-mysql)
42+
- [x] [Custom servers order by drag](https://1remote.github.io/usage/overview/#sorting)
43+
- [x] [Multi-Credentials for RDP\VNC\SHH...(e.g. keep root and normal-user credentials in one server)](https://1remote.github.io/usage/alternative-credential/#addedit)
44+
- [x] Multi-Address for RDP\VNC\SHH... (e.g. 192.168.0.100 for LAN, and xxx.xx.xxx.xx for WAN)
45+
- [x] [Auto switching between multi-addresses (you don't have to select the address manually)](https://1remote.github.io/usage/alternative-credential/#auto-switching-address)
46+
- [x] [Servers sharing within team (e.g. share servers with your colleagues)](https://1remote.github.io/usage/team/team-sharing/)
4647

47-
### Requirements
48+
### Requirements
4849

4950
- [Windows10 17763 and above](https://support.lenovo.com/us/en/solutions/ht502786)
5051
- [.NET 6 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/6.0/runtime)
5152

5253
> P.S. You can clone the code and remove all of the Win10 dependencies if you are likely to use 1Remote in Win7.
5354
54-
### [Quick start](https://1remote.github.io/usage/quick-start/)
55-
56-
1. Open PRemote.exe.
57-
58-
2. Click "+" button and fill address\username\password... then save
55+
### 🗺[Quick start](https://1remote.github.io/usage/quick-start/)
5956

60-
3. Press <kbd>Alt</kbd> + <kbd>M</kbd> Open the launcher, type keyword to find your server, press <kbd>enter</kbd> to start session
6157

62-
## Overview
58+
## 👓Overview
6359

6460
<img src="https://raw.githubusercontent.com/1Remote/PRemoteM/Doc/DocPic/maindemo.png" width="800" />
6561

0 commit comments

Comments
 (0)