Commit 2ad8bc4d authored by Ruben Daniels's avatar Ruben Daniels
Browse files

Merge branch 'realmpaths' into 'dev'

replace mockBoot() with boot()

See merge request ios-application!29
parents ea87be12 157ec1b6
Pipeline #28 passed with stage
in 44 seconds
Showing with 116 additions and 54 deletions
+116 -54
......@@ -49,6 +49,8 @@
5D78D06E242512FB00F7BD3B /* NavigationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D78D06D242512FB00F7BD3B /* NavigationTest.swift */; };
5D78D072242531BE00F7BD3B /* NavigationItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D78D071242531BE00F7BD3B /* NavigationItem.swift */; };
5DA7BAFB241A72640087B81D /* QGrid in Frameworks */ = {isa = PBXBuildFile; productRef = 5DA7BAFA241A72640087B81D /* QGrid */; };
5DB66FB52431DD41007736D6 /* mainTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DB66FB42431DD41007736D6 /* mainTest.swift */; };
5DB66FB72431DEB0007736D6 /* realmTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DB66FB62431DEB0007736D6 /* realmTest.swift */; };
5DC1692724093C3900367905 /* sessions_manually_single.json in Resources */ = {isa = PBXBuildFile; fileRef = 5DC1692624093C3900367905 /* sessions_manually_single.json */; };
5DC1692824093E6B00367905 /* sessions_manually_single.json in Resources */ = {isa = PBXBuildFile; fileRef = 5DC1692624093C3900367905 /* sessions_manually_single.json */; };
5DC1692924093E7000367905 /* sessions_manually_expanded.json in Resources */ = {isa = PBXBuildFile; fileRef = 5DC1692524093BD300367905 /* sessions_manually_expanded.json */; };
......@@ -178,6 +180,8 @@
5D78D06A242500A500F7BD3B /* navigationItems.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = navigationItems.json; sourceTree = "<group>"; };
5D78D06D242512FB00F7BD3B /* NavigationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = NavigationTest.swift; path = memri/control/NavigationTest.swift; sourceTree = SOURCE_ROOT; };
5D78D071242531BE00F7BD3B /* NavigationItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItem.swift; sourceTree = "<group>"; };
5DB66FB42431DD41007736D6 /* mainTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = mainTest.swift; sourceTree = "<group>"; };
5DB66FB62431DEB0007736D6 /* realmTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = realmTest.swift; sourceTree = "<group>"; };
5DC1692524093BD300367905 /* sessions_manually_expanded.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = sessions_manually_expanded.json; sourceTree = "<group>"; };
5DC1692624093C3900367905 /* sessions_manually_single.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = sessions_manually_single.json; sourceTree = "<group>"; };
5DC1692B2409453200367905 /* empty_sessions.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = empty_sessions.json; sourceTree = "<group>"; };
......@@ -288,6 +292,7 @@
children = (
5D0A28B8240678EE00398B17 /* ModelTest.swift */,
86677DEA242A6751007A4782 /* CacheTest.swift */,
5DB66FB62431DEB0007736D6 /* realmTest.swift */,
);
path = model;
sourceTree = "<group>";
......@@ -437,6 +442,7 @@
5D599BD023F2B77700F218A0 /* memriTests */ = {
isa = PBXGroup;
children = (
5DB66FB32431DD2D007736D6 /* main */,
5D0A28C024069A4E00398B17 /* control */,
5D0A28BF24069A4600398B17 /* view */,
5D0A28BE24069A3800398B17 /* model */,
......@@ -465,6 +471,14 @@
path = Navigation;
sourceTree = "<group>";
};
5DB66FB32431DD2D007736D6 /* main */ = {
isa = PBXGroup;
children = (
5DB66FB42431DD41007736D6 /* mainTest.swift */,
);
path = main;
sourceTree = "<group>";
};
5DD1E9B623FD812C007BDF7B /* model */ = {
isa = PBXGroup;
children = (
......@@ -768,12 +782,14 @@
5D0A28B9240678EE00398B17 /* ModelTest.swift in Sources */,
5DE95A6B241BC954003ABA63 /* DecodableDict.swift in Sources */,
5DD17B6F241294E90018A8F1 /* AnyEncodable.swift in Sources */,
5DB66FB72431DEB0007736D6 /* realmTest.swift in Sources */,
86677DEB242A6751007A4782 /* CacheTest.swift in Sources */,
5DD17B5E2412677D0018A8F1 /* DefaultCodingKeys.swift in Sources */,
5D3D962424168C810004040E /* AnyCodable.swift in Sources */,
5D38DE11240576D200FF9B70 /* PodAPITest.swift in Sources */,
5D78D06E242512FB00F7BD3B /* NavigationTest.swift in Sources */,
5D0A28C324069A6500398B17 /* SessionsViewTest.swift in Sources */,
5DB66FB52431DD41007736D6 /* mainTest.swift in Sources */,
5DD17B6C241294DC0018A8F1 /* AnyDecodable.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
......@@ -39,7 +39,7 @@ public class Main: ObservableObject {
cache = Cache(podApi)
}
public func boot(_ callback: (_ error:Error?, _ success:Bool) -> Void) {
public func boot(_ callback: (_ error:Error?, _ success:Bool) -> Void) -> Main {
// Load settings (from cache and/or api)
// Load NavigationCache (from cache and/or api)
......@@ -73,19 +73,21 @@ public class Main: ObservableObject {
}
callback(nil, true)
return self
}
public func mockBoot() -> Main {
self.sessions = try! Sessions.fromJSONFile("empty_sessions")
print("in mockBoot sessions.title = \(self.sessions.currentView.title ?? "")")
self.cancellable = self.sessions.objectWillChange.sink {
DispatchQueue.main.async {
self.setCurrentView()
}
}
self.setCurrentView()
return self
return self.boot({_,_ in })
// self.sessions = try! Sessions.fromJSONFile("empty_sessions")
// print("in mockBoot sessions.title = \(self.sessions.currentView.title ?? "")")
// self.cancellable = self.sessions.objectWillChange.sink {
// DispatchQueue.main.async {
// self.setCurrentView()
// }
// }
// self.setCurrentView()
//
// return self
}
public func setCurrentView(){
......
......@@ -13,7 +13,6 @@ import Combine
struct Browser: View {
@EnvironmentObject var main: Main
@State var isEditMode: EditMode = .inactive
// @State var showContextPane: Bool = false
@State var showNavigation: Bool = false
var renderers: [String: AnyView] = ["list": AnyView(ListRenderer(isEditMode: .constant(.inactive))), // TODO Koen??
......
......@@ -47,15 +47,17 @@ struct Search: View {
.onReceive(Just(searchText)) { (newValue: String) in
self.main.search(self.searchText)
}
ForEach(self.main.currentView.filterButtons!){ filterButton in
// TODO: buttonview
Button(action: {self.main.executeAction(filterButton)}) {
Image(systemName: filterButton.icon)
}.padding(.horizontal , 5)
.font(Font.system(size: 20, weight: .medium))
.foregroundColor(Color(filterButton.color))
if self.main.currentView.filterButtons != nil{
ForEach(self.main.currentView.filterButtons!){ filterButton in
// TODO: buttonview
Button(action: {self.main.executeAction(filterButton)}) {
Image(systemName: filterButton.icon)
}.padding(.horizontal , 5)
.font(Font.system(size: 20, weight: .medium))
.foregroundColor(Color(filterButton.color))
}
}
}.padding(.horizontal , 15)
FilterPanel()
......
......@@ -15,7 +15,7 @@ var config = Realm.Configuration(
// Set the new schema version. This must be greater than the previously used
// version (if you've never set a schema version before, the version is 0).
schemaVersion: 12,
schemaVersion: 14,
// Set the block which will be called automatically when opening a Realm with
// a schema version lower than the one set above
......
//
// mainTest.swift
// memriTests
//
// Created by Koen van der Veen on 30/03/2020.
// Copyright © 2020 memri. All rights reserved.
//
import XCTest
@testable import memri
class mainTest: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testMain() throws {
let main = Main(name: "Memri GUI", key: "ABCDEF")
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
......@@ -8,25 +8,6 @@
import XCTest
@testable import memri
import RealmSwift
let config = Realm.Configuration(
// Set the new schema version. This must be greater than the previously used
// version (if you've never set a schema version before, the version is 0).
schemaVersion: 9,
// Set the block which will be called automatically when opening a Realm with
// a schema version lower than the one set above
migrationBlock: { migration, oldSchemaVersion in
// We haven’t migrated anything yet, so oldSchemaVersion == 0
if (oldSchemaVersion < 2) {
// Nothing to do!
// Realm will automatically detect new properties and removed properties
// And will update the schema on disk automatically
}
})
class CacheTest: XCTestCase {
......@@ -39,19 +20,9 @@ class CacheTest: XCTestCase {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testRealmCreate() {
// Tell Realm to use this new configuration object for the default Realm
// Realm.Configuration.defaultConfiguration = config
print(config.fileURL!)
let realm = try! Realm()
// let note:DataItem = Note(value: ["id": "0x99", "type": "note", "contents": "test"])
// let localStorage = LocalStorage(realm)
// localStorage.create(note)
func testCachInit() {
let podApi = PodAPI("test")
let _ = Cache(podApi)
}
func testPerformanceExample() {
......
//
// realmTest.swift
// memriTests
//
// Created by Koen van der Veen on 30/03/2020.
// Copyright © 2020 memri. All rights reserved.
//
import XCTest
@testable import memri
import RealmSwift
class realmTest: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testRealmCreate() {
#if targetEnvironment(simulator)
config.fileURL = URL(string: "file://\(getRealmPath())/memri.realm")
#endif
Realm.Configuration.defaultConfiguration = config
let realm = try! Realm()
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment