Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace yytext, Complete refactor of theme code, Redesign of Profile and Inbox views #1144

Merged
merged 27 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cbb0f46
Fixed Profile bugs
ccrama Dec 14, 2020
6591922
Start of fixing new SwiftLint errors
ccrama Dec 14, 2020
517709e
LinkParser fixes
ccrama Dec 15, 2020
1c2e5cf
Be gone, YYText
ccrama Dec 15, 2020
39143fa
Got link handling on CommentDepthCell to a usable state, Need to conv…
ccrama Dec 16, 2020
1a6ffca
Moved new preview code to LinkCellView, Added new ProfilePreviewVC
ccrama Dec 16, 2020
103d69e
Fixed text views to support UIContextInteractions
ccrama Dec 16, 2020
8d02c5a
Fixed height constraints in TDSV, Fixed quote views
ccrama Dec 16, 2020
6ed5860
Fixed quote height estimation, Fixed table display
ccrama Dec 16, 2020
e616bd3
Fixed tapping at the top of CommentDepthCell
ccrama Dec 17, 2020
b085fff
Better context menu preview creation and interaction
ccrama Dec 17, 2020
a11e778
Complete refactor of non link/comment cells
ccrama Dec 17, 2020
6c8ac21
Code cleanup
ccrama Dec 17, 2020
8316c54
Fixed crashing on new cells
ccrama Dec 17, 2020
fb1d86d
Fix superscript
colejd Dec 17, 2020
f8a82d7
Replace only relevant attributes when fixing superscript
colejd Dec 17, 2020
c0a1119
Show relevant user actions for profile content preview
ccrama Dec 17, 2020
c5186c9
Complete redesign of CommentCellView
ccrama Dec 18, 2020
9e0c042
Complete redesign of MessageCellView
ccrama Dec 18, 2020
f73a80e
Complete refactor of day/night theming, Breaks iOS 11 and 12 night mode
ccrama Dec 18, 2020
16e69f1
Fixed multi-quotes breaking TDSV
ccrama Dec 18, 2020
1c4c30e
Fixed 'Loading...' on More cells
ccrama Dec 18, 2020
98ad47c
Fix iOS 11 and 12 support
ccrama Dec 18, 2020
6179745
Fixed Swift Lint errors
ccrama Dec 18, 2020
1b19101
Fixed thumbnail images not changing colors with theme
ccrama Dec 18, 2020
f37f9df
Bug fixes, Fixed scrolling tables/code blocks on comments without int…
ccrama Dec 19, 2020
1707cce
Fixed Comments gestures
ccrama Dec 19, 2020
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
3 changes: 1 addition & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ target 'Slide for Reddit' do
pod 'SwiftLinkPreview', '~> 3.0.1'
pod 'DTCoreText', :git => 'https://github.com/Cocoanetics/DTCoreText'
pod 'RLBAlertsPickers', :git => 'https://github.com/ccrama/Alerts-Pickers'
pod 'YYText'
pod 'Alamofire', '~> 4.3'
pod 'SwiftyJSON', :git => 'https://github.com/ccrama/SwiftyJSON.git', :branch => 'hotfix-xcode12'
pod "YoutubePlayer-in-WKWebView", "~> 0.3.0"
Expand Down Expand Up @@ -55,4 +54,4 @@ target 'Slide for Reddit' do

end

pod 'SwiftLint'
pod 'SwiftLint'
6 changes: 1 addition & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ PODS:
- SwiftyJSON (5.0.0)
- TGPControls (5.1.0)
- YoutubePlayer-in-WKWebView (0.3.4)
- YYText (1.0.7)

DEPENDENCIES:
- Alamofire (~> 4.3)
Expand All @@ -74,7 +73,6 @@ DEPENDENCIES:
- SwiftyJSON (from `https://github.com/ccrama/SwiftyJSON.git`, branch `hotfix-xcode12`)
- TGPControls
- YoutubePlayer-in-WKWebView (~> 0.3.0)
- YYText

SPEC REPOS:
trunk:
Expand All @@ -95,7 +93,6 @@ SPEC REPOS:
- SwiftLint
- TGPControls
- YoutubePlayer-in-WKWebView
- YYText

