Skip to content

Conversation

@almirvuk
Copy link
Contributor

@almirvuk almirvuk commented Mar 4, 2021

Implements #381

  • Adds bool IsTextPredictionEnabled { get; } to the IEntry interface
  • Adds IsTextPredictionEnabled property map to EntryHandler
  • Adds IsTextPredictionEnabled mapping methods to EntryHandler for Android and iOS
  • Adds extension methods to apply IsTextPredictionEnabled on Android/iOS
  • Adds DeviceTests for initial IsTextPredictionEnabled values on iOS and Android

@hartez hartez self-requested a review March 4, 2021 23:15
Copy link
Contributor

@hartez hartez 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. Thanks!

@dotnet dotnet deleted a comment from azure-pipelines bot Mar 5, 2021
@rmarinho
Copy link
Member

rmarinho commented Mar 5, 2021

/azp run

@dotnet dotnet deleted a comment from azure-pipelines bot Mar 5, 2021
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Looking good and I just have 2 thoughts.

Not for this PR, but a note for future me and other peoples. We need to create a helper method to test changes. Like init to X, test, set to Y, and confirm it changes. And then do the reverse order.

This is very useful to determine if the "undo" operation works. Like set IsPassword to false, test, true, test and then false again, test.

editText.InputType |= InputTypes.NumberVariationPassword;

if (!entry.IsTextPredictionEnabled && ((editText.InputType & InputTypes.TextFlagNoSuggestions) != InputTypes.TextFlagNoSuggestions))
editText.InputType |= InputTypes.TextFlagNoSuggestions;
Copy link
Member

Choose a reason for hiding this comment

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

I am thinking this is unnecessary setting of the native property. Even though it is fast and, maybe we can use a variable and pipe them all. Then at the end, we set it?

Copy link
Contributor

Choose a reason for hiding this comment

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

This enhancement is addressed in #507.

@mattleibow mattleibow self-requested a review March 5, 2021 01:30
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Marking this red just in case I am right and we can't unset the value.

@almirvuk
Copy link
Contributor Author

almirvuk commented Mar 5, 2021

@mattleibow can you please take a look now? :)

@almirvuk almirvuk requested review from hartez and mattleibow March 5, 2021 06:10
@mattleibow
Copy link
Member

@almirvuk could you add this test just so we don't ever break this feature in the future:

		[Theory(DisplayName = "IsTextPredictionEnabled Updates Correctly")]
		[InlineData(true, true)]
		[InlineData(true, false)]
		[InlineData(false, true)]
		[InlineData(false, false)]
		public async Task IsTextPredictionEnabledUpdatesCorrectly(bool setValue, bool unsetValue)
		{
			var entry = new EntryStub();

			await ValidatePropertyUpdatesValue(
				entry,
				nameof(IEntry.IsTextPredictionEnabled),
				GetNativeIsTextPredictionEnabled,
				setValue,
				unsetValue);
		}

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Looking great! Besides the test that I think we should add, this is good to merge!

Thanks for the PR and the work.

@almirvuk
Copy link
Contributor Author

almirvuk commented Mar 5, 2021

@almirvuk could you add this test just so we don't ever break this feature in the future:

		[Theory(DisplayName = "IsTextPredictionEnabled Updates Correctly")]
		[InlineData(true, true)]
		[InlineData(true, false)]
		[InlineData(false, true)]
		[InlineData(false, false)]
		public async Task IsTextPredictionEnabledUpdatesCorrectly(bool setValue, bool unsetValue)
		{
			var entry = new EntryStub();

			await ValidatePropertyUpdatesValue(
				entry,
				nameof(IEntry.IsTextPredictionEnabled),
				GetNativeIsTextPredictionEnabled,
				setValue,
				unsetValue);
		}

Added with the last commit :) Thank you @mattleibow

@mattleibow
Copy link
Member

Absolutely stunning! This needs to be merged as soon as CI is green.

@mattleibow
Copy link
Member

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@mattleibow mattleibow merged commit b73b615 into dotnet:main Mar 5, 2021
@bkaankose bkaankose mentioned this pull request Mar 15, 2021
12 tasks
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jul 10, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants