Skip to content

Commit

Permalink
a bunch of QoL improvements (#20)
Browse files Browse the repository at this point in the history
* a bunch of QoL improvements

* git version fixes

* try that

* lol

* come on sweetie

* come _on_
  • Loading branch information
WamWooWam authored Dec 12, 2024
1 parent 66137b1 commit d590709
Show file tree
Hide file tree
Showing 29 changed files with 376 additions and 129 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ jobs:
# Create the app package by building and packaging the project
- name: Build App Packages
run: msbuild $env:ProjectFile_Name /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:AppxBundlePlatforms="x86|x64|ARM|ARM64" /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
run: msbuild $env:ProjectFile_Name /p:Configuration=$env:Configuration /p:SourceRevisionBranch="$env:Head_Ref" /p:SourceRevisionCommit="$($env:Sha.Substring(0, 7))" /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:AppxBundlePlatforms="x86|x64|ARM|ARM64" /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
env:
Appx_Bundle: Always
Appx_Package_Build_Mode: SideloadOnly
Appx_Package_Dir: Packages\
Configuration: ${{ matrix.configuration }}
Head_Ref: ${{ github.head_ref }}
Sha: ${{ github.sha }}

# Remove the pfx
- name: Cleanup
Expand Down
14 changes: 14 additions & 0 deletions UniSky.Models/UniSky.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,18 @@
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
<Exec Condition="'$(SourceRevisionCommit)' == ''" Command="git describe --long --always --dirty --exclude=* --abbrev=7" ConsoleToMSBuild="True" IgnoreExitCode="False">
<Output PropertyName="SourceRevisionCommit" TaskParameter="ConsoleOutput"/>
</Exec>
<Exec Condition="'$(SourceRevisionBranch)' == ''" Command="git branch --show-current" ConsoleToMSBuild="True" IgnoreExitCode="True">
<Output PropertyName="SourceRevisionBranch" TaskParameter="ConsoleOutput"/>
</Exec>

<PropertyGroup>
<SourceRevisionId Condition="'$(SourceRevisionBranch)' == 'master' Or '$(SourceRevisionBranch)' == 'main' Or '$(SourceRevisionBranch)' == ''">$(SourceRevisionCommit)</SourceRevisionId>
<SourceRevisionId Condition="'$(SourceRevisionBranch)' != 'master' And '$(SourceRevisionBranch)' != 'main' And '$(SourceRevisionBranch)' != ''">$(SourceRevisionCommit) ($(SourceRevisionBranch))</SourceRevisionId>
</PropertyGroup>
</Target>

</Project>
35 changes: 35 additions & 0 deletions UniSky/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UniSky.Models;
using Windows.ApplicationModel;

namespace UniSky;

public class Constants
{
public static string Version
{
get
{
var gitSha = "";
var versionedAssembly = typeof(LoginModel).Assembly;
var attribute = versionedAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();

int idx;
if (attribute != null && (idx = attribute.InformationalVersion.IndexOf('+')) != -1)
{
gitSha = "-" + attribute.InformationalVersion.Substring(idx + 1);
}

var v = Package.Current.Id.Version;
return $"{v.Major}.{v.Minor}.{v.Build}.{v.Revision}{gitSha}";
}
}

public static string UserAgent
=> $"UniSky/{Version} (https://github.com/UnicordDev/UniSky)";
}
1 change: 1 addition & 0 deletions UniSky/Controls/Compose/ComposeAddAltTextDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
TextWrapping="Wrap"
AcceptsReturn="True"
MaxLength="2000"
MaxHeight="200"
Text="{Binding AltText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

</TextBox>
Expand Down
2 changes: 1 addition & 1 deletion UniSky/Controls/Compose/ComposeSheet.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

<TextBlock Text="{Binding Error.Message, FallbackValue='Something went wrong!'}"
TextWrapping="Wrap"
Margin="8"
Margin="8,7,8,9"
Grid.Column="1"
MaxLines="2"/>
</Grid>
Expand Down
32 changes: 32 additions & 0 deletions UniSky/Controls/Settings/SettingsSheet.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<sheets:SheetControl
x:Class="UniSky.Controls.Settings.SettingsSheet"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:root="using:UniSky"
xmlns:local="using:UniSky.Controls.Settings"
xmlns:sheets="using:UniSky.Controls.Sheet"
xmlns:settings="using:UniSky.ViewModels.Settings"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
d:DataContext="{d:DesignInstance Type=settings:SettingsViewModel}"
Style="{ThemeResource DefaultSheetControlStyle}"
PrimaryButtonVisibility="Collapsed"
SecondaryButtonContent="Close"
TitleContent="SETTINGS">
<ScrollViewer HorizontalScrollMode="Disabled"
VerticalScrollMode="Auto"
IsVerticalScrollChainingEnabled="True"
IsVerticalRailEnabled="True"
IsDeferredScrollingEnabled="False">
<StackPanel Margin="12">
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Text="About"/>
<TextBlock TextWrapping="Wrap">
<Run Text="Version"/>
<Run Text="{x:Bind root:Constants.Version, FallbackValue='1.0.0.0-abcdefg'}"/>
</TextBlock>
</StackPanel>
</ScrollViewer>
</sheets:SheetControl>
11 changes: 11 additions & 0 deletions UniSky/Controls/Settings/SettingsSheet.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using UniSky.Controls.Sheet;

namespace UniSky.Controls.Settings;

public sealed partial class SettingsSheet : SheetControl
{
public SettingsSheet()
{
this.InitializeComponent();
}
}
4 changes: 2 additions & 2 deletions UniSky/DataTemplates/FeedTemplates.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
Style="{ThemeResource BaseTextBlockStyle}"
Text="{Binding Title}"
VerticalAlignment="Bottom"
MaxLines="1"/>
TextWrapping="NoWrap"/>

<TextBlock x:Name="SubtitleBlock"
Visibility="{Binding Description, Converter={StaticResource VisibilityConverter}}"
Expand All @@ -137,7 +137,7 @@
Text="{Binding Source}"
Style="{ThemeResource CaptionTextBlockStyle}"
Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"
MaxLines="1"
TextWrapping="NoWrap"
Margin="8,0,8,8"/>
</Grid>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion UniSky/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="24101WamWooWamRD.25225E497690B"
Publisher="CN=0F22111D-EDF0-42F0-B58D-26C4C5C5054B"
Version="1.0.157.0" />
Version="1.0.160.0" />

<mp:PhoneIdentity PhoneProductId="d3ae258d-7752-4bdb-bb0c-b6cca57f9cd1" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
28 changes: 16 additions & 12 deletions UniSky/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@
<TextBlock Grid.Column="1" Text="Notifications" VerticalAlignment="Center"/>
</Grid>
</mux:NavigationViewItem>
<mux:NavigationViewItem Icon="Message"
Content="Chat"
Tag="{x:Bind viewmodels:HomePages.Chat}"
IsSelected="{x:Bind ViewModel.ChatSelected, Mode=OneWay}" />
<mux:NavigationViewItem Content="Chat"
Tag="{x:Bind viewmodels:HomePages.Chat}"
IsSelected="{x:Bind ViewModel.ChatSelected, Mode=OneWay}">
<mux:NavigationViewItem.Icon>
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE8F2;"/>
</mux:NavigationViewItem.Icon>
</mux:NavigationViewItem>
</mux:NavigationView.MenuItems>
<mux:NavigationView.FooterMenuItems>
<mux:NavigationViewItem Tag="{x:Bind viewmodels:HomePages.Profile}"
Expand Down Expand Up @@ -248,7 +251,7 @@
Grid.Column="4"
Margin="2,0,0,0"
Style="{StaticResource FooterToggleButtonRevealStyle}"
Content="&#xE8BD;"
Content="&#xE8F2;"
ToolTipService.ToolTip="Chat"
ToolTipService.Placement="Top"
Tag="{x:Bind viewmodels:HomePages.Chat}"
Expand Down Expand Up @@ -287,13 +290,14 @@
</Ellipse>
</Grid>
</ToggleButton>
<ToggleButton x:Name="SettingsButton"
Grid.Column="6"
Margin="2,0,0,0"
Style="{StaticResource FooterToggleButtonRevealStyle}"
Content="&#xE713;"
ToolTipService.ToolTip="Settings"
ToolTipService.Placement="Top"/>
<Button x:Name="SettingsButton"
Grid.Column="6"
Margin="2,0,0,0"
Style="{StaticResource CleanPaneButtonButtonStyle}"
Content="&#xE713;"
Command="{x:Bind ViewModel.OpenSettingsCommand}"
ToolTipService.ToolTip="Settings"
ToolTipService.Placement="Top"/>
</Grid>

<UserControl x:Name="AppTitleBarContainer"
Expand Down
8 changes: 7 additions & 1 deletion UniSky/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ private void OnSafeAreaUpdated(object sender, SafeAreaUpdatedEventArgs e)
Margin = new Thickness(e.SafeArea.Bounds.Left, 0, e.SafeArea.Bounds.Right, e.SafeArea.Bounds.Bottom);
}

