This file contains hidden or 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
// ... | |
import CoreData | |
import AVFoundation | |
// ... | |
class ViewController: UIViewController { | |
// ... | |
var coreDataContext:NSManagedObjectContext = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext | |
// ... |
This file contains hidden or 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
// ... | |
import CoreData | |
// ... | |
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
// ... | |
// MARK: - Core Data stack | |
lazy var persistentContainer: NSPersistentContainer = { |
This file contains hidden or 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
const updateUrlParams = () => { | |
const currentLocale = 'en-GB' | |
var url = new URL(window.location.href) | |
// searchParam : https://usefulangle.com/post/81/javascript-change-url-parameters | |
url.searchParams.set('lang', currentLocale) | |
// pushState : https://developer.mozilla.org/en-US/docs/Web/API/History/pushState |
This file contains hidden or 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
import firebase from "firebase/app" | |
if (location.hostname == "127.0.0.1" || location.hostname == "localhost") { | |
console.log("This is local emulator environment") | |
firebase.functions().useFunctionsEmulator("http://localhost:5001") | |
}else{ | |
console.log("It is not under emulator environment") | |
} |
This file contains hidden or 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
firebase | |
.app() | |
.functions(functionsRegion()) | |
.httpsCallable("myFunction")(params) | |
.then((result) => { | |
// done | |
}) | |
.catch((error) => { | |
// error | |
}) |
This file contains hidden or 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
export const functionsRegion = () => { | |
if (location.hostname == "127.0.0.1" || location.hostname == "localhost") { | |
return undefined | |
} else { | |
return "europe-west1" | |
} | |
} |
This file contains hidden or 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
@IBAction func onClickSignOut(_ sender: UIButton) { | |
let firebaseAuth = Auth.auth() | |
do { | |
try firebaseAuth.signOut() | |
self.view.window?.rootViewController?.dismiss(animated: true, completion: nil) | |
} catch let signOutError as NSError { | |
print ("Error signing out: \(signOutError.localizedDescription)") | |
} | |
} |
This file contains hidden or 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
// | |
// Created by Fredric Cliver on 2020/10/13. | |
// | |
import UIKit | |
import Firebase | |
import GoogleSignIn | |
import CryptoKit | |
import AuthenticationServices |
This file contains hidden or 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
let toast = new toastMessage.UI("#toast-message-template") | |
toast.showToast() |