Add support for iOS 13

This commit is contained in:
2020-12-02 10:25:13 +01:00
parent 00dfcce762
commit 2fcf1228f1
8 changed files with 121 additions and 48 deletions

View File

@@ -3,7 +3,7 @@ target 'circolapp' do
use_frameworks! use_frameworks!
# Inhibit warnings for all pods # Inhibit warnings for all pods
inhibit_all_warnings! inhibit_all_warnings!
platform :ios, '14.2' platform :ios, '13.0'
# Pods for iosApp # Pods for iosApp
pod 'shared', :path => '../../shared' pod 'shared', :path => '../../shared'
pod 'Firebase/Messaging' pod 'Firebase/Messaging'

View File

@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* 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 */; }; 9547205B2573B688005AA401 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9547205A2573B688005AA401 /* Settings.bundle */; };
954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E68342574E3890034EBA8 /* iOSServerApi.swift */; }; 954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E68342574E3890034EBA8 /* iOSServerApi.swift */; };
954E683D2574ED9E0034EBA8 /* UserDefaultsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.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 */; }; 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, ); }; }; 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, ); }; }; 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 */; }; 95CA31B2255C1EDE00AC095B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31B1255C1EDE00AC095B /* ContentView.swift */; };
95CA31B7255C1EE000AC095B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */; }; 95CA31B7255C1EE000AC095B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */; };
95CA31C0255C28C300AC095B /* CircularView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CA31BF255C28C300AC095B /* CircularView.swift */; }; 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 = "<group>"; }; 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 = "<group>"; };
8BEA78E7C5BBEF0119834B33 /* Pods_circolapp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_circolapp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = "<group>"; }; 952C5954255C57650018C010 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../../shared/build/xcode-frameworks/shared.framework"; sourceTree = "<group>"; };
952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
9547205A2573B688005AA401 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; 9547205A2573B688005AA401 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
954E68342574E3890034EBA8 /* iOSServerApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSServerApi.swift; sourceTree = "<group>"; }; 954E68342574E3890034EBA8 /* iOSServerApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSServerApi.swift; sourceTree = "<group>"; };
954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsExtensions.swift; sourceTree = "<group>"; }; 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsExtensions.swift; sourceTree = "<group>"; };
@@ -51,7 +53,7 @@
95BC3BF72572BCF900F24400 /* AttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentView.swift; sourceTree = "<group>"; }; 95BC3BF72572BCF900F24400 /* AttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentView.swift; sourceTree = "<group>"; };
95C46A50255D3A34007A75E5 /* CircularViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularViewModel.swift; sourceTree = "<group>"; }; 95C46A50255D3A34007A75E5 /* CircularViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularViewModel.swift; sourceTree = "<group>"; };
95CA31AC255C1EDE00AC095B /* circolapp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = circolapp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = "<group>"; }; 95CA31AF255C1EDE00AC095B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
95CA31B1255C1EDE00AC095B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; 95CA31B1255C1EDE00AC095B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; 95CA31B6255C1EE000AC095B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
95CA31B8255C1EE000AC095B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 95CA31B8255C1EE000AC095B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -132,7 +134,8 @@
959B531E25764726009AD895 /* circolapp.entitlements */, 959B531E25764726009AD895 /* circolapp.entitlements */,
95906F46257506050060F5D0 /* Model */, 95906F46257506050060F5D0 /* Model */,
95906F45257505770060F5D0 /* View */, 95906F45257505770060F5D0 /* View */,
95CA31AF255C1EDE00AC095B /* CircolApp.swift */, 95CA31AF255C1EDE00AC095B /* AppDelegate.swift */,
952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */,
95C46A50255D3A34007A75E5 /* CircularViewModel.swift */, 95C46A50255D3A34007A75E5 /* CircularViewModel.swift */,
954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */, 954E683C2574ED9E0034EBA8 /* UserDefaultsExtensions.swift */,
95CA31B8255C1EE000AC095B /* Info.plist */, 95CA31B8255C1EE000AC095B /* Info.plist */,
@@ -270,9 +273,10 @@
files = ( files = (
9553DB09257173ED006AE167 /* iOSDatabase.swift in Sources */, 9553DB09257173ED006AE167 /* iOSDatabase.swift in Sources */,
95CA31C0255C28C300AC095B /* CircularView.swift in Sources */, 95CA31C0255C28C300AC095B /* CircularView.swift in Sources */,
952DEDDF2576F8DC001DF85D /* SceneDelegate.swift in Sources */,
95CA31B2255C1EDE00AC095B /* ContentView.swift in Sources */, 95CA31B2255C1EDE00AC095B /* ContentView.swift in Sources */,
954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */, 954E68352574E3890034EBA8 /* iOSServerApi.swift in Sources */,
95CA31B0255C1EDE00AC095B /* CircolApp.swift in Sources */, 95CA31B0255C1EDE00AC095B /* AppDelegate.swift in Sources */,
95BC3BF82572BCF900F24400 /* AttachmentView.swift in Sources */, 95BC3BF82572BCF900F24400 /* AttachmentView.swift in Sources */,
954E683D2574ED9E0034EBA8 /* UserDefaultsExtensions.swift in Sources */, 954E683D2574ED9E0034EBA8 /* UserDefaultsExtensions.swift in Sources */,
95C46A51255D3A34007A75E5 /* CircularViewModel.swift in Sources */, 95C46A51255D3A34007A75E5 /* CircularViewModel.swift in Sources */,
@@ -413,7 +417,7 @@
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)"; FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = circolapp/Info.plist; INFOPLIST_FILE = circolapp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.2; IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@@ -446,7 +450,7 @@
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)"; FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = circolapp/Info.plist; INFOPLIST_FILE = circolapp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.2; IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",

