Skip to content
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

Red Border Displayed on Login Screen for Multi-Deployment Brands #385

Open
binokaryg opened this issue Jan 24, 2025 · 0 comments · May be fixed by #386
Open

Red Border Displayed on Login Screen for Multi-Deployment Brands #385

binokaryg opened this issue Jan 24, 2025 · 0 comments · May be fixed by #386
Labels
Type: Bug Fix something that isn't working as intended

Comments

@binokaryg
Copy link
Member

binokaryg commented Jan 24, 2025

Describe the Bug

When using this feature to list multiple deployments to choose from, an issue occurs with deployments accessed via *.app.medicmobile.org. Upon selecting such a deployment, the app displays a red border on the login screen.

To Reproduce

Steps to reproduce the behavior:

  1. Add a valid deployment with a URL in the format *.app.medicmobile.org to the instances list.
  2. Build, open the app and select the deployment.
  3. Wait for the login screen to load.
  4. Observe the red border displayed around the login screen.

Expected Behavior

The app should not display a red border on the login screen.
There should at least be a way to suppress this behavior for a selected brand.
There is IS_TRAINING_APP flag, which produces orange borders.

buildConfigField "boolean", "IS_TRAINING_APP", 'true'

Could we add a flag that suppresses any border? IS_PRODUCTION_APP ?

Screenshots

Red Border Issue Screenshot

Environment

  • Instance: *.app.medicmobile.org
  • Android Version: Any
  • App Version: 1.5.0

Additional context
The issue is caused by the red border logic in EmbeddedBrowserActivity.java:

Code reference:

if (settings.allowsConfiguration() && appUrl != null && appUrl.contains("app.medicmobile.org")) {
View webviewContainer = findViewById(R.id.lytWebView);
webviewContainer.setPadding(10, 10, 10, 10);
webviewContainer.setBackgroundResource(R.drawable.warning_background);
}

For multi-deployment brands, settings.allowsConfiguration() always returns true because they lack the appHost setting.

String appHost = ctx.getResources().getString(R.string.app_host);
String scheme = ctx.getResources().getString(R.string.scheme);
if(appHost.length() > 0) {
return new BrandedSettingsStore(prefs, scheme + "://" + appHost);
}
Boolean allowCustomHosts = ctx.getResources().getBoolean(R.bool.allowCustomHosts);
return new UnbrandedSettingsStore(prefs, allowCustomHosts);

Single Deployment Brands: The app_host property is defined:

<resources>
<string name="app_name">muso</string>
<string name="app_host">cht.mali.prod.musohealth.app</string>
</resources>

Multi-Deployment Brands: The app_host property is missing, causing the app to treat them as unbranded:

<resources>
<string name="app_name">eCHIS Kenya</string>
<bool name="allowCustomHosts">False</bool>
</resources>

Previously, we used to have either:

  • unbranded app with multiple instance URLs, or
  • branded app with a single URL

That is not the case now with #309. Now we can have a branded app with multiple instances.

Possible Solutions

  • Modify allowsConfiguration() in SettingsStore to account for multi-deployment brands that lack appHost.

  • Introduce a dedicated setting for multi-deployment brands to ensure they are correctly branded.

  • Adjust the logic in EmbeddedBrowserActivity` to check branding status more reliably.

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant