Skip to content
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

957 utiliser les feature flags pour activer la voip pour dinum seulement #958

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Btchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ final class BuildSettings: NSObject {
static let tchapFeatureNotificationByEmail = "tchapFeatureNotificationByEmail"
static let tchapFeatureVoiceOverIP = "tchapFeatureVoiceOverIP"
static let tchapFeatureVideoOverIP = "tchapFeatureVideoOverIP" // Tchap: in pre-prod, allow any feature to any instance.
static var tchapFeatureByHomeServer: [String: [String]] = [
static var tchapFeaturesAllowedHomeServersForFeature: [String: [String]] = [
tchapFeatureAnyFeature: [ tchapFeatureAnyHomeServer ]
]

Expand Down
2 changes: 1 addition & 1 deletion DevTchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ final class BuildSettings: NSObject {
static let tchapFeatureNotificationByEmail = "tchapFeatureNotificationByEmail"
static let tchapFeatureVoiceOverIP = "tchapFeatureVoiceOverIP"
static let tchapFeatureVideoOverIP = "tchapFeatureVideoOverIP" // Tchap: in Dev, allow any feature to any instance.
static var tchapFeatureByHomeServer: [String: [String]] = [
static var tchapFeaturesAllowedHomeServersForFeature: [String: [String]] = [
tchapFeatureAnyFeature: [ tchapFeatureAnyHomeServer ]
]

Expand Down
13 changes: 3 additions & 10 deletions Riot/Modules/Room/RoomDisplayConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@ class RoomDisplayConfiguration: NSObject {
guard _tchapCallsEnabled,
let account = MXKAccountManager.shared().activeAccounts.first
else { return false }
// Tchap: allow VoIP for Pre-prod and Dev version
if ["fr.gouv.btchap", "fr.gouv.tchap.dev"].contains(BuildSettings.baseBundleIdentifier)
{
// Tchap: actually, only allow VoIP for DINUM homeServer.
if (account.isFeatureActivated(BuildSettings.tchapFeatureVoiceOverIP) || account.isFeatureActivated(BuildSettings.tchapFeatureVideoOverIP)) {
return true
}
// Tchap: actually, only allow VoIP for DINUM homeServer.
let allowedHomeServersForCalls = ["agent.dinum.tchap.gouv.fr"]
guard let currentHomeServerName = account.mxSession.credentials.homeServerName() else {
else {
return false
}
let callsAreEnabled = allowedHomeServersForCalls.firstIndex {
currentHomeServerName.hasSuffix($0)
} != nil
return callsAreEnabled
}

let integrationsEnabled: Bool
Expand Down
33 changes: 20 additions & 13 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1955,20 +1955,27 @@ - (void)refreshRoomTitle
&& self.roomDataSource.room.isDirect
&& !self.mainSession.vc_homeserverConfiguration.jitsi.useFor1To1Calls)
{
// voice call button for Matrix call
UIBarButtonItem *itemVoice = [[UIBarButtonItem alloc] initWithImage:AssetImages.voiceCallHangonIcon.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onVoiceCallPressed:)];
itemVoice.accessibilityLabel = [VectorL10n roomAccessibilityCall];
itemVoice.enabled = !self.isCallActive;
[rightBarButtonItems addObject:itemVoice];
MXKAccount *account = MXKAccountManager.sharedManager.activeAccounts.firstObject;

// video call button for Matrix call
// Tchap: Disable video call actually
// UIBarButtonItem *itemVideo = [self videoCallBarButtonItem];
// itemVideo.enabled = !self.isCallActive;
// [rightBarButtonItems addObject:itemVideo];
if (account != nil && [account isFeatureActivated:BuildSettings.tchapFeatureVoiceOverIP])
{
// voice call button for Matrix call
UIBarButtonItem *itemVoice = [[UIBarButtonItem alloc] initWithImage:AssetImages.voiceCallHangonIcon.image
style:UIBarButtonItemStylePlain
target:self
action:@selector(onVoiceCallPressed:)];
itemVoice.accessibilityLabel = [VectorL10n roomAccessibilityCall];
itemVoice.enabled = !self.isCallActive;
[rightBarButtonItems addObject:itemVoice];
}

if (account != nil && [account isFeatureActivated:BuildSettings.tchapFeatureVideoOverIP])
{
// video call button for Matrix call
UIBarButtonItem *itemVideo = [self videoCallBarButtonItem];
itemVideo.enabled = !self.isCallActive;
[rightBarButtonItems addObject:itemVideo];
}
}
else
{
Expand Down
9 changes: 8 additions & 1 deletion Tchap/Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,17 @@ final class BuildSettings: NSObject {
static let tchapFeatureNotificationByEmail = "tchapFeatureNotificationByEmail"
static let tchapFeatureVoiceOverIP = "tchapFeatureVoiceOverIP"
static let tchapFeatureVideoOverIP = "tchapFeatureVideoOverIP"
static var tchapFeatureByHomeServer: [String: [String]] = [
static var tchapFeaturesAllowedHomeServersForFeature: [String: [String]] = [
tchapFeatureNotificationByEmail: [
"agent.dinum.tchap.gouv.fr"
],
tchapFeatureVoiceOverIP: [
"agent.dinum.tchap.gouv.fr"
]
// No activation of video calls actually in Tchap Production.
// tchapFeatureVideoOverIP: [
// "agent.dinum.tchap.gouv.fr"
// ],
]

// MARK: - Side Menu
Expand Down
6 changes: 3 additions & 3 deletions Tchap/Extensions/Account+Tchap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
@objc extension MXKAccount {

func isFeatureActivated(_ featureId: String) -> Bool {
guard let targetedFeature = BuildSettings.tchapFeatureByHomeServer[featureId] ?? BuildSettings.tchapFeatureByHomeServer[BuildSettings.tchapFeatureAnyFeature] else {
guard let allowedHomeServers = BuildSettings.tchapFeaturesAllowedHomeServersForFeature[featureId] ?? BuildSettings.tchapFeaturesAllowedHomeServersForFeature[BuildSettings.tchapFeatureAnyFeature] else {

Check failure on line 22 in Tchap/Extensions/Account+Tchap.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'BuildSettings' has no member 'tchapFeaturesAllowedHomeServersForFeature'

Check failure on line 22 in Tchap/Extensions/Account+Tchap.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'BuildSettings' has no member 'tchapFeaturesAllowedHomeServersForFeature'

Check failure on line 22 in Tchap/Extensions/Account+Tchap.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'BuildSettings' has no member 'tchapFeaturesAllowedHomeServersForFeature'

Check failure on line 22 in Tchap/Extensions/Account+Tchap.swift

View workflow job for this annotation

GitHub Actions / Tests

type 'BuildSettings' has no member 'tchapFeaturesAllowedHomeServersForFeature'
return false
}

if targetedFeature.contains(BuildSettings.tchapFeatureAnyHomeServer) {
if allowedHomeServers.contains(BuildSettings.tchapFeatureAnyHomeServer) {
return true
}

Expand All @@ -33,6 +33,6 @@

let homeServerDomain = homeServerURL.replacingOccurrences(of: BuildSettings.serverUrlPrefix, with: "")

return targetedFeature.contains(homeServerDomain)
return allowedHomeServers.contains(homeServerDomain)
}
}
1 change: 1 addition & 0 deletions changelog.d/957.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Utiliser les Features Flags pour activer la VoIP pour la Dinum
Loading