[go: nahoru, domu]

[ios] Removes static initializers in WhatsNewScreenshotViewController.

(cherry picked from commit 54bc728870bdad40563f64ddf5accdf81c210cf7)

Fixed: crbug.com/329106113
Change-Id: Iaa1b6a92e1a1ca89bd4e0c7ffc5df25477691914
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5315216
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1264661}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5361538
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/branch-heads/6312@{#528}
Cr-Branched-From: 6711dcdae48edaf98cbc6964f90fac85b7d9986e-refs/heads/main@{#1262506}
diff --git a/ios/chrome/browser/ui/whats_new/whats_new_screenshot_view_controller.mm b/ios/chrome/browser/ui/whats_new/whats_new_screenshot_view_controller.mm
index a1c4684..795ab10 100644
--- a/ios/chrome/browser/ui/whats_new/whats_new_screenshot_view_controller.mm
+++ b/ios/chrome/browser/ui/whats_new/whats_new_screenshot_view_controller.mm
@@ -13,6 +13,7 @@
 #import "ios/chrome/grit/ios_strings.h"
 #import "ios/public/provider/chrome/browser/lottie/lottie_animation_api.h"
 #import "ios/public/provider/chrome/browser/lottie/lottie_animation_configuration.h"
+#import "ui/base/device_form_factor.h"
 #import "ui/base/l10n/l10n_util.h"
 
 namespace {
@@ -20,8 +21,6 @@
 constexpr CGFloat kLabelBottomMargin = -40;
 constexpr CGFloat kLabelFontSize = 15;
 NSString* const kDarkModeAnimationSuffix = @"_darkmode";
-BOOL isIPad =
-    UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad;
 }  // namespace
 
 @interface WhatsNewScreenshotViewController ()
@@ -80,7 +79,8 @@
 
   [self configureAnimationView];
   [self configureAlertScreen];
-  if (self.item.isIphoneOnly && isIPad) {
+  if (self.item.isIphoneOnly &&
+      ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
     [self configureLabelView];
   }
   [self layoutAlertScreen];
@@ -111,7 +111,8 @@
       [[ConfirmationAlertViewController alloc] init];
   alertScreen.titleString = titleString;
   alertScreen.subtitleString = subtitleString;
-  if (!self.item.isIphoneOnly || !isIPad) {
+  if (!self.item.isIphoneOnly ||
+      ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) {
     alertScreen.primaryActionString = primaryActionString;
     alertScreen.secondaryActionString = secondaryActionString;
   }