From 252f04fe77e9190d8ed597e72b5fe9d34e1c8c06 Mon Sep 17 00:00:00 2001 From: William Newman <3382274+newmanw@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:39:28 -0700 Subject: [PATCH 1/6] Exclude signup route from API token interceptor to prevent multiple authorization tokens from being sent --- mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt b/mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt index 0939afe4..70c6a0c8 100644 --- a/mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt +++ b/mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt @@ -88,7 +88,7 @@ class NetworkModule { tokenProvider: TokenProvider, userAgentHeader: UserAgentHeader ): Interceptor { - val nonTokenRoutes = listOf("/auth/token", "/api/users/myself/password") + val nonTokenRoutes = listOf("/auth/token", "/api/users/myself/password", "/api/users/signups/verifications") return Interceptor { chain -> val builder = chain.request().newBuilder() From f33b1c2741a70e9e16751d498cdca394bcbe87e4 Mon Sep 17 00:00:00 2001 From: William Newman <3382274+newmanw@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:40:09 -0700 Subject: [PATCH 2/6] Hide progress mask on sign up failure --- .../mil/nga/giat/mage/login/SignupActivity.kt | 24 ++++++++++++------- .../nga/giat/mage/login/SignupViewModel.kt | 10 ++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/mage/src/main/java/mil/nga/giat/mage/login/SignupActivity.kt b/mage/src/main/java/mil/nga/giat/mage/login/SignupActivity.kt index a826bd14..d020a6c7 100644 --- a/mage/src/main/java/mil/nga/giat/mage/login/SignupActivity.kt +++ b/mage/src/main/java/mil/nga/giat/mage/login/SignupActivity.kt @@ -109,16 +109,22 @@ open class SignupActivity : AppCompatActivity() { val isActive = status.user!!.get("active").asBoolean showSignupSuccessDialog(isActive) } else { - if (status.error == SignupError.INVALID_USERNAME) { - binding.captchaText.setText("") - binding.usernameLayout.error = "Username not available" + when (status.error) { + SignupError.INVALID_USERNAME -> { + binding.captchaText.setText("") + binding.usernameLayout.error = "Username not available" + } + SignupError.INVALID_CAPTCHA -> { + binding.captchaTextLayout.error = "Invalid Captcha" + } + else -> { + AlertDialog.Builder(this) + .setTitle("Signup Failed") + .setMessage(status.errorMessage) + .setPositiveButton(android.R.string.ok, null) + .show() + } } - - AlertDialog.Builder(this) - .setTitle("Signup Failed") - .setMessage(status.errorMessage) - .setPositiveButton(android.R.string.ok, null) - .show() } } diff --git a/mage/src/main/java/mil/nga/giat/mage/login/SignupViewModel.kt b/mage/src/main/java/mil/nga/giat/mage/login/SignupViewModel.kt index e055bebc..987f8546 100644 --- a/mage/src/main/java/mil/nga/giat/mage/login/SignupViewModel.kt +++ b/mage/src/main/java/mil/nga/giat/mage/login/SignupViewModel.kt @@ -74,8 +74,11 @@ open class SignupViewModel @Inject constructor( open fun signup(account: Account, captchaText: String) { viewModelScope.launch { - val response = userRepository.verifyUser(account.displayName, account.email, account.phone, account.password, captchaText, captchaToken) + _signupStatus.value = null + _signupState.value = SignupState.LOADING + try { + val response = userRepository.verifyUser(account.displayName, account.email, account.phone, account.password, captchaText, captchaToken) if (response.isSuccessful) { _signupStatus.value = SignupStatus(true, response.body()) } else { @@ -88,14 +91,11 @@ open class SignupViewModel @Inject constructor( val error = if (response.code() == 409) SignupError.INVALID_USERNAME else SignupError.INVALID_CAPTCHA _signupStatus.value = SignupStatus(false, null, error, response.errorBody()?.string(), account.username) } - - _signupState.value = SignupState.COMPLETE } catch (e: Exception) { _signupStatus.value = SignupStatus(false, null, null, e.localizedMessage, account.username) } - _signupStatus.value = null - _signupState.value = SignupState.LOADING + _signupState.value = SignupState.COMPLETE } } From d2ac4bb0c53fa7f2b6fdd5308ae8ec3dabdb799b Mon Sep 17 00:00:00 2001 From: Brad Hards Date: Fri, 15 Nov 2024 04:37:18 +1100 Subject: [PATCH 3/6] Update README.md (#66) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50399f8c..3b8361f5 100755 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The **M**obile **A**wareness **G**EOINT **E**nvironment, or MAGE, provides mobil The app remains functional if your mobile device loses its network connection, and will upload its local content when a connection is re-established. When disconnected from the network, MAGE will use local data layers to continue to provide relevant GEOINT. Data layers, including map tiles and vector data, can be stored on your mobile device and are available at all times. -MAGE is very customizable and can be tailored for you situation. +MAGE is very customizable and can be tailored for your situation. MAGE Android was developed at the National Geospatial-Intelligence Agency (NGA) in collaboration with BIT Systems. The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the Apache license. From a90764c39d8cc51045d608a836146bb0c60b3c2d Mon Sep 17 00:00:00 2001 From: Josh McCullough Date: Thu, 14 Nov 2024 12:38:24 -0500 Subject: [PATCH 4/6] fix manifest XML syntax error (#38) From a8144e608ff58b5c814a680e7109c392a22a4609 Mon Sep 17 00:00:00 2001 From: Billy Newman Date: Wed, 27 Nov 2024 09:05:28 -0700 Subject: [PATCH 5/6] Upgrade to gradle 8.9 and java 21 (#68) --- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- mage/build.gradle | 14 +++++--------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 1b27cb37..a2b48b5c 100755 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'com.android.application' version '8.3.0' apply false - id 'com.android.library' version '8.3.0' apply false - id 'org.jetbrains.kotlin.android' version '1.9.10' apply false + id 'com.android.application' version '8.7.2' apply false + id 'com.android.library' version '8.7.2' apply false + id 'org.jetbrains.kotlin.android' version '1.9.25' apply false id 'com.google.dagger.hilt.android' version '2.51' apply false } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3623dd93..f01a4242 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu May 06 13:38:17 MDT 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/mage/build.gradle b/mage/build.gradle index 207ab479..02dc878b 100644 --- a/mage/build.gradle +++ b/mage/build.gradle @@ -46,20 +46,16 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_21 + targetCompatibility JavaVersion.VERSION_21 } kotlin { - jvmToolchain(11) - } - - kotlin { - jvmToolchain(17) + jvmToolchain(21) } kotlinOptions { - jvmTarget = "17" + jvmTarget = "21" freeCompilerArgs = ["-Xcontext-receivers"] } @@ -69,7 +65,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion = "1.5.3" + kotlinCompilerExtensionVersion = "1.5.15" } packagingOptions { From 02e11bace0684df619c4a1c5c3aeeb5646d24924 Mon Sep 17 00:00:00 2001 From: William Newman <3382274+newmanw@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:35:14 -0700 Subject: [PATCH 6/6] Fixes #70 formatting date parameter for field state --- mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt b/mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt index b7af5142..3d7c9590 100644 --- a/mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt +++ b/mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt @@ -389,7 +389,7 @@ fun fieldText( } is FieldValue.Date -> { val dateFormat = DateFormatFactory.format("yyyy-MM-dd HH:mm zz", Locale.getDefault(), context) - dateFormat.format(fieldValue) + dateFormat.format(fieldValue.date) } is FieldValue.Location -> { CoordinateFormatter(context).format(fieldValue.location.centroidLatLng)