EXTERNAL SOURCES:
DTCoreText:
Expand Down Expand Up @@ -162,8 +159,7 @@ SPEC CHECKSUMS:
SwiftyJSON: f0574c07d8ca1644050db687067209e3033a89a0
TGPControls: 52c0770bee9c9aee364f1559cc627fc01ea5e8b2
YoutubePlayer-in-WKWebView: af2f5929fc78882d94bfdfeea999b661b78d9717
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849

PODFILE CHECKSUM: f3d5434b3387a84e7106b422142f47f6745fbb1f
PODFILE CHECKSUM: 921cd225b4120efa1cb2e0c32101c3932f6ceb0c

COCOAPODS: 1.10.0
178 changes: 96 additions & 82 deletions Slide for Reddit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions Slide for Reddit/AlbumViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class AlbumViewController: SwipeDownModalVC, UIPageViewControllerDataSource, UIP
navigationBar.isTranslucent = true
navigationBar.tintColor = .white
navItem = UINavigationItem(title: "Loading album...")
navigationBar.titleTextAttributes = convertToOptionalNSAttributedStringKeyDictionary([NSAttributedString.Key.foregroundColor.rawValue: UIColor.white])
navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]

let close = UIButton.init(type: .custom)
close.setImage(UIImage(sfString: SFSymbol.xmark, overrideString: "close")?.navIcon(true), for: UIControl.State.normal)
Expand Down Expand Up @@ -517,9 +517,3 @@ class AlbumViewController: SwipeDownModalVC, UIPageViewControllerDataSource, UIP
}

}

// Helper function inserted by Swift 4.2 migrator.
private func convertToOptionalNSAttributedStringKeyDictionary(_ input: [String: Any]?) -> [NSAttributedString.Key: Any]? {
guard let input = input else { return nil }
return Dictionary(uniqueKeysWithValues: input.map { key, value in (NSAttributedString.Key(rawValue: key), value) })
}
10 changes: 0 additions & 10 deletions Slide for Reddit/AnyModalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,3 @@ extension AVAsset {
return estimatedSize
}
}

// Helper function inserted by Swift 4.2 migrator.
private func convertFromAVAudioSessionCategory(_ input: AVAudioSession.Category) -> String {
return input.rawValue
}

// Helper function inserted by Swift 4.2 migrator.
private func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value) })
}
15 changes: 5 additions & 10 deletions Slide for Reddit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

self.backgroundTaskId = UIApplication.shared.beginBackgroundTask(withName: "Download New Messages") {
UIApplication.shared.endBackgroundTask(self.backgroundTaskId!)
self.backgroundTaskId = UIBackgroundTaskIdentifier(rawValue: convertFromUIBackgroundTaskIdentifier(UIBackgroundTaskIdentifier.invalid))
self.backgroundTaskId = UIBackgroundTaskIdentifier.invalid
}

func cleanup() {
UIApplication.shared.endBackgroundTask(self.backgroundTaskId!)
self.backgroundTaskId = UIBackgroundTaskIdentifier(rawValue: convertFromUIBackgroundTaskIdentifier(UIBackgroundTaskIdentifier.invalid))
self.backgroundTaskId = UIBackgroundTaskIdentifier.invalid
}

