Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
95 changes: 70 additions & 25 deletions OneGateApp/Pages/DAppDetailsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,64 @@
<ToolbarItem Order="Primary" IconImageSource="{FontImageSource &#xe68b;, FontFamily=Icons, Color={toolkit:AppThemeResource Primary}}" Command="{x:Static og:Commands.Share}" CommandParameter="{Binding .}" />
</ContentPage.ToolbarItems>
<ScrollView>
<VerticalStackLayout Margin="20" Spacing="20">
<Grid ColumnDefinitions="auto,*" ColumnSpacing="20">
<Border StrokeShape="RoundRectangle 10">
<Image WidthRequest="64" HeightRequest="64" Aspect="AspectFit">
<Image.Source>
<UriImageSource Uri="{Binding IconUrl}" CacheValidity="30:00:00:00" />
</Image.Source>
</Image>
</Border>
<VerticalStackLayout Grid.Column="1" Spacing="5">
<Label Text="{Binding Name, Converter={StaticResource LocalizerConverter}}" FontAttributes="Bold" FontSize="22" />
<Label StyleClass="Link" Text="{Binding Developer}" FontAttributes="Bold">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{x:Static og:Commands.OpenUrl}" CommandParameter="{Binding Website}" />
</Label.GestureRecognizers>
</Label>
</VerticalStackLayout>
</Grid>
<VerticalStackLayout Margin="20" Spacing="14">
<Border StyleClass="Card">
<Grid ColumnDefinitions="auto,*" ColumnSpacing="16">
<Border StrokeShape="RoundRectangle 10" Padding="8" WidthRequest="80" HeightRequest="80" VerticalOptions="Center">
<Image WidthRequest="64" HeightRequest="64" Aspect="AspectFit">
<Image.Source>
<UriImageSource Uri="{Binding IconUrl}" CacheValidity="30:00:00:00" />
</Image.Source>
</Image>
</Border>
<VerticalStackLayout Grid.Column="1" Spacing="6" VerticalOptions="Center">
<Label Text="{Binding Name, Converter={StaticResource LocalizerConverter}}" FontAttributes="Bold" FontSize="22" />
<Label StyleClass="Link" Text="{Binding Developer}" FontAttributes="Bold">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{x:Static og:Commands.OpenUrl}" CommandParameter="{Binding Website}" />
</Label.GestureRecognizers>
</Label>
</VerticalStackLayout>
</Grid>
</Border>
<Button Text="{x:Static og:Strings.Open}" Command="{x:Static og:Commands.LaunchDApp}" CommandParameter="{Binding .}" />
<Label Text="{x:Static og:Strings.GameType}" FontAttributes="Bold" IsVisible="{Binding GameType, Converter={StaticResource IsStringNotNullOrEmptyConverter}}" />
<Label Text="{Binding GameTypeDisplayName}" Margin="0,-10,0,0" IsVisible="{Binding GameType, Converter={StaticResource IsStringNotNullOrEmptyConverter}}" />
<Border StyleClass="Card">
<VerticalStackLayout Spacing="10">
<Grid ColumnDefinitions="*,auto" ColumnSpacing="10">
<Label Text="{x:Static og:Strings.DAppSource}" FontAttributes="Bold" VerticalOptions="Center" />
<Border Grid.Column="1" StrokeShape="RoundRectangle 8" BackgroundColor="{toolkit:AppThemeResource BrandMuted}" Padding="10,4">
<Label Text="{Binding SourceStatus, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}" TextColor="{toolkit:AppThemeResource Brand}" FontAttributes="Bold" FontSize="12" />
</Border>
</Grid>
<Label StyleClass="Secondary" Text="{Binding SourceHost, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}" FontSize="13" LineBreakMode="MiddleTruncation" />
<Grid ColumnDefinitions="auto,*" ColumnSpacing="8" IsVisible="{Binding HasWebsite, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}">
<Label StyleClass="Secondary" Text="{x:Static og:Strings.Website}" FontSize="12" />
<Label Grid.Column="1" StyleClass="Link" Text="{Binding WebsiteHost, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}" FontSize="12" LineBreakMode="MiddleTruncation">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{x:Static og:Commands.OpenUrl}" CommandParameter="{Binding Website}" />
</Label.GestureRecognizers>
</Label>
</Grid>
</VerticalStackLayout>
</Border>
<Border StyleClass="Card">
<VerticalStackLayout Spacing="8">
<Label Text="{x:Static og:Strings.DAppPermissions}" FontAttributes="Bold" />
<Label StyleClass="Secondary" Text="{x:Static og:Strings.DAppPermissionsSummary}" FontSize="13" />
</VerticalStackLayout>
</Border>
<Border StyleClass="Card">
<VerticalStackLayout Spacing="8">
<Label Text="{x:Static og:Strings.DAppRecentActivity}" FontAttributes="Bold" />
<Label StyleClass="Secondary" Text="{Binding RecentActivityText, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}" FontSize="13" />
</VerticalStackLayout>
</Border>
<Border StyleClass="Card" IsVisible="{Binding HasTags, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}">
<VerticalStackLayout Spacing="8">
<Label Text="{x:Static og:Strings.DAppTags}" FontAttributes="Bold" />
<Label StyleClass="Secondary" Text="{Binding TagsDisplay, Source={RelativeSource AncestorType={x:Type og:DAppDetailsPage}}}" FontSize="13" />
</VerticalStackLayout>
</Border>
<Label Text="{x:Static og:Strings.Preview}" FontAttributes="Bold" IsVisible="{Binding Previews, Converter={StaticResource IsListNotNullOrEmptyConverter}}" />
<CollectionView ItemsSource="{Binding Previews}" IsVisible="{Binding Previews, Converter={StaticResource IsListNotNullOrEmptyConverter}}">
<CollectionView.ItemsLayout>
Expand All @@ -63,10 +100,18 @@
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="{x:Static og:Strings.Introduction}" FontAttributes="Bold" />
<Label Text="{Binding Description, Converter={StaticResource LocalizerConverter}}" Margin="0,-10,0,0" />
<Label Text="{x:Static og:Strings.SupportedLanguages}" FontAttributes="Bold" />
<Label Text="{Binding Languages, Converter={StaticResource LanguageConverter}}" Margin="0,-10,0,0" />
<Border StyleClass="Card">
<VerticalStackLayout Spacing="8">
<Label Text="{x:Static og:Strings.Introduction}" FontAttributes="Bold" />
<Label StyleClass="Secondary" Text="{Binding Description, Converter={StaticResource LocalizerConverter}}" FontSize="13" />
</VerticalStackLayout>
</Border>
<Border StyleClass="Card">
<VerticalStackLayout Spacing="8">
<Label Text="{x:Static og:Strings.SupportedLanguages}" FontAttributes="Bold" />
<Label StyleClass="Secondary" Text="{Binding Languages, Converter={StaticResource LanguageConverter}}" FontSize="13" />
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
</ContentPage>
35 changes: 34 additions & 1 deletion OneGateApp/Pages/DAppDetailsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NeoOrder.OneGate.Data;
using NeoOrder.OneGate.Properties;
using NeoOrder.OneGate.Services;

