File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 <application
1919 android : allowBackup =" true"
2020 android : dataExtractionRules =" @xml/data_extraction_rules"
21+ android : networkSecurityConfig =" @xml/network_security_config"
2122 android : fullBackupContent =" @xml/backup_rules"
2223 android : icon =" @mipmap/ic_launcher"
2324 android : label =" @string/app_name"
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ class LoginActivity : AppCompatActivity() {
127127 return
128128 }
129129
130- if (! URLUtil .isHttpsUrl(serverUrl.text.toString().trim())) {
130+ if (Settings .isProductionEnvironment( this ) && ! URLUtil .isHttpsUrl(serverUrl.text.toString().trim())) {
131131 Timber .e(" url number [${serverUrl.text.toString()} ] is not an https URL" )
132132 resetView()
133133 serverUrlLayout.error = " Server URL [${serverUrl.text.toString()} ] must be HTTPS"
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ object Settings {
1515 private const val SETTINGS_FCM_TOKEN = " SETTINGS_FCM_TOKEN"
1616 private const val SETTINGS_FCM_TOKEN_UPDATE_TIMESTAMP = " SETTINGS_FCM_TOKEN_UPDATE_TIMESTAMP"
1717 private const val SETTINGS_HEARTBEAT_TIMESTAMP = " SETTINGS_HEARTBEAT_TIMESTAMP"
18+ private const val SETTINGS_PRODUCTION_ENV = " SETTINGS_PRODUCTION_ENV" ;
1819
1920 fun getOwner (context : Context ): String? {
2021 Timber .d(Settings ::getOwner.name)
@@ -82,6 +83,17 @@ object Settings {
8283 return activeStatus
8384 }
8485
86+ fun isProductionEnvironment (context : Context ): Boolean {
87+ Timber .d(Settings ::isProductionEnvironment.name)
88+
89+ val isProductionEnv = PreferenceManager
90+ .getDefaultSharedPreferences(context)
91+ .getBoolean(this .SETTINGS_PRODUCTION_ENV , true )
92+
93+ Timber .d(" SETTINGS_PRODUCTION_ENV: [$isProductionEnv ]" )
94+ return isProductionEnv
95+ }
96+
8597 fun setActiveStatusAsync (context : Context , status : Boolean ) {
8698 Timber .d(Settings ::setActiveStatusAsync.name)
8799
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <network-security-config >
3+ <!-- domain-config cleartextTrafficPermitted="true">
4+ <domain includeSubdomains="true">127.0.0.1</domain>
5+ </domain-config-->
6+ </network-security-config >
You can’t perform that action at this time.
0 commit comments