Commit e4b825b4 authored by Marc-Antoine Courteau's avatar Marc-Antoine Courteau Committed by Commit Bot

[Payment Request] State field: allow selecting 1st state.

If the state field is unpopulated, inserts a blank element at the
beginning of the list of states, as the first element is selected by
default when the UIPickerView is shown.

R=mahmadi

Bug: 767972
Change-Id: Iaa0c4bc29b863d8c521f3e9f0b826eb7ccef408d
Reviewed-on: https://chromium-review.googlesource.com/689857Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Marc-Antoine Courteau <macourteau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505070}
parent 801c6e56
......@@ -175,7 +175,15 @@
// Notify the view controller asynchronously to allow for the view to update.
__weak AddressEditMediator* weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf.consumer setOptions:@[ [regions allKeys] ]
NSMutableArray<NSString*>* values =
[[NSMutableArray alloc] initWithArray:[regions allKeys]];
// If the field contains no value, insert an empty value at the beginning
// of the list of options, as the first option is selected when the UI
// opens. Otherwise, it would be impossible for the user to select the first
// option without selecting another option first.
if (!weakSelf.regionField.value)
[values insertObject:@"" atIndex:0];
[weakSelf.consumer setOptions:@[ values ]
forEditorField:weakSelf.regionField];
});
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment