Skip to content

Commit

Permalink
11.2.1 - iOS 1️⃣7️⃣ 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
lancy-mega committed Sep 14, 2023
1 parent f870046 commit a31e3c4
Show file tree
Hide file tree
Showing 1,587 changed files with 19,287 additions and 6,875 deletions.
8 changes: 7 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ custom_rules:
regex: 'MEGAChatResultRequestDelegate'
name: "Disallow MEGAChatResultRequestDelegate"
message: "'MEGAChatResultRequestDelegate' is deprecated, use 'ChatRequestDelegate' instead"

avoid_empty_lines_at_the_top_of_the_file:
regex: '\A[\r\n]+'
name: "Avoid empty lines at the top of the file"
message: "No empty lines are allowed at the top of the file"

# Currently we use `only_rules` so that we can validate each and every default rule.
# Once everything has been set, we can start using the `disabled_rules` and `opt_in_rules`.
Expand Down Expand Up @@ -174,7 +179,8 @@ included: # Paths to include during linting. `--path` is ignored if present.
- Modules

excluded: # Paths to ignore during linting. Takes precedence over `included`.
- iMEGA/SwiftGen
- Modules/Localization/MEGAL10n/Sources/MEGAL10n/Strings+Generated.swift
- Modules/Localization/MEGAL10n/SwiftGen
- SwiftGen
- transifex
- Xcode Templates
Expand Down
859 changes: 507 additions & 352 deletions MEGA.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions MEGA.xcodeproj/xcshareddata/xcschemes/MEGA.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
ReferencedContainer = "container:MEGA.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "945222FC2A98AB1700C9DFAF"
BuildableName = "SearchDemo.app"
BlueprintName = "SearchDemo"
ReferencedContainer = "container:MEGA.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand Down
77 changes: 77 additions & 0 deletions MEGA.xcodeproj/xcshareddata/xcschemes/SearchDemo.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "945222FC2A98AB1700C9DFAF"
BuildableName = "SearchDemo.app"
BlueprintName = "SearchDemo"
ReferencedContainer = "container:MEGA.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "945222FC2A98AB1700C9DFAF"
BuildableName = "SearchDemo.app"
BlueprintName = "SearchDemo"
ReferencedContainer = "container:MEGA.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "945222FC2A98AB1700C9DFAF"
BuildableName = "SearchDemo.app"
BlueprintName = "SearchDemo"
ReferencedContainer = "container:MEGA.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 3 additions & 3 deletions MEGAData/Repository/Account/AccountRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final class AccountRepository: NSObject, AccountRepositoryProtocol {
private let sdk: MEGASdk
private let currentUserSource: CurrentUserSource

