MESSENGER-4682 imprint from wellknown (and fix lab feature list)

This commit is contained in:
Frank Rotermund
2023-06-22 09:48:24 +00:00
committed by JanNiklas Grabowski
parent c9296cc3a9
commit f70e354f75
8 changed files with 61 additions and 12 deletions

View File

@@ -635,4 +635,7 @@ class BWIBuildSettings: NSObject {
// MARK: Voice Broadcast
var enableLabFeatureVoiceBroadcasts = false
// MARK: WYSIWYG
var enableLabFeatureWYSIWYG = false
}

View File

@@ -33,6 +33,9 @@ extension BWIBuildSettings {
bwiLocationShareButtonVisible = false
bwiLoginFlowLayout = false
useRustEncryption = true
enableLabFeatureVoiceBroadcasts = false
enableLabFeatureWYSIWYG = true
}
}

View File

@@ -205,6 +205,7 @@
"settings_password_has_no_lowercase_letter" = "Das Passwort muss mindestens einen Kleinbuchstaben enthalten";
"settings_about" = "Erweitert";
"bwi_settings_ignored_users_text" = "Ignorierte Nutzer";
"settings_imprint" = "Impressum";
// MARK: - Room Details

View File

@@ -161,6 +161,7 @@
"settings_password_has_no_lowercase_letter" = "The password must include at least one lowercase letter";
"settings_deactivate_my_account" = "Deactivate my account";
"settings_enable_inapp_notifications" = "Enable In-App notifications";
"settings_imprint" = "Imprint";
// MARK: - Room Details

View File

@@ -1523,6 +1523,10 @@ public class BWIL10n: NSObject {
public static var settingsGroupMessages: String {
return BWIL10n.tr("Bwi", "settings_group_messages")
}
/// Impressum
public static var settingsImprint: String {
return BWIL10n.tr("Bwi", "settings_imprint")
}
/// Mentions and Keywords
public static var settingsMentionsAndKeywords: String {
return BWIL10n.tr("Bwi", "settings_mentions_and_keywords")

View File

@@ -210,6 +210,7 @@ typedef NS_ENUM(NSUInteger, ABOUT)
ABOUT_TERM_CONDITIONS_INDEX,
ABOUT_ACCEPTABLE_USE_INDEX,
ABOUT_PRIVACY_INDEX,
ABOUT_IMPRINT_INDEX,
ABOUT_THIRD_PARTY_INDEX,
ABOUT_SUPPORT_INDEX,
ABOUT_SHOW_NSFW_ROOMS_INDEX,
@@ -219,7 +220,7 @@ typedef NS_ENUM(NSUInteger, ABOUT)
ABOUT_CLEAR_CACHE_INDEX,
ABOUT_REPORT_BUG_INDEX,
ABOUT_NETIQUETTE_INDEX,
ABOUT_ACCESSIBILITY_DECLARATION_INDEX
ABOUT_ACCESSIBILITY_DECLARATION_INDEX,
};
typedef NS_ENUM(NSUInteger, LABS_ENABLE)
@@ -733,6 +734,10 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
[sectionAbout addRowWithTag:ABOUT_ACCESSIBILITY_DECLARATION_INDEX];
}
[sectionAbout addRowWithTag:ABOUT_THIRD_PARTY_INDEX];
// bwi #4682 - Show Imprint
if ([self.mainSession.homeserverWellknown imprintURL]) {
[sectionAbout addRowWithTag:ABOUT_IMPRINT_INDEX];
}
sectionAbout.headerTitle = VectorL10n.settingsAbout;
[sectionAbout addRowWithTag:ABOUT_MARK_ALL_AS_READ_INDEX];
@@ -755,21 +760,23 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
if (BWIBuildSettings.shared.settingsScreenShowLabSettings)
{
Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS];
[sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
if (BWIBuildSettings.shared.locationSharingEnabled)
{
[sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING];
}
[sectionLabs addRowWithTag:LABS_ENABLE_NEW_SESSION_MANAGER];
/* bwi: disabled for our apps
[sectionLabs addRowWithTag:LABS_ENABLE_NEW_CLIENT_INFO_FEATURE];
[sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
[sectionLabs addRowWithTag:LABS_ENABLE_NEW_CLIENT_INFO_FEATURE];
[sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING];
*/
if (@available(iOS 15.0, *))
{
[sectionLabs addRowWithTag:LABS_ENABLE_WYSIWYG_COMPOSER];
if (BWIBuildSettings.shared.enableLabFeatureWYSIWYG) {
if (@available(iOS 15.0, *))
{
[sectionLabs addRowWithTag:LABS_ENABLE_WYSIWYG_COMPOSER];
}
}
// bwi: disabled for our apps
if (BWIBuildSettings.shared.enableLabFeatureVoiceBroadcasts)
{
@@ -2697,6 +2704,16 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
cell = thirdPartyCell;
}
else if (row == ABOUT_IMPRINT_INDEX)
{
MXKTableViewCell *imprintCell = [self getDefaultTableViewCell:tableView];
imprintCell.textLabel.text = [BWIL10n settingsImprint];
[imprintCell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
cell = imprintCell;
}
else if (row == ABOUT_SHOW_NSFW_ROOMS_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
@@ -3343,6 +3360,10 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
[self pushViewController:webViewViewController];
}
else if (row == ABOUT_IMPRINT_INDEX)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[self.mainSession.homeserverWellknown imprintURL]] options:@{} completionHandler:nil];
}
}
else if (section == SECTION_TAG_USER_SETTINGS)
{

View File

@@ -98,4 +98,18 @@ public extension MXWellKnown {
return nil
}
}
@objc func imprintURL() -> String? {
do {
guard let bwiDict = self.jsonDictionary()["de.bwi"] as? [String : Any] else {
return nil
}
let bwi = try WellknownBWI(dict: bwiDict)
return bwi.imprintURL
}
catch {
return nil
}
}
}

View File

@@ -19,6 +19,7 @@ import Foundation
struct WellknownBWI {
let dataPrivacyURL: String?
let imprintURL: String?
init(dict: [String: Any]) throws {
let jsonData = try JSONSerialization.data(withJSONObject: dict, options: [])
@@ -30,5 +31,6 @@ struct WellknownBWI {
extension WellknownBWI: Decodable {
enum CodingKeys: String, CodingKey {
case dataPrivacyURL = "data_privacy_url"
case imprintURL = "imprint_url"
}
}