Redacting views via your source code ensures your redaction configuration are tied directly to the application structure.
Redact views within Activity via CobrowseIO.Redacted
Implement the CobrowseIO.Redacted interface on any Activity that contains sensitive views. This interface contains one method:
// From this method you should return a list of the views you want// Cobrowse to redact, for example:publicList<View>redactedViews(){List<View>redacted=newArrayList<>();redacted.add(findViewById(R.id.redact_me));return redacted;}
Redact views within custom delegate via CobrowseIO.RedactionDelegate
If making changes to your Activity classes isn't an option, we also support a delegate style method to allow you to supply this information in one place. Implement CobrowseIO.RedactionDelegate interface in your CobrowseIO.Delegate class, then you can pass redacted views for a specific Activity in a single method:
@OverridepublicList<View>redactedViews(@NonNullActivity activity){List<View>redacted=newArrayList<>(); // Return a list of redacted views for a provided activityreturn redacted;}
Redact Jetpack Compose UI
Redaction for Jetpack Compose UI is shipped in a separate library on Maven Central:
You are required to use the same version of the Cobrowse.io SDK and Compose UI redaction artifacts. Using different versions of Cobrowse.io SDK artifacts is not supported.
Apply Modifier.redacted() to your composable to be redacted, like so:
Redact WebView content
Your app may show web content that contains elements that you wish to redact. This can be achieved by setting the webviewRedactedViews property to an array of CSS selectors that identify the elements to be redacted.
2. Selector based redaction
You can use CSS-like selectors to identify which views should be redacted. These selectors can be defined within your application using our SDK or via the Cobrowse dashboard.
Via SDK
You can use the simple name of any view class, the id of the view.
The #id must be able to be used with system android.view.View#findViewById() and android.app.Activity#findViewById() methods.
You will need to use the cobrowseSelector(tag, id, attributes) modifier filling our the values manually.
This view can now be referenced using the selector of:
Sometimes you may want to redact everything on the screen, then selectively "unredact" only the parts your support agents should be able to see. This is particularly useful on applications that require a higher privacy standard or where only specific sections of the App should be visible to the agent.
To achieve this, you'll need to follow the delegate implementation and ensure you pass the all your applications root views to the Cobrowse redaction delegate method:
Once you've done this, your application root views will be redacted by default and you'll be able to un-redact child components to make them visible to the agents by implementing CobrowseIO.UnredactionDelegate in your CobrowseIO.Delegate class:
Alternatively, you can implement CobrowseIO.Unredacted interface in your Activity subclasses:
Redaction Playground
To explore and modify redaction in your apps you can use the Redaction Playground.
@Override
public List<View> redactedViews(@NonNull Activity activity) {
return new ArrayList<View>() {{
add(activity.getWindow().getDecorView());
}};
}
@Override
public List<View> unredactedViews(@NonNull Activity activity) {
return new ArrayList<View>(){{
if (findViewById(R.id.view_to_be_unredacted) != null)
add(findViewById(R.id.view_to_be_unredacted));
}};
}
@Override
public List<View> unredactedViews() {
return new ArrayList<View>(){{
if (findViewById(R.id.view_to_be_unredacted) != null)
add(findViewById(R.id.view_to_be_unredacted));
}};
}