Skip to content

Fixes #70 formatting date parameter for field state #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
14 changes: 5 additions & 9 deletions mage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}

Expand All @@ -69,7 +65,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
kotlinCompilerExtensionVersion = "1.5.15"
}

packagingOptions {
Expand Down
2 changes: 1 addition & 1 deletion mage/src/main/java/mil/nga/giat/mage/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion mage/src/main/java/mil/nga/giat/mage/form/view/FormView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 15 additions & 9 deletions mage/src/main/java/mil/nga/giat/mage/login/SignupActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
10 changes: 5 additions & 5 deletions mage/src/main/java/mil/nga/giat/mage/login/SignupViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}

Expand Down