TP-66855 | Reverted Hyperion Changes (#12370)
This commit is contained in:
committed by
GitHub
parent
dc818ee5ee
commit
3f7281fcbf
@@ -323,6 +323,19 @@ dependencies {
|
||||
debugImplementation libs.androidx.compose.ui.test.junit4
|
||||
debugImplementation libs.androidx.compose.ui.test.manifest
|
||||
debugImplementation libs.androidx.test.monitor
|
||||
debugImplementation libs.hyperion.attr
|
||||
debugImplementation libs.hyperion.buildConfig
|
||||
debugImplementation libs.hyperion.core
|
||||
debugImplementation libs.hyperion.disk
|
||||
debugImplementation libs.hyperion.geigerCounter
|
||||
debugImplementation libs.hyperion.measurement
|
||||
debugImplementation libs.hyperion.phoenix
|
||||
debugImplementation libs.hyperion.recorder
|
||||
debugImplementation libs.hyperion.sharedPreferences
|
||||
debugImplementation libs.hyperion.simpleItem
|
||||
debugImplementation libs.hyperion.timber
|
||||
|
||||
releaseImplementation libs.hyperion.coreNoOp
|
||||
|
||||
androidTestImplementation libs.androidx.arch.core.testing
|
||||
androidTestImplementation(libs.androidx.test.espresso.contrib) {
|
||||
|
||||
@@ -17,4 +17,10 @@
|
||||
, com.reactnativecommunity.picker, com.microsoft.codepush.react, com.henninghall.date_picker, com.swmansion.reanimated,
|
||||
com.th3rdwave.safeareacontext, com.horcrux.svg, com.truecaller.android.sdk, org.reactnative.maskedview, com.BV.LinearGradient"/>
|
||||
|
||||
<application
|
||||
android:name="hyperion.HyperionApplication"
|
||||
tools:ignore="MissingApplicationIcon"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:name,android:usesCleartextTraffic"/>
|
||||
|
||||
</manifest>
|
||||
33
android/app/src/debug/java/hyperion/HyperionApplication.kt
Normal file
33
android/app/src/debug/java/hyperion/HyperionApplication.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package hyperion
|
||||
|
||||
import android.content.Intent
|
||||
import com.github.takahirom.hyperion.plugin.simpleitem.SimpleItem
|
||||
import com.github.takahirom.hyperion.plugin.simpleitem.SimpleItemHyperionPlugin
|
||||
import com.naviapp.R
|
||||
import com.naviapp.app.NaviApplication
|
||||
import com.naviapp.configuration.NaviConfigurationActivity
|
||||
|
||||
class HyperionApplication : NaviApplication() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
SimpleItemHyperionPlugin.addItem(
|
||||
SimpleItem.Builder()
|
||||
.title("Navi Configuration")
|
||||
.text("Change App Version Code on the fly.")
|
||||
.clickListener {
|
||||
val intent = Intent(applicationContext, NaviConfigurationActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
}
|
||||
.image(R.drawable.ic_navi_logo)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import com.naviapp.common.helper.UpiSdkHelperImpl
|
||||
import com.naviapp.common.navigator.NaviDeepLinkNavigator
|
||||
import com.naviapp.home.compose.activity.HomePageActivity
|
||||
import com.naviapp.utils.getAppName
|
||||
import com.naviapp.utils.getVersionCode
|
||||
import com.xiaomi.channel.commonutils.android.Region
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
@@ -79,7 +80,7 @@ object NaviSDKHelper {
|
||||
AppInfo(
|
||||
getAppName(),
|
||||
BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
),
|
||||
appsFlyerKey = BuildConfig.APPSFLYER_KEY,
|
||||
flavor = BuildConfig.FLAVOR,
|
||||
@@ -113,7 +114,7 @@ object NaviSDKHelper {
|
||||
upiSdkHelper = UpiSdkHelperImpl(naviApplication.naviPayManager),
|
||||
baseUrl = BaseBuildConfig.BASE_URL,
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
applicationId = BuildConfig.APPLICATION_ID,
|
||||
flavor = BuildConfig.FLAVOR,
|
||||
sslPinningKey = BuildConfig.SSL_PINNING_KEY,
|
||||
@@ -124,11 +125,11 @@ object NaviSDKHelper {
|
||||
NaviPayManager.initAppInfo(
|
||||
baseUrl = BaseBuildConfig.BASE_URL,
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
)
|
||||
AdverseSdkManager.init(
|
||||
AdverseConfig(
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
flavor = BuildConfig.FLAVOR,
|
||||
timeoutInSec = FirebaseRemoteConfigHelper.getLong(ADVERSE_NETWORK_TIMEOUT)
|
||||
|
||||
@@ -21,7 +21,7 @@ import dagger.hilt.android.HiltAndroidApp
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltAndroidApp
|
||||
class NaviApplication : BaseApplication(), ImageLoaderFactory {
|
||||
open class NaviApplication : BaseApplication(), ImageLoaderFactory {
|
||||
companion object {
|
||||
lateinit var instance: NaviApplication
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.navi.base.deeplink.DeepLinkManager
|
||||
import com.navi.base.model.CtaData
|
||||
import com.navi.base.model.LineItem
|
||||
import com.navi.base.utils.BaseUtils
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.common.utils.log
|
||||
import com.naviapp.configuration.composable.NaviConfigurationScreen
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class NaviConfigurationActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
NaviConfigurationScreen(
|
||||
onVersionCodeChange = { BaseUtils.saveUpdatedVersionCodeAndRestart(it, this) },
|
||||
onBackButtonClick = { finish() },
|
||||
onEnterApJourneyClicked = ::onEnterApJourneyClicked,
|
||||
onRoutingKeyChange = { BaseUtils.saveRoutingKeyAndRestart(it, this) },
|
||||
onCtaTestingClicked = { onCtaTestingClicked(it) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onCtaTestingClicked(ctaData: String?) {
|
||||
val ctaData = getJsonObject(ctaData)
|
||||
if (ctaData != null) {
|
||||
DeepLinkManager.getDeepLinkListener()
|
||||
?.navigateTo(
|
||||
activity = this@NaviConfigurationActivity,
|
||||
ctaData = ctaData,
|
||||
finish = ctaData.finish.orFalse(),
|
||||
clearTask = ctaData.clearTask.orFalse()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getJsonObject(value: String?): CtaData? {
|
||||
val gson = Gson()
|
||||
val type = object : TypeToken<CtaData>() {}.type
|
||||
var data: CtaData? = null
|
||||
try {
|
||||
data = gson.fromJson<CtaData>(value, type)
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
private fun onEnterApJourneyClicked(applicationType: String?) {
|
||||
DeepLinkManager.getDeepLinkListener()
|
||||
?.navigateTo(
|
||||
activity = this@NaviConfigurationActivity,
|
||||
ctaData =
|
||||
CtaData(
|
||||
url = "applicationPlatform/launch",
|
||||
parameters =
|
||||
listOf(
|
||||
LineItem(key = "applicantType", value = "CUSTOMER"),
|
||||
LineItem(key = "applicationType", value = applicationType)
|
||||
)
|
||||
),
|
||||
finish = true
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.theme.FF1F002A
|
||||
import com.navi.design.theme.GreyA3A3AB
|
||||
import com.navi.design.theme.WhiteFFFFFF
|
||||
import com.navi.design.theme.composeFontFamily
|
||||
import com.navi.design.theme.getFontWeight
|
||||
|
||||
@Composable
|
||||
internal fun NaviButton(
|
||||
title: String,
|
||||
onButtonClick: () -> Unit,
|
||||
isSelected: Boolean = true,
|
||||
) {
|
||||
Button(
|
||||
contentPadding = PaddingValues(horizontal = 24.dp, vertical = 10.dp),
|
||||
onClick = onButtonClick,
|
||||
shape = RoundedCornerShape(size = 4.dp),
|
||||
enabled = isSelected,
|
||||
colors =
|
||||
ButtonDefaults.buttonColors(
|
||||
backgroundColor = FF1F002A,
|
||||
contentColor = WhiteFFFFFF,
|
||||
disabledBackgroundColor = GreyA3A3AB,
|
||||
disabledContentColor = WhiteFFFFFF,
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
fontSize = 14.sp,
|
||||
color = WhiteFFFFFF,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_MEDIUM),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun NaviButtonPreview() {
|
||||
NaviButton(
|
||||
onButtonClick = {},
|
||||
title = "Button Title",
|
||||
isSelected = true,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.navi.base.utils.EMPTY
|
||||
|
||||
@Composable
|
||||
fun NaviConfigurationScreen(
|
||||
onVersionCodeChange: (versionCode: String) -> Unit,
|
||||
onBackButtonClick: () -> Unit,
|
||||
onEnterApJourneyClicked: (applicationType: String?) -> Unit,
|
||||
onRoutingKeyChange: (routingKey: String) -> Unit,
|
||||
onCtaTestingClicked: (cta: String) -> Unit,
|
||||
) {
|
||||
var versionCode by remember { mutableStateOf(TextFieldValue(EMPTY)) }
|
||||
var ctaData by remember { mutableStateOf(TextFieldValue(EMPTY)) }
|
||||
var applicationType by remember { mutableStateOf(TextFieldValue(EMPTY)) }
|
||||
var routingKey by remember { mutableStateOf(TextFieldValue(EMPTY)) }
|
||||
|
||||
Column {
|
||||
NaviTopNavigationBar(onBackButtonClick = onBackButtonClick)
|
||||
|
||||
Column(modifier = Modifier.verticalScroll(state = rememberScrollState())) {
|
||||
NaviHeaderView(
|
||||
titleText = "Navi Configuration",
|
||||
subtitleText = "Change App Version Code on the fly",
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
|
||||
NaviTextFieldWithTitleAndButton(
|
||||
titleText = "Version Code",
|
||||
placeholderText = "Enter version code here",
|
||||
keyboardType = KeyboardType.Number,
|
||||
inputText = versionCode,
|
||||
onTextValueChanged = { versionCode = it },
|
||||
buttonText = "Update",
|
||||
onButtonClick = { onVersionCodeChange(versionCode.text) },
|
||||
)
|
||||
|
||||
NaviTextFieldWithTitleAndButton(
|
||||
titleText = "CTA Launcher",
|
||||
placeholderText =
|
||||
"""
|
||||
{
|
||||
"url": "gi/fresh_policy_form/form",
|
||||
"type": "REDIRECTION_CTA",
|
||||
"parameters": [
|
||||
{
|
||||
"key": "type",
|
||||
"value": "FRESH_POLICY"
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
.trimIndent(),
|
||||
keyboardType = KeyboardType.Text,
|
||||
inputText = ctaData,
|
||||
onTextValueChanged = { ctaData = it },
|
||||
buttonText = "Launch",
|
||||
onButtonClick = { onCtaTestingClicked(ctaData.text) },
|
||||
)
|
||||
|
||||
NaviTextFieldWithTitleAndButton(
|
||||
titleText = "AP Journey Launcher",
|
||||
placeholderText = "Enter application type",
|
||||
keyboardType = KeyboardType.Uri,
|
||||
inputText = applicationType,
|
||||
onTextValueChanged = { applicationType = it },
|
||||
buttonText = "Enter",
|
||||
onButtonClick = { onEnterApJourneyClicked(applicationType.text) },
|
||||
)
|
||||
|
||||
NaviTextFieldWithTitleAndButton(
|
||||
titleText = "Sandbox Routing Key",
|
||||
placeholderText = "Enter sandbox routing key",
|
||||
keyboardType = KeyboardType.Uri,
|
||||
inputText = routingKey,
|
||||
onTextValueChanged = { routingKey = it },
|
||||
buttonText = "Update",
|
||||
onButtonClick = { onRoutingKeyChange(routingKey.text) },
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showSystemUi = true, showBackground = true)
|
||||
@Composable
|
||||
fun NaviConfigurationScreenPreview() {
|
||||
NaviConfigurationScreen(
|
||||
onVersionCodeChange = {},
|
||||
onBackButtonClick = {},
|
||||
onEnterApJourneyClicked = {},
|
||||
onRoutingKeyChange = {},
|
||||
onCtaTestingClicked = {}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.theme.Black1A1A1A
|
||||
import com.navi.design.theme.Grey6B6B6B
|
||||
import com.navi.design.theme.composeFontFamily
|
||||
import com.navi.design.theme.getFontWeight
|
||||
|
||||
@Composable
|
||||
fun NaviHeaderView(
|
||||
titleText: String,
|
||||
subtitleText: String,
|
||||
) {
|
||||
Column(
|
||||
modifier =
|
||||
Modifier.fillMaxWidth()
|
||||
.padding(
|
||||
start = 16.dp,
|
||||
end = 16.dp,
|
||||
top = 8.dp,
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = titleText,
|
||||
fontSize = 24.sp,
|
||||
color = Black1A1A1A,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_MEDIUM),
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = subtitleText,
|
||||
fontSize = 12.sp,
|
||||
color = Grey6B6B6B,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_MEDIUM),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun NaviHeaderViewPreview() {
|
||||
NaviHeaderView(
|
||||
titleText = "Header Title",
|
||||
subtitleText = "Header Subtitle",
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.theme.FF191919
|
||||
import com.navi.design.theme.FF1F002A
|
||||
import com.navi.design.theme.FFA8A8A8
|
||||
import com.navi.design.theme.GreyE3E5E5
|
||||
import com.navi.design.theme.WhiteFFFFFF
|
||||
import com.navi.design.theme.composeFontFamily
|
||||
import com.navi.design.theme.getFontWeight
|
||||
|
||||
@Composable
|
||||
fun NaviOutlinedTextField(
|
||||
placeholderText: String,
|
||||
inputText: TextFieldValue,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
onTextValueChanged: (TextFieldValue) -> Unit,
|
||||
onDone: () -> Unit,
|
||||
) {
|
||||
OutlinedTextField(
|
||||
modifier =
|
||||
Modifier.fillMaxWidth()
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = GreyE3E5E5,
|
||||
shape = RoundedCornerShape(size = 8.dp),
|
||||
)
|
||||
.wrapContentHeight(),
|
||||
value = inputText,
|
||||
placeholder = {
|
||||
Text(
|
||||
text = placeholderText,
|
||||
fontSize = 14.sp,
|
||||
color = FFA8A8A8,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_REGULAR),
|
||||
)
|
||||
},
|
||||
onValueChange = { onTextValueChanged(it) },
|
||||
colors =
|
||||
TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = Color.Unspecified,
|
||||
unfocusedBorderColor = Color.Unspecified,
|
||||
cursorColor = FF1F002A,
|
||||
backgroundColor = WhiteFFFFFF,
|
||||
),
|
||||
textStyle =
|
||||
TextStyle(
|
||||
fontSize = 14.sp,
|
||||
color = FF191919,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_REGULAR),
|
||||
),
|
||||
keyboardOptions =
|
||||
KeyboardOptions(
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
autoCorrect = false,
|
||||
keyboardType = keyboardType,
|
||||
imeAction = ImeAction.Done,
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { onDone() }),
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun NaviOutlinedTextFieldPreview() {
|
||||
NaviOutlinedTextField(
|
||||
placeholderText = "Enter your input here",
|
||||
inputText = TextFieldValue(EMPTY),
|
||||
onTextValueChanged = {},
|
||||
onDone = {}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.theme.Black1A1A1A
|
||||
import com.navi.design.theme.composeFontFamily
|
||||
import com.navi.design.theme.getFontWeight
|
||||
|
||||
@Composable
|
||||
fun NaviTextFieldWithTitleAndButton(
|
||||
titleText: String,
|
||||
placeholderText: String,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
inputText: TextFieldValue,
|
||||
onTextValueChanged: (TextFieldValue) -> Unit,
|
||||
buttonText: String,
|
||||
onButtonClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier =
|
||||
Modifier.fillMaxWidth()
|
||||
.padding(
|
||||
start = 16.dp,
|
||||
end = 16.dp,
|
||||
top = 24.dp,
|
||||
),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = titleText,
|
||||
fontSize = 16.sp,
|
||||
color = Black1A1A1A,
|
||||
fontFamily = composeFontFamily,
|
||||
fontWeight = getFontWeight(FontWeightEnum.TT_MEDIUM),
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
NaviOutlinedTextField(
|
||||
placeholderText = placeholderText,
|
||||
inputText = inputText,
|
||||
keyboardType = keyboardType,
|
||||
onTextValueChanged = onTextValueChanged,
|
||||
onDone = onButtonClick
|
||||
)
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
NaviButton(
|
||||
title = buttonText,
|
||||
onButtonClick = onButtonClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun NaviTextFieldWithTitleAndButtonPreview() {
|
||||
NaviTextFieldWithTitleAndButton(
|
||||
titleText = "Label",
|
||||
placeholderText = "Enter your input here",
|
||||
keyboardType = KeyboardType.Text,
|
||||
inputText = TextFieldValue(EMPTY),
|
||||
onTextValueChanged = {},
|
||||
buttonText = "Update",
|
||||
onButtonClick = {},
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.naviapp.configuration.composable
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.naviapp.R
|
||||
|
||||
@Composable
|
||||
fun NaviTopNavigationBar(onBackButtonClick: () -> Unit) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(all = 16.dp),
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ic_back_arrow_black),
|
||||
contentDescription = null,
|
||||
modifier =
|
||||
Modifier.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null,
|
||||
) {
|
||||
onBackButtonClick()
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun NaviTopNavigationBarPreview() {
|
||||
NaviTopNavigationBar(onBackButtonClick = {})
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.utils.log
|
||||
import com.naviapp.BuildConfig
|
||||
import com.naviapp.analytics.utils.NaviAnalytics
|
||||
import com.naviapp.manager.RetryableUserDataUploadWorker
|
||||
import com.naviapp.manager.RetryableUserDataUploadWorker.Companion.API_FAILURE_RETRY_REQUIRED
|
||||
@@ -32,6 +31,7 @@ import com.naviapp.utils.Constants
|
||||
import com.naviapp.utils.Constants.TEN_SECONDS
|
||||
import com.naviapp.utils.Constants.WORKER_INTERVAL_TIME_IN_SECONDS
|
||||
import com.naviapp.utils.Constants.WORKER_TYPE
|
||||
import com.naviapp.utils.getVersionCode
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
@@ -144,7 +144,7 @@ class UserDataUploadWorkerUseCase @Inject constructor(@ApplicationContext val co
|
||||
}
|
||||
|
||||
private fun isAllowedAppVersion(dataUploadConfig: DataUploadFirebaseConfig): Boolean {
|
||||
return BuildConfig.VERSION_CODE >= dataUploadConfig.allowedAppVersion.orZero()
|
||||
return getVersionCode().toInt() >= dataUploadConfig.allowedAppVersion.orZero()
|
||||
}
|
||||
|
||||
fun startPeriodicDataUploadWorker(screenName: String) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.naviapp.models.response.OnboardingActionResponse
|
||||
import com.naviapp.models.response.WidgetConfig
|
||||
import com.naviapp.network.ApiConstants
|
||||
import com.naviapp.utils.WidgetConfigDeserializer
|
||||
import com.naviapp.utils.getVersionCode
|
||||
import okhttp3.OkHttpClient
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
@@ -58,7 +59,7 @@ fun getNetworkInfo(timeOutInSeconds: Long = ApiConstants.API_CONNECT_TIMEOUT_VAL
|
||||
return NetworkInfo(
|
||||
baseUrl = BaseBuildConfig.BASE_URL,
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
moduleName = ModuleName.LE,
|
||||
timeoutInSec = timeOutInSeconds
|
||||
)
|
||||
@@ -70,7 +71,7 @@ fun getNetworkInfoSuperApp(
|
||||
return NetworkInfo(
|
||||
baseUrl = BaseBuildConfig.BASE_URL,
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
moduleName = null,
|
||||
timeoutInSec = timeOutInSeconds
|
||||
)
|
||||
@@ -82,7 +83,7 @@ fun getNetworkInfoFeeds(
|
||||
return NetworkInfo(
|
||||
baseUrl = BaseBuildConfig.BASE_URL,
|
||||
appVersionName = BuildConfig.VERSION_NAME,
|
||||
appVersionCode = BuildConfig.VERSION_CODE.toString(),
|
||||
appVersionCode = getVersionCode(),
|
||||
moduleName = ModuleName.FEEDS,
|
||||
timeoutInSec = timeOutInSeconds
|
||||
)
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.navi.naviwidgets.extensions.setTextFieldData
|
||||
import com.navi.naviwidgets.models.response.TextFieldData
|
||||
import com.navi.naviwidgets.widgets.textdisplay.Margin
|
||||
import com.navi.naviwidgets.widgets.textdisplay.Padding
|
||||
import com.naviapp.BuildConfig
|
||||
import com.naviapp.R
|
||||
import com.naviapp.analytics.utils.NaviAnalytics
|
||||
import com.naviapp.app.NaviApplication
|
||||
@@ -463,6 +464,17 @@ fun getTextViewItem(textFieldData: TextFieldData?, context: Context): AppCompatT
|
||||
return textView
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns App version code in case of release apk and
|
||||
* In case of debug apk it returns locally stored version code
|
||||
* */
|
||||
fun getVersionCode(): String {
|
||||
if (BuildConfig.DEBUG) {
|
||||
return BaseUtils.getDebugVersionCode() ?: BuildConfig.VERSION_CODE.toString()
|
||||
}
|
||||
return BuildConfig.VERSION_CODE.toString()
|
||||
}
|
||||
|
||||
fun isAllMandatoryPermissionGranted(activity: Activity): Boolean {
|
||||
return isAllMandatoryPermissionGranted(PermissionsManager(activity))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.navi.common.network.models.GenericErrorResponse
|
||||
import com.navi.common.utils.Constants.URL
|
||||
import com.navi.common.utils.isValidResponse
|
||||
import com.navi.common.viewmodel.BaseVM
|
||||
import com.naviapp.BuildConfig
|
||||
import com.naviapp.analytics.utils.NaviAnalytics
|
||||
import com.naviapp.common.navigator.NaviDeepLinkNavigator.WEB_URL
|
||||
import com.naviapp.manager.usecase.UserDataUploadWorkerUseCase
|
||||
@@ -31,6 +30,7 @@ import com.naviapp.registration.helper.isReadSmsPermissionGranted
|
||||
import com.naviapp.utils.buildUrlWithParameters
|
||||
import com.naviapp.utils.generateRandomString
|
||||
import com.naviapp.utils.generateSHA256Hash
|
||||
import com.naviapp.utils.getVersionCode
|
||||
import com.naviapp.utils.toMutableMap
|
||||
import com.naviapp.webredirection.data.WebRedirectionRepository
|
||||
import com.naviapp.webredirection.presentation.utils.CODE_VERIFIER
|
||||
@@ -109,7 +109,7 @@ constructor(
|
||||
setValueInMap(TOKEN, token)
|
||||
setValueInMap(CODE_VERIFIER, codeVerifier)
|
||||
setValueInMap(OS_VERSION, OS_VERSION_NAME + Build.VERSION.RELEASE)
|
||||
setValueInMap(APP_VERSION_CODE, BuildConfig.VERSION_CODE.toString())
|
||||
setValueInMap(APP_VERSION_CODE, getVersionCode())
|
||||
parameterMap.remove(WEB_BASE_URL)
|
||||
parameterMap.remove(WEB_REDIRECTION_TITLE)
|
||||
parameterMap.remove(WEB_REDIRECTION_SUBTITLE)
|
||||
|
||||
@@ -74,6 +74,8 @@ gson = "2.11.0"
|
||||
hamcrest = "2.2"
|
||||
hilt = "2.48"
|
||||
hms = "2.9.0"
|
||||
hyperion = "0.9.38"
|
||||
hyperionSimpleItem = "0.6.0"
|
||||
jakewharton-timber = "5.0.1"
|
||||
jodaMoney = "1.0.4"
|
||||
jodaTime = "2.12.7"
|
||||
@@ -304,6 +306,19 @@ hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
|
||||
hms-androidSdk = { module = "live.100ms:android-sdk", version.ref = "hms" }
|
||||
hms-videoView = { module = "live.100ms:video-view", version.ref = "hms" }
|
||||
|
||||
hyperion-attr = { module = "com.willowtreeapps.hyperion:hyperion-attr", version.ref = "hyperion" }
|
||||
hyperion-buildConfig = { module = "com.willowtreeapps.hyperion:hyperion-build-config", version.ref = "hyperion" }
|
||||
hyperion-core = { module = "com.willowtreeapps.hyperion:hyperion-core", version.ref = "hyperion" }
|
||||
hyperion-coreNoOp = { module = "com.willowtreeapps.hyperion:hyperion-core-no-op", version.ref = "hyperion" }
|
||||
hyperion-disk = { module = "com.willowtreeapps.hyperion:hyperion-disk", version.ref = "hyperion" }
|
||||
hyperion-geigerCounter = { module = "com.willowtreeapps.hyperion:hyperion-geiger-counter", version.ref = "hyperion" }
|
||||
hyperion-measurement = { module = "com.willowtreeapps.hyperion:hyperion-measurement", version.ref = "hyperion" }
|
||||
hyperion-phoenix = { module = "com.willowtreeapps.hyperion:hyperion-phoenix", version.ref = "hyperion" }
|
||||
hyperion-recorder = { module = "com.willowtreeapps.hyperion:hyperion-recorder", version.ref = "hyperion" }
|
||||
hyperion-sharedPreferences = { module = "com.willowtreeapps.hyperion:hyperion-shared-preferences", version.ref = "hyperion" }
|
||||
hyperion-simpleItem = { module = "com.github.takahirom:Hyperion-Simple-Item", version.ref = "hyperionSimpleItem" }
|
||||
hyperion-timber = { module = "com.willowtreeapps.hyperion:hyperion-timber", version.ref = "hyperion" }
|
||||
|
||||
jakewharton-timber = { module = "com.jakewharton.timber:timber", version.ref = "jakewharton-timber" }
|
||||
|
||||
jayway-jsonPath = { module = "com.jayway.jsonpath:json-path", version.ref = "jsonPath" }
|
||||
|
||||
@@ -22,6 +22,7 @@ object CommonPrefConstants {
|
||||
const val IS_MOCK_LOCATION = "IS_MOCK_LOCATION"
|
||||
const val IS_LOCATION_DATA_POST = "IS_LOCATION_DATA_POST"
|
||||
const val LOCATION_UPDATE_ENABLED = "LOCATION_UPDATE_ENABLED"
|
||||
const val UPDATED_VERSION_CODE = "updatedVersionCode"
|
||||
const val ROUTING_KEY = "routing_key"
|
||||
const val ALFRED_DIALOG_SCREENSHOT = "ALFRED_DIALOG_SCREENSHOT"
|
||||
const val DISABLE = "DISABLE"
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.provider.Settings
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import com.navi.base.sharedpref.CommonPrefConstants
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.ROUTING_KEY
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.UPDATED_VERSION_CODE
|
||||
import com.navi.base.sharedpref.PreferenceManager
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -386,6 +387,24 @@ object BaseUtils {
|
||||
return "file://${context.externalCacheDir?.path}/$fileName"
|
||||
}
|
||||
|
||||
private fun checkDiffAndSaveDataInSharedPreference(
|
||||
sharedPrefKey: String,
|
||||
updatedValue: String?
|
||||
): Boolean {
|
||||
if (updatedValue.isNullOrEmpty()) {
|
||||
return false
|
||||
}
|
||||
val currentValue = PreferenceManager.getStringPreferenceApp(key = sharedPrefKey)
|
||||
if (updatedValue != currentValue) {
|
||||
PreferenceManager.saveStringPreferenceAppOnMainThread(
|
||||
key = sharedPrefKey,
|
||||
value = updatedValue
|
||||
)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun triggerAppRestart(context: Context?) {
|
||||
val packageManager: PackageManager? = context?.packageManager
|
||||
val intent: Intent? = packageManager?.getLaunchIntentForPackage(context.packageName)
|
||||
@@ -439,10 +458,35 @@ object BaseUtils {
|
||||
return result + lastDigit
|
||||
}
|
||||
|
||||
fun saveUpdatedVersionCodeAndRestart(updatedVersionCode: String?, context: Context?) {
|
||||
val updatedVersionCode =
|
||||
checkDiffAndSaveDataInSharedPreference(
|
||||
sharedPrefKey = UPDATED_VERSION_CODE,
|
||||
updatedValue = updatedVersionCode
|
||||
)
|
||||
if (updatedVersionCode) {
|
||||
triggerAppRestart(context = context)
|
||||
}
|
||||
}
|
||||
|
||||
fun saveRoutingKeyAndRestart(updatedRoutingKey: String?, context: Context?) {
|
||||
if (
|
||||
checkDiffAndSaveDataInSharedPreference(
|
||||
sharedPrefKey = ROUTING_KEY,
|
||||
updatedValue = updatedRoutingKey
|
||||
)
|
||||
) {
|
||||
triggerAppRestart(context = context)
|
||||
}
|
||||
}
|
||||
|
||||
fun getRoutingKey(): String? {
|
||||
return PreferenceManager.getStringPreferenceApp(ROUTING_KEY)
|
||||
}
|
||||
|
||||
fun getDebugVersionCode(): String? =
|
||||
PreferenceManager.getStringPreferenceApp(key = UPDATED_VERSION_CODE)
|
||||
|
||||
fun getVersionSDKInt() = Build.VERSION.SDK_INT
|
||||
|
||||
fun isUpiAppAvailable(context: Context?): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user