Skip to content

Commit 3717a24

Browse files
author
overtake
committed
no message
1 parent 46636a7 commit 3717a24

File tree

231 files changed

+1614
-41616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+1614
-41616
lines changed

‎.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ url=git@github.com:overtake/rlottie.git
1616
[submodule "submodules/tgcalls"]
1717
path = submodules/tgcalls
1818
url = git@github.com:john-preston/tgcalls.git
19+
[submodule "submodules/AppCenter-sdk"]
20+
path = submodules/AppCenter-sdk
21+
url = git@github.com:overtake/appcenter-sdk-apple.git

‎Telegram-Mac.xcworkspace/contents.xcworkspacedata

+14-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Telegram-Mac/AppDelegate.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Cocoa
2-
2+
import FFMpegBinding
33
import SwiftSignalKit
44
import Postbox
55
import TelegramCore
@@ -160,7 +160,7 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
160160
}
161161

162162
DateUtils.setDateLocalizationFunc ({ key -> String in
163-
return _NSLocalizedString(key)
163+
return _NSLocalizedString(key!)
164164
})
165165

166166
setInputLocalizationFunc { (key) -> String in
@@ -193,7 +193,7 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
193193

194194
#if !APP_STORE
195195
if let secret = Bundle.main.infoDictionary?["APPCENTER_SECRET"] as? String {
196-
MSAppCenter.start(secret, withServices: [MSCrashes.self])
196+
AppCenter.start(withAppSecret: secret, services: [Crashes.self])
197197
}
198198
#endif
199199

‎Telegram-Mac/ApplicationContext.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ private final class ApplicationContainerView: View {
143143

144144
final class AuthorizedApplicationContext: NSObject, SplitViewDelegate {
145145

146-
147-
private var mediaKeyTap:SPMediaKeyTap?
148-
146+
149147
var rootView: View {
150148
return view
151149
}

‎Telegram-Mac/AudioPlayer.swift

-88
This file was deleted.

‎Telegram-Mac/AudioRecorder.swift

+17-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import Cocoa
10-
10+
import OpusBinding
1111
import Foundation
1212
import SwiftSignalKit
1313
import CoreMedia
@@ -142,12 +142,19 @@ private func rendererInputProc(refCon: UnsafeMutableRawPointer, ioActionFlags: U
142142
}
143143

144144
struct RecordedAudioData {
145-
let path: String
146-
let duration: Double
147-
let waveform: Data?
148-
let id:Int64?
145+
public let compressedData: Data
146+
public let duration: Double
147+
public let waveform: Data?
148+
public let id:Int64?
149+
public init(compressedData: Data, duration: Double, waveform: Data?, id: Int64?) {
150+
self.compressedData = compressedData
151+
self.duration = duration
152+
self.waveform = waveform
153+
self.id = id
154+
}
149155
}
150156

157+
151158
final class ManagedAudioRecorderContext {
152159
private let id: Int32
153160
private let micLevel: ValuePromise<Float>
@@ -175,15 +182,15 @@ final class ManagedAudioRecorderContext {
175182
private var recordingStateUpdateTimestamp: Double?
176183

177184

178-
init(queue: Queue, micLevel: ValuePromise<Float>, recordingState: ValuePromise<AudioRecordingState>, dataItem: TGDataItem, liveUploading: PreUploadManager?) {
185+
init(queue: Queue, micLevel: ValuePromise<Float>, recordingState: ValuePromise<AudioRecordingState>, liveUploading: PreUploadManager?) {
179186
assert(queue.isCurrent())
180187
self.liveUploading = liveUploading
181188
self.id = getNextRecorderContextId()
182189
self.micLevel = micLevel
183190
self.recordingState = recordingState
184191

185192
self.queue = queue
186-
self.dataItem = dataItem
193+
self.dataItem = TGDataItem()
187194
self.oggWriter = TGOggOpusWriter()
188195

189196
addAudioRecorderContext(self.id, self)
@@ -521,7 +528,7 @@ final class ManagedAudioRecorderContext {
521528

522529
}
523530
liveUploading?.fileDidChangedSize(true)
524-
return RecordedAudioData(path: self.dataItem.path(), duration: self.oggWriter.encodedDuration(), waveform: waveform, id: liveUploading?.id)
531+
return RecordedAudioData(compressedData: self.dataItem.data(), duration: self.oggWriter.encodedDuration(), waveform: waveform, id: liveUploading?.id)
525532
} else {
526533
return nil
527534
}
@@ -563,10 +570,10 @@ final class ManagedAudioRecorder {
563570
return self.recordingStateValue.get()
564571
}
565572

566-
init(liveUploading: PreUploadManager?, dataItem: TGDataItem) {
573+
init(liveUploading: PreUploadManager?) {
567574

568575
self.queue.async {
569-
let context = ManagedAudioRecorderContext(queue: self.queue, micLevel: self.micLevelValue, recordingState: self.recordingStateValue, dataItem: dataItem, liveUploading: liveUploading)
576+
let context = ManagedAudioRecorderContext(queue: self.queue, micLevel: self.micLevelValue, recordingState: self.recordingStateValue, liveUploading: liveUploading)
570577
self.contextRef = Unmanaged.passRetained(context)
571578
}
572579
}

‎Telegram-Mac/ChatMessageBubbleImages.swift

-27
Original file line numberDiff line numberDiff line change
@@ -104,33 +104,6 @@ func messageBubbleImageModern(incoming: Bool, fillColor: NSColor, strokeColor: N
104104
}
105105

106106

107-
func ninePartPiecesFromImageWithInsets(_ image: CGImage, capInsets: RHEdgeInsets) -> [CGImage] {
108-
109-
let imageWidth: CGFloat = image.backingSize.width
110-
let imageHeight: CGFloat = image.backingSize.height
111-
112-
let leftCapWidth: CGFloat = capInsets.left
113-
let topCapHeight: CGFloat = capInsets.top
114-
let rightCapWidth: CGFloat = capInsets.right
115-
let bottomCapHeight: CGFloat = capInsets.bottom
116-
117-
let centerSize: NSSize = NSMakeSize(imageWidth - leftCapWidth - rightCapWidth, imageHeight - topCapHeight - bottomCapHeight);
118-
119-
let topLeftCorner: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(0.0, imageHeight - topCapHeight, leftCapWidth, topCapHeight))
120-
let topEdgeFill: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(leftCapWidth, imageHeight - topCapHeight, centerSize.width, topCapHeight))
121-
let topRightCorner: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(imageWidth - rightCapWidth, imageHeight - topCapHeight, rightCapWidth, topCapHeight))
122-
123-
let leftEdgeFill: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(0.0, bottomCapHeight, leftCapWidth, centerSize.height))
124-
let centerFill: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(leftCapWidth, bottomCapHeight, centerSize.width, centerSize.height))
125-
let rightEdgeFill: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(imageWidth - rightCapWidth, bottomCapHeight, rightCapWidth, centerSize.height))
126-
127-
let bottomLeftCorner: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(0.0, 0.0, leftCapWidth, bottomCapHeight))
128-
let bottomEdgeFill: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(leftCapWidth, 0.0, centerSize.width, bottomCapHeight))
129-
let bottomRightCorner: CGImage = imageByReferencingRectOfExistingImage(image, NSMakeRect(imageWidth - rightCapWidth, 0.0, rightCapWidth, bottomCapHeight))
130-
131-
return [topLeftCorner, topEdgeFill, topRightCorner, leftEdgeFill, centerFill, rightEdgeFill, bottomLeftCorner, bottomEdgeFill, bottomRightCorner]
132-
}
133-
134107
func drawNinePartImage(_ context: CGContext, frame: NSRect, topLeftCorner: CGImage, topEdgeFill: CGImage, topRightCorner: CGImage, leftEdgeFill: CGImage, centerFill: CGImage, rightEdgeFill: CGImage, bottomLeftCorner: CGImage, bottomEdgeFill: CGImage, bottomRightCorner: CGImage){
135108

136109
let imageWidth: CGFloat = frame.size.width;

‎Telegram-Mac/ChatPresentationInterfaceState.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import Cocoa
10-
10+
import OpusBinding
1111
import Postbox
1212
import TelegramCore
1313
import SyncCore
@@ -215,9 +215,7 @@ final class ChatRecordingAudioState : ChatRecordingState {
215215
let id = arc4random64()
216216
let path = NSTemporaryDirectory() + "voice_message\(id).ogg"
217217
let uploadManager:PreUploadManager? = liveUpload ? PreUploadManager(path, account: account, id: id) : nil
218-
let dataItem = TGDataItem(filePath: path)
219-
220-
recorder = ManagedAudioRecorder(liveUploading: uploadManager, dataItem: dataItem)
218+
recorder = ManagedAudioRecorder(liveUploading: uploadManager)
221219
super.init(autohold: autohold)
222220
}
223221

‎Telegram-Mac/FFMpegAVCodec.h

-21
This file was deleted.

‎Telegram-Mac/FFMpegAVCodec.m

-42
This file was deleted.

‎Telegram-Mac/FFMpegAVCodecContext.h

-40
This file was deleted.

0 commit comments

Comments
 (0)