Skip to content

Commit

Permalink
Merge pull request #8 from Applitom/master
Browse files Browse the repository at this point in the history
Project Maintenance
  • Loading branch information
Applitom authored Jul 23, 2019
2 parents 5fac7a8 + 1127f01 commit bbc4bde
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 59 deletions.
2 changes: 1 addition & 1 deletion ADNetPromoterScoreSurvey.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Pod::Spec.new do |s|

s.resources = "ADNetPromoterScoreSurvey/**/*.{xib,xcassets}"

s.swift_version = "4.0"
s.swift_version = "5.0"

end
22 changes: 11 additions & 11 deletions ADNetPromoterScoreSurvey.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
F1ABC4061F8CBFBF00D6D08A /* NPSFeedbackTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1ABC4051F8CBFBF00D6D08A /* NPSFeedbackTextView.swift */; };
F1ABC4081F8CEB8F00D6D08A /* NPSSendButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1ABC4071F8CEB8F00D6D08A /* NPSSendButton.swift */; };
F1ABC40A1F8CFFB400D6D08A /* NPSBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1ABC4091F8CFFB400D6D08A /* NPSBaseView.swift */; };
F1CD61F822E5E7F100AFEAF1 /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = F1CD61F722E5E7F100AFEAF1 /* CHANGELOG.md */; };
F1D3603E1F9CCA4900D84F39 /* NPSSurveyViewMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D3603D1F9CCA4900D84F39 /* NPSSurveyViewMock.swift */; };
F1D360421F9DCF4500D84F39 /* NetPromoterScoreSurveyDelegateMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D360411F9DCF4500D84F39 /* NetPromoterScoreSurveyDelegateMock.swift */; };
F1DA1E511F83A46D000C5E7D /* NPSFeedbackQuestionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1DA1E501F83A46D000C5E7D /* NPSFeedbackQuestionView.swift */; };
Expand Down Expand Up @@ -61,7 +62,7 @@
F15368D91F7D40A4008343F5 /* ADNetPromoterScoreSurvey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ADNetPromoterScoreSurvey.swift; sourceTree = "<group>"; };
F15368DE1F7D42E4008343F5 /* NPSSurveyView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NPSSurveyView.xib; sourceTree = "<group>"; };
F15368E01F7D435A008343F5 /* NPSSurveyView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSSurveyView.swift; sourceTree = "<group>"; };
F15368E21F7D4581008343F5 /* ADNetPromoterScoreSurvey.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ADNetPromoterScoreSurvey.podspec; sourceTree = "<group>"; };
F15368E21F7D4581008343F5 /* ADNetPromoterScoreSurvey.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ADNetPromoterScoreSurvey.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
F162AA891F81397F00F0A948 /* NPSScoreQuestionView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NPSScoreQuestionView.xib; sourceTree = "<group>"; };
F162AA8B1F8139AA00F0A948 /* NPSScoreQuestionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSScoreQuestionView.swift; sourceTree = "<group>"; };
F162AA8E1F813DD000F0A948 /* NetPromoterScoreSurveyDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetPromoterScoreSurveyDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -76,6 +77,7 @@
F1ABC4051F8CBFBF00D6D08A /* NPSFeedbackTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSFeedbackTextView.swift; sourceTree = "<group>"; };
F1ABC4071F8CEB8F00D6D08A /* NPSSendButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSSendButton.swift; sourceTree = "<group>"; };
F1ABC4091F8CFFB400D6D08A /* NPSBaseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSBaseView.swift; sourceTree = "<group>"; };
F1CD61F722E5E7F100AFEAF1 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
F1D3603D1F9CCA4900D84F39 /* NPSSurveyViewMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSSurveyViewMock.swift; sourceTree = "<group>"; };
F1D360411F9DCF4500D84F39 /* NetPromoterScoreSurveyDelegateMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetPromoterScoreSurveyDelegateMock.swift; sourceTree = "<group>"; };
F1DA1E501F83A46D000C5E7D /* NPSFeedbackQuestionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NPSFeedbackQuestionView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -114,6 +116,7 @@
isa = PBXGroup;
children = (
F15368E21F7D4581008343F5 /* ADNetPromoterScoreSurvey.podspec */,
F1CD61F722E5E7F100AFEAF1 /* CHANGELOG.md */,
F1FB198620027FB900EBB642 /* README.md */,
F1FB198820027FC200EBB642 /* LICENSE.md */,
F1FB198A20027FC900EBB642 /* Contributing.md */,
Expand Down Expand Up @@ -285,12 +288,12 @@
TargetAttributes = {
F15368821F7D1381008343F5 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
F153688B1F7D1381008343F5 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -320,6 +323,7 @@
buildActionMask = 2147483647;
files = (
F1DA1E531F83A481000C5E7D /* NPSFeedbackQuestionView.xib in Resources */,
F1CD61F822E5E7F100AFEAF1 /* CHANGELOG.md in Resources */,
F1DA1E571F83AA99000C5E7D /* NPSThankYouView.xib in Resources */,
F162AA8A1F81397F00F0A948 /* NPSScoreQuestionView.xib in Resources */,
F1FB198B20027FC900EBB642 /* Contributing.md in Resources */,
Expand Down Expand Up @@ -525,8 +529,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -546,8 +549,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.autodesk.ADNetPromoterScoreSurvey;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -560,8 +562,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.autodesk.ADNetPromoterScoreSurveyTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -574,8 +575,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.autodesk.ADNetPromoterScoreSurveyTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
14 changes: 7 additions & 7 deletions ADNetPromoterScoreSurvey/ADNetPromoterScoreSurvey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ import UIKit
case thankYouView
}

public enum NetPromoterType{
@objc public enum NetPromoterType: Int {

case unknown
case promoter
case passive
case detractor
}

@objc public class ADNetPromoterScoreSurvey : NSObject
@objcMembers public class ADNetPromoterScoreSurvey : NSObject
{
public weak var delegate : NetPromoterScoreSurveyDelegate?
public var appearance : NPSAppearance

public var currentSelectedScore: Int?{
public var currentSelectedScore: Int{

get{

Expand All @@ -40,12 +40,12 @@ public enum NetPromoterType{

get{

return self.getPromoterType(forScore: self.currentSelectedScore ?? -1)
return self.getPromoterType(forScore: self.currentSelectedScore)
}
}

fileprivate var surveyView : NPSSurveyViewProtocol?
fileprivate var lastSelectedScore : Int?
fileprivate var lastSelectedScore : Int = -1

public override init() {

Expand Down Expand Up @@ -132,9 +132,9 @@ extension ADNetPromoterScoreSurvey : NPSSurveyViewDelegate{

func surveyViewDidPressSendFeedback(_ surveyView: NPSSurveyViewProtocol, feedbackText: String){

let finalResult = NPSResult(finalScore: self.lastSelectedScore ?? -1,
let finalResult = NPSResult(finalScore: self.lastSelectedScore,
feedbackText: feedbackText,
promoterType: self.getPromoterType(forScore: self.lastSelectedScore ?? -1))
promoterType: self.getPromoterType(forScore: self.lastSelectedScore))

self.delegate?.netPromoterScoreSurveryCompleted?(self, surveyResult: finalResult)
self.surveyView?.showThankYouView()
Expand Down
2 changes: 1 addition & 1 deletion ADNetPromoterScoreSurvey/Data/NPSAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

public class NPSAppearance : NSObject {
@objcMembers public class NPSAppearance : NSObject {

private static let _defaultAppearance = NPSAppearance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

public class NPSFeedbackQuestionViewAppearance : NSObject{
@objcMembers public class NPSFeedbackQuestionViewAppearance : NSObject{

public var titleForPromoter = "Thanks for your feedback!"
public var titleForPassive = "Thanks for your feedback!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

public class NPSScoreQuestionViewAppearance: NSObject{
@objcMembers public class NPSScoreQuestionViewAppearance: NSObject{

public var questionText = "How likely are you to recommend the app to a friend or colleague?"
public var lowRankTitle = "Not likely"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

public class NPSThankYouViewAppearance : NSObject {
@objcMembers public class NPSThankYouViewAppearance : NSObject {

public var thankYouMessageText = "Thanks for your feedback"
public var thankYouMessageFont : UIFont?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ class NPSFeedbackTextView: UITextView {

private func commonInit() {

NotificationCenter.default.addObserver(self, selector: #selector(textDidChange),name: NSNotification.Name.UITextViewTextDidChange,object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(textDidChange),
name: UITextView.textDidChangeNotification,
object: nil)

placeholderLabel.font = font
placeholderLabel.textColor = placeholderColor
Expand Down Expand Up @@ -149,6 +152,6 @@ class NPSFeedbackTextView: UITextView {

deinit {

NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UITextViewTextDidChange,object: nil)
NotificationCenter.default.removeObserver(self, name: UITextView.textDidChangeNotification,object: nil)
}
}
12 changes: 6 additions & 6 deletions ADNetPromoterScoreSurvey/View/NPSFeedbackQuestionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ class NPSFeedbackQuestionView: NPSBaseView {

fileprivate func bindToKeyboard(){

NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChange), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChange), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
}

fileprivate func unbindFromKeyboard(){

NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
}

@objc func dismissKeyboard() {
Expand All @@ -200,12 +200,12 @@ class NPSFeedbackQuestionView: NPSBaseView {

guard let userInfo = notification.userInfo else { return }

let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as! Double
let curve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as! UInt
let targetFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as! Double
let curve = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as! UInt
let targetFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let newY = targetFrame.origin.y-self.frame.height

UIView.animateKeyframes(withDuration: duration, delay: 0.0, options: UIViewKeyframeAnimationOptions(rawValue: curve), animations: {
UIView.animateKeyframes(withDuration: duration, delay: 0.0, options: UIView.KeyframeAnimationOptions(rawValue: curve), animations: {

self.frame.origin.y = newY
})
Expand Down
Loading

0 comments on commit bbc4bde

Please sign in to comment.