Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mludowise-stripe committed Sep 24, 2024
1 parent 3ccc784 commit e6e1eec
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ class MainViewController: UITableViewController {

let appInfo: AppInfo
let merchant: MerchantInfo

init(appInfo: AppInfo, merchant: MerchantInfo) {
self.appInfo = appInfo
self.merchant = merchant
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

/// Rows that display inside this table
enum Row: String, CaseIterable {
case onboarding = "Onboarding"
Expand Down Expand Up @@ -80,7 +80,7 @@ class MainViewController: UITableViewController {
navigationItem.titleView = navbarTitleButton
addChangeAppearanceButtonNavigationItem(to: self)
}

func addChangeAppearanceButtonNavigationItem(to viewController: UIViewController) {
// Add a button to change the appearance
let button = UIBarButtonItem(
Expand All @@ -94,7 +94,7 @@ class MainViewController: UITableViewController {
buttonItems = [button] + buttonItems
viewController.navigationItem.rightBarButtonItems = buttonItems
}

@objc
func selectAppearance() {
self.navigationController?.present(AppearanceSettings(componentManager: embeddedComponentManager).containerViewController, animated: true)
Expand All @@ -110,7 +110,7 @@ class MainViewController: UITableViewController {
case .payouts:
viewControllerToPush = embeddedComponentManager.createPayoutsViewController()
}

viewControllerToPush.navigationItem.backButtonDisplayMode = .minimal
addChangeAppearanceButtonNavigationItem(to: viewControllerToPush)
navigationController?.pushViewController(viewControllerToPush, animated: true)
Expand Down Expand Up @@ -141,28 +141,28 @@ class MainViewController: UITableViewController {

performAction(Row.allCases[indexPath.row], cell: cell)
}

@objc
func presentServerSettings() {
self.present(AppSettingsView(appInfo: appInfo).containerViewController, animated: true)
}

func presentAlert(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
self.present(alert, animated: true)
}

func customFonts() -> [EmbeddedComponentManager.CustomFontSource] {
// Note: The font name does not always match the file name,
// but it makes initialization of font source easier when it does.
let fonts: [String] = [
"Handjet-Regular",
"Handjet-Bold"
"Handjet-Bold",
]

let fontSources: [EmbeddedComponentManager.CustomFontSource] = fonts.map { fontName in
guard let fontFileURL = Bundle.main.url(forResource: fontName, withExtension: "ttf"),
guard let fontFileURL = Bundle.main.url(forResource: fontName, withExtension: "ttf"),
let font = UIFont(name: fontName, size: UIFont.systemFontSize) else {
print("Failed to load font with name \(fontName)")
return nil
Expand All @@ -174,8 +174,8 @@ class MainViewController: UITableViewController {
return nil
}
}
.compactMap({ $0})
.compactMap({ $0 })

if fontSources.count != fonts.count {
print("Failed to load some fonts. Below are the available fonts to choose from: ")
for family in UIFont.familyNames.sorted() {
Expand All @@ -185,7 +185,7 @@ class MainViewController: UITableViewController {
}
}
}

return fontSources
}
}

0 comments on commit e6e1eec

Please sign in to comment.