/* * This file is part of GNU Taler * (C) 2021 Taler Systems S.A. * * GNU Taler is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 3, or (at your option) any later version. * * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * GNU Taler; see the file COPYING. If not, see */ import UIKit import iono @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. // TODO: generate 'taler-wallet-ios.js' from wallet-core instead of pasting it in. let js_path = URL(fileURLWithPath: Bundle.main.path(forResource: "taler-wallet-ios", ofType: "js")!) let nodeInstance = Iono() do { let js = try String(contentsOf: js_path, encoding: .utf8) nodeInstance.putModuleCode(modName: "@gnu-taler/taler-wallet-ios", code: js) nodeInstance.evalNodeCode(source: "require('iono');") nodeInstance.evalNodeCode(source: "tw = require('@gnu-taler/taler-wallet-ios');") nodeInstance.evalNodeCode(source: "tw.installIosWalletListener();") } catch { } return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }