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

make title, message optional. #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MoElnaggar14
Copy link

add UIStackView that contain titleLabel, messageLabel to handle nil or empty title, message

@MoElnaggar14
Copy link
Author

@dkcas11 please, can you check this PR?

@@ -172,7 +171,11 @@ public class CRNotificationView: UIView, CRNotification {
}

@objc internal func dismissNotificationOnTap() {
delegate?.onNotificationTap(type: type,title: titleLabel.text, message: messageLabel.text)
guard let onClickDelegate = onClickDelegate else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant.

@@ -34,38 +34,42 @@ public class CRNotificationView: UIView, CRNotification {
label.translatesAutoresizingMaskIntoConstraints = false
label.font = UIFont.systemFont(ofSize: 13, weight: .semibold)
label.textColor = .white
label.numberOfLines = 2
label.numberOfLines = 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of notifications is to inform of lightweight information. If your text cannot fit within 2 lines you are doing something wrong and should use another approach to communicate your information to your user, like an alert.

@@ -9,7 +9,7 @@
import UIKit

public protocol CRNotificationDelegate {
func onNotificationTap(type: CRNotificationType, title: String?, message: String?)
func onNotificationTap()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the reason for removing this entirely?


private var completion: () -> () = {}
private var type: CRNotificationType
public var delegate: CRNotificationDelegate?
public var onClickDelegate: CRNotificationDelegate?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the delegate property renamed? There is no point in limiting the delegate property to such a narrow purpose. When you need other delegate methods you will need new specific protocols. It just polutes the codebase.

@dkcas11
Copy link
Owner

dkcas11 commented May 13, 2020

There is simply too big of a change in the API to consider this PR at its current state. Most of the stuff has recently been added by request of other users so this will be a breaking change in many ways.
It seems like this serves a very specific use case rather than appealing to a broader audience.
In regards to the amount of displayed text this has already been discussed a few times, such as here: #6
Im sorry, but i think its best to fork the repo and adjust the implementation for your needs and embed the framework from there :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants