| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | |
| 11 #include "components/autofill/core/browser/autofill_data_util.h" | 10 #include "components/autofill/core/browser/autofill_data_util.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 11 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "components/grit/components_scaled_resources.h" | 12 #include "components/grit/components_scaled_resources.h" |
| 14 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h" | 13 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h" |
| 15 #import "ios/chrome/browser/payments/cells/payments_text_item.h" | 14 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
| 16 #import "ios/chrome/browser/payments/cells/price_item.h" | 15 #import "ios/chrome/browser/payments/cells/price_item.h" |
| 17 #import "ios/chrome/browser/ui/authentication/account_control_item.h" | 16 #import "ios/chrome/browser/ui/authentication/account_control_item.h" |
| 18 #import "ios/chrome/browser/ui/authentication/signin_promo_item.h" | 17 #import "ios/chrome/browser/ui/authentication/signin_promo_item.h" |
| 19 #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" | 18 #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" |
| 20 #import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h" | 19 #import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 #import "ios/chrome/browser/ui/settings/cells/native_app_item.h" | 36 #import "ios/chrome/browser/ui/settings/cells/native_app_item.h" |
| 38 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" | 37 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" |
| 39 #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h" | 38 #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h" |
| 40 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 39 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 41 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 40 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 42 #import "ios/public/provider/chrome/browser/signin/signin_resources_provider.h" | 41 #import "ios/public/provider/chrome/browser/signin/signin_resources_provider.h" |
| 43 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" | 42 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 44 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 43 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 45 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 44 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 46 | 45 |
| 46 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 47 #error "This file requires ARC support." |
| 48 #endif |
| 49 |
| 47 namespace { | 50 namespace { |
| 48 | 51 |
| 49 typedef NS_ENUM(NSInteger, SectionIdentifier) { | 52 typedef NS_ENUM(NSInteger, SectionIdentifier) { |
| 50 SectionIdentifierTextCell = kSectionIdentifierEnumZero, | 53 SectionIdentifierTextCell = kSectionIdentifierEnumZero, |
| 51 SectionIdentifierDetailCell, | 54 SectionIdentifierDetailCell, |
| 52 SectionIdentifierSwitchCell, | 55 SectionIdentifierSwitchCell, |
| 53 SectionIdentifierNativeAppCell, | 56 SectionIdentifierNativeAppCell, |
| 54 SectionIdentifierAutofill, | 57 SectionIdentifierAutofill, |
| 55 SectionIdentifierPayments, | 58 SectionIdentifierPayments, |
| 56 SectionIdentifierAccountCell, | 59 SectionIdentifierAccountCell, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return self; | 109 return self; |
| 107 } | 110 } |
| 108 | 111 |
| 109 - (void)loadModel { | 112 - (void)loadModel { |
| 110 [super loadModel]; | 113 [super loadModel]; |
| 111 CollectionViewModel* model = self.collectionViewModel; | 114 CollectionViewModel* model = self.collectionViewModel; |
| 112 | 115 |
| 113 // Text cells. | 116 // Text cells. |
| 114 [model addSectionWithIdentifier:SectionIdentifierTextCell]; | 117 [model addSectionWithIdentifier:SectionIdentifierTextCell]; |
| 115 | 118 |
| 116 CollectionViewTextItem* textHeader = [ | 119 CollectionViewTextItem* textHeader = |
| 117 [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease]; | 120 [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader]; |
| 118 textHeader.text = @"CollectionViewTextCell"; | 121 textHeader.text = @"CollectionViewTextCell"; |
| 119 textHeader.textFont = [MDCTypography body2Font]; | 122 textHeader.textFont = [MDCTypography body2Font]; |
| 120 textHeader.textColor = [[MDCPalette greyPalette] tint500]; | 123 textHeader.textColor = [[MDCPalette greyPalette] tint500]; |
| 121 [model setHeader:textHeader | 124 [model setHeader:textHeader |
| 122 forSectionWithIdentifier:SectionIdentifierTextCell]; | 125 forSectionWithIdentifier:SectionIdentifierTextCell]; |
| 123 | 126 |
| 124 CollectionViewTextItem* textCell = [[[CollectionViewTextItem alloc] | 127 CollectionViewTextItem* textCell = |
| 125 initWithType:ItemTypeTextCheckmark] autorelease]; | 128 [[CollectionViewTextItem alloc] initWithType:ItemTypeTextCheckmark]; |
| 126 textCell.text = @"Text cell 1"; | 129 textCell.text = @"Text cell 1"; |
| 127 textCell.accessoryType = MDCCollectionViewCellAccessoryCheckmark; | 130 textCell.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
| 128 [model addItem:textCell toSectionWithIdentifier:SectionIdentifierTextCell]; | 131 [model addItem:textCell toSectionWithIdentifier:SectionIdentifierTextCell]; |
| 129 CollectionViewTextItem* textCell2 = [[[CollectionViewTextItem alloc] | 132 CollectionViewTextItem* textCell2 = |
| 130 initWithType:ItemTypeTextDetail] autorelease]; | 133 [[CollectionViewTextItem alloc] initWithType:ItemTypeTextDetail]; |
| 131 textCell2.text = | 134 textCell2.text = |
| 132 @"Text cell with text that is so long it must truncate at some point"; | 135 @"Text cell with text that is so long it must truncate at some point"; |
| 133 textCell2.accessoryType = MDCCollectionViewCellAccessoryDetailButton; | 136 textCell2.accessoryType = MDCCollectionViewCellAccessoryDetailButton; |
| 134 [model addItem:textCell2 toSectionWithIdentifier:SectionIdentifierTextCell]; | 137 [model addItem:textCell2 toSectionWithIdentifier:SectionIdentifierTextCell]; |
| 135 CollectionViewTextItem* textCell3 = | 138 CollectionViewTextItem* textCell3 = |
| 136 [[[CollectionViewTextItem alloc] initWithType:ItemTypeText] autorelease]; | 139 [[CollectionViewTextItem alloc] initWithType:ItemTypeText]; |
| 137 textCell3.text = @"Truncated text cell with three lines:"; | 140 textCell3.text = @"Truncated text cell with three lines:"; |
| 138 textCell3.detailText = @"One title line and two detail lines, so it should " | 141 textCell3.detailText = @"One title line and two detail lines, so it should " |
| 139 @"wrap nicely at some point."; | 142 @"wrap nicely at some point."; |
| 140 textCell3.numberOfDetailTextLines = 0; | 143 textCell3.numberOfDetailTextLines = 0; |
| 141 [model addItem:textCell3 toSectionWithIdentifier:SectionIdentifierTextCell]; | 144 [model addItem:textCell3 toSectionWithIdentifier:SectionIdentifierTextCell]; |
| 142 CollectionViewTextItem* smallTextCell = | 145 CollectionViewTextItem* smallTextCell = |
| 143 [[[CollectionViewTextItem alloc] initWithType:ItemTypeText] autorelease]; | 146 [[CollectionViewTextItem alloc] initWithType:ItemTypeText]; |
| 144 smallTextCell.text = @"Text cell with small font but height of 48."; | 147 smallTextCell.text = @"Text cell with small font but height of 48."; |
| 145 smallTextCell.textFont = [smallTextCell.textFont fontWithSize:8]; | 148 smallTextCell.textFont = [smallTextCell.textFont fontWithSize:8]; |
| 146 [model addItem:smallTextCell | 149 [model addItem:smallTextCell |
| 147 toSectionWithIdentifier:SectionIdentifierTextCell]; | 150 toSectionWithIdentifier:SectionIdentifierTextCell]; |
| 148 | 151 |
| 149 // Text and Error cell. | 152 // Text and Error cell. |
| 150 TextAndErrorItem* textAndErrorItem = | 153 TextAndErrorItem* textAndErrorItem = |
| 151 [[[TextAndErrorItem alloc] initWithType:ItemTypeTextError] autorelease]; | 154 [[TextAndErrorItem alloc] initWithType:ItemTypeTextError]; |
| 152 textAndErrorItem.text = @"Text and Error cell"; | 155 textAndErrorItem.text = @"Text and Error cell"; |
| 153 textAndErrorItem.shouldDisplayError = YES; | 156 textAndErrorItem.shouldDisplayError = YES; |
| 154 textAndErrorItem.accessoryType = | 157 textAndErrorItem.accessoryType = |
| 155 MDCCollectionViewCellAccessoryDisclosureIndicator; | 158 MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 156 [model addItem:textAndErrorItem | 159 [model addItem:textAndErrorItem |
| 157 toSectionWithIdentifier:SectionIdentifierTextCell]; | 160 toSectionWithIdentifier:SectionIdentifierTextCell]; |
| 158 | 161 |
| 159 // Detail cells. | 162 // Detail cells. |
| 160 [model addSectionWithIdentifier:SectionIdentifierDetailCell]; | 163 [model addSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 161 CollectionViewDetailItem* detailBasic = [[[CollectionViewDetailItem alloc] | 164 CollectionViewDetailItem* detailBasic = |
| 162 initWithType:ItemTypeDetailBasic] autorelease]; | 165 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailBasic]; |
| 163 detailBasic.text = @"Preload Webpages"; | 166 detailBasic.text = @"Preload Webpages"; |
| 164 detailBasic.detailText = @"Only on Wi-Fi"; | 167 detailBasic.detailText = @"Only on Wi-Fi"; |
| 165 detailBasic.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; | 168 detailBasic.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 166 [model addItem:detailBasic | 169 [model addItem:detailBasic |
| 167 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 170 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 168 CollectionViewDetailItem* detailMediumLeft = | 171 CollectionViewDetailItem* detailMediumLeft = |
| 169 [[[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailLeftMedium] | 172 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailLeftMedium]; |
| 170 autorelease]; | |
| 171 detailMediumLeft.text = @"A long string but it should fit"; | 173 detailMediumLeft.text = @"A long string but it should fit"; |
| 172 detailMediumLeft.detailText = @"Detail"; | 174 detailMediumLeft.detailText = @"Detail"; |
| 173 [model addItem:detailMediumLeft | 175 [model addItem:detailMediumLeft |
| 174 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 176 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 175 CollectionViewDetailItem* detailMediumRight = | 177 CollectionViewDetailItem* detailMediumRight = |
| 176 [[[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailRightMedium] | 178 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailRightMedium]; |
| 177 autorelease]; | |
| 178 detailMediumRight.text = @"Main"; | 179 detailMediumRight.text = @"Main"; |
| 179 detailMediumRight.detailText = @"A long string but it should fit"; | 180 detailMediumRight.detailText = @"A long string but it should fit"; |
| 180 [model addItem:detailMediumRight | 181 [model addItem:detailMediumRight |
| 181 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 182 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 182 CollectionViewDetailItem* detailLongLeft = [[[CollectionViewDetailItem alloc] | 183 CollectionViewDetailItem* detailLongLeft = |
| 183 initWithType:ItemTypeDetailLeftLong] autorelease]; | 184 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailLeftLong]; |
| 184 detailLongLeft.text = | 185 detailLongLeft.text = |
| 185 @"This is a very long main text that is intended to overflow"; | 186 @"This is a very long main text that is intended to overflow"; |
| 186 detailLongLeft.detailText = @"Detail Text"; | 187 detailLongLeft.detailText = @"Detail Text"; |
| 187 [model addItem:detailLongLeft | 188 [model addItem:detailLongLeft |
| 188 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 189 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 189 CollectionViewDetailItem* detailLongRight = [[[CollectionViewDetailItem alloc] | 190 CollectionViewDetailItem* detailLongRight = |
| 190 initWithType:ItemTypeDetailRightLong] autorelease]; | 191 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailRightLong]; |
| 191 detailLongRight.text = @"Main Text"; | 192 detailLongRight.text = @"Main Text"; |
| 192 detailLongRight.detailText = | 193 detailLongRight.detailText = |
| 193 @"This is a very long detail text that is intended to overflow"; | 194 @"This is a very long detail text that is intended to overflow"; |
| 194 [model addItem:detailLongRight | 195 [model addItem:detailLongRight |
| 195 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 196 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 196 CollectionViewDetailItem* detailLongBoth = [[[CollectionViewDetailItem alloc] | 197 CollectionViewDetailItem* detailLongBoth = |
| 197 initWithType:ItemTypeDetailBothLong] autorelease]; | 198 [[CollectionViewDetailItem alloc] initWithType:ItemTypeDetailBothLong]; |
| 198 detailLongBoth.text = | 199 detailLongBoth.text = |
| 199 @"This is a very long main text that is intended to overflow"; | 200 @"This is a very long main text that is intended to overflow"; |
| 200 detailLongBoth.detailText = | 201 detailLongBoth.detailText = |
| 201 @"This is a very long detail text that is intended to overflow"; | 202 @"This is a very long detail text that is intended to overflow"; |
| 202 [model addItem:detailLongBoth | 203 [model addItem:detailLongBoth |
| 203 toSectionWithIdentifier:SectionIdentifierDetailCell]; | 204 toSectionWithIdentifier:SectionIdentifierDetailCell]; |
| 204 | 205 |
| 205 // Switch cells. | 206 // Switch cells. |
| 206 [model addSectionWithIdentifier:SectionIdentifierSwitchCell]; | 207 [model addSectionWithIdentifier:SectionIdentifierSwitchCell]; |
| 207 [model addItem:[self basicSwitchItem] | 208 [model addItem:[self basicSwitchItem] |
| 208 toSectionWithIdentifier:SectionIdentifierSwitchCell]; | 209 toSectionWithIdentifier:SectionIdentifierSwitchCell]; |
| 209 [model addItem:[self longTextSwitchItem] | 210 [model addItem:[self longTextSwitchItem] |
| 210 toSectionWithIdentifier:SectionIdentifierSwitchCell]; | 211 toSectionWithIdentifier:SectionIdentifierSwitchCell]; |
| 211 [model addItem:[self syncSwitchItem] | 212 [model addItem:[self syncSwitchItem] |
| 212 toSectionWithIdentifier:SectionIdentifierSwitchCell]; | 213 toSectionWithIdentifier:SectionIdentifierSwitchCell]; |
| 213 | 214 |
| 214 // Native app cells. | 215 // Native app cells. |
| 215 [model addSectionWithIdentifier:SectionIdentifierNativeAppCell]; | 216 [model addSectionWithIdentifier:SectionIdentifierNativeAppCell]; |
| 216 NativeAppItem* fooApp = | 217 NativeAppItem* fooApp = [[NativeAppItem alloc] initWithType:ItemTypeApp]; |
| 217 [[[NativeAppItem alloc] initWithType:ItemTypeApp] autorelease]; | |
| 218 fooApp.name = @"App Foo"; | 218 fooApp.name = @"App Foo"; |
| 219 fooApp.state = NativeAppItemSwitchOff; | 219 fooApp.state = NativeAppItemSwitchOff; |
| 220 [model addItem:fooApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; | 220 [model addItem:fooApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; |
| 221 NativeAppItem* barApp = | 221 NativeAppItem* barApp = [[NativeAppItem alloc] initWithType:ItemTypeApp]; |
| 222 [[[NativeAppItem alloc] initWithType:ItemTypeApp] autorelease]; | |
| 223 barApp.name = @"App Bar"; | 222 barApp.name = @"App Bar"; |
| 224 barApp.state = NativeAppItemSwitchOn; | 223 barApp.state = NativeAppItemSwitchOn; |
| 225 [model addItem:barApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; | 224 [model addItem:barApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; |
| 226 NativeAppItem* bazApp = | 225 NativeAppItem* bazApp = [[NativeAppItem alloc] initWithType:ItemTypeApp]; |
| 227 [[[NativeAppItem alloc] initWithType:ItemTypeApp] autorelease]; | |
| 228 bazApp.name = @"App Baz Qux Bla Bug Lorem ipsum dolor sit amet"; | 226 bazApp.name = @"App Baz Qux Bla Bug Lorem ipsum dolor sit amet"; |
| 229 bazApp.state = NativeAppItemInstall; | 227 bazApp.state = NativeAppItemInstall; |
| 230 [model addItem:bazApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; | 228 [model addItem:bazApp toSectionWithIdentifier:SectionIdentifierNativeAppCell]; |
| 231 | 229 |
| 232 // Autofill cells. | 230 // Autofill cells. |
| 233 [model addSectionWithIdentifier:SectionIdentifierAutofill]; | 231 [model addSectionWithIdentifier:SectionIdentifierAutofill]; |
| 234 [model addItem:[self autofillItemWithMainAndTrailingText] | 232 [model addItem:[self autofillItemWithMainAndTrailingText] |
| 235 toSectionWithIdentifier:SectionIdentifierAutofill]; | 233 toSectionWithIdentifier:SectionIdentifierAutofill]; |
| 236 [model addItem:[self autofillItemWithLeadingTextOnly] | 234 [model addItem:[self autofillItemWithLeadingTextOnly] |
| 237 toSectionWithIdentifier:SectionIdentifierAutofill]; | 235 toSectionWithIdentifier:SectionIdentifierAutofill]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 254 [model addItem:[self statusItemError] | 252 [model addItem:[self statusItemError] |
| 255 toSectionWithIdentifier:SectionIdentifierAutofill]; | 253 toSectionWithIdentifier:SectionIdentifierAutofill]; |
| 256 [model addItem:[self storageSwitchItem] | 254 [model addItem:[self storageSwitchItem] |
| 257 toSectionWithIdentifier:SectionIdentifierAutofill]; | 255 toSectionWithIdentifier:SectionIdentifierAutofill]; |
| 258 | 256 |
| 259 // Payments cells. | 257 // Payments cells. |
| 260 [model addSectionWithIdentifier:SectionIdentifierPayments]; | 258 [model addSectionWithIdentifier:SectionIdentifierPayments]; |
| 261 [model addItem:[self paymentsItemWithWrappingTextandOptionalImage] | 259 [model addItem:[self paymentsItemWithWrappingTextandOptionalImage] |
| 262 toSectionWithIdentifier:SectionIdentifierPayments]; | 260 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 263 PriceItem* priceItem1 = | 261 PriceItem* priceItem1 = |
| 264 [[[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine] autorelease]; | 262 [[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine]; |
| 265 priceItem1.item = @"Total"; | 263 priceItem1.item = @"Total"; |
| 266 priceItem1.notification = @"Updated"; | 264 priceItem1.notification = @"Updated"; |
| 267 priceItem1.price = @"USD $100.00"; | 265 priceItem1.price = @"USD $100.00"; |
| 268 [model addItem:priceItem1 toSectionWithIdentifier:SectionIdentifierPayments]; | 266 [model addItem:priceItem1 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 269 PriceItem* priceItem2 = | 267 PriceItem* priceItem2 = |
| 270 [[[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine] autorelease]; | 268 [[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine]; |
| 271 priceItem2.item = @"Price label is long and should get clipped"; | 269 priceItem2.item = @"Price label is long and should get clipped"; |
| 272 priceItem2.notification = @"Updated"; | 270 priceItem2.notification = @"Updated"; |
| 273 priceItem2.price = @"USD $1,000,000.00"; | 271 priceItem2.price = @"USD $1,000,000.00"; |
| 274 [model addItem:priceItem2 toSectionWithIdentifier:SectionIdentifierPayments]; | 272 [model addItem:priceItem2 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 275 PriceItem* priceItem3 = | 273 PriceItem* priceItem3 = |
| 276 [[[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine] autorelease]; | 274 [[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine]; |
| 277 priceItem3.item = @"Price label is long and should get clipped"; | 275 priceItem3.item = @"Price label is long and should get clipped"; |
| 278 priceItem3.notification = @"Should get clipped too"; | 276 priceItem3.notification = @"Should get clipped too"; |
| 279 priceItem3.price = @"USD $1,000,000.00"; | 277 priceItem3.price = @"USD $1,000,000.00"; |
| 280 [model addItem:priceItem3 toSectionWithIdentifier:SectionIdentifierPayments]; | 278 [model addItem:priceItem3 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 281 PriceItem* priceItem4 = | 279 PriceItem* priceItem4 = |
| 282 [[[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine] autorelease]; | 280 [[PriceItem alloc] initWithType:ItemTypePaymentsSingleLine]; |
| 283 priceItem4.item = @"Price label is long and should get clipped"; | 281 priceItem4.item = @"Price label is long and should get clipped"; |
| 284 priceItem4.notification = @"Should get clipped too"; | 282 priceItem4.notification = @"Should get clipped too"; |
| 285 priceItem4.price = @"USD $1,000,000,000.00"; | 283 priceItem4.price = @"USD $1,000,000,000.00"; |
| 286 [model addItem:priceItem4 toSectionWithIdentifier:SectionIdentifierPayments]; | 284 [model addItem:priceItem4 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 287 | 285 |
| 288 AutofillProfileItem* profileItem1 = [[[AutofillProfileItem alloc] | 286 AutofillProfileItem* profileItem1 = |
| 289 initWithType:ItemTypePaymentsDynamicHeight] autorelease]; | 287 [[AutofillProfileItem alloc] initWithType:ItemTypePaymentsDynamicHeight]; |
| 290 profileItem1.name = @"Profile Name gets wrapped if it's too long"; | 288 profileItem1.name = @"Profile Name gets wrapped if it's too long"; |
| 291 profileItem1.address = @"Profile Address also gets wrapped if it's too long"; | 289 profileItem1.address = @"Profile Address also gets wrapped if it's too long"; |
| 292 profileItem1.phoneNumber = @"123-456-7890"; | 290 profileItem1.phoneNumber = @"123-456-7890"; |
| 293 profileItem1.email = @"foo@bar.com"; | 291 profileItem1.email = @"foo@bar.com"; |
| 294 profileItem1.notification = @"Some fields are missing"; | 292 profileItem1.notification = @"Some fields are missing"; |
| 295 [model addItem:profileItem1 | 293 [model addItem:profileItem1 |
| 296 toSectionWithIdentifier:SectionIdentifierPayments]; | 294 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 297 AutofillProfileItem* profileItem2 = [[[AutofillProfileItem alloc] | 295 AutofillProfileItem* profileItem2 = |
| 298 initWithType:ItemTypePaymentsDynamicHeight] autorelease]; | 296 [[AutofillProfileItem alloc] initWithType:ItemTypePaymentsDynamicHeight]; |
| 299 profileItem1.name = @"All fields are optional"; | 297 profileItem1.name = @"All fields are optional"; |
| 300 profileItem2.phoneNumber = @"123-456-7890"; | 298 profileItem2.phoneNumber = @"123-456-7890"; |
| 301 profileItem2.notification = @"Some fields are missing"; | 299 profileItem2.notification = @"Some fields are missing"; |
| 302 [model addItem:profileItem2 | 300 [model addItem:profileItem2 |
| 303 toSectionWithIdentifier:SectionIdentifierPayments]; | 301 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 304 AutofillProfileItem* profileItem3 = [[[AutofillProfileItem alloc] | 302 AutofillProfileItem* profileItem3 = |
| 305 initWithType:ItemTypePaymentsDynamicHeight] autorelease]; | 303 [[AutofillProfileItem alloc] initWithType:ItemTypePaymentsDynamicHeight]; |
| 306 profileItem3.address = @"All fields are optional"; | 304 profileItem3.address = @"All fields are optional"; |
| 307 profileItem3.email = @"foo@bar.com"; | 305 profileItem3.email = @"foo@bar.com"; |
| 308 [model addItem:profileItem3 | 306 [model addItem:profileItem3 |
| 309 toSectionWithIdentifier:SectionIdentifierPayments]; | 307 toSectionWithIdentifier:SectionIdentifierPayments]; |
| 310 | 308 |
| 311 // Account cells. | 309 // Account cells. |
| 312 [model addSectionWithIdentifier:SectionIdentifierAccountCell]; | 310 [model addSectionWithIdentifier:SectionIdentifierAccountCell]; |
| 313 [model addItem:[self accountItemDetailWithError] | 311 [model addItem:[self accountItemDetailWithError] |
| 314 toSectionWithIdentifier:SectionIdentifierAccountCell]; | 312 toSectionWithIdentifier:SectionIdentifierAccountCell]; |
| 315 [model addItem:[self accountItemCheckMark] | 313 [model addItem:[self accountItemCheckMark] |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 return YES; | 435 return YES; |
| 438 default: | 436 default: |
| 439 return NO; | 437 return NO; |
| 440 } | 438 } |
| 441 } | 439 } |
| 442 | 440 |
| 443 #pragma mark Item models | 441 #pragma mark Item models |
| 444 | 442 |
| 445 - (CollectionViewItem*)accountItemDetailWithError { | 443 - (CollectionViewItem*)accountItemDetailWithError { |
| 446 CollectionViewAccountItem* accountItemDetail = | 444 CollectionViewAccountItem* accountItemDetail = |
| 447 [[[CollectionViewAccountItem alloc] initWithType:ItemTypeAccountDetail] | 445 [[CollectionViewAccountItem alloc] initWithType:ItemTypeAccountDetail]; |
| 448 autorelease]; | |
| 449 accountItemDetail.image = [UIImage imageNamed:@"default_avatar"]; | 446 accountItemDetail.image = [UIImage imageNamed:@"default_avatar"]; |
| 450 accountItemDetail.text = @"Account User Name"; | 447 accountItemDetail.text = @"Account User Name"; |
| 451 accountItemDetail.detailText = | 448 accountItemDetail.detailText = |
| 452 @"Syncing to AccountUserNameAccount@example.com"; | 449 @"Syncing to AccountUserNameAccount@example.com"; |
| 453 accountItemDetail.accessoryType = | 450 accountItemDetail.accessoryType = |
| 454 MDCCollectionViewCellAccessoryDisclosureIndicator; | 451 MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 455 accountItemDetail.shouldDisplayError = YES; | 452 accountItemDetail.shouldDisplayError = YES; |
| 456 return accountItemDetail; | 453 return accountItemDetail; |
| 457 } | 454 } |
| 458 | 455 |
| 459 - (CollectionViewItem*)accountItemCheckMark { | 456 - (CollectionViewItem*)accountItemCheckMark { |
| 460 CollectionViewAccountItem* accountItemCheckMark = | 457 CollectionViewAccountItem* accountItemCheckMark = |
| 461 [[[CollectionViewAccountItem alloc] initWithType:ItemTypeAccountCheckMark] | 458 [[CollectionViewAccountItem alloc] initWithType:ItemTypeAccountCheckMark]; |
| 462 autorelease]; | |
| 463 accountItemCheckMark.image = [UIImage imageNamed:@"default_avatar"]; | 459 accountItemCheckMark.image = [UIImage imageNamed:@"default_avatar"]; |
| 464 accountItemCheckMark.text = @"Lorem ipsum dolor sit amet, consectetur " | 460 accountItemCheckMark.text = @"Lorem ipsum dolor sit amet, consectetur " |
| 465 @"adipiscing elit, sed do eiusmod tempor " | 461 @"adipiscing elit, sed do eiusmod tempor " |
| 466 @"incididunt ut labore et dolore magna aliqua."; | 462 @"incididunt ut labore et dolore magna aliqua."; |
| 467 accountItemCheckMark.detailText = | 463 accountItemCheckMark.detailText = |
| 468 @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " | 464 @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " |
| 469 @"eiusmod tempor incididunt ut labore et dolore magna aliqua."; | 465 @"eiusmod tempor incididunt ut labore et dolore magna aliqua."; |
| 470 accountItemCheckMark.accessoryType = MDCCollectionViewCellAccessoryCheckmark; | 466 accountItemCheckMark.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
| 471 return accountItemCheckMark; | 467 return accountItemCheckMark; |
| 472 } | 468 } |
| 473 | 469 |
| 474 - (CollectionViewItem*)accountSignInItem { | 470 - (CollectionViewItem*)accountSignInItem { |
| 475 AccountSignInItem* accountSignInItem = [[[AccountSignInItem alloc] | 471 AccountSignInItem* accountSignInItem = |
| 476 initWithType:ItemTypeAccountSignIn] autorelease]; | 472 [[AccountSignInItem alloc] initWithType:ItemTypeAccountSignIn]; |
| 477 accountSignInItem.image = | 473 accountSignInItem.image = |
| 478 CircularImageFromImage(ios::GetChromeBrowserProvider() | 474 CircularImageFromImage(ios::GetChromeBrowserProvider() |
| 479 ->GetSigninResourcesProvider() | 475 ->GetSigninResourcesProvider() |
| 480 ->GetDefaultAvatar(), | 476 ->GetDefaultAvatar(), |
| 481 kHorizontalImageFixedSize); | 477 kHorizontalImageFixedSize); |
| 482 return accountSignInItem; | 478 return accountSignInItem; |
| 483 } | 479 } |
| 484 | 480 |
| 485 - (CollectionViewItem*)coldStateSigninPromoItem { | 481 - (CollectionViewItem*)coldStateSigninPromoItem { |
| 486 SigninPromoItem* signinPromoItem = [[[SigninPromoItem alloc] | 482 SigninPromoItem* signinPromoItem = |
| 487 initWithType:ItemTypeWarmStateSigninPromo] autorelease]; | 483 [[SigninPromoItem alloc] initWithType:ItemTypeWarmStateSigninPromo]; |
| 488 signinPromoItem.configurator = | 484 signinPromoItem.configurator = |
| 489 [[[SigninPromoViewConfigurator alloc] initWithUserEmail:nil | 485 [[SigninPromoViewConfigurator alloc] initWithUserEmail:nil |
| 490 userFullName:nil | 486 userFullName:nil |
| 491 userImage:nil] autorelease]; | 487 userImage:nil]; |
| 492 return signinPromoItem; | 488 return signinPromoItem; |
| 493 } | 489 } |
| 494 | 490 |
| 495 - (CollectionViewItem*)warmStateSigninPromoItem { | 491 - (CollectionViewItem*)warmStateSigninPromoItem { |
| 496 SigninPromoItem* signinPromoItem = [[[SigninPromoItem alloc] | 492 SigninPromoItem* signinPromoItem = |
| 497 initWithType:ItemTypeColdStateSigninPromo] autorelease]; | 493 [[SigninPromoItem alloc] initWithType:ItemTypeColdStateSigninPromo]; |
| 498 signinPromoItem.configurator = [[[SigninPromoViewConfigurator alloc] | 494 signinPromoItem.configurator = [[SigninPromoViewConfigurator alloc] |
| 499 initWithUserEmail:@"jonhdoe@example.com" | 495 initWithUserEmail:@"jonhdoe@example.com" |
| 500 userFullName:@"John Doe" | 496 userFullName:@"John Doe" |
| 501 userImage:nil] autorelease]; | 497 userImage:nil]; |
| 502 return signinPromoItem; | 498 return signinPromoItem; |
| 503 } | 499 } |
| 504 | 500 |
| 505 - (CollectionViewItem*)accountControlItem { | 501 - (CollectionViewItem*)accountControlItem { |
| 506 AccountControlItem* item = [[[AccountControlItem alloc] | 502 AccountControlItem* item = [[AccountControlItem alloc] |
| 507 initWithType:ItemTypeAccountControlDynamicHeight] autorelease]; | 503 initWithType:ItemTypeAccountControlDynamicHeight]; |
| 508 item.image = [UIImage imageNamed:@"settings_sync"]; | 504 item.image = [UIImage imageNamed:@"settings_sync"]; |
| 509 item.text = @"Account Sync Settings"; | 505 item.text = @"Account Sync Settings"; |
| 510 item.detailText = @"Detail text"; | 506 item.detailText = @"Detail text"; |
| 511 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; | 507 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 512 return item; | 508 return item; |
| 513 } | 509 } |
| 514 | 510 |
| 515 - (CollectionViewItem*)accountControlItemWithExtraLongText { | 511 - (CollectionViewItem*)accountControlItemWithExtraLongText { |
| 516 AccountControlItem* item = [[[AccountControlItem alloc] | 512 AccountControlItem* item = [[AccountControlItem alloc] |
| 517 initWithType:ItemTypeAccountControlDynamicHeight] autorelease]; | 513 initWithType:ItemTypeAccountControlDynamicHeight]; |
| 518 item.image = [ChromeIcon infoIcon]; | 514 item.image = [ChromeIcon infoIcon]; |
| 519 item.text = @"Account Control Settings"; | 515 item.text = @"Account Control Settings"; |
| 520 item.detailText = | 516 item.detailText = |
| 521 @"Detail text detail text detail text detail text detail text."; | 517 @"Detail text detail text detail text detail text detail text."; |
| 522 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; | 518 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 523 return item; | 519 return item; |
| 524 } | 520 } |
| 525 | 521 |
| 526 #pragma mark Private | 522 #pragma mark Private |
| 527 | 523 |
| 528 - (CollectionViewItem*)basicSwitchItem { | 524 - (CollectionViewItem*)basicSwitchItem { |
| 529 CollectionViewSwitchItem* item = [[[CollectionViewSwitchItem alloc] | 525 CollectionViewSwitchItem* item = |
| 530 initWithType:ItemTypeSwitchBasic] autorelease]; | 526 [[CollectionViewSwitchItem alloc] initWithType:ItemTypeSwitchBasic]; |
| 531 item.text = @"Enable awesomeness."; | 527 item.text = @"Enable awesomeness."; |
| 532 item.on = YES; | 528 item.on = YES; |
| 533 return item; | 529 return item; |
| 534 } | 530 } |
| 535 | 531 |
| 536 - (CollectionViewItem*)longTextSwitchItem { | 532 - (CollectionViewItem*)longTextSwitchItem { |
| 537 CollectionViewSwitchItem* item = [[[CollectionViewSwitchItem alloc] | 533 CollectionViewSwitchItem* item = [[CollectionViewSwitchItem alloc] |
| 538 initWithType:ItemTypeSwitchDynamicHeight] autorelease]; | 534 initWithType:ItemTypeSwitchDynamicHeight]; |
| 539 item.text = @"Enable awesomeness. This is a very long text that is intended " | 535 item.text = @"Enable awesomeness. This is a very long text that is intended " |
| 540 @"to overflow."; | 536 @"to overflow."; |
| 541 item.on = YES; | 537 item.on = YES; |
| 542 return item; | 538 return item; |
| 543 } | 539 } |
| 544 | 540 |
| 545 - (CollectionViewItem*)syncSwitchItem { | 541 - (CollectionViewItem*)syncSwitchItem { |
| 546 SyncSwitchItem* item = | 542 SyncSwitchItem* item = |
| 547 [[[SyncSwitchItem alloc] initWithType:ItemTypeSwitchSync] autorelease]; | 543 [[SyncSwitchItem alloc] initWithType:ItemTypeSwitchSync]; |
| 548 item.text = @"Cell used in Sync Settings"; | 544 item.text = @"Cell used in Sync Settings"; |
| 549 item.detailText = | 545 item.detailText = |
| 550 @"This is a very long text that is intended to overflow to two lines."; | 546 @"This is a very long text that is intended to overflow to two lines."; |
| 551 item.on = NO; | 547 item.on = NO; |
| 552 return item; | 548 return item; |
| 553 } | 549 } |
| 554 | 550 |
| 555 - (CollectionViewItem*)paymentsItemWithWrappingTextandOptionalImage { | 551 - (CollectionViewItem*)paymentsItemWithWrappingTextandOptionalImage { |
| 556 PaymentsTextItem* item = [[[PaymentsTextItem alloc] | 552 PaymentsTextItem* item = |
| 557 initWithType:ItemTypePaymentsDynamicHeight] autorelease]; | 553 [[PaymentsTextItem alloc] initWithType:ItemTypePaymentsDynamicHeight]; |
| 558 item.text = @"If you want to display a long text that wraps to the next line " | 554 item.text = @"If you want to display a long text that wraps to the next line " |
| 559 @"and may need to feature an image this is the cell to use."; | 555 @"and may need to feature an image this is the cell to use."; |
| 560 item.image = [UIImage imageNamed:@"app_icon_placeholder"]; | 556 item.image = [UIImage imageNamed:@"app_icon_placeholder"]; |
| 561 return item; | 557 return item; |
| 562 } | 558 } |
| 563 | 559 |
| 564 - (CollectionViewItem*)autofillItemWithMainAndTrailingText { | 560 - (CollectionViewItem*)autofillItemWithMainAndTrailingText { |
| 565 AutofillDataItem* item = [[[AutofillDataItem alloc] | 561 AutofillDataItem* item = |
| 566 initWithType:ItemTypeAutofillDynamicHeight] autorelease]; | 562 [[AutofillDataItem alloc] initWithType:ItemTypeAutofillDynamicHeight]; |
| 567 item.text = @"Main Text"; | 563 item.text = @"Main Text"; |
| 568 item.trailingDetailText = @"Trailing Detail Text"; | 564 item.trailingDetailText = @"Trailing Detail Text"; |
| 569 item.accessoryType = MDCCollectionViewCellAccessoryNone; | 565 item.accessoryType = MDCCollectionViewCellAccessoryNone; |
| 570 return item; | 566 return item; |
| 571 } | 567 } |
| 572 | 568 |
| 573 - (CollectionViewItem*)autofillItemWithLeadingTextOnly { | 569 - (CollectionViewItem*)autofillItemWithLeadingTextOnly { |
| 574 AutofillDataItem* item = [[[AutofillDataItem alloc] | 570 AutofillDataItem* item = |
| 575 initWithType:ItemTypeAutofillDynamicHeight] autorelease]; | 571 [[AutofillDataItem alloc] initWithType:ItemTypeAutofillDynamicHeight]; |
| 576 item.text = @"Main Text"; | 572 item.text = @"Main Text"; |
| 577 item.leadingDetailText = @"Leading Detail Text"; | 573 item.leadingDetailText = @"Leading Detail Text"; |
| 578 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; | 574 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 579 return item; | 575 return item; |
| 580 } | 576 } |
| 581 | 577 |
| 582 - (CollectionViewItem*)autofillItemWithAllText { | 578 - (CollectionViewItem*)autofillItemWithAllText { |
| 583 AutofillDataItem* item = [[[AutofillDataItem alloc] | 579 AutofillDataItem* item = |
| 584 initWithType:ItemTypeAutofillDynamicHeight] autorelease]; | 580 [[AutofillDataItem alloc] initWithType:ItemTypeAutofillDynamicHeight]; |
| 585 item.text = @"Main Text"; | 581 item.text = @"Main Text"; |
| 586 item.leadingDetailText = @"Leading Detail Text"; | 582 item.leadingDetailText = @"Leading Detail Text"; |
| 587 item.trailingDetailText = @"Trailing Detail Text"; | 583 item.trailingDetailText = @"Trailing Detail Text"; |
| 588 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; | 584 item.accessoryType = MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 589 return item; | 585 return item; |
| 590 } | 586 } |
| 591 | 587 |
| 592 - (CollectionViewItem*)autofillEditItem { | 588 - (CollectionViewItem*)autofillEditItem { |
| 593 AutofillEditItem* item = [[[AutofillEditItem alloc] | 589 AutofillEditItem* item = |
| 594 initWithType:ItemTypeAutofillDynamicHeight] autorelease]; | 590 [[AutofillEditItem alloc] initWithType:ItemTypeAutofillDynamicHeight]; |
| 595 item.textFieldName = @"Required Card Number"; | 591 item.textFieldName = @"Required Card Number"; |
| 596 item.textFieldValue = @"4111111111111111"; | 592 item.textFieldValue = @"4111111111111111"; |
| 597 item.textFieldEnabled = YES; | 593 item.textFieldEnabled = YES; |
| 598 item.required = YES; | 594 item.required = YES; |
| 599 return item; | 595 return item; |
| 600 } | 596 } |
| 601 | 597 |
| 602 - (CollectionViewItem*)autofillEditItemWithIcon { | 598 - (CollectionViewItem*)autofillEditItemWithIcon { |
| 603 AutofillEditItem* item = [[[AutofillEditItem alloc] | 599 AutofillEditItem* item = |
| 604 initWithType:ItemTypeAutofillDynamicHeight] autorelease]; | 600 [[AutofillEditItem alloc] initWithType:ItemTypeAutofillDynamicHeight]; |
| 605 item.textFieldName = @"Card Number"; | 601 item.textFieldName = @"Card Number"; |
| 606 item.textFieldValue = @"4111111111111111"; | 602 item.textFieldValue = @"4111111111111111"; |
| 607 item.textFieldEnabled = YES; | 603 item.textFieldEnabled = YES; |
| 608 int resourceID = | 604 int resourceID = |
| 609 autofill::data_util::GetPaymentRequestData(autofill::kVisaCard) | 605 autofill::data_util::GetPaymentRequestData(autofill::kVisaCard) |
| 610 .icon_resource_id; | 606 .icon_resource_id; |
| 611 item.cardTypeIcon = | 607 item.cardTypeIcon = |
| 612 ResizeImage(NativeImage(resourceID), CGSizeMake(30.0, 30.0), | 608 ResizeImage(NativeImage(resourceID), CGSizeMake(30.0, 30.0), |
| 613 ProjectionMode::kAspectFillNoClipping); | 609 ProjectionMode::kAspectFillNoClipping); |
| 614 return item; | 610 return item; |
| 615 } | 611 } |
| 616 | 612 |
| 617 - (CollectionViewItem*)cvcItem { | 613 - (CollectionViewItem*)cvcItem { |
| 618 CVCItem* item = | 614 CVCItem* item = [[CVCItem alloc] initWithType:ItemTypeAutofillCVC]; |
| 619 [[[CVCItem alloc] initWithType:ItemTypeAutofillCVC] autorelease]; | |
| 620 item.instructionsText = | 615 item.instructionsText = |
| 621 @"This is a long text explaining to enter card details and what " | 616 @"This is a long text explaining to enter card details and what " |
| 622 @"will happen afterwards."; | 617 @"will happen afterwards."; |
| 623 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT; | 618 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT; |
| 624 return item; | 619 return item; |
| 625 } | 620 } |
| 626 | 621 |
| 627 - (CollectionViewItem*)cvcItemWithDate { | 622 - (CollectionViewItem*)cvcItemWithDate { |
| 628 CVCItem* item = | 623 CVCItem* item = [[CVCItem alloc] initWithType:ItemTypeAutofillCVC]; |
| 629 [[[CVCItem alloc] initWithType:ItemTypeAutofillCVC] autorelease]; | |
| 630 item.instructionsText = | 624 item.instructionsText = |
| 631 @"This is a long text explaining to enter card details and what " | 625 @"This is a long text explaining to enter card details and what " |
| 632 @"will happen afterwards."; | 626 @"will happen afterwards."; |
| 633 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT; | 627 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT; |
| 634 item.showDateInput = YES; | 628 item.showDateInput = YES; |
| 635 return item; | 629 return item; |
| 636 } | 630 } |
| 637 | 631 |
| 638 - (CollectionViewItem*)cvcItemWithError { | 632 - (CollectionViewItem*)cvcItemWithError { |
| 639 CVCItem* item = | 633 CVCItem* item = [[CVCItem alloc] initWithType:ItemTypeAutofillCVC]; |
| 640 [[[CVCItem alloc] initWithType:ItemTypeAutofillCVC] autorelease]; | |
| 641 item.instructionsText = | 634 item.instructionsText = |
| 642 @"This is a long text explaining to enter card details and what " | 635 @"This is a long text explaining to enter card details and what " |
| 643 @"will happen afterwards. Is this long enough to span 3 lines?"; | 636 @"will happen afterwards. Is this long enough to span 3 lines?"; |
| 644 item.errorMessage = @"Some error"; | 637 item.errorMessage = @"Some error"; |
| 645 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT_AMEX; | 638 item.CVCImageResourceID = IDR_CREDIT_CARD_CVC_HINT_AMEX; |
| 646 item.showNewCardButton = YES; | 639 item.showNewCardButton = YES; |
| 647 item.showCVCInputError = YES; | 640 item.showCVCInputError = YES; |
| 648 return item; | 641 return item; |
| 649 } | 642 } |
| 650 | 643 |
| 651 - (CollectionViewItem*)statusItemVerifying { | 644 - (CollectionViewItem*)statusItemVerifying { |
| 652 StatusItem* item = | 645 StatusItem* item = [[StatusItem alloc] initWithType:ItemTypeAutofillStatus]; |
| 653 [[[StatusItem alloc] initWithType:ItemTypeAutofillStatus] autorelease]; | |
| 654 item.text = @"Verifying…"; | 646 item.text = @"Verifying…"; |
| 655 return item; | 647 return item; |
| 656 } | 648 } |
| 657 | 649 |
| 658 - (CollectionViewItem*)statusItemVerified { | 650 - (CollectionViewItem*)statusItemVerified { |
| 659 StatusItem* item = | 651 StatusItem* item = [[StatusItem alloc] initWithType:ItemTypeAutofillStatus]; |
| 660 [[[StatusItem alloc] initWithType:ItemTypeAutofillStatus] autorelease]; | |
| 661 item.state = StatusItemState::VERIFIED; | 652 item.state = StatusItemState::VERIFIED; |
| 662 item.text = @"Verified!"; | 653 item.text = @"Verified!"; |
| 663 return item; | 654 return item; |
| 664 } | 655 } |
| 665 | 656 |
| 666 - (CollectionViewItem*)statusItemError { | 657 - (CollectionViewItem*)statusItemError { |
| 667 StatusItem* item = | 658 StatusItem* item = [[StatusItem alloc] initWithType:ItemTypeAutofillStatus]; |
| 668 [[[StatusItem alloc] initWithType:ItemTypeAutofillStatus] autorelease]; | |
| 669 item.state = StatusItemState::ERROR; | 659 item.state = StatusItemState::ERROR; |
| 670 item.text = @"There was a really long error. We can't tell you more, but we " | 660 item.text = @"There was a really long error. We can't tell you more, but we " |
| 671 @"will still display this long string."; | 661 @"will still display this long string."; |
| 672 return item; | 662 return item; |
| 673 } | 663 } |
| 674 | 664 |
| 675 - (CollectionViewItem*)storageSwitchItem { | 665 - (CollectionViewItem*)storageSwitchItem { |
| 676 StorageSwitchItem* item = [[[StorageSwitchItem alloc] | 666 StorageSwitchItem* item = |
| 677 initWithType:ItemTypeAutofillStorageSwitch] autorelease]; | 667 [[StorageSwitchItem alloc] initWithType:ItemTypeAutofillStorageSwitch]; |
| 678 item.on = YES; | 668 item.on = YES; |
| 679 return item; | 669 return item; |
| 680 } | 670 } |
| 681 | 671 |
| 682 - (CollectionViewFooterItem*)shortFooterItem { | 672 - (CollectionViewFooterItem*)shortFooterItem { |
| 683 CollectionViewFooterItem* footerItem = [[[CollectionViewFooterItem alloc] | 673 CollectionViewFooterItem* footerItem = |
| 684 initWithType:ItemTypeFooter] autorelease]; | 674 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooter]; |
| 685 footerItem.text = @"Hello"; | 675 footerItem.text = @"Hello"; |
| 686 return footerItem; | 676 return footerItem; |
| 687 } | 677 } |
| 688 | 678 |
| 689 - (CollectionViewFooterItem*)longFooterItem { | 679 - (CollectionViewFooterItem*)longFooterItem { |
| 690 CollectionViewFooterItem* footerItem = [[[CollectionViewFooterItem alloc] | 680 CollectionViewFooterItem* footerItem = |
| 691 initWithType:ItemTypeFooter] autorelease]; | 681 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooter]; |
| 692 footerItem.text = @"Hello Hello Hello Hello Hello Hello Hello Hello Hello " | 682 footerItem.text = @"Hello Hello Hello Hello Hello Hello Hello Hello Hello " |
| 693 @"Hello Hello Hello Hello Hello Hello Hello Hello Hello " | 683 @"Hello Hello Hello Hello Hello Hello Hello Hello Hello " |
| 694 @"Hello Hello Hello Hello Hello Hello Hello Hello Hello "; | 684 @"Hello Hello Hello Hello Hello Hello Hello Hello Hello "; |
| 695 footerItem.image = [UIImage imageNamed:@"app_icon_placeholder"]; | 685 footerItem.image = [UIImage imageNamed:@"app_icon_placeholder"]; |
| 696 return footerItem; | 686 return footerItem; |
| 697 } | 687 } |
| 698 | 688 |
| 699 - (ContentSuggestionsArticleItem*)contentSuggestionsArticleItem { | 689 - (ContentSuggestionsArticleItem*)contentSuggestionsArticleItem { |
| 700 ContentSuggestionsArticleItem* articleItem = | 690 ContentSuggestionsArticleItem* articleItem = |
| 701 [[ContentSuggestionsArticleItem alloc] | 691 [[ContentSuggestionsArticleItem alloc] |
| (...skipping 11 matching lines...) Expand all Loading... |
| 713 - (ContentSuggestionsFooterItem*)contentSuggestionsFooterItem { | 703 - (ContentSuggestionsFooterItem*)contentSuggestionsFooterItem { |
| 714 ContentSuggestionsFooterItem* footerItem = | 704 ContentSuggestionsFooterItem* footerItem = |
| 715 [[ContentSuggestionsFooterItem alloc] | 705 [[ContentSuggestionsFooterItem alloc] |
| 716 initWithType:ItemTypeContentSuggestions | 706 initWithType:ItemTypeContentSuggestions |
| 717 title:@"Footer title" | 707 title:@"Footer title" |
| 718 block:nil]; | 708 block:nil]; |
| 719 return footerItem; | 709 return footerItem; |
| 720 } | 710 } |
| 721 | 711 |
| 722 @end | 712 @end |
| OLD | NEW |