Include EULA
This commit is contained in:
parent
610dfb4272
commit
495c19452e
|
@ -588,6 +588,7 @@
|
|||
B86BD08423399ACF000F5AE3 /* Modal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08323399ACF000F5AE3 /* Modal.swift */; };
|
||||
B86BD08623399CEF000F5AE3 /* SeedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86BD08523399CEF000F5AE3 /* SeedModal.swift */; };
|
||||
B8783E9C23EB8DDE00404FB8 /* GeneralUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8783E9B23EB8DDE00404FB8 /* GeneralUtilities.swift */; };
|
||||
B8783E9E23EB948D00404FB8 /* UILabel+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8783E9D23EB948D00404FB8 /* UILabel+Interaction.swift */; };
|
||||
B885D5F4233491AB00EE0D8E /* DeviceLinkingModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */; };
|
||||
B886B4A72398B23E00211ABE /* QRCodeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B886B4A62398B23E00211ABE /* QRCodeVC.swift */; };
|
||||
B886B4A92398BA1500211ABE /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B886B4A82398BA1500211ABE /* QRCode.swift */; };
|
||||
|
@ -1429,6 +1430,7 @@
|
|||
B86BD08323399ACF000F5AE3 /* Modal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modal.swift; sourceTree = "<group>"; };
|
||||
B86BD08523399CEF000F5AE3 /* SeedModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedModal.swift; sourceTree = "<group>"; };
|
||||
B8783E9B23EB8DDE00404FB8 /* GeneralUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralUtilities.swift; sourceTree = "<group>"; };
|
||||
B8783E9D23EB948D00404FB8 /* UILabel+Interaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+Interaction.swift"; sourceTree = "<group>"; };
|
||||
B885D5F3233491AB00EE0D8E /* DeviceLinkingModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLinkingModal.swift; sourceTree = "<group>"; };
|
||||
B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Constraints.swift"; sourceTree = "<group>"; };
|
||||
B886B4A62398B23E00211ABE /* QRCodeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeVC.swift; sourceTree = "<group>"; };
|
||||
|
@ -2804,6 +2806,7 @@
|
|||
B847570223D5698100759540 /* LokiPushNotificationManager.swift */,
|
||||
B84664F4235022F30083A1CD /* MentionUtilities.swift */,
|
||||
B886B4A82398BA1500211ABE /* QRCode.swift */,
|
||||
B8783E9D23EB948D00404FB8 /* UILabel+Interaction.swift */,
|
||||
);
|
||||
path = Utilities;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3838,6 +3841,7 @@
|
|||
34D1F0501F7D45A60066283D /* GifPickerCell.swift in Sources */,
|
||||
3496957421A301A100DCFE74 /* OWSBackupAPI.swift in Sources */,
|
||||
34D99C931F2937CC00D284D6 /* OWSAnalytics.swift in Sources */,
|
||||
B8783E9E23EB948D00404FB8 /* UILabel+Interaction.swift in Sources */,
|
||||
B80C6B5B2384C7F900FDBC8B /* DeviceNameModalDelegate.swift in Sources */,
|
||||
340FC8B8204DAC8D007AEB0F /* AddToGroupViewController.m in Sources */,
|
||||
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */,
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
extension UILabel {
|
||||
|
||||
func characterIndex(for point: CGPoint) -> Int {
|
||||
let textStorage = NSTextStorage(attributedString: attributedText!)
|
||||
let layoutManager = NSLayoutManager()
|
||||
textStorage.addLayoutManager(layoutManager)
|
||||
let textContainer = NSTextContainer(size: bounds.size)
|
||||
textContainer.lineFragmentPadding = 0
|
||||
textContainer.maximumNumberOfLines = numberOfLines
|
||||
textContainer.lineBreakMode = lineBreakMode
|
||||
layoutManager.addTextContainer(textContainer)
|
||||
return layoutManager.characterIndex(for: point, in: textContainer, fractionOfDistanceBetweenInsertionPoints: nil)
|
||||
}
|
||||
}
|
|
@ -25,10 +25,11 @@ final class RegisterVC : UIViewController {
|
|||
let result = UILabel()
|
||||
result.textColor = Colors.text
|
||||
result.font = .systemFont(ofSize: Values.verySmallFontSize)
|
||||
let text = "By using this service, you agree to our Terms and Conditions and Privacy Statement"
|
||||
let attributedText = NSMutableAttributedString(string: text)
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Terms and Conditions"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Privacy Statement"))
|
||||
let text = "By using this service, you agree to our Terms of Service, End User License Agreement (EULA) and Privacy Policy"
|
||||
let attributedText = NSMutableAttributedString(string: text, attributes: [ .font : UIFont.systemFont(ofSize: Values.verySmallFontSize) ])
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Terms of Service"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "End User License Agreement (EULA)"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Privacy Policy"))
|
||||
result.attributedText = attributedText
|
||||
result.numberOfLines = 0
|
||||
result.textAlignment = .center
|
||||
|
@ -201,7 +202,24 @@ final class RegisterVC : UIViewController {
|
|||
}
|
||||
|
||||
@objc private func handleLegalLabelTapped(_ tapGestureRecognizer: UITapGestureRecognizer) {
|
||||
let url = URL(string: "https://github.com/loki-project/loki-messenger-ios/blob/master/privacy-policy.md")!
|
||||
UIApplication.shared.open(url)
|
||||
let urlAsString: String?
|
||||
let tosRange = (legalLabel.text! as NSString).range(of: "Terms of Service")
|
||||
let eulaRange = (legalLabel.text! as NSString).range(of: "End User License Agreement (EULA)")
|
||||
let ppRange = (legalLabel.text! as NSString).range(of: "Privacy Policy")
|
||||
let touchInLegalLabelCoordinates = tapGestureRecognizer.location(in: legalLabel)
|
||||
let characterIndex = legalLabel.characterIndex(for: touchInLegalLabelCoordinates)
|
||||
if tosRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/legal/#tos"
|
||||
} else if eulaRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/legal/#eula"
|
||||
} else if ppRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/privacy-policy/"
|
||||
} else {
|
||||
urlAsString = nil
|
||||
}
|
||||
if let urlAsString = urlAsString {
|
||||
let url = URL(string: urlAsString)!
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,11 @@ final class RestoreVC : UIViewController {
|
|||
let result = UILabel()
|
||||
result.textColor = Colors.text
|
||||
result.font = .systemFont(ofSize: Values.verySmallFontSize)
|
||||
let text = "By using this service, you agree to our Terms and Conditions and Privacy Statement"
|
||||
let attributedText = NSMutableAttributedString(string: text)
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Terms and Conditions"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Privacy Statement"))
|
||||
let text = "By using this service, you agree to our Terms of Service, End User License Agreement (EULA) and Privacy Policy"
|
||||
let attributedText = NSMutableAttributedString(string: text, attributes: [ .font : UIFont.systemFont(ofSize: Values.verySmallFontSize) ])
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Terms of Service"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "End User License Agreement (EULA)"))
|
||||
attributedText.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "Privacy Policy"))
|
||||
result.attributedText = attributedText
|
||||
result.numberOfLines = 0
|
||||
result.textAlignment = .center
|
||||
|
@ -190,7 +191,24 @@ final class RestoreVC : UIViewController {
|
|||
}
|
||||
|
||||
@objc private func handleLegalLabelTapped(_ tapGestureRecognizer: UITapGestureRecognizer) {
|
||||
let url = URL(string: "https://github.com/loki-project/loki-messenger-ios/blob/master/privacy-policy.md")!
|
||||
UIApplication.shared.open(url)
|
||||
let urlAsString: String?
|
||||
let tosRange = (legalLabel.text! as NSString).range(of: "Terms of Service")
|
||||
let eulaRange = (legalLabel.text! as NSString).range(of: "End User License Agreement (EULA)")
|
||||
let ppRange = (legalLabel.text! as NSString).range(of: "Privacy Policy")
|
||||
let touchInLegalLabelCoordinates = tapGestureRecognizer.location(in: legalLabel)
|
||||
let characterIndex = legalLabel.characterIndex(for: touchInLegalLabelCoordinates)
|
||||
if tosRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/legal/#tos"
|
||||
} else if eulaRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/legal/#eula"
|
||||
} else if ppRange.contains(characterIndex) {
|
||||
urlAsString = "https://getsession.org/privacy-policy/"
|
||||
} else {
|
||||
urlAsString = nil
|
||||
}
|
||||
if let urlAsString = urlAsString {
|
||||
let url = URL(string: urlAsString)!
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue