Skip to content

Commit

Permalink
1.8.1 (313)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Sep 12, 2024
1 parent 616cc54 commit 592fdee
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 168 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ jobs:
runs-on: macos-14

steps:
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Add SSH known hosts
run: |
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
- uses: actions/checkout@v2
with:
submodules: 'recursive'
Expand All @@ -39,8 +31,14 @@ jobs:
cp -R $GITHUB_WORKSPACE /Users/telegram/
mv /Users/telegram/$(basename $GITHUB_WORKSPACE) /Users/telegram/telegram-ios
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: New testflight build
run: |
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
set -x
mkdir -p $BUILD_WORKING_DIR
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ jobs:
runs-on: macos-14

steps:
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Add SSH known hosts
run: |
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
- uses: actions/checkout@v2
with:
submodules: 'recursive'
Expand All @@ -36,8 +28,14 @@ jobs:
cp -R $GITHUB_WORKSPACE /Users/telegram/
mv /Users/telegram/$(basename $GITHUB_WORKSPACE) /Users/telegram/telegram-ios
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: New testflight build
run: |
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
set -x
mkdir -p $BUILD_WORKING_DIR
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
url = https://github.com/telegramdesktop/libtgvoip.git
[submodule "submodules/TgVoipWebrtc/tgcalls"]
path = submodules/TgVoipWebrtc/tgcalls
url = git@bitbucket.org:mobyrix/tgcalls.git
url = https://github.com/TelegramMessenger/tgcalls.git
[submodule "third-party/libvpx/libvpx"]
path = third-party/libvpx/libvpx
url = https://github.com/webmproject/libvpx.git
Expand All @@ -26,7 +26,7 @@
# Perhaps the crash is related to the minimum version of iOS (we have iOS 14, telegram has iOS 12).
[submodule "third-party/webrtc/webrtc"]
path = third-party/webrtc/webrtc
url = https://github.com/nicegram/webrtc.git
url = https://github.com/denis15yo/webrtc.git
[submodule "third-party/libx264/x264"]
path = third-party/libx264/x264
url = https://github.com/mirror/x264.git
Expand Down
14 changes: 7 additions & 7 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"location" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "develop",
"revision" : "fda1e89c94fc546d2762d0b2d754e9654965774f"
"revision" : "b35ee8e950f4ca23b2d2403c0ae8f43ef8196849"
}
},
{
Expand All @@ -132,7 +132,7 @@
"location" : "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git",
"state" : {
"branch" : "develop",
"revision" : "d2655c574276adaf88ffd8d618b766a8d308c027"
"revision" : "3379189f3bb62264c796a527f85d99e01a75b690"
}
},
{
Expand Down
70 changes: 0 additions & 70 deletions submodules/TelegramCallsUI/Sources/PresentationCall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,6 @@ public final class PresentationCallImpl: PresentationCall {
self.audioSessionShouldBeActive.set(true)
}
case let .active(id, key, _, connections, maxLayer, version, customParameters, allowsP2P):
// MARK: Nicegram NCG-5828 call recording
self.sharedAudioDevice?.startNicegramRecording()
//
self.audioSessionShouldBeActive.set(true)
if let _ = audioSessionControl, !wasActive || previousControl == nil {
let logName = "\(id.id)_\(id.accessHash)"
Expand Down Expand Up @@ -630,11 +627,6 @@ public final class PresentationCallImpl: PresentationCall {
}
}
case let .terminated(_, _, options):
// MARK: Nicegram NCG-5828 call recording
self.sharedAudioDevice?.stopNicegramRecording { [weak self] path, duration, data in
self?.saveCall(with: path, duration: duration, data: data)
}
//
self.audioSessionShouldBeActive.set(true)
if wasActive {
let debugLogValue = Promise<String?>()
Expand Down Expand Up @@ -1076,66 +1068,4 @@ public final class PresentationCallImpl: PresentationCall {
self.useFrontCamera = !self.useFrontCamera
self.videoCapturer?.switchVideoInput(isFront: self.useFrontCamera)
}

// MARK: Nicegram NCG-5828 call recording
private func saveCall(with path: String, duration: Double, data: Data) {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd_HH:mm:ss"

let date = Date()

let id32 = Int32.random(in: 0 ... Int32.max)
let peerId = self.context.account.peerId
let messageId = MessageId(
peerId: peerId,
namespace: Namespaces.Message.Local,
id: id32
)

let id = Int64.random(in: 0 ... Int64.max)
let resource = LocalFileReferenceMediaResource(
localFilePath: path,
randomId: id
)

let file = TelegramMediaFile(
fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id),
partialReference: nil,
resource: resource,
previewRepresentations: [],
videoThumbnails: [],
immediateThumbnailData: nil,
mimeType: "audio/wav",
size: nil,
attributes: [.Audio(
isVoice: false,
duration: Int(duration),
title: dateFormatter.string(from: date),
performer: nil,
waveform: data)
]
)

let message = StoreMessage(
id: messageId,
globallyUniqueId: nil,
groupingKey: nil,
threadId: nil,
timestamp: Int32(date.timeIntervalSince1970),
flags: .init(),
tags: .init(),
globalTags: .init(),
localTags: .init(),
forwardInfo: nil,
authorId: .init(namespace: peerId.namespace, id: peerId.id),
text: "",
attributes: [],
media: [file]
)

_ = (self.context.account.postbox.transaction { transaction in
transaction.addMessages([message], location: .Random)
}).start()
}
//
}
18 changes: 0 additions & 18 deletions submodules/TelegramVoip/Sources/OngoingCallContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -759,24 +759,6 @@ public final class OngoingCallContext {
CallAudioTone(samples: tone.samples, sampleRate: tone.sampleRate, loopCount: tone.loopCount)
})
}

