Skip to content

Commit

Permalink
Aggiunta: gestione app in pagina pubblica
Browse files Browse the repository at this point in the history
  • Loading branch information
trinko committed Jan 25, 2025
1 parent 4a2a72d commit 3e04b14
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
!/PERSONAL/translations/.gitkeep
/public/app/*
!/public/app/.gitkeep
!/public/app/giuaschool-app-v*
/public/bundles/
/public/spid/
/src/Command/Argo/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
!/PERSONAL/translations/.gitkeep
/public/app/*
!/public/app/.gitkeep
!/public/app/giuaschool-app-v*
/public/bundles/
/public/spid/
/src/Command/Argo/
Expand Down
Binary file added public/app/giuaschool-app-v1.3.4.apk
Binary file not shown.
10 changes: 8 additions & 2 deletions src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,15 @@ public function info(ConfigLoader $config): Response {
$giuaschoolApp = null;
$finder = new Finder();
$finder->files()->in($this->getParameter('kernel.project_dir').'/public/app')
->name('giuaschool-app-*.apk')->sortByModifiedTime()->reverseSorting();
->name('giuaschool-app-*.apk');
foreach ($finder as $file) {
$giuaschoolApp = substr($file->getBasename(), 15, -4);
// considera solo il primo file trovato
$versione = substr($file->getBasename(), 15, -4);
if (str_starts_with($versione, 'CUSTOM-')) {
// versione personalizzata
$versione = substr($versione, 7);
}
$giuaschoolApp = [$file->getBasename(), $versione];
break;
}
// mostra la pagina di risposta
Expand Down
4 changes: 2 additions & 2 deletions templates/app/info.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% if giuaschoolApp is not null %}
<div id="giuaschool-app" class="alert alert-success gs-mt-5" role="alert">
<div class="row text-center"><strong class="gs-big">giua@school-app {{ giuaschoolApp }}</strong></div>
<div class="row text-center"><strong class="gs-big">giua@school/app {{ giuaschoolApp[1] }}</strong></div>
<hr class="gs-mt-2 gs-mb-2">
<div class="row text-center">
</div>
Expand Down Expand Up @@ -36,7 +36,7 @@
</tbody>
</table>
<div class="row text-center">
<a class="btn btn-primary btn-sm" href="{{ asset('app/giuaschool-app-'~giuaschoolApp~'.apk') }}" title="Clicca per scaricare l'applicazione sul tuo smartphone"><strong class="gs-big">Scarica l'app</strong></a>
<a class="btn btn-primary btn-sm" href="{{ asset('app/'~giuaschoolApp[0]) }}" title="Clicca per scaricare l'applicazione sul tuo smartphone"><strong class="gs-big">Scarica l'app</strong></a>
</div>
</div>
</div>
Expand Down

0 comments on commit 3e04b14

Please sign in to comment.