mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
fix bug in android app + more pages
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
<deviceKey>
|
<deviceKey>
|
||||||
<Key>
|
<Key>
|
||||||
<type value="VIRTUAL_DEVICE_PATH" />
|
<type value="VIRTUAL_DEVICE_PATH" />
|
||||||
<value value="$USER_HOME$/.android/avd/Nexus_10_API_34.avd" />
|
<value value="$USER_HOME$/.android/avd/Pixel_7_Pro_API_30.avd" />
|
||||||
</Key>
|
</Key>
|
||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</targetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2023-10-10T12:09:47.123729787Z" />
|
<timeTargetWasSelectedWithDropDown value="2023-10-10T15:22:18.675007998Z" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -11,7 +11,7 @@ android {
|
|||||||
applicationId = "com.janishutz.libreevent"
|
applicationId = "com.janishutz.libreevent"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 33
|
targetSdk = 33
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,7 @@
|
|||||||
package com.janishutz.libreevent
|
package com.janishutz.libreevent
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -8,6 +10,7 @@ import android.os.StrictMode.ThreadPolicy
|
|||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
@@ -27,6 +30,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val usernameEditText = findViewById<EditText>(R.id.username)
|
val usernameEditText = findViewById<EditText>(R.id.username)
|
||||||
val passwordEditText = findViewById<EditText>(R.id.password)
|
val passwordEditText = findViewById<EditText>(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" ) {
|
if (sharedPref.getString( "url", null ).toString() != "null" && sharedPref.getString( "username", null ).toString() != "null" ) {
|
||||||
urlEditText.setText(sharedPref.getString( "url", null ).toString())
|
urlEditText.setText(sharedPref.getString( "url", null ).toString())
|
||||||
usernameEditText.setText(sharedPref.getString( "username", null ).toString())
|
usernameEditText.setText(sharedPref.getString( "username", null ).toString())
|
||||||
@@ -38,6 +45,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
startActivity(switchIntent)
|
startActivity(switchIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loginButton.setOnClickListener {
|
loginButton.setOnClickListener {
|
||||||
val url = urlEditText.text.toString()
|
val url = urlEditText.text.toString()
|
||||||
val username = usernameEditText.text.toString()
|
val username = usernameEditText.text.toString()
|
||||||
@@ -91,4 +100,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
alertDialogBuilder.show()
|
alertDialogBuilder.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val CAMERA_PERMISSION_REQUEST = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ import com.journeyapps.barcodescanner.BarcodeResult
|
|||||||
import com.journeyapps.barcodescanner.CaptureActivity
|
import com.journeyapps.barcodescanner.CaptureActivity
|
||||||
import com.journeyapps.barcodescanner.CaptureManager
|
import com.journeyapps.barcodescanner.CaptureManager
|
||||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView
|
import com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
class ScannerActivity : CaptureActivity() {
|
class ScannerActivity : CaptureActivity() {
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ class ScannerActivity : CaptureActivity() {
|
|||||||
private lateinit var captureManager: CaptureManager
|
private lateinit var captureManager: CaptureManager
|
||||||
|
|
||||||
private var lastScanned: String = ""
|
private var lastScanned: String = ""
|
||||||
|
private var lastScanTimestamp: Long = 0
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_scanner)
|
setContentView(R.layout.activity_scanner)
|
||||||
@@ -61,7 +63,8 @@ class ScannerActivity : CaptureActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleScanResult(result: String) {
|
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 sharedPref = applicationContext.getSharedPreferences( "login", MODE_PRIVATE )
|
||||||
|
|
||||||
val status = ApiClient().checkTicket( sharedPref.getString( "url", null ).toString(),
|
val status = ApiClient().checkTicket( sharedPref.getString( "url", null ).toString(),
|
||||||
|
|||||||
@@ -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<out String>, 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
51
website/dist/android/index.html
vendored
Normal file
51
website/dist/android/index.html
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/css/style.css">
|
||||||
|
<link rel="stylesheet" href="/css/home.css">
|
||||||
|
<title>About :: libreǝvent</title>
|
||||||
|
<meta name="description" content="Looking for a free and open source event management solution you can host yourself? libreevent is a project that does exactly that.">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav"></div>
|
||||||
|
<div id="backToTop" onclick="backToTop();"></div>
|
||||||
|
<div class="title-wrapper">
|
||||||
|
<h1>Android app</h1>
|
||||||
|
<footer>Check the validity of tickets easily</footer>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<p>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.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
<!-- TODO: Link to app -->
|
||||||
|
</div>
|
||||||
|
<div id="footer"></div>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
<script>
|
||||||
|
let btn = document.getElementById( 'backToTop' );
|
||||||
|
$( document ).ready( function () {
|
||||||
|
$( '#nav' ).load( '/nav.html' );
|
||||||
|
$( '#footer' ).load( '/footer.html' );
|
||||||
|
} );
|
||||||
|
|
||||||
|
function backToTop () {
|
||||||
|
if ( document.body.scrollTop > 500 || document.documentElement.scrollTop > 500 ) {
|
||||||
|
window.scrollTo( { top: 0, behavior: 'smooth' } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onscroll = function () {
|
||||||
|
if ( document.body.scrollTop > 500 || document.documentElement.scrollTop > 500 ) {
|
||||||
|
btn.style.opacity = '1';
|
||||||
|
btn.style.cursor = 'pointer';
|
||||||
|
} else {
|
||||||
|
btn.style.opacity = '0';
|
||||||
|
btn.style.cursor = 'default';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
51
website/dist/ios/index.html
vendored
Normal file
51
website/dist/ios/index.html
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/css/style.css">
|
||||||
|
<link rel="stylesheet" href="/css/home.css">
|
||||||
|
<title>About :: libreǝvent</title>
|
||||||
|
<meta name="description" content="Looking for a free and open source event management solution you can host yourself? libreevent is a project that does exactly that.">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav"></div>
|
||||||
|
<div id="backToTop" onclick="backToTop();"></div>
|
||||||
|
<div class="title-wrapper">
|
||||||
|
<h1>iOS app</h1>
|
||||||
|
<footer>Check the validity of tickets easily</footer>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<p>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.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
<!-- TODO: Link to app -->
|
||||||
|
</div>
|
||||||
|
<div id="footer"></div>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
<script>
|
||||||
|
let btn = document.getElementById( 'backToTop' );
|
||||||
|
$( document ).ready( function () {
|
||||||
|
$( '#nav' ).load( '/nav.html' );
|
||||||
|
$( '#footer' ).load( '/footer.html' );
|
||||||
|
} );
|
||||||
|
|
||||||
|
function backToTop () {
|
||||||
|
if ( document.body.scrollTop > 500 || document.documentElement.scrollTop > 500 ) {
|
||||||
|
window.scrollTo( { top: 0, behavior: 'smooth' } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onscroll = function () {
|
||||||
|
if ( document.body.scrollTop > 500 || document.documentElement.scrollTop > 500 ) {
|
||||||
|
btn.style.opacity = '1';
|
||||||
|
btn.style.cursor = 'pointer';
|
||||||
|
} else {
|
||||||
|
btn.style.opacity = '0';
|
||||||
|
btn.style.cursor = 'default';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Home
|
# 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!)
|
||||||
<!-- In a future update, depending on your account's privileges, you may find more or less settings. Only the root account has access to the admin accounts page. Currently though, all pages are unlocked for all users. -->
|
<!-- In a future update, depending on your account's privileges, you may find more or less settings. Only the root account has access to the admin accounts page. Currently though, all pages are unlocked for all users. -->
|
||||||
|
|
||||||
Here's a list of the pages available when logged in as the root user. <!-- All other users have fewer pages enabled.-->
|
Here's a list of the pages available when logged in as the root user. <!-- All other users have fewer pages enabled.-->
|
||||||
|
|||||||
Reference in New Issue
Block a user