Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ plugins {

android {
defaultConfig {
compileSdk 34
targetSdk 34
applicationId "com.meshcentral.agent2"
minSdk 23
versionCode 28
versionName "1.0.21"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
compileSdk = 34
targetSdk = 34
applicationId = "com.meshcentral.agent2"
minSdk = 23
versionCode = 28
versionName = "1.0.21"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
debug {
debuggable true
debuggable = true
}
release {
// Enables code shrinking, obfuscation, and optimization for only
Expand All @@ -31,20 +31,23 @@ android {
// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
proguardFiles(getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro')
signingConfig = signingConfigs.debug

//debuggable true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.meshcentral.agent'
namespace = 'com.meshcentral.agent'
buildFeatures {
buildConfig = true
}
}

dependencies {
Expand All @@ -56,9 +59,9 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation 'com.budiyev.android:code-scanner:2.1.0'
implementation 'com.karumi:dexter:6.2.2'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.github.yuriy-budiyev:code-scanner:2.3.2'
implementation 'com.karumi:dexter:6.2.3'
implementation 'com.squareup.okhttp3:okhttp:5.3.2'
implementation 'com.madgag.spongycastle:bcpkix-jdk15on:1.58.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-messaging:23.4.1'
Expand Down
34 changes: 16 additions & 18 deletions app/src/main/java/com/meshcentral/agent/AuthFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,47 @@ import androidx.navigation.fragment.findNavController
import java.lang.Exception

class AuthFragment : Fragment() {
var countDownTimer : CountDownTimer? = null
private lateinit var countDownTimer : CountDownTimer

override fun onCreate(savedInstanceState: Bundle?) {
println("onCreate-auth");
println("onCreate-auth")
super.onCreate(savedInstanceState)
}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
println("onCreateView-auth");
println("onCreateView-auth")
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_auth, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
println("onViewCreated-auth");
println("onViewCreated-auth")
super.onViewCreated(view, savedInstanceState)
authFragment = this
visibleScreen = 4;
visibleScreen = 4

// Set authentication code
var t:TextView = view.findViewById<Button>(R.id.authTopText2) as TextView
t.text = "000000"
val t:TextView? = view.findViewById(R.id.authTopText2)
t?.text = getString(R.string.zero_string)
if (g_auth_url != null) {
var authCode: String? = g_auth_url?.getQueryParameter("code")
val authCode: String? = g_auth_url?.getQueryParameter("code")
if (authCode != null) {
t.text = String(Base64.decode(authCode, Base64.DEFAULT), charset("UTF-8"))
t?.text = String(Base64.decode(authCode, Base64.DEFAULT), charset("UTF-8"))
}
}

// Set authentication progress bar
var p:ProgressBar = view.findViewById<Button>(R.id.authProgressBar) as ProgressBar
p.progress = 100
val p:ProgressBar? = view.findViewById(R.id.authProgressBar)
p?.progress = 100
countDownTimer = object : CountDownTimer(60000, 600) {
override fun onTick(millisUntilFinished: Long) {
var p:ProgressBar = view.findViewById<Button>(R.id.authProgressBar) as ProgressBar
if (p.progress > 0) { p.progress = p.progress - 1 }
val p:ProgressBar? = view.findViewById(R.id.authProgressBar)
if (p?.progress!! > 0) { p.progress -= 1 }
}
override fun onFinish() {
countDownTimer = null
exit()
}
}.start()
Expand All @@ -74,12 +73,11 @@ class AuthFragment : Fragment() {
}

fun exit() {
if (countDownTimer != null) {
countDownTimer?.cancel()
countDownTimer = null
if (this::countDownTimer.isInitialized) {
countDownTimer.cancel()
}
try {
findNavController().navigate(R.id.action_authFragment_to_FirstFragment)
} catch (ex: Exception) {}
} catch (_: Exception) {}
}
}
Loading