In-app notification settings that allow your users to customize which of your notifications they receive. Allows you to build high quality, flexible preference settings very quickly.
Requirement | Reason |
---|---|
Authentication
|
Needed to view preferences that belong to a user. |
The default CourierPreferences
styles.
// Get the view by id
val preferences: CourierPreferences = view.findViewById(R.id.courierPreferences)
// Set the mode and listen to errors
preferences.apply {
mode = CourierPreferences.Mode.Topic
onError = { e ->
print(e)
}
}
The styles you can use to quickly customize the CourierPreferences
.
val preferences: CourierPreferences = view.findViewById(R.id.courierPreferences)
preferences.apply {
val availableChannels = listOf(
CourierPreferenceChannel.PUSH,
CourierPreferenceChannel.SMS,
CourierPreferenceChannel.EMAIL
)
mode = CourierPreferences.Mode.Channels(availableChannels)
onError = { e ->
print(e)
}
}
val font = ResourcesCompat.getFont(requireContext(), R.font.poppins)
val purple500 = ContextCompat.getColor(requireContext(), R.color.courier_purple)
val purple200 = ContextCompat.getColor(requireContext(), R.color.purple_200)
val grey500 = ContextCompat.getColor(requireContext(), android.R.color.darker_gray)
val theme = CourierPreferencesTheme(
brandId = "7S9RBWHHS9MBYRPSRYAFYF9K3Q1M", // Optional
loadingIndicatorColor = purple500,
sectionTitleFont = CourierStyles.Font(
typeface = font,
color = purple500,
sizeInSp = 22,
),
topicDividerItemDecoration = DividerItemDecoration(context, DividerItemDecoration.VERTICAL),
topicTitleFont = CourierStyles.Font(
typeface = font,
),
topicSubtitleFont = CourierStyles.Font(
typeface = font,
color = grey500,
),
sheetTitleFont = CourierStyles.Font(
typeface = font,
color = purple500,
sizeInSp = 22,
),
sheetDividerItemDecoration = DividerItemDecoration(context, DividerItemDecoration.VERTICAL),
sheetSettingStyles = CourierStyles.Preferences.SettingStyles(
font = CourierStyles.Font(
typeface = font,
),
toggleThumbColor = purple500,
toggleTrackColor = purple200,
)
)
preferences.lightTheme = theme
preferences.darkTheme = theme
You can control your branding from the Courier Studio
.
Supported Brand Styles | Support |
---|---|
Primary Color |
✅ |
Show/Hide Courier Footer |
✅ |
👋 Branding APIs
can be found here
👋 Preference APIs
can be found here