Skip to content

Commit cfc5f16

Browse files
committed
Update UI, allow notifications and add CI
1 parent b602b75 commit cfc5f16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+48096
-604
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Build and Test app
2+
on:
3+
push:
4+
branches: [master]
5+
jobs:
6+
build:
7+
runs-on: [macos-latest]
8+
env:
9+
XC_VERSION: ${{ '14.1' }}
10+
XC_WORKSPACE: ${{ 'Fosdem.xcworkspace' }}
11+
XC_SCHEME: ${{ 'Fosdem' }}
12+
steps:
13+
- name: Select latest Xcode
14+
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"
15+
- uses: actions/checkout@v3
16+
- name: Run Unit and UI Tests
17+
run: /usr/bin/xcodebuild test -workspace "$XC_WORKSPACE" -scheme "$XC_SCHEME" -destination 'platform=iOS Simulator,name=iPhone 14'

.swiftlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
opt_in_rules: # some rules are turned off by default, so you need to opt-in
2+
- empty_count
3+
analyzer_rules: # Rules run by `swiftlint analyze`
4+
- explicit_self
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "B8871E4B-8380-42E2-B742-04D58B2BBD70",
5+
"name" : "Configuration 1",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
13+
},
14+
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:Fosdem.xcodeproj",
18+
"identifier" : "14D2772D2205D07500740042",
19+
"name" : "FosdemTests"
20+
}
21+
}
22+
],
23+
"version" : 1
24+
}

Fosdem.xcodeproj/project.pbxproj

Lines changed: 74 additions & 42 deletions
Large diffs are not rendered by default.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1410"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "14D277142205D07200740042"
18+
BuildableName = "Fosdem.app"
19+
BlueprintName = "Fosdem"
20+
ReferencedContainer = "container:Fosdem.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "14D2772D2205D07500740042"
36+
BuildableName = "FosdemTests.xctest"
37+
BlueprintName = "FosdemTests"
38+
ReferencedContainer = "container:Fosdem.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
<TestableReference
42+
skipped = "NO">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "14D277382205D07500740042"
46+
BuildableName = "FosdemUITests.xctest"
47+
BlueprintName = "FosdemUITests"
48+
ReferencedContainer = "container:Fosdem.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
51+
</Testables>
52+
</TestAction>
53+
<LaunchAction
54+
buildConfiguration = "Debug"
55+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
launchStyle = "0"
58+
useCustomWorkingDirectory = "NO"
59+
ignoresPersistentStateOnLaunch = "NO"
60+
debugDocumentVersioning = "YES"
61+
debugServiceExtension = "internal"
62+
allowLocationSimulation = "YES">
63+
<BuildableProductRunnable
64+
runnableDebuggingMode = "0">
65+
<BuildableReference
66+
BuildableIdentifier = "primary"
67+
BlueprintIdentifier = "14D277142205D07200740042"
68+
BuildableName = "Fosdem.app"
69+
BlueprintName = "Fosdem"
70+
ReferencedContainer = "container:Fosdem.xcodeproj">
71+
</BuildableReference>
72+
</BuildableProductRunnable>
73+
</LaunchAction>
74+
<ProfileAction
75+
buildConfiguration = "Release"
76+
shouldUseLaunchSchemeArgsEnv = "YES"
77+
savedToolIdentifier = ""
78+
useCustomWorkingDirectory = "NO"
79+
debugDocumentVersioning = "YES">
80+
<BuildableProductRunnable
81+
runnableDebuggingMode = "0">
82+
<BuildableReference
83+
BuildableIdentifier = "primary"
84+
BlueprintIdentifier = "14D277142205D07200740042"
85+
BuildableName = "Fosdem.app"
86+
BlueprintName = "Fosdem"
87+
ReferencedContainer = "container:Fosdem.xcodeproj">
88+
</BuildableReference>
89+
</BuildableProductRunnable>
90+
</ProfileAction>
91+
<AnalyzeAction
92+
buildConfiguration = "Debug">
93+
</AnalyzeAction>
94+
<ArchiveAction
95+
buildConfiguration = "Release"
96+
revealArchiveInOrganizer = "YES">
97+
</ArchiveAction>
98+
</Scheme>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1410"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
buildConfiguration = "Debug"
11+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
12+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
shouldUseLaunchSchemeArgsEnv = "YES">
14+
<TestPlans>
15+
<TestPlanReference
16+
reference = "container:Fosdem.xcodeproj/FosdemTests.xctestplan"
17+
default = "YES">
18+
</TestPlanReference>
19+
</TestPlans>
20+
<Testables>
21+
<TestableReference
22+
skipped = "NO">
23+
<BuildableReference
24+
BuildableIdentifier = "primary"
25+
BlueprintIdentifier = "14D2772D2205D07500740042"
26+
BuildableName = "FosdemTests.xctest"
27+
BlueprintName = "FosdemTests"
28+
ReferencedContainer = "container:Fosdem.xcodeproj">
29+
</BuildableReference>
30+
</TestableReference>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
</LaunchAction>
44+
<ProfileAction
45+
buildConfiguration = "Release"
46+
shouldUseLaunchSchemeArgsEnv = "YES"
47+
savedToolIdentifier = ""
48+
useCustomWorkingDirectory = "NO"
49+
debugDocumentVersioning = "YES">
50+
</ProfileAction>
51+
<AnalyzeAction
52+
buildConfiguration = "Debug">
53+
</AnalyzeAction>
54+
<ArchiveAction
55+
buildConfiguration = "Release"
56+
revealArchiveInOrganizer = "YES">
57+
</ArchiveAction>
58+
</Scheme>