namespace NeoOrder.OneGate.Pages;
Expand All @@ -8,6 +9,13 @@ public partial class DAppDetailsPage : ContentPage, IQueryAttributable
readonly ApplicationDbContext dbContext;

public bool IsFavorite { get; set { field = value; OnPropertyChanged(); } }
public string SourceHost { get; private set { field = value; OnPropertyChanged(); } } = "";
public string SourceStatus { get; private set { field = value; OnPropertyChanged(); } } = "";
public string WebsiteHost { get; private set { field = value; OnPropertyChanged(); } } = "";
public bool HasWebsite { get; private set { field = value; OnPropertyChanged(); } }
public string RecentActivityText { get; private set { field = value; OnPropertyChanged(); } } = "";
public string TagsDisplay { get; private set { field = value; OnPropertyChanged(); } } = "";
public bool HasTags { get; private set { field = value; OnPropertyChanged(); } }

public DAppDetailsPage(ApplicationDbContext dbContext, IHomeShortcutService homeShortcutService)
{
Expand All @@ -25,13 +33,38 @@ public void ApplyQueryAttributes(IDictionary<string, object> query)
protected override async void OnBindingContextChanged()
{
base.OnBindingContextChanged();
DApp dapp = (DApp)BindingContext;
if (BindingContext is not DApp dapp) return;

SourceHost = GetHost(dapp.Url) ?? dapp.Url;
SourceStatus = dapp.Id > 0 ? Strings.DAppCatalogStatus : Strings.DAppExternalStatus;
WebsiteHost = GetHost(dapp.Website) ?? "";
HasWebsite = !string.IsNullOrWhiteSpace(dapp.Website);
TagsDisplay = string.Join(", ", (dapp.Tags ?? [])
.Select(DApp.LocalizeTag)
.Append(dapp.GameTypeDisplayName)
.OfType<string>()
.Where(p => !string.IsNullOrWhiteSpace(p))
.Distinct(StringComparer.CurrentCultureIgnoreCase));
HasTags = !string.IsNullOrWhiteSpace(TagsDisplay);

List<int>? favorites = await dbContext.Settings.GetAsync<List<int>>("dapps/favorite");
IsFavorite = favorites?.Contains(dapp.Id) ?? false;
List<int>? recents = await dbContext.Settings.GetAsync<List<int>>("dapps/recent");
RecentActivityText = recents?.Contains(dapp.Id) == true
? Strings.DAppRecentlyOpened
: Strings.DAppNotRecentlyOpened;
}

void OnFavoriteClicked(object sender, EventArgs e)
{
IsFavorite = !IsFavorite;
}

static string? GetHost(string? url)
{
if (string.IsNullOrWhiteSpace(url)) return null;
if (Uri.TryCreate(url, UriKind.Absolute, out Uri? uri))
return uri.Host;
return url;
}
}
81 changes: 81 additions & 0 deletions OneGateApp/Properties/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion OneGateApp/Properties/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,33 @@
<data name="AppDetails" xml:space="preserve">
<value>App-Details</value>
</data>
<data name="DAppCatalogStatus" xml:space="preserve">
<value>OneGate-Katalog</value>
</data>
<data name="DAppExternalStatus" xml:space="preserve">
<value>Externer Link</value>
</data>
<data name="DAppNotRecentlyOpened" xml:space="preserve">
<value>Keine kürzlichen Öffnungen auf diesem Gerät</value>
</data>
<data name="DAppPermissions" xml:space="preserve">
<value>Berechtigungen</value>
</data>
<data name="DAppPermissionsSummary" xml:space="preserve">
<value>Diese dApp kann Wallet-Verbindung, Nachrichtensignaturen und Transaktionssignaturen anfordern. OneGate bittet um Bestätigung, bevor Wallet-Daten geteilt oder Signaturen ausgeführt werden.</value>
</data>
<data name="DAppRecentActivity" xml:space="preserve">
<value>Aktuelle Aktivität</value>
</data>
<data name="DAppRecentlyOpened" xml:space="preserve">
<value>Kürzlich auf diesem Gerät geöffnet</value>
</data>
<data name="DAppSource" xml:space="preserve">
<value>Quelle</value>
</data>
<data name="DAppTags" xml:space="preserve">
<value>Tags</value>
</data>
<data name="Introduction" xml:space="preserve">
<value>Beschreibung</value>
</data>
Expand Down Expand Up @@ -989,4 +1016,4 @@ Es wird empfohlen, den NEP-2-Schlüssel und das Passwort getrennt aufzubewahren
<data name="Unavailable" xml:space="preserve">
<value>Nicht verfügbar</value>
</data>
</root>
</root>
29 changes: 28 additions & 1 deletion OneGateApp/Properties/Strings.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,33 @@
<data name="AppDetails" xml:space="preserve">
<value>Detalles de la aplicación</value>
</data>
<data name="DAppCatalogStatus" xml:space="preserve">
<value>Catálogo de OneGate</value>
</data>
<data name="DAppExternalStatus" xml:space="preserve">
<value>Enlace externo</value>
</data>
<data name="DAppNotRecentlyOpened" xml:space="preserve">
<value>No se abrió recientemente en este dispositivo</value>
</data>
<data name="DAppPermissions" xml:space="preserve">
<value>Permisos</value>
</data>
<data name="DAppPermissionsSummary" xml:space="preserve">
<value>Esta dApp puede solicitar conexión de billetera, firmas de mensajes y firma de transacciones. OneGate pide confirmación antes de compartir datos de la billetera o firmar.</value>
</data>
<data name="DAppRecentActivity" xml:space="preserve">
<value>Actividad reciente</value>
</data>
<data name="DAppRecentlyOpened" xml:space="preserve">
<value>Abierta recientemente en este dispositivo</value>
</data>
<data name="DAppSource" xml:space="preserve">
<value>Origen</value>
</data>
<data name="DAppTags" xml:space="preserve">
<value>Etiquetas</value>
</data>
<data name="Introduction" xml:space="preserve">
<value>Descripción</value>
</data>
Expand Down Expand Up @@ -989,4 +1016,4 @@ Se recomienda almacenar la clave NEP-2 y la contraseña por separado y realizar
<data name="Unavailable" xml:space="preserve">
<value>No disponible</value>
</data>
</root>
</root>
29 changes: 28 additions & 1 deletion OneGateApp/Properties/Strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,33 @@
<data name="AppDetails" xml:space="preserve">
<value>Détails de l’application</value>
</data>
<data name="DAppCatalogStatus" xml:space="preserve">
<value>Catalogue OneGate</value>
</data>
<data name="DAppExternalStatus" xml:space="preserve">
<value>Lien externe</value>
</data>
<data name="DAppNotRecentlyOpened" xml:space="preserve">
<value>Aucune ouverture récente sur cet appareil</value>
</data>
<data name="DAppPermissions" xml:space="preserve">
<value>Autorisations</value>
</data>
<data name="DAppPermissionsSummary" xml:space="preserve">
<value>Cette dApp peut demander la connexion au portefeuille, des signatures de messages et la signature de transactions. OneGate demande confirmation avant de partager les données du portefeuille ou de signer.</value>
</data>
<data name="DAppRecentActivity" xml:space="preserve">
<value>Activité récente</value>
</data>
<data name="DAppRecentlyOpened" xml:space="preserve">
<value>Récemment ouverte sur cet appareil</value>
</data>
<data name="DAppSource" xml:space="preserve">
<value>Source</value>
</data>
<data name="DAppTags" xml:space="preserve">
<value>Étiquettes</value>
</data>
<data name="Introduction" xml:space="preserve">
<value>Description</value>
</data>
Expand Down Expand Up @@ -989,4 +1016,4 @@ Il est recommandé de conserver séparément la clé NEP-2 et le mot de passe, e
<data name="Unavailable" xml:space="preserve">
<value>Indisponible</value>
</data>
</root>
</root>
Loading