-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
541 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/xcode/Sources/VCamUI/Resources/Assets.xcassets/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/xcode/Sources/VCamUI/Resources/Assets.xcassets/StatusItemIcon.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "StatusItemIcon.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true, | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file added
BIN
+2.36 KB
...xcode/Sources/VCamUI/Resources/Assets.xcassets/StatusItemIcon.imageset/StatusItemIcon.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// VCamSystem.swift | ||
// | ||
// | ||
// Created by Tatsuya Tanaka on 2023/02/25. | ||
// | ||
|
||
import Foundation | ||
import VCamAppExtension | ||
import VCamBridge | ||
import VCamTracking | ||
import VCamLogger | ||
|
||
public final class VCamSystem { | ||
public let pasteboardObserver = PasteboardObserver() | ||
|
||
public private(set) var isStarted = false | ||
public var isUniVCamSystemEnabled = false | ||
|
||
init() { | ||
ExtensionNotificationCenter.default.setObserver(for: .startCameraExtensionStream) { [weak self] in | ||
self?.startSystem() | ||
} | ||
|
||
ExtensionNotificationCenter.default.setObserver(for: .stopAllCameraExtensionStreams) { [weak self] in | ||
self?.stopSystem() | ||
} | ||
} | ||
|
||
public func startSystem() { | ||
Logger.log("\(isStarted)") | ||
guard !isStarted else { return } | ||
isStarted = true | ||
Tracking.shared.configure() | ||
AvatarAudioManager.shared.startIfNeeded() | ||
RenderTextureManager.shared.resume() | ||
pasteboardObserver.observe() | ||
UniBridge.shared.resumeApp() | ||
} | ||
|
||
public func stopSystem() { | ||
Logger.log("\(isStarted), \(WindowManager.shared.isWindowClosed)") | ||
guard isStarted, WindowManager.shared.isWindowClosed else { return } | ||
isStarted = false | ||
Tracking.shared.stop() | ||
AvatarAudioManager.shared.stop(usage: .all) | ||
VideoRecorder.shared.stop() | ||
RenderTextureManager.shared.pause() | ||
pasteboardObserver.dispose() | ||
UniBridge.shared.pauseApp() | ||
} | ||
|
||
public func dispose() { | ||
isStarted = false | ||
Tracking.shared.stop() | ||
AvatarAudioManager.shared.stop(usage: .all) | ||
VideoRecorder.shared.stop() | ||
RenderTextureManager.shared.pause() | ||
pasteboardObserver.dispose() | ||
UniBridge.shared.reset() | ||
} | ||
} | ||
|
||
private extension UniBridge { | ||
func reset() { | ||
intMapper.reset() | ||
boolMapper.reset() | ||
arrayMapper.reset() | ||
floatMapper.reset() | ||
stringMapper.reset() | ||
structMapper.reset() | ||
triggerMapper.reset() | ||
} | ||
} |
Oops, something went wrong.