Fosdem/AppDelegate.swift

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright © 2019 Sean Molenaar. All rights reserved.
77
//
88

9-
import UIKit
109
import CoreData
1110
import SwiftUI
1211

@@ -26,30 +25,31 @@ struct Fosdem: App {
2625
class AppDelegate: UIResponder, UIApplicationDelegate {
2726

2827
var window: UIWindow?
29-
30-
static let year = YearHelper().year
3128

29+
static let year = YearHelper().year
3230

33-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
31+
func application(_ application: UIApplication,
32+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3433
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
3534
debugPrint(paths[0])
3635

3736
DataImporter.context = persistentContainer.newBackgroundContext()
3837
RemoteScheduleFetcher.fetchScheduleForYear(YearHelper().year)
39-
RoomStatusFetcher.fetchRoomStatus()
38+
4039
return true
4140
}
4241

4342
func applicationWillResignActive(_ application: UIApplication) {}
4443

4544
func applicationDidEnterBackground(_ application: UIApplication) {}
4645

47-
func applicationWillEnterForeground(_ application: UIApplication) {}
48-
49-
func applicationDidBecomeActive(_ application: UIApplication) {
50-
46+
func applicationWillEnterForeground(_ application: UIApplication) {
47+
RoomStatusFetcher.fetchRoomStatus()
48+
RemoteScheduleFetcher.fetchScheduleForYear(YearHelper().year)
5149
}
5250

51+
func applicationDidBecomeActive(_ application: UIApplication) {}
52+
5353
func applicationWillTerminate(_ application: UIApplication) {
5454
self.saveContext()
5555
}
@@ -64,19 +64,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6464
error conditions that could cause the creation of the store to fail.
6565
*/
6666
let container = NSPersistentContainer(name: "Fosdem")
67-
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
67+
container.loadPersistentStores(completionHandler: { (_, error) in
68+
container.viewContext.mergePolicy = NSMergePolicy(merge: .overwriteMergePolicyType)
69+
container.viewContext.automaticallyMergesChangesFromParent = true
6870
if let error = error as NSError? {
6971
// Replace this implementation with code to handle the error appropriately.
70-
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
71-
72-
/*
73-
Typical reasons for an error here include:
74-
* The parent directory does not exist, cannot be created, or disallows writing.
75-
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
76-
* The device is out of space.
77-
* The store could not be migrated to the current model version.
78-
Check the error message to determine what the actual problem was.
79-
*/
8072
fatalError("Unresolved error \(error), \(error.userInfo)")
8173
}
8274
})
@@ -92,7 +84,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
9284
try context.save()
9385
} catch {
9486
// Replace this implementation with code to handle the error appropriately.
95-
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
9687
let nserror = error as NSError
9788
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
9889
}

0 commit comments

Comments
 (0)