private void NavigationView_ItemInvoked(MUXC.NavigationView sender, MUXC.NavigationViewItemInvokedEventArgs args)
private async void NavigationView_ItemInvoked(MUXC.NavigationView sender, MUXC.NavigationViewItemInvokedEventArgs args)
{
if (args.InvokedItemContainer?.Tag is HomePages page)
ViewModel.Page = page;

if (args.IsSettingsInvoked)
{
ViewModel.Page = ViewModel.Page;
await ViewModel.OpenSettingsCommand.ExecuteAsync(null);
}
}

private void FooterToggleButton_Checked(object sender, RoutedEventArgs e)
Expand Down
11 changes: 7 additions & 4 deletions UniSky/Pages/ProfilePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@
Grid.Row="0"
Style="{ThemeResource SubtitleTextBlockStyle}"
Text="{Binding Name}"
MaxLines="1"/>
TextWrapping="NoWrap"/>
<TextBlock x:Name="HandleBlock"
Grid.Row="1"
Style="{ThemeResource BaseTextBlockStyle}"
Text="{Binding Handle}"
MaxLines="1"/>
TextWrapping="NoWrap"/>
<TextBlock x:Name="InfoBlock"
Grid.Row="2"
Grid.ColumnSpan="2"
Expand All @@ -155,7 +155,9 @@
Grid.RowSpan="3"/>

