From c5936c456510aae043ef28d15338311642ac5ae9 Mon Sep 17 00:00:00 2001 From: Mumthasir mohammed <> Date: Mon, 20 Nov 2023 21:44:01 +0530 Subject: [PATCH] Add #190: Localisation string file path issue fix --- .../Classes/Extension/ExtensionMethods.swift | 8 ++++++-- PrivacyDashboardiOS/Classes/PrivacyDashboard.swift | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PrivacyDashboardiOS/Classes/Extension/ExtensionMethods.swift b/PrivacyDashboardiOS/Classes/Extension/ExtensionMethods.swift index 61ccb10..1ad9a51 100644 --- a/PrivacyDashboardiOS/Classes/Extension/ExtensionMethods.swift +++ b/PrivacyDashboardiOS/Classes/Extension/ExtensionMethods.swift @@ -543,7 +543,11 @@ extension NSMutableAttributedString { extension String { var localized: String { let languageCode = BBConsentPrivacyDashboardiOS.shared.languageCode - let bundle = Bundle(url: Bundle.main.bundleURL.appendingPathComponent("Frameworks").appendingPathComponent("PrivacyDashboardiOS.framework").appendingPathComponent("/\(languageCode).lproj")) ?? Bundle.main - return NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: "") + if let bundle = Bundle(url: Bundle.main.bundleURL.appendingPathComponent("Frameworks").appendingPathComponent("PrivacyDashboardiOS.framework").appendingPathComponent("/\(languageCode).lproj")) { + return NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: "") + } else { + let bundle = Bundle(url: Bundle.main.bundleURL.appendingPathComponent("PrivacyDashboardiOS.bundle").appendingPathComponent("\(languageCode).lproj")) ?? Bundle.main + return NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: "") + } } } diff --git a/PrivacyDashboardiOS/Classes/PrivacyDashboard.swift b/PrivacyDashboardiOS/Classes/PrivacyDashboard.swift index 6ba13ed..37c3c13 100644 --- a/PrivacyDashboardiOS/Classes/PrivacyDashboard.swift +++ b/PrivacyDashboardiOS/Classes/PrivacyDashboard.swift @@ -11,8 +11,8 @@ public class PrivacyDashboard { public static var receiveDataBackFromPrivacyDashboard : (([String: Any]) -> Void)? // MARK: - Invoking 'PrivacyDashboard' iOS SDK - public static func showPrivacyDashboard(withApiKey: String, withUserId: String, withOrgId: String, withBaseUrl: String, withLocale: String?, accessToken: String = "", turnOnAskme: Bool, turnOnUserRequest: Bool, turnOnAttributeDetail: Bool) { - BBConsentPrivacyDashboardiOS.shared.languageCode = withLocale ?? "en" + public static func showPrivacyDashboard(withApiKey: String, withUserId: String, withOrgId: String, withBaseUrl: String, withLocale: String = "en", accessToken: String = "", turnOnAskme: Bool, turnOnUserRequest: Bool, turnOnAttributeDetail: Bool) { + BBConsentPrivacyDashboardiOS.shared.languageCode = withLocale BBConsentPrivacyDashboardiOS.shared.turnOnUserRequests = turnOnUserRequest BBConsentPrivacyDashboardiOS.shared.turnOnAskMeSection = turnOnAskme BBConsentPrivacyDashboardiOS.shared.turnOnAttributeDetailScreen = turnOnAttributeDetail