diff --git a/ios/circolapp/Podfile b/ios/circolapp/Podfile index 4d39e6e..050ab5d 100644 --- a/ios/circolapp/Podfile +++ b/ios/circolapp/Podfile @@ -3,7 +3,7 @@ target 'circolapp' do use_frameworks! # Inhibit warnings for all pods inhibit_all_warnings! - platform :ios, '14.2' + platform :ios, '13.0' # Pods for iosApp pod 'shared', :path => '../../shared' pod 'Firebase/Messaging' diff --git a/ios/circolapp/circolapp.xcodeproj/project.pbxproj b/ios/circolapp/circolapp.xcodeproj/project.pbxproj index 1db3db0..2bb3e03 100644 --- a/ios/circolapp/circolapp.xcodeproj/project.pbxproj +++ b/ios/circolapp/circolapp.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 952DEDDF2576F8DC001DF85D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */; }; 9547205B2573B688005AA401 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9547205A2573B688005AA401 /* Settings.bundle */; }; 954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E68342574E3890034EBA8 /* iOSServerApi.swift */; }; 954E683D2574ED9E0034EBA8 /* UserDefaultsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */; }; @@ -17,7 +18,7 @@ 95C46A51255D3A34007A75E5 /* CircularViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C46A50255D3A34007A75E5 /* CircularViewModel.swift */; }; 95C9CBA32570EDEE005F879D /* Pods_circolapp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BEA78E7C5BBEF0119834B33 /* Pods_circolapp.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 95C9CBA42570EDEE005F879D /* Pods_circolapp.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8BEA78E7C5BBEF0119834B33 /* Pods_circolapp.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 95CA31B0255C1EDE00AC095B /* CircolApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31AF255C1EDE00AC095B /* CircolApp.swift */; }; + 95CA31B0255C1EDE00AC095B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31AF255C1EDE00AC095B /* AppDelegate.swift */; }; 95CA31B2255C1EDE00AC095B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31B1255C1EDE00AC095B /* ContentView.swift */; }; 95CA31B7255C1EE000AC095B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */; }; 95CA31C0255C28C300AC095B /* CircularView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31BF255C28C300AC095B /* CircularView.swift */; }; @@ -41,6 +42,7 @@ 892B265487980F6A344AC2A7 /* Pods-circolapp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-circolapp.debug.xcconfig"; path = "Target Support Files/Pods-circolapp/Pods-circolapp.debug.xcconfig"; sourceTree = ""; }; 8BEA78E7C5BBEF0119834B33 /* Pods_circolapp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_circolapp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 952C5954255C57650018C010 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../../shared/build/xcode-frameworks/shared.framework"; sourceTree = ""; }; + 952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 9547205A2573B688005AA401 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 954E68342574E3890034EBA8 /* iOSServerApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSServerApi.swift; sourceTree = ""; }; 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsExtensions.swift; sourceTree = ""; }; @@ -51,7 +53,7 @@ 95BC3BF72572BCF900F24400 /* AttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentView.swift; sourceTree = ""; }; 95C46A50255D3A34007A75E5 /* CircularViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularViewModel.swift; sourceTree = ""; }; 95CA31AC255C1EDE00AC095B /* circolapp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = circolapp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 95CA31AF255C1EDE00AC095B /* CircolApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircolApp.swift; sourceTree = ""; }; + 95CA31AF255C1EDE00AC095B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 95CA31B1255C1EDE00AC095B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 95CA31B8255C1EE000AC095B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -132,7 +134,8 @@ 959B531E25764726009AD895 /* circolapp.entitlements */, 95906F46257506050060F5D0 /* Model */, 95906F45257505770060F5D0 /* View */, - 95CA31AF255C1EDE00AC095B /* CircolApp.swift */, + 95CA31AF255C1EDE00AC095B /* AppDelegate.swift */, + 952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */, 95C46A50255D3A34007A75E5 /* CircularViewModel.swift */, 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */, 95CA31B8255C1EE000AC095B /* Info.plist */, @@ -270,9 +273,10 @@ files = ( 9553DB09257173ED006AE167 /* iOSDatabase.swift in Sources */, 95CA31C0255C28C300AC095B /* CircularView.swift in Sources */, + 952DEDDF2576F8DC001DF85D /* SceneDelegate.swift in Sources */, 95CA31B2255C1EDE00AC095B /* ContentView.swift in Sources */, 954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */, - 95CA31B0255C1EDE00AC095B /* CircolApp.swift in Sources */, + 95CA31B0255C1EDE00AC095B /* AppDelegate.swift in Sources */, 95BC3BF82572BCF900F24400 /* AttachmentView.swift in Sources */, 954E683D2574ED9E0034EBA8 /* UserDefaultsExtensions.swift in Sources */, 95C46A51255D3A34007A75E5 /* CircularViewModel.swift in Sources */, @@ -413,7 +417,7 @@ ENABLE_PREVIEWS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = circolapp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.2; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -446,7 +450,7 @@ ENABLE_PREVIEWS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = circolapp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.2; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/ios/circolapp/circolapp/CircolApp.swift b/ios/circolapp/circolapp/AppDelegate.swift similarity index 52% rename from ios/circolapp/circolapp/CircolApp.swift rename to ios/circolapp/circolapp/AppDelegate.swift index ff7161c..89dfbcb 100644 --- a/ios/circolapp/circolapp/CircolApp.swift +++ b/ios/circolapp/circolapp/AppDelegate.swift @@ -16,23 +16,25 @@ * along with this program. If not, see . */ -import SwiftUI +import UIKit import Firebase +@UIApplicationMain class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { FirebaseApp.configure() return true } -} -@main -struct CircolApp: App { - @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate - - var body: some Scene { - WindowGroup { - ContentView() - } + 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. } } diff --git a/ios/circolapp/circolapp/Info.plist b/ios/circolapp/circolapp/Info.plist index 20f7c9a..f05304e 100644 --- a/ios/circolapp/circolapp/Info.plist +++ b/ios/circolapp/circolapp/Info.plist @@ -25,7 +25,19 @@ UIApplicationSceneManifest UIApplicationSupportsMultipleScenes - + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + UIApplicationSupportsIndirectInputEvents diff --git a/ios/circolapp/circolapp/SceneDelegate.swift b/ios/circolapp/circolapp/SceneDelegate.swift new file mode 100644 index 0000000..8a3c473 --- /dev/null +++ b/ios/circolapp/circolapp/SceneDelegate.swift @@ -0,0 +1,59 @@ +// +// SceneDelegate.swift +// circolapp +// +// Created by Matteo Schiff on 01/12/20. +// + +import UIKit +import SwiftUI + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + // Create the SwiftUI view that provides the window contents. + let contentView = ContentView() + + // Use a UIHostingController as window root view controller. + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } +} diff --git a/ios/circolapp/circolapp/View/AttachmentView.swift b/ios/circolapp/circolapp/View/AttachmentView.swift index cdde91b..ace95d1 100644 --- a/ios/circolapp/circolapp/View/AttachmentView.swift +++ b/ios/circolapp/circolapp/View/AttachmentView.swift @@ -17,10 +17,10 @@ */ import SwiftUI +import UIKit import Shared struct AttachmentView: View { - @Environment(\.openURL) var openURL var attachmentName: String var attachmentUrl: String @@ -34,7 +34,7 @@ struct AttachmentView: View { Button(action: { guard let url = URL(string: attachmentUrl) else { return } - openURL(url) + UIApplication.shared.open(url) }) { Image(systemName: "envelope.open") .foregroundColor(.blue) diff --git a/ios/circolapp/circolapp/View/CircularView.swift b/ios/circolapp/circolapp/View/CircularView.swift index c38c65f..5190266 100644 --- a/ios/circolapp/circolapp/View/CircularView.swift +++ b/ios/circolapp/circolapp/View/CircularView.swift @@ -17,10 +17,10 @@ */ import SwiftUI +import UIKit import Shared struct CircularView: View { - @Environment(\.openURL) var openURL @State private var showDetail = false var circular: Circular @@ -50,7 +50,7 @@ struct CircularView: View { HStack { Button(action: { guard let url = URL(string: circular.url) else { return } - openURL(url) + UIApplication.shared.open(url) }) { Image(systemName: "envelope.open") .foregroundColor(.blue) @@ -109,10 +109,8 @@ struct CircularView: View { .buttonStyle(PlainButtonStyle()) } - LazyVStack { - ForEach(0..