Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dbejanishvili committed Dec 6, 2021
1 parent 877802a commit d11c65d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions Sources/MavisSDK/IosUnityBridge.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// File.swift
//
//
//
// Created by Lasha Bukhnikashvili on 10.05.21.
//
Expand All @@ -15,31 +15,31 @@ class IosUnityBridge {
}

public func Init(){
NotificationCenter.default.addObserver(self, selector: #selector(arSeesionStart(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(arSessionStart(_:)),
name: NSNotification.Name("ArSessionStart") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(arSeesionEnd(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(arSessionEnd(_:)),
name: NSNotification.Name("ArSessionEnd") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(targetDetected(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(targetDetected(_:)),
name: NSNotification.Name("TargetDetected") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(targetLost(_:)),
name: NSNotification.Name("TargetLost") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(arContentsShown(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(arContentsShown(_:)),
name: NSNotification.Name("ArContentsShown") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(arContentClicked(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(arContentClicked(_:)),
name: NSNotification.Name("ArContentClicked") , object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(errorOccured(_:)),
NotificationCenter.default.addObserver(self, selector: #selector(errorOccured(_:)),
name: NSNotification.Name("ErrorOccured") , object: nil)
}

@objc private func arSeesionStart(_ n: NSNotification){
@objc private func arSessionStart(_ n: NSNotification){
let json = (n.userInfo?["data"] ?? "") as! String
let parsedData = try! JSONDecoder().decode(ArSessionStartInfo.self, from: json.data(using: .utf8)!)
eventHandler.ArSeesionStart(sessionInfo: parsedData)
eventHandler.ArSessionStart(sessionInfo: parsedData)
}
@objc private func arSeesionEnd(_ n: NSNotification){
@objc private func arSessionEnd(_ n: NSNotification){
let json = (n.userInfo?["data"] ?? "") as! String
let parsedData = try! JSONDecoder().decode(ArSessionEndInfo.self, from: json.data(using: .utf8)!)
eventHandler.ArSeesionEnd(sessionInfo: parsedData)
eventHandler.ArSessionEnd(sessionInfo: parsedData)
}
@objc private func targetDetected(_ n: NSNotification){
let json = (n.userInfo?["data"] ?? "") as! String
Expand Down
4 changes: 2 additions & 2 deletions Sources/MavisSDK/MavisEventHandlerBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open class MavisEventHandlerBase{
* Called When AR Session is started, i.e. camera view is shown to user
* sessionInfo.sessionId - newly generated session Id for current AR session (format: uuid4, url-safe encoding)
*/
open func ArSeesionStart(sessionInfo : ArSessionStartInfo){
open func ArSessionStart(sessionInfo : ArSessionStartInfo){
print(sessionInfo)
}

Expand All @@ -24,7 +24,7 @@ open class MavisEventHandlerBase{
* arSessionEndInfo.sessionId - session Id for current AR session (format: uuid4, url-safe encoding)
* arSessionEndInfo.duration - Ar session duration (in minutes)
*/
open func ArSeesionEnd(sessionInfo : ArSessionEndInfo){
open func ArSessionEnd(sessionInfo : ArSessionEndInfo){
print(sessionInfo)
}

Expand Down

0 comments on commit d11c65d

Please sign in to comment.