<Button x:Name="FollowButton"
x:Load="{x:Bind converters:Static.Not(ViewModel.IsMe), Mode=OneWay}"
Style="{ThemeResource AccentButtonStyle}"
Command="{Binding FollowCommand}"
Grid.Column="1"
Grid.RowSpan="2"
VerticalAlignment="Center">
Expand Down Expand Up @@ -223,11 +225,11 @@
Grid.Row="0"
Style="{ThemeResource SubtitleTextBlockStyle}"
Text="{Binding Name}"
MaxLines="1"/>
TextWrapping="NoWrap"/>
<TextBlock x:Name="ScrolledHandleBlock" Style="{ThemeResource CaptionTextBlockStyle}"
Grid.Row="1"
Text="{Binding Handle}"
MaxLines="1"/>
TextWrapping="NoWrap"/>

<Border Background="Transparent"
Tapped="ProfileContainer_Tapped"
Expand All @@ -237,6 +239,7 @@

<Button x:Name="ScrolledFollowButton"
Style="{ThemeResource ButtonRevealStyle}"
Command="{Binding FollowCommand}"
Grid.Column="1"
Grid.RowSpan="2"
VerticalAlignment="Center">
Expand Down
4 changes: 2 additions & 2 deletions UniSky/Pages/SearchPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
Style="{ThemeResource BaseTextBlockStyle}"
Text="{Binding Name}"
VerticalAlignment="Bottom"
MaxLines="1"/>
TextWrapping="NoWrap"/>

<TextBlock Grid.Row="1"
Grid.Column="1"
Style="{ThemeResource CaptionTextBlockStyle}"
Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"
Text="{Binding Handle}"
VerticalAlignment="Top"
MaxLines="1"/>
TextWrapping="NoWrap"/>

<Button Style="{ThemeResource ButtonRevealStyle}"
Margin="4,0,0,0"
Expand Down
14 changes: 14 additions & 0 deletions UniSky/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page
x:Class="UniSky.Pages.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UniSky.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

</Grid>
</Page>
30 changes: 30 additions & 0 deletions UniSky/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace UniSky.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SettingsPage : Page
{
public SettingsPage()
{
this.InitializeComponent();
}
}
}
12 changes: 12 additions & 0 deletions UniSky/Resources/en-GB/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,16 @@
<data name="NotificationRetweetSingle" xml:space="preserve">
<value>{0} reposted</value>
</data>
<data name="ProfileBlocked" xml:space="preserve">
<value>Blocked</value>
</data>
<data name="ProfileInvalidHandle" xml:space="preserve">
<value>Invalid Handle</value>
</data>
<data name="ProfileUserBlocked" xml:space="preserve">
<value>You are blocking this user</value>
</data>
<data name="ProfileYouAreBlocked" xml:space="preserve">
<value>You are blocked by this user</value>
</data>
</root>
4 changes: 3 additions & 1 deletion UniSky/Services/ISheetService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using UniSky.Controls.Sheet;

namespace UniSky.Services
{
public interface ISheetService
{
Task<ISheetController> ShowAsync<T>(object parameter = null) where T : SheetControl, new();
Task<ISheetController> ShowAsync<T>(Func<SheetControl> factory, object parameter = null) where T : SheetControl;
}
}
Loading

0 comments on commit d590709

Please sign in to comment.