if (canImportSomething) {
[self initializeDataSource];
[self.importStageTransitionHandler transitionToNextImportStage];
} else if (anyTypeBlockedByPolicy) {
[self.importStageTransitionHandler
resetToInitialImportStage:DataImportResetReasonAllDataBlockedByPolicy];
} else {
[self.importStageTransitionHandler
resetToInitialImportStage:DataImportResetReasonNoImportableData];
}@tmar...@chromium.org let me know if I should add comments or is it self-explanatory.
alert.title = @"Import Not Allowed";
alert.message =
@"Importing this data is not allowed by your organization's policy.";
shouldRecordFailure = YES;@tmar...@chromium.org @ginny...@chromium.org strings will be localized once finalized.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Logic lgtm, but please take care of the readability nits if you aren't in a hurry of submission :)
BOOL canImportSomething = NO;Readability nit: `shouldInitiateImport`. Having "something" in a variable name makes it feel like pseudocode 😂
canImportSomething = YES;Nit: add a `break` after this line. It seems that we only care about `blockedByPolicy` when this is false...
- (UIAlertController*)errorAlert {I encourage you to remove the `errorAlert` property and turn this into a helper method that takes a `title` and a `message` instead 😊
The reason why it was originally a variable was because I thought I needed to call `weakSelf.errorAlert` in the dismiss handler. Turns out that it's not needed, which is why line 181 is now `handler:nil`.
Thanks!
SafariDataImportStage currentStage = _containerViewController.importStage;`self.importStage` would return exactly the same thing. Why are you changing this part?
alert.title = @"Import Not Allowed";If you are planning to land like this, add a TODO on the top showing that you are planning to replace this part and use L10n instead.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Readability nit: `shouldInitiateImport`. Having "something" in a variable name makes it feel like pseudocode 😂
Done
Nit: add a `break` after this line. It seems that we only care about `blockedByPolicy` when this is false...
Done
I encourage you to remove the `errorAlert` property and turn this into a helper method that takes a `title` and a `message` instead 😊
The reason why it was originally a variable was because I thought I needed to call `weakSelf.errorAlert` in the dismiss handler. Turns out that it's not needed, which is why line 181 is now `handler:nil`.
Thanks!
Done
SafariDataImportStage currentStage = _containerViewController.importStage;`self.importStage` would return exactly the same thing. Why are you changing this part?
Correct! Changed it back
If you are planning to land like this, add a TODO on the top showing that you are planning to replace this part and use L10n instead.
I will be landing this CL once the strings are localized.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
/// Alert screen being displayed when the last selected file could not be
/// processed or contains no valid items.My apologies this would be my fault... but would you mind updating this comment:
/// Alert screen being displayed before dismissal, asking the user whether the imported file should be deleted.
BOOL shouldRecordFailure = NO;Do you really need this variable? Because it's always the same as `alert != nil` and so you can just keep checking the latter :)
BOOL success = [self presentViewController:alert];Don't capture `self` in a block :)
if (_containerViewController.presentedViewController &&
!_containerViewController.presentedViewController.isBeingDismissed) {
[_containerViewController
dismissViewControllerAnimated:NO
completion:presentAlertBlock];
} else {This check does not exist previously. Can we remove it? If you think it's necessary we can add it in a follow up CL.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
BOOL success = [self presentViewController:alert];Don't capture `self` in a block :)
I'll lgtm once this is fixed
typedef NS_ENUM(NSInteger, DataImportResetReason) {The Best Practices document prefers the use of `enum class` over `NS_ENUM`:
go/bling-best-practices#ns-enum-vs-c-enums
if (canImportSomething) {
[self initializeDataSource];
[self.importStageTransitionHandler transitionToNextImportStage];
} else if (anyTypeBlockedByPolicy) {
[self.importStageTransitionHandler
resetToInitialImportStage:DataImportResetReasonAllDataBlockedByPolicy];
} else {
[self.importStageTransitionHandler
resetToInitialImportStage:DataImportResetReasonNoImportableData];
}@tmar...@chromium.org let me know if I should add comments or is it self-explanatory.
lgtm
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
typedef NS_ENUM(NSInteger, DataImportResetReason) {The Best Practices document prefers the use of `enum class` over `NS_ENUM`:
go/bling-best-practices#ns-enum-vs-c-enums
Done
/// Alert screen being displayed when the last selected file could not be
/// processed or contains no valid items.My apologies this would be my fault... but would you mind updating this comment:
/// Alert screen being displayed before dismissal, asking the user whether the imported file should be deleted.
Done
Do you really need this variable? Because it's always the same as `alert != nil` and so you can just keep checking the latter :)
Thanks for the suggestion!
Ginny HuangDon't capture `self` in a block :)
I'll lgtm once this is fixed
Done
if (_containerViewController.presentedViewController &&
!_containerViewController.presentedViewController.isBeingDismissed) {
[_containerViewController
dismissViewControllerAnimated:NO
completion:presentAlertBlock];
} else {This check does not exist previously. Can we remove it? If you think it's necessary we can add it in a follow up CL.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Import Not AllowedPlease double check that "Not Allowed" should be capitalized. IIRC our UXW team is moving away from title case, so maybe it should be "Import not allowed"
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Please double check that "Not Allowed" should be capitalized. IIRC our UXW team is moving away from title case, so maybe it should be "Import not allowed"
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[iOSImportPasswordsSafari] File import policy block error
Show a specific error message if a user tries to import a file, and all
the data types found within that file are blocked by enterprise policy.
This handles the case where the import option is available (because not
all 4 data types are blocked), but the specific file's contents are
fully restricted by policy.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |