Skip to content

Commit

Permalink
feat: splash screen background image
Browse files Browse the repository at this point in the history
  • Loading branch information
loliGothicK committed Mar 2, 2024
1 parent 2fcaf4b commit b518389
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ jobs:
$certificatePath = "GitHubActionsWorkflow.pfx"
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
# Create the app package by building and packaging the project
- name: Create the app package
# download
- name: download register_secrets
run: |
cd docs
curl -s https://api.github.com/repos/loliGothicK/register_secrets/releases \
| jq -r '.[0].assets[] | select(.name | test("register_secrets.zip")) | .browser_download_url' \
| xargs -n1 curl -LOk
unzip register_secrets.zip
- name: Build
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=false
env:
Appx_Bundle: Never
Expand Down
18 changes: 12 additions & 6 deletions MitamatchOperations/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using Microsoft.Windows.AppLifecycle;
using Mitama.Domain;
using Mitama.Lib;
using Mitama.Pages;
using Mitama.Pages.Common;
using Newtonsoft.Json;
using Windows.ApplicationModel;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
Expand Down Expand Up @@ -40,10 +40,10 @@ public App()
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
// Get the activation args
var appArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
var appArgs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs();

// Get or register the main instance
var mainInstance = AppInstance.FindOrRegisterForKey("main");
var mainInstance = Microsoft.Windows.AppLifecycle.AppInstance.FindOrRegisterForKey("main");

// If the main instance isn't this current instance
if (!mainInstance.IsCurrent)
Expand All @@ -61,7 +61,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
}

// Otherwise, register for activation redirection
AppInstance.GetCurrent().Activated += On_Activated;
Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().Activated += On_Activated;

var splash = new SplashScreen(typeof(MainWindow), async () =>
await channel.Reader.ReadAsync() switch
Expand Down Expand Up @@ -142,6 +142,12 @@ private static void Upsert(DiscordUser user)

var key = db.CreateKeyFactory("user").CreateKey(user.id);
var result = db.Lookup(key);
var appVersion = string.Format("Version: {0}.{1}.{2}.{3}",
Package.Current.Id.Version.Major,
Package.Current.Id.Version.Minor,
Package.Current.Id.Version.Build,
Package.Current.Id.Version.Revision);

if (result is not null)
{
var entity = new Entity()
Expand All @@ -153,7 +159,7 @@ private static void Upsert(DiscordUser user)
["discriminator"] = user.discriminator,
["global_name"] = user.global_name,
["email"] = user.email,
["version"] = SettingsPage.appVersion,
["version"] = appVersion,
["created_at"] = result["created_at"],
["updated_at"] = DateTime.UtcNow
};
Expand All @@ -171,7 +177,7 @@ private static void Upsert(DiscordUser user)
["discriminator"] = user.discriminator,
["global_name"] = user.global_name,
["email"] = user.email,
["version"] = SettingsPage.appVersion,
["version"] = appVersion,
["created_at"] = DateTime.UtcNow,
["updated_at"] = DateTime.UtcNow
};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion MitamatchOperations/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Mitama.Pages;
/// </summary>
public sealed partial class SettingsPage
{
public static readonly string appVersion = string.Format("Version: {0}.{1}.{2}.{3}",
private readonly string appVersion = string.Format("Version: {0}.{1}.{2}.{3}",
Package.Current.Id.Version.Major,
Package.Current.Id.Version.Minor,
Package.Current.Id.Version.Build,
Expand Down
7 changes: 5 additions & 2 deletions MitamatchOperations/SplashScreen.xaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<winuiex:SplashScreen
x:Class="Mitama.SplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:winuiex="using:WinUIEx"
xmlns:gauge="using:Syncfusion.UI.Xaml.Gauges"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="Black">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Background>
<ImageBrush ImageSource="Assets/Images/SplashScreen.png" />
</Grid.Background>
<!--LOGO-->
<Image Source="Assets\Images\MO_DARK.png" Margin="100,100,100,10"/>
<!--CODE NAME-->
Expand Down

0 comments on commit b518389

Please sign in to comment.