Skip to content

Commit

Permalink
Adapt mqtt updates
Browse files Browse the repository at this point in the history
  • Loading branch information
klassm committed Jun 10, 2022
1 parent ce558c9 commit f143c0c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Carthage
.DS_Store
walkingpad-client.xcodeproj/project.pbxproj
walkingpad-client.xcodeproj/project.xcworkspace/xcuserdata
walkingpad-client.xcodeproj/xcuserdata

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions walkingpad-client/services/MqttService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class MqttService {
}

public func publish(oldState: DeviceState?, newState: DeviceState) {
if (oldState?.speed != newState.speed) {
return
}
guard let connection = self.connection else { return }
let config = connection.config
connection.mqtt.publish(CocoaMQTTMessage(topic: "\(config.topic)/speed", string: "\(newState.speedKmh())"))
Expand Down
3 changes: 3 additions & 0 deletions walkingpad-client/services/Workout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class Workout: ObservableObject {
}

public func load() {
if (self.steps > 0) {
return
}
let workouts = loadAll()
let workout = workouts.first (where: { entry in Calendar.current.isDateInToday(entry.date) })

Expand Down

0 comments on commit f143c0c

Please sign in to comment.