Skip to content

Commit

Permalink
Added optional donation banner
Browse files Browse the repository at this point in the history
  • Loading branch information
onionware-github committed Jan 8, 2024
1 parent 2314cf9 commit 8605265
Show file tree
Hide file tree
Showing 22 changed files with 745 additions and 605 deletions.
175 changes: 55 additions & 120 deletions OnionMedia.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<PackageCertificateThumbprint>1111AC8AA6AD26FF6CAA2E199D1F25D77FC4461E</PackageCertificateThumbprint>
<PackageCertificateThumbprint>068D2BFA1799318C046DD586A0AE4A8AC2BFBF94</PackageCertificateThumbprint>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
Expand Down
6 changes: 2 additions & 4 deletions OnionMedia/OnionMedia (Package)/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="11715Onionware.OnionMedia"
Publisher="CN=DEDBA644-CCA1-4BC1-A233-7FFFE9747007"
Version="1.2.3.0" />
Version="1.2.5.0" />

<Properties>
<DisplayName>OnionMedia</DisplayName>
Expand All @@ -25,9 +25,7 @@
</Dependencies>

<Resources>
<Resource Language="en-US"/>
<Resource Language="de-DE"/>
<Resource Language="es"/>
<Resource Language="x-generate"/>
</Resources>

<Applications>
Expand Down
4 changes: 4 additions & 0 deletions OnionMedia/OnionMedia.Core/Classes/DownloaderMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public static async Task DownloadStreamAsync(StreamItemModel stream, bool getMP4
{
stream.Downloading = false;
stream.Converting = false;
Console.WriteLine(ex.Message);
Debug.WriteLine(ex.Message);
switch (ex)
{
default:
Expand Down Expand Up @@ -173,6 +175,8 @@ public static async Task DownloadStreamAsync(StreamItemModel stream, bool getMP4
{
stream.DownloadState = Enums.DownloadState.IsFailed;
stream.ProgressInfo.IsCancelledOrFailed = true;
Console.WriteLine(ex.Message);
Debug.WriteLine(ex.Message);
switch (ex)
{
default:
Expand Down
10 changes: 9 additions & 1 deletion OnionMedia/OnionMedia.Core/Models/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private AppSettings()

customAccentColorHex = settingsService.GetSetting("customAccentColorHex") as string;
useCustomAccentColor = settingsService.GetSetting("useCustomAccentColor") as bool? ?? false;
showDonationBanner = settingsService.GetSetting("showDonationBanner") as bool? ?? true;
selectedTheme = ParseEnum<ThemeType>(settingsService.GetSetting("selectedTheme"));
appFlowDirection = ParseEnum<AppFlowDirection>(settingsService.GetSetting("appFlowDirection"));

Expand Down Expand Up @@ -300,7 +301,14 @@ public bool DownloaderPageIsOpen
set => settingsService.SetSetting("downloaderPageIsOpen", value);
}

public StartPageType StartPageType
public bool ShowDonationBanner
{
get => showDonationBanner.HasValue && (bool)showDonationBanner;
set => SetSetting(ref showDonationBanner, value, "showDonationBanner");
}
private bool? showDonationBanner;

public StartPageType StartPageType
{
get => startPageType;
set
Expand Down
1 change: 1 addition & 0 deletions OnionMedia/OnionMedia.Core/Models/MediaItemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public string BuildConversionArgs(string filePath, ConversionPreset conversionOp
argBuilder.Append($"-threads {AppSettings.Instance.MaxThreadCountForConversion} ");

outputPath = Path.ChangeExtension(filePath, options.Format.Name);
argBuilder.Append("-map 0 ");
argBuilder.Append($"\"{outputPath}\"");
return argBuilder.ToString();
}
Expand Down
Binary file not shown.
1 change: 0 additions & 1 deletion OnionMedia/OnionMedia/OnionMedia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
<PackageReference Include="CommunityToolkit.WinUI.UI.Animations" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="FFMpegCore" Version="4.7.0" />
<PackageReference Include="Jab" Version="0.8.6" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
Expand Down
13 changes: 11 additions & 2 deletions OnionMedia/OnionMedia/Services/NetworkStatusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ sealed class NetworkStatusService : INetworkStatusService
{
public NetworkStatusService()
{
NetworkInformation.NetworkStatusChanged += o => ConnectionStateChanged?.Invoke(this, NetworkInformation.GetInternetConnectionProfile() != null);
NetworkInformation.NetworkStatusChanged += o => ConnectionStateChanged?.Invoke(this, IsNetworkConnectionAvailable());
}

public event EventHandler<bool> ConnectionStateChanged;

public bool IsNetworkConnectionAvailable()
{
return NetworkInformation.GetInternetConnectionProfile() != null;
try
{
var connectionProfile = NetworkInformation.GetInternetConnectionProfile();
return connectionProfile is not null;
}
catch
{
//if in doubt, return true
return true;
}
}
}
}
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/de-de/DownloaderPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
<data name="currentPlaylist.Text" xml:space="preserve">
<value>Aktuelle Playlist</value>
</data>
<data name="donationBanner.Text" xml:space="preserve">
<value>OnionMedia ist ein gemeinnütziges Projekt eines Einzelentwicklers, kostenlos und werbefrei. Wenn Ihnen meine Arbeit gefällt, unterstützen Sie mich gerne mit einer freiwilligen Spende - schon der Wert einer Tasse Kaffee bewirkt viel.</value>
</data>
<data name="done.Text" xml:space="preserve">
<value>Fertig</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/de-de/SettingsPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
<data name="setStoragePaths.Content" xml:space="preserve">
<value>Speicherpfade festlegen</value>
</data>
<data name="showDonationBanner.Header" xml:space="preserve">
<value>Spendenbanner anzeigen</value>
</data>
<data name="startPageBox.Header" xml:space="preserve">
<value>Startseite:</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/en-us/DownloaderPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
<data name="currentPlaylist.Text" xml:space="preserve">
<value>Current playlist</value>
</data>
<data name="donationBanner.Text" xml:space="preserve">
<value>OnionMedia is a voluntary project by an individual developer, open and ad-free. If you appreciate my work and can afford it, feel free to support me with a small donation.</value>
</data>
<data name="done.Text" xml:space="preserve">
<value>Done</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/en-us/SettingsPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
<data name="setStoragePaths.Content" xml:space="preserve">
<value>Set storage paths</value>
</data>
<data name="showDonationBanner.Header" xml:space="preserve">
<value>Show donation banner</value>
</data>
<data name="startPageBox.Header" xml:space="preserve">
<value>Startpage:</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/es/DownloaderPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
<data name="currentPlaylist.Text" xml:space="preserve">
<value>Vídeos</value>
</data>
<data name="donationBanner.Text" xml:space="preserve">
<value>OnionMedia es un proyecto voluntario de un desarrollador individual, abierto y sin publicidad. Si aprecias mi trabajo y puedes permitírtelo, no dudes en apoyarme con una pequeña donación.</value>
</data>
<data name="done.Text" xml:space="preserve">
<value>Hecho</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions OnionMedia/OnionMedia/Strings/es/SettingsPage.resw
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
<data name="setStoragePaths.Content" xml:space="preserve">
<value>Fijar las rutas de almacenamiento</value>
</data>
<data name="showDonationBanner.Header" xml:space="preserve">
<value>Mostrar banner de donación</value>
</data>
<data name="startPageBox.Header" xml:space="preserve">
<value>Página de inicio:</value>
</data>
Expand Down
Loading

0 comments on commit 8605265

Please sign in to comment.