Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class AppVersionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Return the latest Android app version info.
|
||||
*
|
||||
* To publish a new version:
|
||||
* 1. Build a signed APK in Android Studio.
|
||||
* 2. Rename it to the android_app.apk_file name in the platform config, e.g. timebank-cc-1.0.1.apk.
|
||||
* 3. Upload it to storage/app/public/apk/.
|
||||
* 4. Update $versionCode and $versionName below.
|
||||
* 5. Run: php artisan storage:link (once, if not already done)
|
||||
*/
|
||||
public function show(): JsonResponse
|
||||
{
|
||||
abort_unless(timebank_config('android_app.enabled', true), 404);
|
||||
|
||||
return response()->json(self::latest());
|
||||
}
|
||||
|
||||
/**
|
||||
* The latest version and its download URL; also used by the static Android app page.
|
||||
* scripts/deploy-apk.sh rewrites the two version lines below.
|
||||
*/
|
||||
public static function latest(): array
|
||||
{
|
||||
$versionCode = 6;
|
||||
$versionName = '1.0.4';
|
||||
|
||||
$apkFile = str_replace('{version}', $versionName, timebank_config('android_app.apk_file', 'timebank-cc-{version}.apk'));
|
||||
|
||||
return [
|
||||
'versionCode' => $versionCode,
|
||||
'versionName' => $versionName,
|
||||
'apkUrl' => url("storage/apk/{$apkFile}"),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user