Skip to content

Commit 97db6d1

Browse files
author
Sonam Dhingra
committed
rounded record button
1 parent 1e0daf1 commit 97db6d1

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

Plugin Source/Source/RecordViewController.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import UIKit
2424
private func setupView() {
2525

2626
//*** Start button
27-
let btnImage = UIImage(named:"recordBtnImage")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
28-
startRecordBtn.setImage(btnImage, for: .normal)
27+
startRecordBtn.backgroundColor = .purple
2928
startRecordBtn.addTarget(self, action: #selector(didTapStartRecording), for: .touchUpInside)
3029
view.addSubview(startRecordBtn)
3130
setupStartBtnConstraints()
@@ -37,6 +36,13 @@ import UIKit
3736
}
3837
}
3938

39+
override func viewDidLayoutSubviews() {
40+
41+
super.viewDidLayoutSubviews()
42+
startRecordBtn.layer.masksToBounds = true
43+
startRecordBtn.layer.cornerRadius = startRecordBtn.frame.width/2
44+
}
45+
4046
public func relayoutInterface() {
4147

4248
startRecordBtn.isHidden = false

Plugin Source/Source/ReplayKitNative.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,23 @@ let kCallbackTarget = "ReplayKitUnity"
8787
// For Unity to add a default interface that will be excluded from the interface during playback
8888
@objc func addDefaultButtonWindowForUnity() {
8989

90-
if let currentVC = UnityGetGLViewController() {
91-
buttonWindow = UIWindow(frame: currentVC.view.frame)
92-
let recordVC = RecordViewController()
93-
recordVC.recordDuration = recordTime
94-
buttonWindow?.rootViewController = recordVC
95-
buttonWindow?.rootViewController?.view.backgroundColor = .clear
96-
buttonWindow?.makeKeyAndVisible()
97-
} else {
98-
assertionFailure("cannot get the current vc from unity")
99-
}
90+
// if let currentVC = UnityGetGLViewController() {
91+
// buttonWindow = UIWindow(frame: currentVC.view.frame)
92+
// let recordVC = RecordViewController()
93+
// recordVC.recordDuration = recordTime
94+
// buttonWindow?.rootViewController = recordVC
95+
// buttonWindow?.rootViewController?.view.backgroundColor = .clear
96+
// buttonWindow?.makeKeyAndVisible()
97+
// } else {
98+
// assertionFailure("cannot get the current vc from unity")
99+
// }
100100
}
101101

102102
@objc func startScreenCaptureAndSaveToFile() {
103103

104104
// Sends a message to Unity that iOS has started to record the screen
105105
// In this Xcode Project this line will return an error since you do not have the UnityInterface file imported into this project. Once this file and the source code is dragged into Unity > Plugins> iOS folder,and you build the Xcode project it will work.
106-
UnitySendMessage(kCallbackTarget, "OnStartRecording", "")
106+
// UnitySendMessage(kCallbackTarget, "OnStartRecording", "")
107107

108108
let fileAppendValue = FileHandler.fetchAllReplays().count > 0 ? FileHandler.fetchAllReplays().count + 1 : 0
109109
self.replayPath = "recording_\(fileAppendValue)"
@@ -173,7 +173,7 @@ let kCallbackTarget = "ReplayKitUnity"
173173
}
174174

175175
// Send a message to Unity with the file path itself.
176-
UnitySendMessage(kCallbackTarget, "OnStopRecording", file.absoluteString)
176+
// UnitySendMessage(kCallbackTarget, "OnStopRecording", file.absoluteString)
177177

178178
if self?.fileURLCallback != nil {
179179
self?.fileURLCallback!(file)
@@ -267,12 +267,12 @@ let kCallbackTarget = "ReplayKitUnity"
267267
activityVC.excludedActivityTypes = [.assignToContact, .saveToCameraRoll, .openInIBooks]
268268

269269
// Once this file is in your built Unity Xcode project, this function allows for you to fetch the current view controller being displayed from Unity
270-
if let currentVC = UnityGetGLViewController() {
271-
activityVC.popoverPresentationController?.sourceView = currentVC.view
272-
currentVC.present(activityVC, animated: true, completion: nil)
273-
} else {
274-
assertionFailure("cannot get current vc from unity")
275-
}
270+
// if let currentVC = UnityGetGLViewController() {
271+
// activityVC.popoverPresentationController?.sourceView = currentVC.view
272+
// currentVC.present(activityVC, animated: true, completion: nil)
273+
// } else {
274+
// assertionFailure("cannot get current vc from unity")
275+
// }
276276
}
277277

278278
}

0 commit comments

Comments
 (0)