Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
21 efrain 1
//
2
//  Device.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 10/10/22.
6
//
7
 
8
import Foundation
9
import UIKit
10
import SwiftUI
11
 
12
class Device {
13
    private var appData = Environment(\.appData).wrappedValue
14
 
15
    static let sharedInstance: Device = {
16
           let instance = Device()
17
 
18
           return instance
19
    }()
20
 
21
 
22
 
23
    public func generateUUID()
24
    {
25
        if appData.deviceUuid.isEmpty {
26
 
27
            if let new_uuid = UIDevice.current.identifierForVendor?.uuidString {
28
 
29
                print( "Generate DeviceUuid: \(new_uuid)")
30
                let userInfo = ["uuid": new_uuid]
31
                NotificationCenter.default.post(name: Constants.NOTIFICATION_NAME_DEVICE_REGISTER_NAME , object: self, userInfo: userInfo)
32
 
33
            }
34
 
35
        } else {
36
            print( "Generate DeviceUuid: \(appData.deviceUuid)")
37
            let userInfo = ["uuid": appData.deviceUuid]
38
            NotificationCenter.default.post(name: Constants.NOTIFICATION_NAME_DEVICE_REGISTER_NAME , object: self, userInfo: userInfo)
39
        }
40
    }
41
}