diff --git a/src/apps/Android/.idea/deploymentTargetDropDown.xml b/src/apps/Android/.idea/deploymentTargetDropDown.xml index 6803cab..50a46f4 100644 --- a/src/apps/Android/.idea/deploymentTargetDropDown.xml +++ b/src/apps/Android/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,11 @@ - + - + \ No newline at end of file diff --git a/src/apps/Android/app/build.gradle.kts b/src/apps/Android/app/build.gradle.kts index 6556df0..11bb8dc 100644 --- a/src/apps/Android/app/build.gradle.kts +++ b/src/apps/Android/app/build.gradle.kts @@ -11,7 +11,7 @@ android { applicationId = "com.janishutz.libreevent" minSdk = 24 targetSdk = 33 - versionCode = 1 + versionCode = 2 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/src/apps/Android/app/release/app-release.aab b/src/apps/Android/app/release/app-release.aab index fa119a0..e777376 100644 Binary files a/src/apps/Android/app/release/app-release.aab and b/src/apps/Android/app/release/app-release.aab differ diff --git a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/MainActivity.kt b/src/apps/Android/app/src/main/java/com/janishutz/libreevent/MainActivity.kt index 1f94664..13d312b 100644 --- a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/MainActivity.kt +++ b/src/apps/Android/app/src/main/java/com/janishutz/libreevent/MainActivity.kt @@ -1,5 +1,7 @@ package com.janishutz.libreevent +import android.Manifest +import android.content.pm.PackageManager import android.app.AlertDialog import android.content.Intent import android.os.Bundle @@ -8,6 +10,7 @@ import android.os.StrictMode.ThreadPolicy import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AppCompatActivity +import androidx.core.app.ActivityCompat class MainActivity : AppCompatActivity() { @@ -27,6 +30,10 @@ class MainActivity : AppCompatActivity() { val usernameEditText = findViewById(R.id.username) val passwordEditText = findViewById(R.id.password) + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA), CAMERA_PERMISSION_REQUEST) + } + if (sharedPref.getString( "url", null ).toString() != "null" && sharedPref.getString( "username", null ).toString() != "null" ) { urlEditText.setText(sharedPref.getString( "url", null ).toString()) usernameEditText.setText(sharedPref.getString( "username", null ).toString()) @@ -38,6 +45,8 @@ class MainActivity : AppCompatActivity() { startActivity(switchIntent) } + + loginButton.setOnClickListener { val url = urlEditText.text.toString() val username = usernameEditText.text.toString() @@ -91,4 +100,8 @@ class MainActivity : AppCompatActivity() { alertDialogBuilder.show() } } + + companion object { + private const val CAMERA_PERMISSION_REQUEST = 1 + } } \ No newline at end of file diff --git a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/ScannerActivity.kt b/src/apps/Android/app/src/main/java/com/janishutz/libreevent/ScannerActivity.kt index 1f88125..356be9b 100644 --- a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/ScannerActivity.kt +++ b/src/apps/Android/app/src/main/java/com/janishutz/libreevent/ScannerActivity.kt @@ -12,6 +12,7 @@ import com.journeyapps.barcodescanner.BarcodeResult import com.journeyapps.barcodescanner.CaptureActivity import com.journeyapps.barcodescanner.CaptureManager import com.journeyapps.barcodescanner.DecoratedBarcodeView +import java.util.Date class ScannerActivity : CaptureActivity() { @@ -19,6 +20,7 @@ class ScannerActivity : CaptureActivity() { private lateinit var captureManager: CaptureManager private var lastScanned: String = "" + private var lastScanTimestamp: Long = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_scanner) @@ -61,7 +63,8 @@ class ScannerActivity : CaptureActivity() { } private fun handleScanResult(result: String) { - if ( lastScanned != result ) { + if ( lastScanned != result || lastScanTimestamp + 2000 < System.currentTimeMillis()) { + lastScanTimestamp = System.currentTimeMillis() val sharedPref = applicationContext.getSharedPreferences( "login", MODE_PRIVATE ) val status = ApiClient().checkTicket( sharedPref.getString( "url", null ).toString(), diff --git a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/backup.txt b/src/apps/Android/app/src/main/java/com/janishutz/libreevent/backup.txt deleted file mode 100644 index 86c8f1f..0000000 --- a/src/apps/Android/app/src/main/java/com/janishutz/libreevent/backup.txt +++ /dev/null @@ -1,73 +0,0 @@ -package com.janishutz.libreevent - -import android.Manifest -import android.content.pm.PackageManager -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import androidx.core.app.ActivityCompat -import com.journeyapps.barcodescanner.BarcodeCallback -import com.journeyapps.barcodescanner.CaptureManager -import com.journeyapps.barcodescanner.DecoratedBarcodeView - -class ScannerActivity : AppCompatActivity() { - - private lateinit var barcodeView: DecoratedBarcodeView - private lateinit var captureManager: CaptureManager - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_scanner) - - barcodeView = findViewById(R.id.barcodeScannerView) - - // Check for camera permission and request if not granted - if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA), CAMERA_PERMISSION_REQUEST) - } else { - setupScanner() - } - } - - private fun setupScanner() { - captureManager = CaptureManager(this, barcodeView) - - captureManager.initializeFromIntent(intent, null) - captureManager.decode() - } - - private fun handleScanResult(result: String) { - // The `result` parameter contains the scanned data (e.g., QR code content) - // You can process it or send it as needed - } - - override fun onResume() { - super.onResume() - captureManager.onResume() - } - - override fun onPause() { - super.onPause() - captureManager.onPause() - } - - // Pass savedInstanceState to onSaveInstanceState - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - captureManager.onSaveInstanceState(outState) - } - - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if (requestCode == CAMERA_PERMISSION_REQUEST) { - if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - setupScanner() - } else { - // Handle permission denied - } - } - } - - companion object { - private const val CAMERA_PERMISSION_REQUEST = 1 - } -} \ No newline at end of file diff --git a/website/dist/android/index.html b/website/dist/android/index.html new file mode 100644 index 0000000..9d1c38b --- /dev/null +++ b/website/dist/android/index.html @@ -0,0 +1,51 @@ + + + + + + + + + About :: libreǝvent + + + + +
+
+

Android app

+
Check the validity of tickets easily
+
+
+

libreǝvent features an Android app to allow you to check the validity of the tickets. Just download the app from the Google Play Store using the link below.

+

You may then log into the app using the URL to your fully set up libreevent instance, the email address of an admin account and its password.

+ +
+ + + + + + \ No newline at end of file diff --git a/website/dist/ios/index.html b/website/dist/ios/index.html new file mode 100644 index 0000000..ec6d6ce --- /dev/null +++ b/website/dist/ios/index.html @@ -0,0 +1,51 @@ + + + + + + + + + About :: libreǝvent + + + + +
+
+

iOS app

+
Check the validity of tickets easily
+
+
+

libreǝvent features an iOS app to allow you to check the validity of the tickets. Just download the app from the AppStore using the link below.

+

You may then log into the app using the URL to your fully set up libreevent instance, the email address of an admin account and its password.

+ +
+ + + + + + \ No newline at end of file diff --git a/website/src/admin-panel.md b/website/src/admin-panel.md index 53280ca..4d4c513 100644 --- a/website/src/admin-panel.md +++ b/website/src/admin-panel.md @@ -1,5 +1,5 @@ # Home -The admin panel is where you can change basically everything about libreevent. +The admin panel is where you can change basically everything about libreevent. It can be reached by visiting your libreevent instance and at the end type '/admin'. Example: 'https://libreevent.janishutz.com/admin' (note that this is not a valid URL!) Here's a list of the pages available when logged in as the root user.