NSLog("getData running...")
Expand Down Expand Up @@ -878,7 +878,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if SettingValues.biometrics {
if backView == nil {
backView = UIView.init(frame: self.window!.frame)
backView?.backgroundColor = ColorUtil.theme.backgroundColor
backView?.backgroundColor = UIColor.backgroundColor
if let window = self.window {
window.insertSubview(backView!, at: 0)
backView!.edgeAnchors /==/ window.edgeAnchors
Expand Down Expand Up @@ -1110,14 +1110,9 @@ extension Session {
}
}

// Helper function inserted by Swift 4.2 migrator.
private func convertFromUIBackgroundTaskIdentifier(_ input: UIBackgroundTaskIdentifier) -> Int {
return input.rawValue
}

class CustomSplitController: UISplitViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
if ColorUtil.theme.isLight && SettingValues.reduceColor {
if UIColor.isLightTheme && SettingValues.reduceColor {
if #available(iOS 13, *) {
return .darkContent
} else {
Expand Down Expand Up @@ -1272,7 +1267,7 @@ class NoHomebarSplitViewController: UISplitViewController {
}

override var preferredStatusBarStyle: UIStatusBarStyle {
if ColorUtil.theme.isLight && SettingValues.reduceColor {
if UIColor.isLightTheme && SettingValues.reduceColor {
if #available(iOS 13, *) {
return .darkContent
} else {
Expand Down
6 changes: 3 additions & 3 deletions Slide for Reddit/AsyncAlertImagePickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ extension AlertController {
}

func setupTheme() {
self.visualStyle.backgroundColor = ColorUtil.theme.foregroundColor.withAlphaComponent(0.92)
self.visualStyle.backgroundColor = UIColor.foregroundColor.withAlphaComponent(0.92)
self.visualStyle.normalTextColor = ColorUtil.baseAccent
self.visualStyle.textFieldBorderColor = ColorUtil.theme.fontColor
self.visualStyle.actionHighlightColor = ColorUtil.theme.navIconColor
self.visualStyle.textFieldBorderColor = UIColor.fontColor
self.visualStyle.actionHighlightColor = UIColor.navIconColor
}
}

Expand Down
17 changes: 3 additions & 14 deletions Slide for Reddit/BannerUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class BannerUtil {

let finalText: NSMutableAttributedString!
if textParts.count > 1 {
let firstPart = NSMutableAttributedString.init(string: textParts[0], attributes: convertToOptionalNSAttributedStringKeyDictionary([convertFromNSAttributedStringKey(NSAttributedString.Key.foregroundColor): UIColor.white, convertFromNSAttributedStringKey(NSAttributedString.Key.font): UIFont.boldSystemFont(ofSize: 12)]))
let secondPart = NSMutableAttributedString.init(string: "\n" + textParts[1], attributes: convertToOptionalNSAttributedStringKeyDictionary([convertFromNSAttributedStringKey(NSAttributedString.Key.foregroundColor): UIColor.white, convertFromNSAttributedStringKey(NSAttributedString.Key.font): UIFont.boldSystemFont(ofSize: 14)]))
let firstPart = NSMutableAttributedString.init(string: textParts[0], attributes: [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 12)])
let secondPart = NSMutableAttributedString.init(string: "\n" + textParts[1], attributes: [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 14)])
firstPart.append(secondPart)
finalText = firstPart
} else {
finalText = NSMutableAttributedString.init(string: text, attributes: convertToOptionalNSAttributedStringKeyDictionary([convertFromNSAttributedStringKey(NSAttributedString.Key.foregroundColor): UIColor.white, convertFromNSAttributedStringKey(NSAttributedString.Key.font): UIFont.boldSystemFont(ofSize: 14)]))
finalText = NSMutableAttributedString.init(string: text, attributes: [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 14)])
}
popup.attributedText = finalText
popup.numberOfLines = 0
Expand Down Expand Up @@ -72,14 +72,3 @@ public class BannerUtil {
SwiftEntryKit.display(entry: popup.withPadding(padding: UIEdgeInsets(top: 5, left: 50, bottom: 0, right: 50)), using: attributes)
}
}

// Helper function inserted by Swift 4.2 migrator.
private func convertToOptionalNSAttributedStringKeyDictionary(_ input: [String: Any]?) -> [NSAttributedString.Key: Any]? {
guard let input = input else { return nil }
return Dictionary(uniqueKeysWithValues: input.map { key, value in (NSAttributedString.Key(rawValue: key), value) })
}

// Helper function inserted by Swift 4.2 migrator.
private func convertFromNSAttributedStringKey(_ input: NSAttributedString.Key) -> String {
return input.rawValue
}
22 changes: 11 additions & 11 deletions Slide for Reddit/CacheSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class CacheSettings: BubbleSettingTableViewController {

public func createCell(_ cell: UITableViewCell, _ switchV: UISwitch? = nil, isOn: Bool, text: String) {
cell.textLabel?.text = text
cell.textLabel?.textColor = ColorUtil.theme.fontColor
cell.backgroundColor = ColorUtil.theme.foregroundColor
cell.textLabel?.textColor = UIColor.fontColor
cell.backgroundColor = UIColor.foregroundColor
cell.textLabel?.numberOfLines = 0
cell.textLabel?.lineBreakMode = .byWordWrapping
if let s = switchV {
Expand All @@ -52,27 +52,27 @@ class CacheSettings: BubbleSettingTableViewController {

createCell(autoCache, autoCacheSwitch, isOn: SettingValues.autoCache, text: "Cache subreddits automatically")
self.autoCache.detailTextLabel?.text = "Will run the first time Slide opens each day"
self.autoCache.detailTextLabel?.textColor = ColorUtil.theme.fontColor
self.autoCache.detailTextLabel?.textColor = UIColor.fontColor
self.autoCache.detailTextLabel?.lineBreakMode = .byWordWrapping
self.autoCache.detailTextLabel?.numberOfLines = 0

createCell(cacheContent, cacheContentSwitch, isOn: false, text: "Cache subreddits automatically")
self.cacheContent.detailTextLabel?.text = "Coming soon!"
self.cacheContent.detailTextLabel?.textColor = ColorUtil.theme.fontColor
self.cacheContent.detailTextLabel?.textColor = UIColor.fontColor
self.cacheContent.detailTextLabel?.lineBreakMode = .byWordWrapping
self.cacheContent.detailTextLabel?.numberOfLines = 0

self.tableView.tableFooterView = UIView()

createCell(depth, nil, isOn: false, text: "Depth of comments to cache")
self.depth.detailTextLabel?.text = "\(SettingValues.commentDepth) levels"
self.depth.detailTextLabel?.textColor = ColorUtil.theme.fontColor
self.depth.detailTextLabel?.textColor = UIColor.fontColor
self.depth.detailTextLabel?.lineBreakMode = .byWordWrapping
self.depth.detailTextLabel?.numberOfLines = 0

createCell(posts, nil, isOn: false, text: "Number of posts to cache in each subreddit")
self.posts.detailTextLabel?.text = "\(SettingValues.cachedPostsCount) posts"
self.posts.detailTextLabel?.textColor = ColorUtil.theme.fontColor
self.posts.detailTextLabel?.textColor = UIColor.fontColor
self.posts.detailTextLabel?.lineBreakMode = .byWordWrapping
self.posts.detailTextLabel?.numberOfLines = 0
}
Expand Down Expand Up @@ -159,8 +159,8 @@ class CacheSettings: BubbleSettingTableViewController {

actionSheetController.setupTheme()

actionSheetController.attributedTitle = NSAttributedString(string: "Posts to cache", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
actionSheetController.attributedMessage = NSAttributedString(string: "How many posts will cache in each subreddit", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
actionSheetController.attributedTitle = NSAttributedString(string: "Posts to cache", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor.fontColor])
actionSheetController.attributedMessage = NSAttributedString(string: "How many posts will cache in each subreddit", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: UIColor.fontColor])

actionSheetController.addChild(pickerView)

Expand Down Expand Up @@ -189,8 +189,8 @@ class CacheSettings: BubbleSettingTableViewController {

actionSheetController.setupTheme()

actionSheetController.attributedTitle = NSAttributedString(string: "Comment cache depth", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
actionSheetController.attributedMessage = NSAttributedString(string: "How deep comment chains will load to", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
actionSheetController.attributedTitle = NSAttributedString(string: "Comment cache depth", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor.fontColor])
actionSheetController.attributedMessage = NSAttributedString(string: "How deep comment chains will load to", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: UIColor.fontColor])

actionSheetController.addChild(pickerView)

Expand Down Expand Up @@ -223,7 +223,7 @@ class CacheSettings: BubbleSettingTableViewController {
let c = tableView.dequeueReusableCell(withIdentifier: "sub", for: indexPath) as! SubredditCellView
c.setSubreddit(subreddit: thing, nav: nil)
cell = c
cell?.backgroundColor = ColorUtil.theme.foregroundColor
cell?.backgroundColor = UIColor.foregroundColor
let aSwitch = UISwitch().then {
$0.onTintColor = ColorUtil.accentColorForSub(sub: thing)
}
Expand Down
Loading