Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Community tools UI #139

Merged
merged 32 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6b8317e
trying to implement community button w/ webview
Cryotechnic May 7, 2023
adf1ee4
Commit an example to hide the flyout while clicking the button
neon-nyan May 7, 2023
786f5e1
fontawesome 6 update
Cryotechnic May 19, 2023
47fa45d
Initial community tools implementation for HI3
Cryotechnic May 19, 2023
ed2017d
added official tools for GI
Cryotechnic May 19, 2023
1e173d6
fixed incorrect wiki url for Hoyolab genshin wiki
Cryotechnic May 19, 2023
651aed2
Added HSR official tools
Cryotechnic May 19, 2023
ad44638
merge conflict fix? prayge
Cryotechnic May 19, 2023
d76633c
Merge branch 'main' into community-tools-ui
Cryotechnic May 19, 2023
f6a4426
comments
Cryotechnic May 19, 2023
d566327
added GI community tools
Cryotechnic May 24, 2023
cc2744e
fixed duplicate rendering of UI elements
Cryotechnic May 25, 2023
3a9ff82
added HSR community tools
Cryotechnic Jun 8, 2023
3e5cb21
update inventory kamera with correct url
Cryotechnic Jun 9, 2023
cca5a13
Merge remote-tracking branch 'origin/main' into community-tools-ui
Cryotechnic Jun 9, 2023
5d8af28
submodules?
Cryotechnic Jun 9, 2023
d1b85a3
update submodule
Cryotechnic Jun 9, 2023
197831f
Merge remote-tracking branch 'origin/community-tools-ui' into communi…
Cryotechnic Jun 9, 2023
aba0766
Refactor the logic
neon-nyan Jun 11, 2023
d9d0033
[Fix Conflict] Update submodules
neon-nyan Jun 11, 2023
cc6879e
Move the ``DataType`` binding from ``localStatic`` to ``local``
neon-nyan Jun 11, 2023
454de6e
Fix horizontal scroll not working
neon-nyan Jun 12, 2023
69d3ab9
typo fixes
Cryotechnic Jun 12, 2023
34c3034
added base for launching specific tools natively in Collapse
Cryotechnic Jun 13, 2023
b555dd5
added new localization strings
Cryotechnic Jun 13, 2023
d8ee309
added custom dialog for custom exe location
Cryotechnic Jun 15, 2023
0624ddd
fixed file dialog not displaying items in correct order
Cryotechnic Jun 15, 2023
9654614
partial implementation for file dialog for a specific 3rd party tool
Cryotechnic Jun 15, 2023
ec3e118
Community Toolkit Improvements by @neon-nyan (#176)
Cryotechnic Jun 19, 2023
f98c63b
Merge branch 'main' of github.com:neon-nyan/Collapse into community-t…
Cryotechnic Jun 19, 2023
25ed892
Updated submodule ColorThief
Cryotechnic Jun 19, 2023
c9c79a4
Updated submodule Hi3Helper.SharpHDiffPatch
Cryotechnic Jun 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions CollapseLauncher/Assets/Presets/CommunityTools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"OfficialToolsDictionary": {
"Honkai": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "HoYoLab Website",
"URL": "https://www.hoyolab.com/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Daily Check-in",
"URL": "https://act.hoyolab.com/bbs/event/signin-bh3/index.html?act_id=e202110291205111"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Honkai Impact 3rd Wiki",
"URL": "https://honkaiimpact3.fandom.com/wiki/"
}
],
"Genshin": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Daily Check-in",
"URL": "https://act.hoyolab.com/ys/event/signin-sea-v3/index.html?act_id=e202102251931481&hyl_auth_required=true&hyl_presentation_style=fullscreen&utm_source=hoyolab&utm_medium=tools&lang=en-us&bbs_theme=light&bbs_theme_device=1"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "HoYoLab Website",
"URL": "https://www.hoyolab.com/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Gensin Impact Wiki",
"URL": "https://wiki.hoyolab.com/pc/genshin/home"
}
],
"StarRail": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Daily Check-in",
"URL": "https://act.hoyolab.com/bbs/event/signin/hkrpg/index.html?act_id=e202303301540311"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "HoYoLab Website",
"URL": "https://www.hoyolab.com/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Honkai: Star Rail Wiki",
"URL": "https://wiki.hoyolab.com/pc/hsr/home"
}
]
},
"CommunityToolsDictionary": {
"Honkai": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Reddit Community",
"URL": "https://www.reddit.com/r/HonkaiImpact3rd/"
}
],
"Genshin": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "paimon.moe",
"URL": "https://paimon.moe/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Enka Network",
"URL": "https://enka.network/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "seelie.me",
"URL": "https://seelie.me/"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Genshin Optimizer",
"URL": "https://frzyc.github.io/genshin-optimizer"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "Inventory Kamera",
"URL": "https://github.com/Andrewthe13th/Inventory_Kamera$OpenExternalApp:ApplicationName=Inventory Kamera,ApplicationExecName=InventoryKamera.exe,RunAsAdmin=true$OpenUrlIfCancel"
},
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "akasha.cv",
"URL": "https://akasha.cv"
}
],
"StarRail": [
{
"IconFontFamily": "ms-appx:///Assets/Fonts/FontAwesomeSolid6.otf#Font Awesome 6 Free Solid",
"IconGlyph": "",
"Text": "pom.moe",
"URL": "https://pom.moe/"
}
]
}
}
4 changes: 4 additions & 0 deletions CollapseLauncher/Classes/ClassesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ internal sealed partial class NotificationPushContext : JsonSerializerContext {
[JsonSourceGenerationOptions(IncludeFields = false, GenerationMode = JsonSourceGenerationMode.Metadata, IgnoreReadOnlyFields = true)]
[JsonSerializable(typeof(CacheAsset))]
internal sealed partial class CacheAssetContext : JsonSerializerContext { }

[JsonSourceGenerationOptions(IncludeFields = false, GenerationMode = JsonSourceGenerationMode.Metadata, IgnoreReadOnlyFields = true)]
[JsonSerializable(typeof(CommunityToolsProperty))]
internal sealed partial class CommunityToolsPropertyContext : JsonSerializerContext { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Hi3Helper;
using Hi3Helper.Preset;
using Hi3Helper.Shared.Region;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace CollapseLauncher
{
public class CommunityToolsProperty
{
public Dictionary<GameType, List<CommunityToolsEntry>> OfficialToolsDictionary { get; set; }
public Dictionary<GameType, List<CommunityToolsEntry>> CommunityToolsDictionary { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
public ObservableCollection<CommunityToolsEntry> OfficialToolsList;
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
public ObservableCollection<CommunityToolsEntry> CommunityToolsList;

public CommunityToolsProperty()
{
OfficialToolsList = new ObservableCollection<CommunityToolsEntry>();
CommunityToolsList = new ObservableCollection<CommunityToolsEntry>();
}

public void Clear()
{
OfficialToolsList.Clear();
CommunityToolsList.Clear();
}

public static CommunityToolsProperty LoadCommunityTools()
{
string filePath = Path.Combine(LauncherConfig.AppFolder, @"Assets\Presets\CommunityTools.json");

try
{
if (!File.Exists(filePath)) throw new FileNotFoundException("Community Tools file is not found!", filePath);

return (CommunityToolsProperty)JsonSerializer.Deserialize(File.ReadAllText(filePath), typeof(CommunityToolsProperty), CommunityToolsPropertyContext.Default);
}
catch (Exception ex)
{
Logger.LogWriteLine($"Error while parsing Community Tools list file in Assets\\Presets\\CommunityTools.json\r\n{ex}", LogType.Error, true);
return new CommunityToolsProperty();
}
}
}

public class CommunityToolsEntry
{
public string IconFontFamily { get; set; }
public string IconGlyph { get; set; }
public string Text { get; set; }
public string URL { get; set; }
}
}
1 change: 1 addition & 0 deletions CollapseLauncher/Classes/PageStatics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ internal partial class PageStatics
internal static ICache _GameCache { get; set; }
internal static IGameVersionCheck _GameVersion { get; set; }
internal static IGameInstallManager _GameInstall { get; set; }
internal static CommunityToolsProperty _CommunityToolsProperty { get; set; }
}
}
6 changes: 6 additions & 0 deletions CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;DISABLETRANSPARENT;DISABLEMOVEMIGRATE</DefineConstants>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Presets\CommunityTools.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Clowd.Squirrel" Version="2.9.42" />
Expand Down Expand Up @@ -96,6 +99,9 @@
<Content Update="Assets\Fonts\FontAwesomeSolid6.otf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Presets\CommunityTools.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Presets\Honkai\PersonalGraphicsSettingV2.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
3 changes: 3 additions & 0 deletions CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ private async Task InitializeStartup()
{
RunBackgroundCheck();

// Load community tools properties
PageStatics._CommunityToolsProperty = CommunityToolsProperty.LoadCommunityTools();

Type Page;

if (!IsConfigV2StampExist() || !IsConfigV2ContentExist())
Expand Down
10 changes: 10 additions & 0 deletions CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ await SpawnDialog(
Lang._Misc.LocateDir
);

public static async Task<ContentDialogResult> Dialog_OpenExecutable(UIElement Content) =>
await SpawnDialog(
Lang._Dialogs.LocateExePathTitle,
Lang._Dialogs.LocateExePathSubtitle,
Content,
null,
Lang._Misc.LocateExecutable,
Lang._Misc.Cancel
);

public static async Task<ContentDialogResult> Dialog_InsufficientWritePermission(UIElement Content, string path) =>
await SpawnDialog(
Lang._Dialogs.UnauthorizedDirTitle,
Expand Down
Loading