Signal-iOS/Signal/src/ViewControllers/AppSettings/HelpViewController.swift
Michelle Linington a2d169c878 A whole bunch of bug fixes, design changes and PR feedback:
Bug fixes:
- Use a localized variant of the subject in localizedEmailSubject
- Debug switch should default on
- Fixed a constraint's incorrect RTL behavior
- Add chevrons to the HelpViewController table view cells
- VoiceOver action on SupportRequestTextView was totally broken, this
  fixes it.

Design changes:
- Remove navigation bar styling and adopt default translucent behavior

Other PR feedback:
- Move support constants out of TSConstants
- Mark OWSTableViewController subclasses as final, remove -contents
  override and just access the superclass' property like normal.
- Subviews of ContactSupportViewController should observe Theme changes
  themselves
- Perform early layout on the EmojiMoodPickerView's stack view to get
  correct corner radius
- EmojiMoodPickerView's Mood enum is now leveraging the Emoji enum
- A bunch of changes to SupportRequestTextView's placeholder handling.
  Now, the placeholder stays visible until the user enters text
2020-07-30 13:02:00 -07:00

62 lines
3.1 KiB
Swift

//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
import Foundation
@objc(OWSHelpViewController)
final class HelpViewController: OWSTableViewController {
override func viewDidLoad() {
contents = constructContents()
}
fileprivate func constructContents() -> OWSTableContents {
let helpTitle = NSLocalizedString("SETTINGS_HELP",
comment: "Title for support page in app settings.")
let supportCenterLabel = NSLocalizedString("HELP_SUPPORT_CENTER",
comment: "Help item that takes the user to the Signal support website")
let contactLabel = NSLocalizedString("HELP_CONTACT_US",
comment: "Help item allowing the user to file a support request")
return OWSTableContents(title: helpTitle, sections: [
OWSTableSection(header: {
// TODO: Replace this temporary view with design asset
guard let signalAsset = UIImage(named: "signal-logo-128") else { return nil }
let header = UIView()
header.backgroundColor = Theme.launchScreenBackground
let signalLogo = UIImageView(image: signalAsset)
signalLogo.contentMode = .scaleAspectFit
header.addSubview(signalLogo)
signalLogo.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30))
return header
}, items: [
OWSTableItem.disclosureItem(withText: supportCenterLabel, actionBlock: {
UIApplication.shared.open(SupportConstants.supportURL, options: [:])
}),
OWSTableItem.disclosureItem(withText: contactLabel, actionBlock: {
guard ComposeSupportEmailOperation.canSendEmails else {
let localizedSheetTitle = NSLocalizedString("EMAIL_SIGNAL_TITLE",
comment: "Title for the fallback support sheet if user cannot send email")
let localizedSheetMessage = NSLocalizedString("EMAIL_SIGNAL_MESSAGE",
comment: "Description for the fallback support sheet if user cannot send email")
let fallbackSheet = ActionSheetController(title: localizedSheetTitle,
message: localizedSheetMessage)
let buttonTitle = NSLocalizedString("BUTTON_OKAY", comment: "Label for the 'okay' button.")
fallbackSheet.addAction(ActionSheetAction(title: buttonTitle, style: .default))
self.presentActionSheet(fallbackSheet)
return
}
let supportVC = ContactSupportViewController()
let navVC = OWSNavigationController(rootViewController: supportVC)
self.presentFormSheet(navVC, animated: true)
})
])
])
}
}