mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-13 00:31:30 -07:00
add a scam warning to the flag editor
This commit is contained in:
parent
ba561a2421
commit
4e72ecaf95
Bloxstrap
Models/Persistable
Resources
UI
@ -2,7 +2,7 @@
|
||||
{
|
||||
public class State
|
||||
{
|
||||
public bool ShowFFlagEditorWarning { get; set; } = true;
|
||||
public bool ShowFFlagEditorWarnings { get; set; } = true;
|
||||
|
||||
public bool PromptWebView2Install { get; set; } = true;
|
||||
|
||||
|
20
Bloxstrap/Resources/Strings.Designer.cs
generated
20
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -2318,6 +2318,26 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to If you bought fast flags, you have been scammed.
|
||||
///
|
||||
///Ask for your money back immediately..
|
||||
/// </summary>
|
||||
public static string Menu_FastFlagEditor_ScamWarning_Text {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu.FastFlagEditor.ScamWarning.Text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Scam Warning.
|
||||
/// </summary>
|
||||
public static string Menu_FastFlagEditor_ScamWarning_Title {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu.FastFlagEditor.ScamWarning.Title", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Search.
|
||||
/// </summary>
|
||||
|
@ -1271,4 +1271,12 @@ Please close any applications that may be using Roblox's files, and relaunch.</v
|
||||
<value>All Bloxstrap logs</value>
|
||||
<comment>Label that appears next to a checkbox</comment>
|
||||
</data>
|
||||
<data name="Menu.FastFlagEditor.ScamWarning.Text" xml:space="preserve">
|
||||
<value>If you bought fast flags, you have been scammed.
|
||||
|
||||
Ask for your money back immediately.</value>
|
||||
</data>
|
||||
<data name="Menu.FastFlagEditor.ScamWarning.Title" xml:space="preserve">
|
||||
<value>Scam Warning</value>
|
||||
</data>
|
||||
</root>
|
@ -62,6 +62,7 @@
|
||||
|
||||
<ui:NavigationItem Content="{x:Static resources:Strings.Menu_FastFlagEditor_Title}" PageType="{x:Type pages:FastFlagEditorPage}" Tag="fastflageditor" Visibility="Collapsed" />
|
||||
<ui:NavigationItem Content="" PageType="{x:Type pages:FastFlagEditorWarningPage}" Tag="fastflageditorwarning" Visibility="Collapsed" x:Name="EditorWarningNavItem" />
|
||||
<ui:NavigationItem Content="" PageType="{x:Type pages:FastFlagEditorScamWarningPage}" Tag="fastflageditorscamwarning" Visibility="Collapsed" />
|
||||
</ui:NavigationFluent.Items>
|
||||
<ui:NavigationFluent.Footer>
|
||||
<ui:NavigationItem Content="Bloxstrap" PageType="{x:Type pages:BloxstrapPage}" Icon="Settings24" Tag="shortcuts" />
|
||||
|
@ -0,0 +1,52 @@
|
||||
<local:FastFlagEditorWarningBase
|
||||
x:Class="Bloxstrap.UI.Elements.Settings.Pages.FastFlagEditorScamWarningPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Settings.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="FastFlagEditorScamWarningPage"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Scrollable="True"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<Image
|
||||
Width="96"
|
||||
HorizontalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="pack://application:,,,/Resources/MessageBox/Warning.png" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="48"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Static resources:Strings.Menu_FastFlagEditor_ScamWarning_Title}" />
|
||||
<TextBlock
|
||||
Margin="16"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="24"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Static resources:Strings.Menu_FastFlagEditor_ScamWarning_Text}"
|
||||
TextAlignment="Center"
|
||||
TextWrapping="Wrap" />
|
||||
<StackPanel
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ui:Button
|
||||
Margin="0,0,8,0"
|
||||
Appearance="Primary"
|
||||
Command="{Binding GoBackCommand, Mode=OneTime}"
|
||||
Content="{x:Static resources:Strings.Menu_FastFlagEditor_Warning_Back}" />
|
||||
<ui:Button
|
||||
Appearance="Danger"
|
||||
Command="{Binding ContinueCommand, Mode=OneTime}"
|
||||
Content="{Binding ContinueButtonText, Mode=OneWay}"
|
||||
IsEnabled="{Binding CanContinue, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</local:FastFlagEditorWarningBase>
|
@ -0,0 +1,22 @@
|
||||
using Bloxstrap.UI.ViewModels.Settings;
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FastFlagEditorScamWarningPage.xaml
|
||||
/// </summary>
|
||||
public partial class FastFlagEditorScamWarningPage
|
||||
{
|
||||
public FastFlagEditorScamWarningPage() : base(typeof(FastFlagEditorPage))
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void ContinueCallback()
|
||||
{
|
||||
App.State.Prop.ShowFFlagEditorWarnings = false;
|
||||
App.State.Save(); // should we be force saving?
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using Bloxstrap.UI.ViewModels.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
{
|
||||
public class FastFlagEditorWarningBase : UiPage
|
||||
{
|
||||
private bool _initialLoad = false;
|
||||
|
||||
protected FastFlagEditorWarningBase(Type nextPageType)
|
||||
{
|
||||
Loaded += Page_Loaded;
|
||||
|
||||
var vm = new FastFlagEditorWarningViewModel(this, nextPageType, ContinueCallback);
|
||||
DataContext = vm;
|
||||
vm.StartCountdown();
|
||||
}
|
||||
|
||||
protected virtual void ContinueCallback()
|
||||
{
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// refresh datacontext on page load to reset timer
|
||||
|
||||
if (!_initialLoad)
|
||||
{
|
||||
_initialLoad = true;
|
||||
return;
|
||||
}
|
||||
|
||||
((FastFlagEditorWarningViewModel)DataContext).StartCountdown();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
<ui:UiPage x:Class="Bloxstrap.UI.Elements.Settings.Pages.FastFlagEditorWarningPage"
|
||||
<local:FastFlagEditorWarningBase x:Class="Bloxstrap.UI.Elements.Settings.Pages.FastFlagEditorWarningPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Settings.Pages"
|
||||
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.Settings"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Scrollable="True"
|
||||
Loaded="Page_Loaded"
|
||||
Title="FastFlagEditorWarningPage">
|
||||
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
@ -22,4 +22,4 @@
|
||||
<ui:Button Content="{Binding ContinueButtonText, Mode=OneWay}" Appearance="Danger" IsEnabled="{Binding CanContinue, Mode=OneWay}" Command="{Binding ContinueCommand, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ui:UiPage>
|
||||
</local:FastFlagEditorWarningBase>
|
@ -1,32 +1,13 @@
|
||||
using Bloxstrap.UI.ViewModels.Settings;
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FastFlagEditorWarningPage.xaml
|
||||
/// </summary>
|
||||
public partial class FastFlagEditorWarningPage
|
||||
{
|
||||
private bool _initialLoad = false;
|
||||
|
||||
public FastFlagEditorWarningPage()
|
||||
public FastFlagEditorWarningPage() : base(typeof(FastFlagEditorScamWarningPage))
|
||||
{
|
||||
DataContext = new FastFlagEditorWarningViewModel(this);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// refresh datacontext on page load to reset timer
|
||||
|
||||
if (!_initialLoad)
|
||||
{
|
||||
_initialLoad = true;
|
||||
return;
|
||||
}
|
||||
|
||||
DataContext = new FastFlagEditorWarningViewModel(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
{
|
||||
if (Window.GetWindow(this) is INavigationWindow window)
|
||||
{
|
||||
if (App.State.Prop.ShowFFlagEditorWarning)
|
||||
if (App.State.Prop.ShowFFlagEditorWarnings)
|
||||
window.Navigate(typeof(FastFlagEditorWarningPage));
|
||||
else
|
||||
window.Navigate(typeof(FastFlagEditorPage));
|
||||
|
@ -12,6 +12,10 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
internal class FastFlagEditorWarningViewModel : NotifyPropertyChangedViewModel
|
||||
{
|
||||
private Page _page;
|
||||
private Type _nextPageType;
|
||||
private Action _continueCallback;
|
||||
|
||||
private CancellationTokenSource? _cancellationTokenSource;
|
||||
|
||||
public string ContinueButtonText { get; set; } = "";
|
||||
|
||||
@ -21,20 +25,39 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
|
||||
public ICommand ContinueCommand => new RelayCommand(Continue);
|
||||
|
||||
public FastFlagEditorWarningViewModel(Page page)
|
||||
public FastFlagEditorWarningViewModel(Page page, Type nextPageType, Action continueCallback)
|
||||
{
|
||||
_page = page;
|
||||
DoCountdown();
|
||||
_nextPageType = nextPageType;
|
||||
_continueCallback = continueCallback;
|
||||
}
|
||||
|
||||
private async void DoCountdown()
|
||||
public void StartCountdown()
|
||||
{
|
||||
_cancellationTokenSource?.Cancel();
|
||||
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
DoCountdown(_cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private async void DoCountdown(CancellationToken token)
|
||||
{
|
||||
CanContinue = false;
|
||||
OnPropertyChanged(nameof(CanContinue));
|
||||
|
||||
for (int i = 10; i > 0; i--)
|
||||
{
|
||||
ContinueButtonText = $"({i}) {Strings.Menu_FastFlagEditor_Warning_Continue}";
|
||||
OnPropertyChanged(nameof(ContinueButtonText));
|
||||
|
||||
await Task.Delay(1000);
|
||||
try
|
||||
{
|
||||
await Task.Delay(1000, token);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ContinueButtonText = Strings.Menu_FastFlagEditor_Warning_Continue;
|
||||
@ -42,9 +65,6 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
|
||||
CanContinue = true;
|
||||
OnPropertyChanged(nameof(CanContinue));
|
||||
|
||||
App.State.Prop.ShowFFlagEditorWarning = false;
|
||||
App.State.Save();
|
||||
}
|
||||
|
||||
private void Continue()
|
||||
@ -52,8 +72,10 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
if (!CanContinue)
|
||||
return;
|
||||
|
||||
_continueCallback();
|
||||
|
||||
if (Window.GetWindow(_page) is INavigationWindow window)
|
||||
window.Navigate(typeof(FastFlagEditorPage));
|
||||
window.Navigate(_nextPageType);
|
||||
}
|
||||
|
||||
private void GoBack()
|
||||
|
Loading…
Reference in New Issue
Block a user