View File

@@ -16,23 +16,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import SwiftUI import UIKit
import Firebase import Firebase
@UIApplicationMain
class AppDelegate: NSObject, UIApplicationDelegate { class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
FirebaseApp.configure() FirebaseApp.configure()
return true return true
} }
}
@main func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
struct CircolApp: App { // Called when a new scene session is being created.
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate // Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
var body: some Scene { func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
WindowGroup { // Called when the user discards a scene session.
ContentView() // 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.
} }
} }

View File

@@ -25,7 +25,19 @@
<key>UIApplicationSceneManifest</key> <key>UIApplicationSceneManifest</key>
<dict> <dict>
<key>UIApplicationSupportsMultipleScenes</key> <key>UIApplicationSupportsMultipleScenes</key>
<true/> <false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict> </dict>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>

View File

@@ -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.
}
}

View File

@@ -17,10 +17,10 @@
*/ */
import SwiftUI import SwiftUI
import UIKit
import Shared import Shared
struct AttachmentView: View { struct AttachmentView: View {
@Environment(\.openURL) var openURL
var attachmentName: String var attachmentName: String
var attachmentUrl: String var attachmentUrl: String
@@ -34,7 +34,7 @@ struct AttachmentView: View {
Button(action: { Button(action: {
guard let url = URL(string: attachmentUrl) else { return } guard let url = URL(string: attachmentUrl) else { return }
openURL(url) UIApplication.shared.open(url)
}) { }) {
Image(systemName: "envelope.open") Image(systemName: "envelope.open")
.foregroundColor(.blue) .foregroundColor(.blue)

View File

@@ -17,10 +17,10 @@
*/ */
import SwiftUI import SwiftUI
import UIKit
import Shared import Shared
struct CircularView: View { struct CircularView: View {
@Environment(\.openURL) var openURL
@State private var showDetail = false @State private var showDetail = false
var circular: Circular var circular: Circular
@@ -50,7 +50,7 @@ struct CircularView: View {
HStack { HStack {
Button(action: { Button(action: {
guard let url = URL(string: circular.url) else { return } guard let url = URL(string: circular.url) else { return }
openURL(url) UIApplication.shared.open(url)
}) { }) {
Image(systemName: "envelope.open") Image(systemName: "envelope.open")
.foregroundColor(.blue) .foregroundColor(.blue)
@@ -109,10 +109,8 @@ struct CircularView: View {
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
} }
LazyVStack { ForEach(0..<circular.attachmentsNames.count, id: \.self) { index in
ForEach(0..<circular.attachmentsNames.count, id: \.self) { index in
AttachmentView(attachmentName: circular.attachmentsNames[index] as! String, attachmentUrl: circular.attachmentsUrls[index] as! String) AttachmentView(attachmentName: circular.attachmentsNames[index] as! String, attachmentUrl: circular.attachmentsUrls[index] as! String)
}
} }
} }
} }

View File

@@ -17,6 +17,7 @@
*/ */
import SwiftUI import SwiftUI
import UIKit
import Shared import Shared
struct ContentView: View { struct ContentView: View {
@@ -35,30 +36,27 @@ struct ContentView: View {
self.circularViewModel.stopObserving() self.circularViewModel.stopObserving()
}) })
} }
.toolbar {
ToolbarItem(placement: .bottomBar) {
HStack(spacing: 50) {
Button(action: { Divider()
self.circularViewModel.startObservingCirculars() HStack(spacing: 50) {
}) { Button(action: {
Image(systemName: "folder") self.circularViewModel.startObservingCirculars()
} }) {
Image(systemName: "folder")
Button(action: {
self.circularViewModel.startObservingFavourites()
}) {
Image(systemName: "book")
}
Button(action: {
self.circularViewModel.startObservingAlarms()
}) {
Image(systemName: "alarm")
}
}
} }
}
Button(action: {
self.circularViewModel.startObservingFavourites()
}) {
Image(systemName: "book")
}
Button(action: {
self.circularViewModel.startObservingAlarms()
}) {
Image(systemName: "alarm")
}
}.frame(height: 50.0)
} }
} }