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
Menu 2.0 #1058
Menu 2.0 #1058
Changes from 1 commit
57860c2
d2a4044
0e2a935
799f2c7
1f25420
2cb5750
191f371
7926cfe
17afd7d
bbdaa80
7d19867
ea4f0d8
c3a737a
ee76b6a
f06a617
02dab4c
c0d29cd
736fc5e
5138870
ada5f14
134d4a9
d68cad8
c022eb5
7e30962
f781004
1d5d612
e6c7a1c
93c9a24
880de9e
40f11b9
99b171f
0bf5ddc
c57f709
1d9e0c3
de90bd1
32e1e30
bc45a12
f7fd274
839602c
8ad53f3
21d08ed
76ab847
File filter...
Jump to…
review
- Loading branch information
| @@ -25,6 +25,10 @@ class AddEditHeaderView: UIView { | ||
|
|
||
| backgroundColor = .white | ||
| addSubview(mainStackView) | ||
iccub
Author
Contributor
|
||
|
|
||
| mainStackView.snp.makeConstraints { | ||
| $0.edges.equalTo(self) | ||
| } | ||
| } | ||
|
|
||
| @available(*, unavailable) | ||
| @@ -20,7 +20,7 @@ class BookmarkDetailsView: AddEditHeaderView, BookmarkFormFieldsProtocol { | ||
|
|
||
| let urlTextField: UITextField? = UITextField().then { | ||
jhreis
Contributor
|
||
| $0.placeholder = Strings.BookmarkUrlPlaceholderText | ||
| $0.keyboardType = .webSearch | ||
| $0.keyboardType = .URL | ||
| $0.autocorrectionType = .no | ||
| $0.autocapitalizationType = .none | ||
| $0.smartDashesType = .no | ||
| @@ -56,21 +56,18 @@ class BookmarkDetailsView: AddEditHeaderView, BookmarkFormFieldsProtocol { | ||
|
|
||
| guard let urlTextField = urlTextField else { fatalError("Url text field must be set up") } | ||
|
|
||
| [UIView.separatorLine, contentStackView, UIView.separatorLine].forEach { | ||
| mainStackView.addArrangedSubview($0) | ||
| } | ||
| [UIView.separatorLine, contentStackView, UIView.separatorLine] | ||
| .forEach(mainStackView.addArrangedSubview) | ||
|
|
||
| [titleTextField, UIView.separatorLine, urlTextField].forEach { | ||
| textFieldsStackView.addArrangedSubview($0) | ||
| } | ||
| [titleTextField, UIView.separatorLine, urlTextField] | ||
| .forEach(textFieldsStackView.addArrangedSubview) | ||
|
|
||
| // Adding spacer view with zero width, UIStackView's spacing will take care | ||
| // about adding a left margin to the content stack view. | ||
| let emptySpacer = UIView.spacer(.horizontal, amount: 0) | ||
|
|
||
| [emptySpacer, faviconImageView, textFieldsStackView].forEach { | ||
| contentStackView.addArrangedSubview($0) | ||
| } | ||
| [emptySpacer, faviconImageView, textFieldsStackView] | ||
| .forEach(contentStackView.addArrangedSubview) | ||
|
|
||
| if let url = url, let favUrl = URL(string: url) { | ||
| faviconImageView.setIcon(nil, forURL: favUrl) | ||
| @@ -79,10 +76,6 @@ class BookmarkDetailsView: AddEditHeaderView, BookmarkFormFieldsProtocol { | ||
| titleTextField.text = title ?? Strings.NewBookmarkDefaultName | ||
| urlTextField.text = url ?? Strings.NewFolderDefaultName | ||
|
|
||
| mainStackView.snp.makeConstraints { | ||
| $0.edges.equalTo(self) | ||
| } | ||
|
|
||
| setupTextFieldTargets() | ||
| } | ||
|
|
||
| @@ -124,8 +124,6 @@ public final class Bookmark: NSManagedObject, WebsitePresentable, Syncable, CRUD | ||
|
|
||
| fetchRequest.predicate = predicate | ||
|
|
||
| //"parentFolder == %@" | ||
| return NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: context, | ||
| sectionNameKeyPath: nil, cacheName: nil) | ||
| } | ||
| @@ -146,9 +144,7 @@ public final class Bookmark: NSManagedObject, WebsitePresentable, Syncable, CRUD | ||
| // MARK: Update | ||
| public func update(customTitle: String?, url: String?) { | ||
| // Title can't be empty, except when coming from Sync | ||
| let isTitleEmpty = customTitle?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true | ||
| if customTitle == nil || isTitleEmpty { return } | ||
| if !containsCustomTitle { return } | ||
| updateInternal(customTitle: customTitle, url: url) | ||
| } | ||
|
|
||
| @@ -158,11 +154,16 @@ public final class Bookmark: NSManagedObject, WebsitePresentable, Syncable, CRUD | ||
| } | ||
|
|
||
| public func updateWithNewLocation(customTitle: String?, url: String?, location: Bookmark?) { | ||
jhreis
Contributor
|
||
| let isTitleEmpty = customTitle?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true | ||
| if customTitle == nil || isTitleEmpty { return } | ||
| if !containsCustomTitle { return } | ||
|
|
||
| updateInternal(customTitle: customTitle, url: url, location: .new(location: location)) | ||
| } | ||
|
|
||
| // Title can't be empty, except when coming from Sync | ||
| private var containsCustomTitle: Bool { | ||
| return customTitle?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false | ||
| } | ||
|
|
||
| public class func migrateBookmarkOrders() { | ||
| DataController.perform { context in | ||
| migrateOrder(forFavorites: true, context: context) | ||
then?