Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Scribe/AboutTab/AboutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ extension AboutViewController {
let setting = section.section[indexPath.row]

let hasDescription = setting.shortDescription != nil
return hasDescription ? 80.0 : 48.0
let userDefaults = UserDefaults(suiteName: "group.be.scri.userDefaultsContainer")
let fontScale: CGFloat = userDefaults?.bool(forKey: "increaseTextSize") == true ? 1.25 : 1.0

if DeviceType.isPad {
return (hasDescription ? 110.0 : 72.0) * fontScale
}
return (hasDescription ? 80.0 : 48.0) * fontScale
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down
2 changes: 2 additions & 0 deletions Scribe/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
Expand Down
42 changes: 31 additions & 11 deletions Scribe/SettingsTab/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,26 +270,46 @@ extension SettingsViewController: UITableViewDelegate {
let setting = section.section[indexPath.row]

let hasDescription = setting.shortDescription != nil
return hasDescription ? 80.0 : 48.0
let userDefaults = UserDefaults(suiteName: "group.be.scri.userDefaultsContainer")
let fontScale: CGFloat = userDefaults?.bool(forKey: "increaseTextSize") == true ? 1.25 : 1.0

if DeviceType.isPad {
return (hasDescription ? 110.0 : 66.0) * fontScale
}
return (hasDescription ? 80.0 : 48.0) * fontScale
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView: UIView
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
let label = UILabel()
label.text = tableData[section].headingTitle
label.font = UIFont.boldSystemFont(ofSize: fontSize * 1.1)
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping

if let reusableHeaderView = tableView.headerView(forSection: section) {
headerView = reusableHeaderView
} else {
headerView = UIView(
frame: CGRect(x: 0, y: 0, width: parentTable.bounds.width, height: 32)
)
}
let horizontalPadding: CGFloat = 32
let verticalPadding: CGFloat = 16

let constrainedWidth = parentTable.bounds.width - horizontalPadding
let size = label.sizeThatFits(
CGSize(width: constrainedWidth, height: CGFloat.greatestFiniteMagnitude)
)

let minHeaderHeight: CGFloat = DeviceType.isPad ? 42.0 : 32.0
return max(size.height + verticalPadding, minHeaderHeight)
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerHeight = self.tableView(tableView, heightForHeaderInSection: section)
let headerView = UIView(
frame: CGRect(x: 0, y: 0, width: parentTable.bounds.width, height: headerHeight)
)

let label = UILabel(
frame: CGRect(
x: preferredLanguage.prefix(2) == "ar" ? -1 * headerView.bounds.width / 10 : 0,
y: 0,
width: headerView.bounds.width,
height: 32
height: headerHeight
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ final class InfoChildTableViewCell: UITableViewCell {
} else {
descriptionLabel.text = nil
descriptionLabel.isHidden = true
descriptionLabel.removeFromSuperview()
}

if section.hasToggle {
Expand Down
8 changes: 8 additions & 0 deletions Scribe/Views/SelectionViewTemplateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ extension SelectionViewTemplateViewController {
return cell
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let fontScale: CGFloat = userDefaults.bool(forKey: "increaseTextSize") ? 1.25 : 1.0
if DeviceType.isPad {
return 66.0 * fontScale
}
return 48.0 * fontScale
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! RadioTableViewCell
let oldLang = userDefaults.string(forKey: langCode + "TranslateLanguage") ?? "en"
Expand Down
7 changes: 5 additions & 2 deletions Scribe/Views/TableViewTemplateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ extension TableViewTemplateViewController {
let section = dataSet[indexPath.section]
let setting = section.section[indexPath.row]

let fontScale: CGFloat = userDefaults.bool(forKey: "increaseTextSize") ? 1.25 : 1.0

// If there's no description, return a fixed small height.
guard let description = setting.shortDescription
else {
return 54.0
return (DeviceType.isPad ? 66.0 : 54.0) * fontScale
}

// Calculate available width for text.
Expand Down Expand Up @@ -156,7 +158,8 @@ extension TableViewTemplateViewController {
).height

// Return total height: title + description + padding buffer.
return ceil(titleHeight + descHeight + 52)
let padding: CGFloat = DeviceType.isPad ? 64.0 : 52.0
return ceil((titleHeight + descHeight + padding) * fontScale)
}

override func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down
Loading