-
Notifications
You must be signed in to change notification settings - Fork 18
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
Account Settings Cleanup - Support / FAQ / Email (2U) #198
Merged
volodymyr-chekyrta
merged 18 commits into
openedx:develop
from
touchapp:feat/support_faq_120
Dec 18, 2023
Merged
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
494a3ab
chore: add faq, open in browser screen
eyatsenkoperpetio 15c69fd
Merge branch 'develop' into feat/support_faq_120
eyatsenkoperpetio ed701ec
chore: merge develop to branch
eyatsenkoperpetio 65dcd7e
Merge branch 'develop' into feat/support_faq_120
eyatsenkoperpetio 6bc18cf
Merge branch 'develop' into feat/support_faq_120
eyatsenkoperpetio e3b2d29
chore: add new links Cookie Policy, Do Not Sell my Personal Informat…
eyatsenkoperpetio 4aa242a
chore: add folder subviews to profile
eyatsenkoperpetio 267e269
chore: add support language to support urls
eyatsenkoperpetio ce4b6e9
chore: add create button
eyatsenkoperpetio 88d1a4c
chore: add tests
eyatsenkoperpetio 713bd70
chore: fix language local
eyatsenkoperpetio aa72677
chore: changes PR feedback
eyatsenkoperpetio 3e0946e
chore: change strings
eyatsenkoperpetio 0f3e68f
chore: change strings
eyatsenkoperpetio ae22f8f
chore: changes from PR feedback
eyatsenkoperpetio 5895a08
chore: add progress to web browser
eyatsenkoperpetio 7196b2b
chore: show always progress when web page loading
eyatsenkoperpetio fec2fc2
chore: add show progress param to web browser
eyatsenkoperpetio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -10,17 +10,55 @@ import Foundation | |
private enum AgreementKeys: String { | ||
case privacyPolicyURL = "PRIVACY_POLICY_URL" | ||
case tosURL = "TOS_URL" | ||
case cookiePolicyURL = "COOKIE_POLICY_URL" | ||
case dataSellContentURL = "DATA_SELL_CONSENT_URL" | ||
case supportedLanguages = "SUPPORTED_LANGUAGES" | ||
} | ||
|
||
public class AgreementConfig: NSObject { | ||
public var privacyPolicyURL: URL? | ||
public var tosURL: URL? | ||
|
||
public var cookiePolicyURL: URL? | ||
public var dataSellContentURL: URL? | ||
public var supportedLanguages: [String]? | ||
|
||
init(dictionary: [String: AnyObject]) { | ||
privacyPolicyURL = (dictionary[AgreementKeys.privacyPolicyURL.rawValue] as? String).flatMap(URL.init) | ||
tosURL = (dictionary[AgreementKeys.tosURL.rawValue] as? String).flatMap(URL.init) | ||
supportedLanguages = dictionary[AgreementKeys.supportedLanguages.rawValue] as? [String] | ||
cookiePolicyURL = (dictionary[AgreementKeys.cookiePolicyURL.rawValue] as? String).flatMap(URL.init) | ||
dataSellContentURL = (dictionary[AgreementKeys.dataSellContentURL.rawValue] as? String).flatMap(URL.init) | ||
|
||
super.init() | ||
|
||
if let tosURL = dictionary[AgreementKeys.tosURL.rawValue] as? String { | ||
self.tosURL = URL(string: completePath(url: tosURL)) | ||
} | ||
|
||
if let privacyPolicyURL = dictionary[AgreementKeys.privacyPolicyURL.rawValue] as? String { | ||
self.privacyPolicyURL = URL(string: completePath(url: privacyPolicyURL)) | ||
} | ||
} | ||
|
||
private func completePath(url: String) -> String { | ||
let langCode = String(Locale.preferredLanguages.first?.prefix(2) ?? "") | ||
if let supportedLanguages = supportedLanguages, | ||
!supportedLanguages.contains(langCode) { | ||
return url | ||
} | ||
|
||
let URL = URL(string: url) | ||
let host = URL?.host ?? "" | ||
let components = url.components(separatedBy: host) | ||
|
||
if components.count != 2 { | ||
return url | ||
} | ||
|
||
if let firstComponent = components.first, let lastComponent = components.last { | ||
return "\(firstComponent)\(host)/\(langCode)\(lastComponent)" | ||
} | ||
|
||
return url | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please correct the indentation. |
||
} | ||
|
||
private let key = "AGREEMENT_URLS" | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,10 @@ class ConfigTests: XCTestCase { | |
"WHATS_NEW_ENABLED": true, | ||
"AGREEMENT_URLS": [ | ||
"PRIVACY_POLICY_URL": "https://www.example.com/privacy", | ||
"TOS_URL": "https://www.example.com/tos" | ||
"TOS_URL": "https://www.example.com/tos", | ||
"DATA_SELL_CONSENT_URL": "https://www.example.com/sell", | ||
"COOKIE_POLICY_URL": "https://www.example.com/cookie", | ||
"SUPPORTED_LANGUAGES": ["es"] | ||
], | ||
"FIREBASE": [ | ||
"ENABLED": true, | ||
|
@@ -73,6 +76,9 @@ class ConfigTests: XCTestCase { | |
|
||
XCTAssertEqual(config.agreement.privacyPolicyURL, URL(string: "https://www.example.com/privacy")) | ||
XCTAssertEqual(config.agreement.tosURL, URL(string: "https://www.example.com/tos")) | ||
XCTAssertEqual(config.agreement.cookiePolicyURL, URL(string: "https://www.example.com/cookie")) | ||
XCTAssertEqual(config.agreement.dataSellContentURL, URL(string: "https://www.example.com/sell")) | ||
XCTAssertEqual(config.agreement.supportedLanguages, ["es"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about moving the AgreementConfig tests to a different file, like to AgreementConfigTests? Thoughts? |
||
} | ||
|
||
func testFirebaseConfigInitialization() { | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding the prefix isn't a good option. I guess you can use the following code to get the desired code