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

feature: DefaultViewLocator now public for users to override ViewModelToViewFunc #2275

Merged
merged 8 commits into from Dec 15, 2019

Conversation

@fdoyon
Copy link
Contributor

fdoyon commented Dec 8, 2019

What kind of change does this PR introduce?
This is a feature update that allows users to override DefaultViewLocator.ViewModelToViewFunc if they are using custom naming conventions.

What is the current behavior?
Currently the users have to copy/paste the source of DefaultViewLocator and then change their ViewModelToViewFunc implementation. This is dangerous because if the logic of DefaultViewLocator changes, the copy-pasted code won't be able to carry the feature.

What is the new behavior?
Allow users to get a reference to the locator thusly:

var viewLocator = Locator.Current.GetService<IViewLocator>() as DefaultViewLocator;
viewLocator.ViewModelToViewFunc = x => x.Replace("ViewModel", "MyViewModel");

What might this PR break?
nothing

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:
Discussed with @anaisbetts on slack.

@dnfclas

This comment has been minimized.

Copy link

dnfclas commented Dec 8, 2019

CLA assistant check
All CLA requirements met.

@fdoyon fdoyon marked this pull request as ready for review Dec 8, 2019
@fdoyon fdoyon requested a review from reactiveui/core-team as a code owner Dec 8, 2019
@fdoyon

This comment has been minimized.

@RLittlesII

This comment has been minimized.

Copy link
Contributor

RLittlesII commented Dec 8, 2019

This isn't an unrelated test. These tests verify changes to the public API of the code. You changing from internal to public changes the API surface so the test failed. The api approval change should be uploaded to the artifacts of the build so you can see the difference between the old API surface and the new API surface. You should also be able to this to reproduce this locally running .\build.ps1 --t=Test

@RLittlesII RLittlesII changed the title DefaultViewLocator now public for users to override ViewModelToViewFunc feature: DefaultViewLocator now public for users to override ViewModelToViewFunc Dec 8, 2019
@glennawatson

This comment has been minimized.

Copy link
Contributor

glennawatson commented Dec 9, 2019

Install a diff program like beyondcompare and it should be easy to modify with the API changes.

fdoyon added 2 commits Dec 9, 2019
@glennawatson

This comment has been minimized.

Copy link
Contributor

glennawatson commented Dec 9, 2019

You can copy .received.txt to .approved.txt -- that might get around your current issues.

@fdoyon

This comment has been minimized.

Copy link
Contributor Author

fdoyon commented Dec 10, 2019

Thanks - now the winforms tests are crashing - I don't have a windows machine to test on I am afraid.

@glennawatson

This comment has been minimized.

Copy link
Contributor

glennawatson commented Dec 10, 2019

We'll do the rest for you. Thanks for getting it this far.

@codecov

This comment has been minimized.

Copy link

codecov bot commented Dec 13, 2019

Codecov Report

Merging #2275 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2275   +/-   ##
=======================================
  Coverage   55.32%   55.32%           
=======================================
  Files         113      113           
  Lines        4334     4334           
  Branches      660      660           
=======================================
  Hits         2398     2398           
  Misses       1771     1771           
  Partials      165      165
Impacted Files Coverage Δ
src/ReactiveUI/View/DefaultViewLocator.cs 96.61% <100%> (ø) ⬆️

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 0dd8f2c...46884e3. Read the comment docs.

RLittlesII added 2 commits Dec 13, 2019
@RLittlesII

This comment has been minimized.

Copy link
Contributor

RLittlesII commented Dec 14, 2019

/azp run

@azure-pipelines

This comment has been minimized.

Copy link

azure-pipelines bot commented Dec 14, 2019

Azure Pipelines successfully started running 1 pipeline(s).
@glennawatson glennawatson merged commit 858ef01 into reactiveui:master Dec 15, 2019
1 check passed
1 check passed
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.