Skip to content

task(SDK-1556) - Minor improvements around dot sep #815

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

Conversation

Anush-Shand
Copy link
Contributor

@Anush-Shand Anush-Shand commented May 28, 2025

Summary by CodeRabbit

  • New Features
    • Added support for an alternate message summary in timer notifications.
  • Improvements
    • Updated notification color defaults to use a centralized constant for consistency.
  • Refactor
    • Simplified resource handling for notification dot separator graphics.
  • Cleanup
    • Removed unused properties to streamline code.

Copy link
Contributor

coderabbitai bot commented May 28, 2025

Walkthrough

A new constant for alternate message summary was added to the constants file. The template renderer was updated to support this alternate summary value during timer notification rendering. Resource handling in the content view was streamlined, and the default color in notification styles now references a constant instead of a hardcoded value.

Changes

File(s) Change Summary
.../pushtemplates/PTConstants.java Added new constant string PT_MSG_SUMMARY_ALT.
.../pushtemplates/TemplateRenderer.kt Added private property for alternate summary; updated timer rendering logic to use alternate summary if present; removed unused bitmap property.
.../pushtemplates/content/ContentView.kt Replaced dynamic drawable lookup with direct reference; removed unused bitmap assignment; updated exception handling.
.../pushtemplates/styles/Style.kt Imported PTConstants; changed default icon color from hardcoded value to constant.

Suggested labels

ptv2.0.0

Suggested reviewers

  • CTLalit
  • piyush-kukadiya
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Anush-Shand
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/ContentView.kt (1)

50-52: Simplified dot separator handling, but verify the utility method behavior.

The changes streamline the dot separator implementation by using a direct drawable reference. However, there are a few concerns:

  1. The result of Utils.setBitMapColour is no longer assigned to renderer.pt_dot - verify this is intentional
  2. Catching only NullPointerException instead of a broader Exception might miss other potential errors during bitmap processing

