forked from JJUNGTABLE/iOS
48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
//
|
|
// FB_Functions.swift
|
|
// CheckAnything
|
|
//
|
|
// Created by Sean Kim on 5/23/24.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
import FirebaseMessaging
|
|
import FirebaseAuth
|
|
|
|
class FB_FUNC {
|
|
static var shared = FB_FUNC()
|
|
private init() {}
|
|
|
|
//CheckAnything.com
|
|
func sendPushNotification(_ title: String, body: String) {
|
|
@UserDefault (key: "fcmToken", defaultValue: "") var pushFCMToken
|
|
|
|
// let url = URL(string: "\(KEY.apiLink)send?&")!
|
|
// var request = URLRequest(url: url)
|
|
// request.httpMethod = "GET"
|
|
// let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
// if let error = error {
|
|
// print("Error sending FCM token: \(error)")
|
|
// return
|
|
// }
|
|
// if let response = response as? HTTPURLResponse, response.statusCode == 200 {
|
|
// print("FCM token sent successfully")
|
|
// } else {
|
|
// print("Failed to send FCM token")
|
|
// }
|
|
// }
|
|
// task.resume()
|
|
}
|
|
|
|
|
|
func login(_ id: String, _ password: String, _ code: String) {
|
|
Auth.auth().signIn(withEmail: "\(id)@checkanythingemail.com", password: password) { authResult, error in
|
|
if let error = error {
|
|
printLog(error.localizedDescription)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|