Skip to content

Commit

Permalink
[RFR-1015] New Release of RFR App with Competition (#173)
Browse files Browse the repository at this point in the history
Add Competition for 2024 in RFR Project
  • Loading branch information
muthenberg authored May 8, 2024
2 parents f300887 + 15873ad commit 0a0370d
Show file tree
Hide file tree
Showing 19 changed files with 807 additions and 330 deletions.
74 changes: 44 additions & 30 deletions RFR-App/RFR.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
Expand All @@ -20,58 +20,70 @@
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug Production"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA87D0772982ADE9002F6B3B"
BuildableName = "RFRTests.xctest"
BlueprintName = "RFRTests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA87D0812982ADE9002F6B3B"
BuildableName = "RFRUITests.xctest"
BlueprintName = "RFRUITests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA6239982B0CA8DF007875BF"
BuildableName = "Ready for Robots DevelopmentTests.xctest"
BlueprintName = "Ready for Robots DevelopmentTests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA1E40622B17EAF100CACBE6"
BuildableName = "Ready for Robots UITests.xctest"
BlueprintName = "Ready for Robots UITests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug Production"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
Expand Down
68 changes: 38 additions & 30 deletions RFR-App/RFR.xcodeproj/xcshareddata/xcschemes/RFR Staging.xcscheme
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.7">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
Expand All @@ -20,62 +20,70 @@
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug Staging"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA87D0772982ADE9002F6B3B"
BuildableName = "RFRTests.xctest"
BlueprintName = "RFRTests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA87D0812982ADE9002F6B3B"
BuildableName = "RFRUITests.xctest"
BlueprintName = "RFRUITests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "YES"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA6239982B0CA8DF007875BF"
BuildableName = "Ready for Robots DevelopmentTests.xctest"
BlueprintName = "Ready for Robots DevelopmentTests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AA1E40622B17EAF100CACBE6"
BuildableName = "Ready for Robots UITests.xctest"
BlueprintName = "Ready for Robots UITests"
ReferencedContainer = "container:RFR.xcodeproj">
</BuildableReference>
</TestableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug Staging"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
Expand Down
7 changes: 3 additions & 4 deletions RFR-App/RFR/InitializationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import AppAuthCore
The first view shown after starting the application. This should usually be the login link or some error message if startup failed.

- Author: Klemens Muthmann
- Version: 1.0.1
- Version: 1.0.2
- Since: 3.1.2
*/
struct InitializationView: View {
Expand Down Expand Up @@ -106,9 +106,8 @@ let liveViewModel = LiveViewModel(
)

let voucherViewModel2 = VoucherViewModel(
authenticator: authenticator,
url: incentivesUrl,
dataStoreStack: mockDataStoreStack
vouchers: MockVouchers(count: 3, voucher: Voucher(code: "test-voucher")),
voucherRequirements: VoucherRequirements(dataStoreStack: mockDataStoreStack)
)

#Preview("Standard") {
Expand Down
12 changes: 7 additions & 5 deletions RFR-App/RFR/Measurements/MeasurementsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import MapKit
A view showing the lists of measurements capture by this device.

- Author: Klemens Muthmann
- Version: 1.0.0
- Version: 1.0.1
- Since: 3.1.2
*/
struct MeasurementsView: View {
Expand Down Expand Up @@ -56,7 +56,7 @@ struct MeasurementsView: View {
.headerProminence(.increased)
}.clipped()

voucherViewModel.view()
voucherViewModel.view().padding([.bottom])
}
}.onAppear {
Task {
Expand Down Expand Up @@ -96,9 +96,11 @@ struct MeasurementsView: View {

var voucherViewModel: VoucherViewModel {
let ret = VoucherViewModel(
authenticator: MockAuthenticator(),
url: try! ConfigLoader.load().getIncentivesUrl(),
dataStoreStack: MockDataStoreStack()
vouchers: MockVouchers(count: 3, voucher: Voucher(code: "test-code")),
voucherRequirements: VoucherRequirements(
dataStoreStack: MockDataStoreStack(),
daysInSpecialRegionFullFilled: 2
)
)
return ret
}
Expand Down
23 changes: 23 additions & 0 deletions RFR-App/RFR/Preview_Mocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import OSLog

- Author: Klemens Muthmann
- Version: 1.0.0
- Since: 3.2.2
*/
class MockAuthenticator: Authenticator {
func authenticate(onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error) -> Void) {
Expand Down Expand Up @@ -55,6 +56,7 @@ class MockAuthenticator: Authenticator {

- Author: Klemens Muthmann
- Version: 1.0.0
- Since: 3.2.2
*/
class MockDataStoreStack: DataStoreStack {

Expand Down Expand Up @@ -82,4 +84,25 @@ class MockDataStoreStack: DataStoreStack {
}
}

/**
A mock for the vouchers interface avoiding actual network communication.

This should be used during testing and for previews.

- Author: Klemens Muthmann
- Version: 1.0.0
- Since: 3.2.2
*/
struct MockVouchers: Vouchers {
/// The amount of simulated vouchers available.
var count: Int
/// The voucher currently enabled for the active user.
let voucher: Voucher

/// Simulate requesting a voucher from the server. This will always return the hard coded voucher provided on initialization.
func requestVoucher() async throws -> Voucher {
return voucher
}
}

#endif
16 changes: 11 additions & 5 deletions RFR-App/RFR/RFRApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct RFRApp: App {
Those errors are published via the ``error`` property of this class.

- Author: Klemens Muthmann
- Version: 1.0.1
- Version: 1.0.2
- Since: 3.1.2
*/
class AppModel: ObservableObject {
Expand All @@ -90,7 +90,7 @@ class AppModel: ObservableObject {
/// View model used to manage information about the complete collection of local measurements.
let measurementsViewModel: MeasurementsViewModel
/// View model used to manage voucher progress and download vouchers from a voucher server.
let voucherViewModel: VoucherViewModel
var voucherViewModel: VoucherViewModel
/// The authenticator used by this application to communicate with the Cyface Data Collector and the voucher server.
let authenticator: Authenticator
/// Tells the view about errors occuring during initialization.
Expand Down Expand Up @@ -145,11 +145,16 @@ class AppModel: ObservableObject {
uploadProcessBuilder: uploadProcessBuilder,
measurementsViewModel: measurementsViewModel
)
voucherViewModel = VoucherViewModel(
authenticator: authenticator,
url: incentivesUrl,
let voucherRequirements = VoucherRequirements(
dataStoreStack: dataStoreStack
)
voucherViewModel = VoucherViewModel(
vouchers: VouchersApi(
authenticator: authenticator,
url: incentivesUrl
),
voucherRequirements: voucherRequirements
)

Task {
do {
Expand All @@ -167,6 +172,7 @@ class AppModel: ObservableObject {
try context.save()
}
try await measurementsViewModel.setup()

initialized = true
} catch {
self.error = error
Expand Down
Loading

0 comments on commit 0a0370d

Please sign in to comment.