-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from ibm-bluemix-mobile-services/development
In app feedback implementation for ios
- Loading branch information
Showing
71 changed files
with
14,572 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
coverage_service: coveralls | ||
xcodeproj: BMSAnalytics.xcodeproj | ||
scheme: BMSAnalytics iOS | ||
ignore: | ||
- Source/SSZipArchive/* | ||
- Source/Feedback/ComposeEditorViewController.swift | ||
- Source/Feedback/UIImageControllerViewController.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
Pod::Spec.new do |s| | ||
|
||
s.name = 'BMSAnalytics' | ||
s.version = '2.2.4' | ||
s.version = '2.2.5' | ||
s.summary = 'The analytics component of the Swift client SDK for IBM Bluemix Mobile Services' | ||
s.homepage = 'https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics' | ||
s.documentation_url = 'https://ibm-bluemix-mobile-services.github.io/API-docs/client-SDK/BMSAnalytics/Swift/index.html' | ||
s.license = 'Apache License, Version 2.0' | ||
s.authors = { 'IBM Bluemix Services Mobile SDK' => '[email protected]' } | ||
|
||
s.source = { :git => 'https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics.git', :tag => s.version } | ||
s.source_files = 'Source/**/*.swift' | ||
s.ios.exclude_files = 'Source/**/*watchOS*.swift' | ||
s.watchos.exclude_files = 'Source/**/*iOS*.swift' | ||
|
||
s.subspec 'SSZipArchive' do |ss| | ||
ss.source_files = 'Source/SSZipArchive/*.{m,h}', 'Source/SSZipArchive/minizip/*.{c,h}', 'Source/SSZipArchive/minizip/aes/*.{c,h}' | ||
ss.libraries = 'z' | ||
ss.pod_target_xcconfig = {'SWIFT_INCLUDE_PATHS' => '$(SRCROOT)/Source/SSZipArchive','LIBRARY_SEARCH_PATHS' => '$(SRCROOT)/Source/SSZipArchive'} | ||
ss.public_header_files= 'Source/SSZipArchive/*.h' | ||
end | ||
|
||
s.source_files = 'Source/**/*.swift','Source/Resource/*.h' | ||
s.ios.exclude_files = 'Source/**/*watchOS*.swift' | ||
s.watchos.exclude_files = 'Source/**/*iOS*.swift','Source/Feedback','Source/SSZipArchive/*.{swift,h}', 'Source/SSZipArchive/minizip/*.{c,h}', 'Source/SSZipArchive/minizip/aes/*.{c,h}' | ||
s.dependency 'BMSCore', '~> 2.1' | ||
|
||
s.requires_arc = true | ||
|
||
s.ios.resources = ['Source/Resources/*.{storyboard,xcassets,json,imageset,png}'] | ||
s.ios.deployment_target = '8.0' | ||
s.watchos.deployment_target = '2.0' | ||
|
||
end |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright 2016 IBM Corp. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
|
||
// MARK: - Swift 3 | ||
|
||
#if swift(>=3.0) | ||
|
||
import UIKit | ||
|
||
class ComposeEditorViewController: UIViewController { | ||
|
||
var messages: [String] = [String]() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
// messageBox.delegate = self as! UITextViewDelegate | ||
|
||
// Do any additional setup after loading the view. | ||
messageBox.placeholder = "Please enter your comments here" | ||
messageBox.textColor = UIColor.lightGray | ||
|
||
self.messageBox.textContainer.maximumNumberOfLines = 5 | ||
self.messageBox.textContainer.lineBreakMode = .byTruncatingTail | ||
|
||
messageBox.inputView = UIView() | ||
|
||
messageBox.translatesAutoresizingMaskIntoConstraints = false | ||
messageBox.isScrollEnabled = false | ||
|
||
func textViewDidChange(_ textView: UITextView) { | ||
let fixedWidth = messageBox.frame.size.width | ||
messageBox.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.greatestFiniteMagnitude)) | ||
let newSize = messageBox.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.greatestFiniteMagnitude)) | ||
var newFrame = messageBox.frame | ||
newFrame.size = CGSize(width: max(newSize.width, fixedWidth), height: newSize.height) | ||
messageBox.frame = newFrame | ||
} | ||
|
||
} | ||
|
||
@IBOutlet weak var messageBox: UITextView! | ||
|
||
@IBAction func messagePopupOK(_ sender: Any) { | ||
|
||
Feedback.messages.append(messageBox.text) | ||
|
||
dismiss(animated: false, completion: nil) | ||
} | ||
|
||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | ||
self.view.endEditing(true) | ||
} | ||
|
||
} | ||
|
||
extension UITextView: UITextViewDelegate { | ||
|
||
/// Resize the placeholder when the UITextView bounds change | ||
override open var bounds: CGRect { | ||
didSet { | ||
self.resizePlaceholder() | ||
} | ||
} | ||
|
||
/// The UITextView placeholder text | ||
public var placeholder: String? { | ||
get { | ||
var placeholderText: String? | ||
|
||
if let placeholderLabel = self.viewWithTag(100) as? UILabel { | ||
placeholderText = placeholderLabel.text | ||
} | ||
|
||
return placeholderText | ||
} | ||
set { | ||
if let placeholderLabel = self.viewWithTag(100) as? UILabel { | ||
placeholderLabel.text = newValue | ||
placeholderLabel.sizeToFit() | ||
} else { | ||
self.addPlaceholder(newValue!) | ||
} | ||
} | ||
} | ||
|
||
/// When the UITextView did change, show or hide the label based on if the UITextView is empty or not | ||
/// | ||
/// - Parameter textView: The UITextView that got updated | ||
public func textViewDidChange(_ textView: UITextView) { | ||
if let placeholderLabel = self.viewWithTag(100) as? UILabel { | ||
placeholderLabel.isHidden = self.text.characters.count > 0 | ||
} | ||
} | ||
|
||
/// Resize the placeholder UILabel to make sure it's in the same position as the UITextView text | ||
private func resizePlaceholder() { | ||
if let placeholderLabel = self.viewWithTag(100) as! UILabel? { | ||
let labelX = self.textContainer.lineFragmentPadding | ||
let labelY = self.textContainerInset.top - 2 | ||
let labelWidth = self.frame.width - (labelX * 2) | ||
let labelHeight = placeholderLabel.frame.height | ||
|
||
placeholderLabel.frame = CGRect(x: labelX, y: labelY, width: labelWidth, height: labelHeight) | ||
} | ||
} | ||
|
||
/// Adds a placeholder UILabel to this UITextView | ||
private func addPlaceholder(_ placeholderText: String) { | ||
let placeholderLabel = UILabel() | ||
|
||
placeholderLabel.text = placeholderText | ||
placeholderLabel.sizeToFit() | ||
|
||
placeholderLabel.font = self.font | ||
placeholderLabel.textColor = UIColor.lightGray | ||
placeholderLabel.tag = 100 | ||
|
||
placeholderLabel.isHidden = self.text.characters.count > 0 | ||
|
||
self.addSubview(placeholderLabel) | ||
self.resizePlaceholder() | ||
self.delegate = self | ||
} | ||
|
||
} | ||
|
||
#endif |
Oops, something went wrong.