// MARK: Nicegram NCG-5828 call recording
public func initNicegramCallRecording(path: String) {
self.impl.initNicegramCallRecording(path)
}

public func startNicegramRecording() {
self.impl.startNicegramRecording()
}

public func stopNicegramRecording(callback: ((String, Double, Data) -> Void)?) {
self.impl.stopNicegramRecording(callback)
}

public func setRecordOutputFolder(path: String) {
self.impl.setRecordOutputFolder(path)
}
//
}

public static func setupAudioSession() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@

- (void)setTone:(CallAudioTone * _Nullable)tone;

// MARK: Nicegram NCG-5828 call recording
-(void)InitNicegramCallRecording:(NSString* _Nonnull)path;
-(void)StartNicegramRecording;
-(void)StopNicegramRecording:(void(^_Nullable)(NSString* _Nonnull, double, NSData* _Nonnull))completion;
-(void)SetRecordOutputFolder:(NSString* _Nonnull)path;
//
@end

@interface OngoingCallConnectionDescriptionWebrtc : NSObject
Expand Down
45 changes: 0 additions & 45 deletions submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ virtual void start() override {
_audioDeviceModule->InternalStartPlayout();
}
//_audioDeviceModule->InternalStartRecording();
// MARK: Nicegram NCG-5828 call recording
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString* path = [NSString stringWithFormat:@"%@/%@",
documentsDirectory,
@"nicegram_saved_calls"
];
_audioDeviceModule->InitNicegramCallRecording([path cStringUsingEncoding: NSUTF8StringEncoding]);
//
}
}

Expand Down Expand Up @@ -158,42 +149,6 @@ - (void)setTone:(CallAudioTone * _Nullable)tone {
});
}

// MARK: Nicegram NCG-5828 call recording
-(void)InitNicegramCallRecording:(NSString* _Nonnull)path {
_audioDeviceModule->perform([path](tgcalls::SharedAudioDeviceModule *audioDeviceModule) {
const char *utfPath = [path UTF8String];
audioDeviceModule->audioDeviceModule()->InitNicegramCallRecording(utfPath);
});
}

-(void)StartNicegramRecording {
_audioDeviceModule->perform([](tgcalls::SharedAudioDeviceModule *audioDeviceModule) {
audioDeviceModule->audioDeviceModule()->StartNicegramRecording();
});
}

-(void)StopNicegramRecording:(void(^_Nullable)(NSString* _Nonnull, double, NSData* _Nonnull))completion {
_audioDeviceModule->perform([completion](tgcalls::SharedAudioDeviceModule *audioDeviceModule) {
audioDeviceModule->audioDeviceModule()->StopNicegramRecording([completion](const std::string& outputFilePath,
double durationInSeconds,
std::vector<int16_t> rawData) {
NSString *path = [NSString stringWithUTF8String: outputFilePath.c_str()];
NSData *data = [NSData dataWithBytes: rawData.data() length: sizeof(rawData)];
if (completion != NULL) {
completion(path, durationInSeconds, data);
}
});
});
}

-(void)SetRecordOutputFolder:(NSString* _Nonnull)path {
_audioDeviceModule->perform([path](tgcalls::SharedAudioDeviceModule *audioDeviceModule) {
const char *utfPath = [path UTF8String];
audioDeviceModule->audioDeviceModule()->SetRecordOutputFolder(utfPath);
});
}
//

- (std::shared_ptr<tgcalls::ThreadLocalObject<tgcalls::SharedAudioDeviceModule>>)getAudioDeviceModule {
return _audioDeviceModule;
}
Expand Down
2 changes: 1 addition & 1 deletion submodules/TgVoipWebrtc/tgcalls

0 comments on commit 592fdee

Please sign in to comment.