This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update account creation legal statement (#1101)
* LEARNER-4934- Agreement Text update
- Loading branch information
1 parent
9d43338
commit 5b78cf5
Showing
22 changed files
with
6,383 additions
and
4,003 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// AgreementTextView.swift | ||
// edX | ||
// | ||
// Created by Zeeshan Arif on 4/25/18. | ||
// Copyright © 2018 edX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@objc enum AgreementType: UInt { | ||
case signIn, | ||
signUp | ||
} | ||
|
||
@objc protocol AgreementTextViewDelegate: class { | ||
func agreementTextView(_ textView: AgreementTextView, didSelect url: URL) | ||
} | ||
|
||
class AgreementTextView: UITextView { | ||
|
||
weak var agreementDelegate: AgreementTextViewDelegate? | ||
|
||
@objc func setup(for type: AgreementType) { | ||
let style = OEXMutableTextStyle(weight: .normal, size: .xSmall, color: OEXStyles.shared().neutralDark()) | ||
style.lineBreakMode = .byWordWrapping | ||
style.alignment = .center | ||
let platformName = OEXConfig.shared().platformName() | ||
let prefix: String | ||
switch type { | ||
case .signIn: | ||
prefix = Strings.Agreement.textPrefixSignin | ||
break | ||
case .signUp: | ||
prefix = Strings.Agreement.textPrefixSignup | ||
break | ||
} | ||
let eulaText = Strings.Agreement.linkTextEula(platformName: platformName) | ||
let tosText = Strings.Agreement.linkTextTos(platformName: platformName) | ||
let privacyPolicyText = Strings.Agreement.linkTextPrivacyPolicy | ||
let agreementText = "\(prefix)\(Strings.Agreement.text(eula: eulaText, tos: tosText, privacyPolicy: privacyPolicyText))" | ||
var attributedString = style.attributedString(withText: agreementText) | ||
if let eulaUrl = Bundle.main.url(forResource: "MobileAppEula", withExtension: "htm"), | ||
let tosUrl = Bundle.main.url(forResource: "TermsOfServices", withExtension: "htm"), | ||
let privacyPolicyUrl = Bundle.main.url(forResource: "PrivacyPolicy", withExtension: "htm") { | ||
attributedString = attributedString.addLink(on: eulaText, value: eulaUrl) | ||
attributedString = attributedString.addLink(on: tosText, value: tosUrl) | ||
attributedString = attributedString.addLink(on: privacyPolicyText, value: privacyPolicyUrl) | ||
} | ||
attributedText = attributedString | ||
isUserInteractionEnabled = true | ||
isScrollEnabled = false | ||
isEditable = false | ||
delegate = self | ||
} | ||
} | ||
|
||
extension AgreementTextView: UITextViewDelegate { | ||
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool { | ||
agreementDelegate?.agreementTextView(self, didSelect: URL) | ||
return false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
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
Oops, something went wrong.