private let requestResultSourcePublisher = PassthroughSubject<Result<AccountRequestEntity, Error>, Never>()
var requestResultPublisher: AnyPublisher<Result<AccountRequestEntity, Error>, Never> {
private let requestResultSourcePublisher = PassthroughSubject<Result<AccountRequestEntity, any Error>, Never>()
var requestResultPublisher: AnyPublisher<Result<AccountRequestEntity, any Error>, Never> {
requestResultSourcePublisher.eraseToAnyPublisher()
}

Expand Down Expand Up @@ -78,7 +78,7 @@ final class AccountRepository: NSObject, AccountRepositoryProtocol {
}

func incomingContactsRequestsCount() -> Int {
sdk.incomingContactRequests().size.intValue
sdk.incomingContactRequests().size
}

func relevantUnseenUserAlertsCount() -> UInt {
Expand Down
4 changes: 2 additions & 2 deletions MEGAData/Repository/AudioVideo/AudioSessionRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class AudioSessionRepository: AudioSessionRepositoryProtocol {
var routeChanged: ((_ reason: AudioSessionRouteChangedReason, _ previousAudioPort: AudioPort?) -> Void)?

var isBluetoothAudioRouteAvailable: Bool {
audioSession.mnz_isBluetoothAudioRouteAvailable
audioSession.isBluetoothAudioRouteAvailable
}

var currentSelectedAudioPort: AudioPort {
Expand Down Expand Up @@ -137,7 +137,7 @@ final class AudioSessionRepository: AudioSessionRepositoryProtocol {
return false
}

return audioSession.mnz_isOutputEqual(toPortType: avAudioSessionPort)
return audioSession.isOutputEqualToPortType(avAudioSessionPort)
}

// MARK: - Private methods
Expand Down
45 changes: 45 additions & 0 deletions MEGAData/Repository/Calls/CallRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import MEGADomain

final class CallRepository: NSObject, CallRepositoryProtocol {

static var newRepo: CallRepository {
CallRepository(chatSdk: .shared, callActionManager: .shared)
}

private let chatSdk: MEGAChatSdk
private let callActionManager: CallActionManager
private var callbacksDelegate: (any CallCallbacksRepositoryProtocol)?
Expand Down Expand Up @@ -105,6 +109,25 @@ final class CallRepository: NSObject, CallRepositoryProtocol {
}
}

func startMeetingInWaitingRoomChat(for scheduledMeeting: ScheduledMeetingEntity, enableVideo: Bool, enableAudio: Bool, completion: @escaping (Result<CallEntity, CallErrorEntity>) -> Void) {
let delegate = createStartMeetingRequestDelegate(for: scheduledMeeting.chatId, completion: completion)
callActionManager.startMeetingInWaitingRoomChat(chatId: scheduledMeeting.chatId, scheduledId: scheduledMeeting.scheduledId, enableVideo: enableVideo, enableAudio: enableAudio, delegate: delegate)
}

@MainActor
func startMeetingInWaitingRoomChat(for scheduledMeeting: ScheduledMeetingEntity, enableVideo: Bool, enableAudio: Bool) async throws -> CallEntity {
try await withCheckedThrowingContinuation { continuation in
startMeetingInWaitingRoomChat(for: scheduledMeeting, enableVideo: enableVideo, enableAudio: enableAudio) { result in
switch result {
case .success(let callEntity):
continuation.resume(returning: callEntity)
case .failure(let error):
continuation.resume(throwing: error)
}
}
}
}

func joinCall(for chatId: HandleEntity, enableVideo: Bool, enableAudio: Bool, completion: @escaping (Result<CallEntity, CallErrorEntity>) -> Void) {
guard let activeCall = chatSdk.chatCall(forChatId: chatId) else {
completion(.failure(.generic))
Expand Down Expand Up @@ -144,6 +167,18 @@ final class CallRepository: NSObject, CallRepositoryProtocol {
chatSdk.remove(fromChat: call.chatId, userHandle: peerId)
}

func allowUsersJoinCall(_ call: CallEntity, users: [UInt64]) {
chatSdk.allowUsersJoinCall(call.chatId, usersHandles: users.map(NSNumber.init(value:)))
}

func kickUsersFromCall(_ call: CallEntity, users: [UInt64]) {
chatSdk.kickUsers(fromCall: call.callId, usersHandles: users.map(NSNumber.init(value:)))
}

func pushUsersIntoWaitingRoom(for scheduledMeeting: ScheduledMeetingEntity, users: [UInt64]) {
chatSdk.pushUsers(intoWaitingRoom: scheduledMeeting.chatId, usersHandles: users.map(NSNumber.init(value:)))
}

func makePeerAModerator(inCall call: CallEntity, peerId: UInt64) {
chatSdk.updateChatPermissions(call.chatId, userHandle: peerId, privilege: MEGAChatRoomPrivilege.moderator.rawValue)
}
Expand Down Expand Up @@ -317,6 +352,16 @@ extension CallRepository: MEGAChatCallDelegate {
break
}
}

if call.hasChanged(for: .waitingRoomUsersEntered) {
guard let usersHandle = call.waitingRoomHandleList.toHandleEntityArray() else { return }
callbacksDelegate?.waitingRoomUsersEntered(with: usersHandle)
}

if call.hasChanged(for: .waitingRoomUsersLeave) {
guard let usersHandle = call.waitingRoomHandleList.toHandleEntityArray() else { return }
callbacksDelegate?.waitingRoomUsersLeave(with: usersHandle)
}
case .terminatingUserParticipation, .destroyed:
callbacksDelegate?.callTerminated(call.toCallEntity())
case .userNoPresent:
Expand Down
Loading

0 comments on commit a31e3c4

Please sign in to comment.