From ee607ce091447ac8a38105d8c39d7f2b5006e973 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 20 Sep 2023 19:36:37 +0200 Subject: [PATCH] Remove unused Riot files --- .../xcshareddata/xcschemes/Riot.xcscheme | 117 ----------------- .../xcshareddata/swiftpm/Package.resolved | 95 -------------- Riot/Experiments/CryptoSDKFeature.swift | 123 ------------------ 3 files changed, 335 deletions(-) delete mode 100644 Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme delete mode 100644 Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved delete mode 100644 Riot/Experiments/CryptoSDKFeature.swift diff --git a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme b/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme deleted file mode 100644 index 52ec9a4e1..000000000 --- a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 4a7151c77..000000000 --- a/Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,95 +0,0 @@ -{ - "pins" : [ - { - "identity" : "devicekit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/devicekit/DeviceKit", - "state" : { - "revision" : "20e0991f3975916ab0f6d58db84d8bc64f883537", - "version" : "4.7.0" - } - }, - { - "identity" : "dtcoretext", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Cocoanetics/DTCoreText", - "state" : { - "revision" : "9d2d4d2296e5d2d852a7d3c592b817d913a5d020", - "version" : "1.6.27" - } - }, - { - "identity" : "dtfoundation", - "kind" : "remoteSourceControl", - "location" : "https://github.com/Cocoanetics/DTFoundation.git", - "state" : { - "revision" : "76062513434421cb6c8a1ae1d4f8368a7ebc2da3", - "version" : "1.7.18" - } - }, - { - "identity" : "maplibre-gl-native-distribution", - "kind" : "remoteSourceControl", - "location" : "https://github.com/maplibre/maplibre-gl-native-distribution", - "state" : { - "revision" : "d761956e81e74d8bdbfba31e0ec3a75616190658", - "version" : "5.12.2" - } - }, - { - "identity" : "matrix-analytics-events", - "kind" : "remoteSourceControl", - "location" : "https://github.com/matrix-org/matrix-analytics-events", - "state" : { - "revision" : "2f5fa5f1e2f6c6ae1a47c33d953a3ce289167eb0", - "version" : "0.5.0" - } - }, - { - "identity" : "matrix-wysiwyg-composer-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/matrix-org/matrix-wysiwyg-composer-swift", - "state" : { - "revision" : "1100b217c04d096dfe072afb4484660ff794d805", - "version" : "2.2.2" - } - }, - { - "identity" : "ogg-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/vector-im/ogg-swift.git", - "state" : { - "revision" : "9d82ed838404f10b607a1a1689f404563e9115c3", - "version" : "0.8.3" - } - }, - { - "identity" : "opus-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/vector-im/opus-swift", - "state" : { - "revision" : "11f1887767cbc87c4b64b789ee830b779cc744cb", - "version" : "0.8.4" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "48254824bb4248676bf7ce56014ff57b142b77eb", - "version" : "1.0.2" - } - }, - { - "identity" : "swift-ogg", - "kind" : "remoteSourceControl", - "location" : "https://github.com/vector-im/swift-ogg", - "state" : { - "branch" : "0.0.1", - "revision" : "e9a9e7601da662fd8b97d93781ff5c60b4becf88" - } - } - ], - "version" : 2 -} diff --git a/Riot/Experiments/CryptoSDKFeature.swift b/Riot/Experiments/CryptoSDKFeature.swift deleted file mode 100644 index 07127577c..000000000 --- a/Riot/Experiments/CryptoSDKFeature.swift +++ /dev/null @@ -1,123 +0,0 @@ -// -// Copyright 2023 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import MatrixSDKCrypto - -/// An implementation of `MXCryptoV2Feature` which uses `UserDefaults` to persist the enabled status -/// of `CryptoSDK`, and which uses feature flags to control rollout availability. -/// -/// The implementation uses both remote and local feature flags to control the availability of `CryptoSDK`. -/// Whilst remote is more convenient in that it allows changes to the rollout without new app releases, -/// it is not available to all users because it requires data tracking user consent. Remote therefore -/// represents the safer, albeit limited rollout strategy, whereas the local feature flags allows eventually -/// targetting all users, but each target change requires new app release. -/// -/// Additionally users can manually enable this feature from the settings if they are not already in the -/// feature group. -@objc class CryptoSDKFeature: NSObject, MXCryptoV2Feature { - @objc static let shared = CryptoSDKFeature() - - var isEnabled: Bool { - RiotSettings.shared.enableCryptoSDK - } - - var needsVerificationUpgrade: Bool { - get { - return RiotSettings.shared.showVerificationUpgradeAlert - } - set { - RiotSettings.shared.showVerificationUpgradeAlert = newValue - } - } - - private static let FeatureName = "ios-crypto-sdk" - private static let FeatureNameV2 = "ios-crypto-sdk-v2" - - private let remoteFeature: RemoteFeaturesClientProtocol - private let localFeature: PhasedRolloutFeature - - init( - remoteFeature: RemoteFeaturesClientProtocol = PostHogAnalyticsClient.shared, - localTargetPercentage: Double = 1 - ) { - self.remoteFeature = remoteFeature - // Tchap -// self.localFeature = PhasedRolloutFeature(name: Self.FeatureName, targetPercentage: localTargetPercentage) -#if TCHAP_PRODUCTION - self.localFeature = PhasedRolloutFeature(name: Self.FeatureName, targetPercentage: 1.0) -#elseif TCHAP_PREPRODUCTION - self.localFeature = PhasedRolloutFeature(name: Self.FeatureName, targetPercentage: 1.0) -#elseif TCHAP_DEVELOPMENT - self.localFeature = PhasedRolloutFeature(name: Self.FeatureName, targetPercentage: 1.0) -#else - self.localFeature = PhasedRolloutFeature(name: Self.FeatureName, targetPercentage: localTargetPercentage) -#endif - } - - func enable() { - RiotSettings.shared.enableCryptoSDK = true - Analytics.shared.trackCryptoSDKEnabled() - - MXLog.debug("[CryptoSDKFeature] Crypto SDK enabled") - } - - func enableIfAvailable(forUserId userId: String!) { - guard !isEnabled else { - MXLog.debug("[CryptoSDKFeature] enableIfAvailable: Feature is already enabled") - return - } - - guard let userId else { - MXLog.failure("[CryptoSDKFeature] enableIfAvailable: Missing user id") - return - } - - guard isFeatureEnabled(userId: userId) else { - MXLog.debug("[CryptoSDKFeature] enableIfAvailable: Feature is currently not available for this user") - return - } - - MXLog.debug("[CryptoSDKFeature] enableIfAvailable: Feature has become available for this user and will be enabled") - enable() - } - - @objc func canManuallyEnable(forUserId userId: String!) -> Bool { - guard let userId else { - MXLog.failure("[CryptoSDKFeature] canManuallyEnable: Missing user id") - return false - } - - // User can manually enable only if not already within the automatic feature group - return !isFeatureEnabled(userId: userId) - } - - @objc func reset() { - RiotSettings.shared.enableCryptoSDK = false - MXLog.debug("[CryptoSDKFeature] Crypto SDK disabled") - } - - private func isFeatureEnabled(userId: String) -> Bool { - // This feature includes app version with a bug, and thus will not be rolled out to 100% users - remoteFeature.isFeatureEnabled(Self.FeatureName) - - // Second version of the remote feature with a bugfix and released eventually to 100% users - || remoteFeature.isFeatureEnabled(Self.FeatureNameV2) - - // Local feature - || localFeature.isEnabled(userId: userId) - } -}