-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix deployment issues with mainnet test users #111
Changes from all commits
e7ac841
2d1e6e2
94e7c24
a0289ce
9e7a3b2
3c1ccb3
f99207d
03c3429
4f438d7
58f6cc9
d580dbe
4fa08dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ import android.content.Context | |
import android.util.Log | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalInspectionMode | ||
import exchange.dydx.utilities.utils.DebugEnabled | ||
import exchange.dydx.utilities.utils.Logging | ||
import exchange.dydx.utilities.utils.SharedPreferencesStore | ||
|
||
interface AppConfig { | ||
val appContext: Context? | ||
|
@@ -17,7 +20,6 @@ interface AppConfig { | |
val appSchemeHost: String? | ||
get() = appContext?.getString(R.string.app_scheme_host) | ||
val appWebHost: String? | ||
get() = appContext?.getString(R.string.app_web_host) | ||
|
||
companion object { | ||
const val ANDROID_LOGGING = Log.INFO | ||
|
@@ -31,6 +33,7 @@ interface AppConfig { | |
appVersionCode = "0", | ||
debug = BuildConfig.DEBUG, | ||
activityClass = null, | ||
preferencesStore = null, | ||
) | ||
} | ||
} | ||
|
@@ -41,7 +44,27 @@ data class AppConfigImpl( | |
override val appVersionCode: String, | ||
override val debug: Boolean, | ||
override val activityClass: Class<*>?, | ||
) : AppConfig | ||
private val preferencesStore: SharedPreferencesStore?, | ||
private val logger: Logging? = null, | ||
) : AppConfig { | ||
override val appWebHost: String? | ||
get() { | ||
if (appContext == null || preferencesStore == null) { | ||
logger?.e("AppConfigImpl", "appContext or preferencesStore is null") | ||
return null | ||
} | ||
Comment on lines
+52
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a huge code smell, we should address later. appContext by definition is never null, same with preferencesStore (since we are always providing it in the graph) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AppConfig needs mocks. No big deal.. can refactor when we run out of stuff to do. |
||
|
||
val appDeployment = appContext.getString(R.string.app_deployment) | ||
return if (appDeployment == "MAINNET" && DebugEnabled.enabled(preferencesStore)) { | ||
// Force to public testnet host if user has enabled debug mode, otherwise US test | ||
// users will be blocked from accessing the asset images/descriptions, which are fetched | ||
// based on app_web_host. | ||
"v4.testnet.dydx.exchange" | ||
} else { | ||
appContext.getString(R.string.app_web_host) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun PreviewAppConfig(): AppConfig { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were we running into issues here locally or on bitrise? ideally this should be configured differently for local vs ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI