Skip to content

Commit

Permalink
Merge pull request #154 from DimensionSrl/feature/improve_access_not_…
Browse files Browse the repository at this point in the history
…granted_screen

Display authenticated user email on access not granted screen
  • Loading branch information
RudiThoeni authored Nov 28, 2024
2 parents 989ec24 + ce56794 commit 02bcf1e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,6 @@ final class AccessNotGrantedViewController: ContainerViewController {

private lazy var loadingViewController = LoadingViewController(style: .light)

private var accessNotGrantedViewController: BlockAccessViewController = {
let contentVC = BlockAccessViewController(nibName: nil, bundle: nil)
contentVC.text = .localized("outsider_user_title")
let detailedAttributedText: NSAttributedString = {
let text = String.localized("outsider_user_body")
let mAttributedText = NSMutableAttributedString(string: text,
attributes: [
.font: UIFont.preferredFont(forTextStyle: .body),
.foregroundColor: UIColor.noiSecondaryColor
])

if let range = text.range(of: String.localized("outsider_user_body_link_1_part")),
let url = URL(string: .localized("url_jobs_noi_techpark")) {
mAttributedText.addAttribute(.link,
value: url,
range: NSRange(range, in: text))
}

return NSAttributedString(attributedString: mAttributedText)
}()
contentVC.detailedAttributedText = detailedAttributedText
contentVC.primaryActionTitle = .localized("btn_logout")
return contentVC
}()

init(viewModel: MyAccountViewModel) {
self.viewModel = viewModel

Expand Down Expand Up @@ -84,16 +59,15 @@ private extension AccessNotGrantedViewController {
.sink { [weak self] isLoading in
if isLoading {
self?.showLoader()
} else {
self?.showAccessNotGranted()
}
}
.store(in: &subscriptions)

viewModel.$userInfoResult
.compactMap { $0 }
.receive(on: DispatchQueue.main)
.sink { [weak self] userInfo in
self?.showAccessNotGranted()
self?.showAccessNotGranted(with: userInfo)
}
.store(in: &subscriptions)

Expand All @@ -119,9 +93,36 @@ private extension AccessNotGrantedViewController {
content = loadingViewController
}

private func showAccessNotGranted() {
private func showAccessNotGranted(with userInfo: UserInfo) {
navigationController?.navigationBar.isHidden = false

let accessNotGrantedViewController: BlockAccessViewController = {
let contentVC = BlockAccessViewController(nibName: nil, bundle: nil)
contentVC.text = .localized("outsider_user_title")
let detailedAttributedText: NSAttributedString = {
let text = String.localizedStringWithFormat(
.localized("outsider_user_body_format"),
userInfo.email ?? "N/D"
)
let mAttributedText = NSMutableAttributedString(string: text,
attributes: [
.font: UIFont.preferredFont(forTextStyle: .body),
.foregroundColor: UIColor.noiSecondaryColor
])

if let range = text.range(of: String.localized("outsider_user_body_link_1_part")),
let url = URL(string: .localized("url_jobs_noi_techpark")) {
mAttributedText.addAttribute(.link,
value: url,
range: NSRange(range, in: text))
}

return NSAttributedString(attributedString: mAttributedText)
}()
contentVC.detailedAttributedText = detailedAttributedText
contentVC.primaryActionTitle = .localized("btn_logout")
return contentVC
}()
accessNotGrantedViewController.primaryAction = { [weak self] in
self?.viewModel.logout()
}
Expand Down
2 changes: 1 addition & 1 deletion NOICommunity/de.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* InfoPlist.strings (de)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down
4 changes: 2 additions & 2 deletions NOICommunity/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Localizable.strings (de)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down Expand Up @@ -303,7 +303,7 @@ Tab Orientate: button label */
"outsider_user_title" = "Hoppla, das hat leider nicht geklappt!";

/* Body of user outsider of NOI community */
"outsider_user_body" = "Die angegebene E-Mail-Adresse scheint in unserer Datenbank nicht auf. \n \nDiese App ist den Mitgliedern der NOI-Community vorbehalten. Wenn du Teil davon bist, prüfe bitte die angegebene E-Mail-Adresse und versuch es noch einmal. Klappt es dann immer noch nicht, schreib uns bitte eine E-Mail an [email protected]. \n \nDu möchtest auch zur NOI-Community gehören? Hier geht’s zu unseren Job-Angeboten.";
"outsider_user_body_format" = "Die angegebene E-Mail-Adresse (%@) scheint in unserer Datenbank nicht auf. \n \nDiese App ist den Mitgliedern der NOI-Community vorbehalten. Wenn du Teil davon bist, prüfe bitte die angegebene E-Mail-Adresse und versuch es noch einmal. Klappt es dann immer noch nicht, schreib uns bitte eine E-Mail an [email protected]. \n \nDu möchtest auch zur NOI-Community gehören? Hier geht’s zu unseren Job-Angeboten.";

/* Text to match for adding the first link inside outsider_user_body */
"outsider_user_body_link_1_part" = "Job-Angeboten";
Expand Down
2 changes: 1 addition & 1 deletion NOICommunity/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* InfoPlist.strings (en)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down
4 changes: 2 additions & 2 deletions NOICommunity/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Localizable.strings (en)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down Expand Up @@ -303,7 +303,7 @@ Tab Orientate: button label */
"outsider_user_title" = "Oops, that didn't work!";

/* Body of user outsider of NOI community */
"outsider_user_body" = "The e-mail address you provided does not exist in our database. \n \nThis app is reserved for members of the NOI-Community. If you are one of them, please check the e-mail address you entered and try again. It it still doesn’t work, please email us at [email protected]. \n \nWant to join the NOI-Community? Click here for our job offers!";
"outsider_user_body_format" = "The e-mail address (%@) you provided does not exist in our database. \n \nThis app is reserved for members of the NOI-Community. If you are one of them, please check the e-mail address you entered and try again. It it still doesn’t work, please email us at [email protected]. \n \nWant to join the NOI-Community? Click here for our job offers!";

/* Text to match for adding the first link inside outsider_user_body */
"outsider_user_body_link_1_part" = "here";
Expand Down
2 changes: 1 addition & 1 deletion NOICommunity/it.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* InfoPlist.strings (it)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down
4 changes: 2 additions & 2 deletions NOICommunity/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Localizable.strings (it)
* Copyright © 2021 Dimension S.r.l. All rights reserved.
*
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-07T11:58:16+0100
* Generated from "https://docs.google.com/spreadsheets/d/1Yiol3UqS-0I9q4R5HLifVMdGbTSe3ZwuYBAMPyZJthc/edit#gid=0" on 2024-11-28T14:57:14+0100
* Please do not edit this file by hand, use the export function from Google Sheet.
*/

Expand Down Expand Up @@ -303,7 +303,7 @@ Tab Orientate: button label */
"outsider_user_title" = "Ops, qualcosa è andato storto!";

/* Body of user outsider of NOI community */
"outsider_user_body" = "L'indirizzo e-mail inserito non è presente nel nostro database. \n \nQuesta app è riservata ai membri della NOI-Community. Se ne fai parte, controlla l'indirizzo e-mail inserito e riprova. Se il problema persiste, invia un'e-mail a [email protected]. \n \nVorresti entrare a far parte della NOI-Community? Clicca qui per le nostre offerte di lavoro.";
"outsider_user_body_format" = "L'indirizzo e-mail inserito (%@) non è presente nel nostro database. \n \nQuesta app è riservata ai membri della NOI-Community. Se ne fai parte, controlla l'indirizzo e-mail inserito e riprova. Se il problema persiste, invia un'e-mail a [email protected]. \n \nVorresti entrare a far parte della NOI-Community? Clicca qui per le nostre offerte di lavoro.";

/* Text to match for adding the first link inside outsider_user_body */
"outsider_user_body_link_1_part" = "offerte di lavoro";
Expand Down

0 comments on commit 02bcf1e

Please sign in to comment.