Consider this approach if the utility method behavior has changed:

 private fun setDotSep() {
     try {
         renderer.pt_dot = R.drawable.pt_dot_sep
-        Utils.setBitMapColour(context, renderer.pt_dot, renderer.pt_meta_clr, PTConstants.PT_META_CLR_DEFAULTS)
-    } catch (_: NullPointerException) {
+        Utils.setBitMapColour(context, renderer.pt_dot, renderer.pt_meta_clr, PTConstants.PT_META_CLR_DEFAULTS)
+    } catch (e: Exception) {
-        PTLog.debug("NPE while setting dot sep color")
+        PTLog.debug("Error while setting dot sep color: ${e.message}")
     }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07dd385 and 613f688.

📒 Files selected for processing (4)
  • clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PTConstants.java (1 hunks)
  • clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt (3 hunks)
  • clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/content/ContentView.kt (1 hunks)
  • clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt (2 hunks)
🔇 Additional comments (6)
clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/PTConstants.java (1)

121-121: LGTM! Well-structured constant addition.

The new PT_MSG_SUMMARY_ALT constant follows the established naming convention and is appropriately positioned with other alternate message constants. This supports the enhanced timer notification functionality.

clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/styles/Style.kt (2)

11-11: Good practice using centralized constants.

Adding the PTConstants import supports the use of centralized constants instead of hardcoded values.


43-43:

❓ Verification inconclusive

Verify the impact of changing default icon color from white to grey.

This change modifies the default small icon color from white (#FFFFFF) to grey (#A6A6A6). This could significantly impact notification visibility, especially on dark backgrounds where white icons are more prominent than grey ones.

Please verify that this color change aligns with design requirements and doesn't negatively affect user experience.


🏁 Script executed:

#!/bin/bash
# Description: Search for references to the old hardcoded color to ensure consistency
# Expected: No remaining hardcoded "#FFFFFF" references for notification icons

rg -i "#FFFFFF" --type kotlin --type java -A 2 -B 2

Length of output: 54070


Verify consistency of white→grey default icon color change across all styles

The default small icon color in push templates was updated from white (#FFFFFF) to grey (#A6A6A6). A search for remaining #FFFFFF usages revealed numerous references in sample apps, core style defaults, and tests. Please confirm whether this change should be propagated (or exceptions kept) and update any dependent code or documentation accordingly:

• sample/src/main/java/com/clevertap/demo/ui/main/HomeScreenViewModel.kt
unselectedTabColor = "#FFFFFF"
navBarColor = "#FFFFFF"

• clevertap-core/src/main/java/com/clevertap/android/sdk/Constants.java
String WHITE = "#FFFFFF";

• clevertap-core/src/main/java/com/clevertap/android/sdk/CTInboxStyleConfig.java
this.navBarColor = "#FFFFFF";
this.tabBackgroundColor = "#FFFFFF";

• Test fixtures and unit tests
clevertap-core/src/test/java/.../InAppFixtures.kt (HTML/CSS backgrounds using #ffffff)
CTInboxListViewFragmentTest.kt (JSON bg":"#ffffff")
CTLocalInAppTest.kt (radius, bg or text colors set to #FFFFFF)
CTnAppNotificationTest.kt (assertEquals("#FFFFFF", notification.backgroundColor))

Next steps:

  1. Confirm with design whether push‐template icons should now default to grey only, or if white remains expected elsewhere.
  2. Update sample code, style constants, fixtures, and tests to reflect the intended default.
  3. Verify notification visibility and contrast in all affected modules and sample apps.
clevertap-pushtemplates/src/main/java/com/clevertap/android/pushtemplates/TemplateRenderer.kt (3)

70-70: Good addition following established patterns.

The new pt_msg_summary_alt property declaration is consistent with other alternate value properties like pt_title_alt and pt_msg_alt.


421-421: Proper initialization using the new constant.

The initialization correctly uses the PT_MSG_SUMMARY_ALT constant and follows the same pattern as other alternate properties.


285-290: Well-implemented timer notification enhancement.

The implementation correctly handles the alternate message summary during timer notification rendering. The null and empty checks are appropriate, and the conditional logic for JSON vs Bundle updates matches the existing pattern for other alternate values.

@Anush-Shand Anush-Shand merged commit 35ced64 into task/SDK-1556/replace_multi_layouts_with_dimens Jun 5, 2025
4 checks passed
@Anush-Shand Anush-Shand deleted the task/SDK-1556/minor_improvements branch June 5, 2025 05:36
Anush-Shand added a commit that referenced this pull request Jun 5, 2025
* task(SDK-1556) - Deletes all v19 layouts since minSDKVersion is 21

* task(SDK-1556) - Deletes files in v22 and v23 that are same as v21

* task(SDK-1556) - Deletes files in v22 that are same as v21

* task(SDK-1556) - Deletes files in v31 that are same as default folder

* task(SDK-1556) - Fixes manual_carousel in default folder and deletes redundant file in v31

* task(SDK-4057) - Makes v21 layouts as the default layouts
Also removes redundant attributes like marginLeft which were needed for v17

* task(SDK-4057) - Replaces redundant layout files with different dimensions

* task(SDK-4057) - Replaces for five cta, redundant layout files with different dimensions

* task(SDK-4057) - Introduces pt_render_terminal to render the final notification

- Some refactoring
- Introduces key

* task(SDK-4536) - Fixes negative value for timer template

- Changes support for timer template to Android O and above
- Updates docs

* task(SDK-4465) - Adds prefix pt_ to res files of push-templates to avoid conflicts

- Also removes redundant attributes

* task(SDK-4465)

- Changes marginLeft to marginStart
- Changes marginRight to marginEnd

* Task/sdk 4595/replicate standard and basic (#788)

* task(SDK-4595) - Replicate Standard Android Notification with Basic Push Template

- Changes in dimens
- Removes redundant styles.xml for sw-400

* task(SDK-4595) - Fixes color

* task(SDK-1556) - Makes timer margin and padding same as other templates

* fix(SDK-1556) - fixes zero bezel on API 31 and above

* Task/sdk 4048/ctas pt (#786)

* POC for FG service based timer notif

* task(SDK-4048) - Adds CTAs in the remote view for push templates below API level 31

* task(SDK-4048) - Reverts rating view changes

* Rename .java to .kt

* task(SDK-4048) - Adds action buttons to remote view

- For API 31 and above StyleWithActionButtons is responsible
- For API 30 and below ActionButtonsContentView is responsible

* task(SDK-4048) - Resolves comments

- Makes classes internal
- Removes redundant colour attribute
- Adds pt_ prefix

* task(SDK-4048) - Resolves comments

- Removes return@forEach

* task(SDK-4048) - Resolves comments

- Adds extension function to increase readability

* task(SDK-4048) - Resolves comments

- Removes public access modifier

* task(SDK-4048) - Testing

- Adds UTs for TemplateRenderer

* task(SDK-4537) - Removes extra space from manual_carousel.xml (#794)

- Removes padding from shape and adds margin

* task(SDK-4048) - Removes dependency from core-sdk

* task(SDK-4040) - Adds CTA for manual carousel

* task(SDK-4040) - Adds CTA for auto carousel

* task(SDK-4048) - Compresses forward and backward arrows for manual carousel

* task(SDK-4048) - Separates PendingIntent from ActionButton.kt

* task(SDK-4048) - Uses composition instead of inheritance for action buttons

* task(SDK-4048) - Fixes image in rating template

* task(SDK-4048) - Fixes string resource name

* task(SDK-4048) - Fixes rating template padding

* task(SDK-4048) - Minor PR comments

* task(SDK-4655) - Dark mode for push templates (#795)

* task(SDK-4655) - Dark mode for push templates

- Adds dark mode support for push templates
- Removes bg as mandatory key
- Parses colour based on dark mode of phone

* task(SDK-4655) - Addresses few todos

* task(SDK-4655) - Makes product display action colour optional

* task(SDK-4655) - Addresses todos

* task(SDK-4655) -Fixes typo and deletes redundant files

* task(SDK-4655) - Color for CTA in clicked state

* task(SDK-4655) - Fixes default colour for title

* task(SDK-4655) - Fixes default colour for small icon

* task(SDK-4655) - Adds color for rating confirm button for light and dark mode

* task(SDK-4655) - Fixes default colour for product template buttons

* task(SDK-4655) - Extracts dimens

* task(SDK-4655) - Improves code reuse by refactoring setting of colours

* task(SDK-4655) - Improves code reuse by refactoring dark mode colors

* task(SDK-4834) - Makes image in notification configurable for scaletype (#808)

* task(SDK-4834) - Makes image in notification configurable for scaletype

* task(SDK-4834) - Improves code reuse by refactoring dark mode colors

* task(SDK-4834) - Minor PR comments

* task(SDK-1556) - Fixes tests

* Tests/sdk 1556/pt unit tests (#811)

* task(SDK-1556) - Adds test for getFlipInterval

* task(SDK-1556) - Adds test for getColour

* task(SDK-1556) - Adds test for createColourMap

* task(SDK-1556) - Adds test for getFallback, getTimerEnd, getApplicationName, getTimeStamp, loadImageRidIntoRemoteView

* task(SDK-1556) - Adds test for getImageListFromExtras, getCTAListFromExtras, getDeepLinkListFromExtras, getBigTextFromExtras, getSmallTextFromExtras, getPriceFromExtras

* task(SDK-1556) - Adds test for convertRatingBundleObjectToHashMap, getEventNameFromExtras

* task(SDK-1556) - Adds test for getEventPropertiesFromExtras

* task(SDK-1556) - Adds test

* task(SDK-1556) - Adds test for raiseNotificationClicked, getActionKeys

* task(SDK-1556) - Adds test for raiseNotificationClicked

* task(SDK-1556) - Adds test for deleteImageFromStorage

* task(SDK-1556) - Adds test for isNotificationChannelEnabled

* task(SDK-1556) - Adds test

* task(SDK-1556) - Adds test for getTimerThreshold

* task(SDK-1556) - Adds test for fromJson

* task(SDK-1556) - Adds test for loadImageUrLIntoRemoteView

* tests(SDK-1556) - Improves timer template test

* tests(SDK-1556) - Improves timer template test

* task(SDK-1556) - Improves tests and Utils function

* task(SDK-1556) - Moves mockkStatic inside a code-block

* task(SDK-1556) - Minor improvements around dot sep (#815)

* task(SDK-1556) - Minor improvements around dot sep

* task(SDK-1556) - Minor colour improvement

* task(SDK-1556) - Minor improvements around message summary for timer template

* task(SDK-1556) - Coderabbit pr comments

* task(SDK-1556) - Fixes flaky test

* docs(SDK-1556) - CHANGELOG and version upgrade for PT (#814)

* docs(SDK-1556) - CHANGELOG and version upgrade for PT

* task(SDK-1556) - Improves docs and updates dates

* task(SDK-1556) - copyTemplates

* docs(SDK-1556) - Improves changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants