mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
External link warning code cleanup
This commit is contained in:
parent
7401fabb5d
commit
b4809f4417
@ -42,7 +42,7 @@ namespace osu.Game.Configuration
|
|||||||
if (!val) Set(OsuSetting.SavePassword, false);
|
if (!val) Set(OsuSetting.SavePassword, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
Set(OsuSetting.WarnAboutOpeningExternalLink, true);
|
Set(OsuSetting.ExternalLinkWarning, true);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
||||||
@ -151,6 +151,6 @@ namespace osu.Game.Configuration
|
|||||||
BeatmapHitsounds,
|
BeatmapHitsounds,
|
||||||
IncreaseFirstObjectVisibility,
|
IncreaseFirstObjectVisibility,
|
||||||
ScoreDisplayMode,
|
ScoreDisplayMode,
|
||||||
WarnAboutOpeningExternalLink
|
ExternalLinkWarning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,24 +15,22 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
private GameHost host;
|
private GameHost host;
|
||||||
private DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
private Bindable<bool> warnAboutOpeningExternal;
|
private Bindable<bool> externalLinkWarning;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config)
|
private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.dialogOverlay = dialogOverlay;
|
this.dialogOverlay = dialogOverlay;
|
||||||
warnAboutOpeningExternal = config.GetBindable<bool>(OsuSetting.WarnAboutOpeningExternalLink);
|
externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenUrlExternally(string url)
|
public void OpenUrlExternally(string url)
|
||||||
{
|
{
|
||||||
void externalAction() => host.OpenUrlExternally(url);
|
if (externalLinkWarning)
|
||||||
|
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
|
||||||
if (warnAboutOpeningExternal)
|
|
||||||
dialogOverlay.Push(new ExternalLinkDialog(url, externalAction));
|
|
||||||
else
|
else
|
||||||
externalAction();
|
host.OpenUrlExternally(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,9 +104,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
private ExternalLinkOpener externalLinkOpener;
|
|
||||||
public void OpenUrlExternally(string url) => externalLinkOpener.OpenUrlExternally(url);
|
|
||||||
|
|
||||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||||
[Cached]
|
[Cached]
|
||||||
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
|
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
|
||||||
@ -182,6 +179,9 @@ namespace osu.Game
|
|||||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
|
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ExternalLinkOpener externalLinkOpener;
|
||||||
|
public void OpenUrlExternally(string url) => externalLinkOpener.OpenUrlExternally(url);
|
||||||
|
|
||||||
private ScheduledDelegate scoreLoad;
|
private ScheduledDelegate scoreLoad;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
BodyText = url;
|
BodyText = url;
|
||||||
|
|
||||||
Icon = FontAwesome.fa_warning;
|
Icon = FontAwesome.fa_warning;
|
||||||
HeaderText = "Confirm opening external link";
|
HeaderText = "Are you sure you want to open the following?";
|
||||||
Buttons = new PopupDialogButton[]
|
Buttons = new PopupDialogButton[]
|
||||||
{
|
{
|
||||||
new PopupDialogOkButton
|
new PopupDialogOkButton
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Online
|
|||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Warn about opening external links",
|
LabelText = "Warn about opening external links",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.WarnAboutOpeningExternalLink)
|
Bindable = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user