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

Add stringHelper to NimbusMessageHelper. #4831

Merged
merged 10 commits into from
Feb 11, 2022

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Feb 9, 2022

Fixes EXP-2159.

This PR adds a string interpolation method to the MessageHelper.

This might better be done in Kotlin and Swift, but there is some fiddly logic which needs to be the same in both places, so we did it in Rust.

The fiddly logic was:

  • access to nimbus app context.
  • need to generate a UUID based on the content of the string template.

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGES_UNRELEASED.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2022

Codecov Report

Merging #4831 (f96203a) into main (70a8840) will decrease coverage by 0.23%.
The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4831      +/-   ##
==========================================
- Coverage   81.51%   81.28%   -0.24%     
==========================================
  Files          57       58       +1     
  Lines        5665     5743      +78     
==========================================
+ Hits         4618     4668      +50     
- Misses       1047     1075      +28     
Impacted Files Coverage Δ
components/nimbus/src/lib.rs 64.80% <0.00%> (-5.65%) ⬇️
components/nimbus/tests/test_message_helpers.rs 100.00% <ø> (ø)
components/nimbus/src/evaluator.rs 87.25% <100.00%> (+3.61%) ⬆️
components/nimbus/src/strings.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70a8840...f96203a. Read the comment docs.

@jhugman jhugman requested review from tarikeshaq and travis79 and removed request for tarikeshaq February 9, 2022 12:03
@jhugman jhugman assigned tarikeshaq and unassigned tarikeshaq Feb 9, 2022
@jhugman jhugman requested a review from tarikeshaq February 9, 2022 13:12
Copy link
Contributor

@tarikeshaq tarikeshaq left a comment

Choose a reason for hiding this comment

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

Looks good for the most part 🕺 🚀 - I have a slight concern about supporting unicode, but haven't looked too hard into it

components/nimbus/src/strings.rs Show resolved Hide resolved
components/nimbus/src/strings.rs Outdated Show resolved Hide resolved
components/nimbus/src/strings.rs Show resolved Hide resolved
components/nimbus/src/strings.rs Show resolved Hide resolved
components/nimbus/src/lib.rs Show resolved Hide resolved
Copy link
Contributor Author

@jhugman jhugman left a comment

Choose a reason for hiding this comment

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

Address review comments/questions.

) -> Result<Arc<NimbusStringHelper>> {
let context = self.merge_additional_context(additional_context)?;
let helper = NimbusStringHelper::new(context.as_object().unwrap().to_owned());
Ok(Arc::new(helper))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deliberately trying to keep string helper and targeting helper separate, because I don't know how the Glean targeting helper is going to play out.

components/nimbus/src/lib.rs Show resolved Hide resolved
components/nimbus/src/strings.rs Outdated Show resolved Hide resolved
components/nimbus/src/strings.rs Show resolved Hide resolved
components/nimbus/src/strings.rs Show resolved Hide resolved
@jhugman jhugman force-pushed the jhugman/exp-2159-add-string-template-to-message-helper branch from 15b527f to f96203a Compare February 11, 2022 13:38
@jhugman jhugman requested a review from tarikeshaq February 11, 2022 14:49
Copy link
Contributor

@tarikeshaq tarikeshaq left a comment

Choose a reason for hiding this comment

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

🚢 🚢 :shipit:

@jhugman jhugman merged commit 152e219 into main Feb 11, 2022
@jhugman jhugman deleted the jhugman/exp-2159-add-string-template-to-message-helper branch February 11, 2022 18:43
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