Files

62 lines
3.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@php
abort_unless(timebank_config('android_app.enabled', true), 404);
$layout = Auth::check() ? 'app-layout' : 'guest-layout';
$fallbackTexts = [
'en' => 'The :platform Android app lets you quickly access your account using biometric login. Check your balance, make payments, chat with other members, and get push notifications — all from your phone. Download the APK below to install the app directly on your Android device.',
'nl' => 'De :platform Android-app geeft je snel toegang tot je account via biometrische login. Bekijk je saldo, doe betalingen, chat met andere leden en ontvang pushmeldingen — allemaal vanaf je telefoon. Download de APK hieronder om de app direct op je Android-apparaat te installeren.',
'fr' => 'L\'application Android :platform te permet d\'accéder rapidement à ton compte grâce à la connexion biométrique. Consulte ton solde, effectue des paiements, discute avec d\'autres membres et reçois des notifications push — tout depuis ton téléphone. Télécharge l\'APK ci-dessous pour installer l\'application directement sur ton appareil Android.',
'de' => 'Die :platform Android-App ermöglicht dir den schnellen Zugriff auf dein Konto per biometrischem Login. Sieh deinen Kontostand ein, tätige Zahlungen, chatte mit anderen Mitgliedern und erhalte Push-Benachrichtigungen – alles von deinem Telefon aus. Lade die APK unten herunter, um die App direkt auf deinem Android-Gerät zu installieren.',
'es' => 'La app Android de :platform te permite acceder rápidamente a tu cuenta mediante inicio de sesión biométrico. Consulta tu saldo, realiza pagos, chatea con otros miembros y recibe notificaciones push — todo desde tu teléfono. Descarga el APK a continuación para instalar la app directamente en tu dispositivo Android.',
];
$locale = app()->getLocale();
$fallbackText = str_replace(':platform', platform_name(), $fallbackTexts[$locale] ?? $fallbackTexts['en']);
$apkUrl = \App\Http\Controllers\AppVersionController::latest()['apkUrl'];
$hasPost = \App\Models\Post::whereHas('category', fn($q) => $q->where('type', 'SiteContents\Static\AndroidApp'))
->whereHas('translations', fn($q) => $q
->where('locale', 'like', $locale . '%')
->whereDate('from', '<=', now())
->where(fn($q2) => $q2->whereDate('till', '>', now())->orWhereNull('till'))
)->exists();
@endphp
<x-dynamic-component :component="$layout">
<x-slot name="header">
{{ __('Android app') }}
</x-slot>
<div class="py-6">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
@if($hasPost)
@livewire('static-post', [
'type' => 'SiteContents\Static\AndroidApp',
'limit' => timebank_config('posts.static.android-app.limit'),
'hideAuthor' => timebank_config('posts.static.android-app.hideAuthor'),
])
@endif
{{-- Fallback text (when no post) and Download APK button (always shown) --}}
<div class="overflow-hidden bg-theme-background shadow-xl sm:rounded-lg mb-3">
<div class="px-3 sm:px-0">
<div class="max-w-4xl mx-auto my-12 p-4">
@if(!$hasPost)
<p class="text-theme-primary mb-8">{{ $fallbackText }}</p>
@endif
<div class="flex justify-center">
<a href="{{ $apkUrl }}" download>
<x-jetstream.button>
{{ __('Download APK') }}
</x-jetstream.button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</x-dynamic-component>