Skip to content

Commit

Permalink
Merge pull request #1595 from ruuvi/dev
Browse files Browse the repository at this point in the history
fix: Abort sync prevents successive sync #1109
  • Loading branch information
priyonto authored Aug 14, 2023
2 parents e2accd6 + 09c2c3d commit 9dcd085
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
20 changes: 10 additions & 10 deletions station.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6369,7 +6369,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand Down Expand Up @@ -6401,7 +6401,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand Down Expand Up @@ -6433,7 +6433,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -6470,7 +6470,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -6505,7 +6505,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -6541,7 +6541,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -6693,7 +6693,7 @@
CODE_SIGN_ENTITLEMENTS = station/station.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand Down Expand Up @@ -6755,7 +6755,7 @@
CODE_SIGN_ENTITLEMENTS = station/station.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
INFOPLIST_FILE = "$(SRCROOT)/station/Resources/Plists/Info.plist";
Expand Down Expand Up @@ -6869,7 +6869,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -6904,7 +6904,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 397;
CURRENT_PROJECT_VERSION = 398;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class TagChartsViewInteractor {
private let maximumPointsCount: Double = 3000.0
private let minimumDownsampleThreshold: Int = 1000

private var gattSyncInterruptedByUser: Bool = false

deinit {
ruuviTagSensorObservationToken?.invalidate()
ruuviTagSensorObservationToken = nil
Expand Down Expand Up @@ -163,7 +165,10 @@ extension TagChartsViewInteractor: TagChartsViewInteractorInput {
connectionTimeout: connectionTimeout,
serviceTimeout: serviceTimeout)
op.on(success: { [weak self] _ in
self?.localSyncState.setGattSyncDate(Date(), for: self?.ruuviTagSensor.macId)
if let isInterrupted = self?.gattSyncInterruptedByUser, !isInterrupted {
self?.localSyncState.setGattSyncDate(Date(), for: self?.ruuviTagSensor.macId)
}
self?.gattSyncInterruptedByUser = false
promise.succeed(value: ())
}, failure: {error in
promise.fail(error: .ruuviService(error))
Expand All @@ -178,7 +183,8 @@ extension TagChartsViewInteractor: TagChartsViewInteractorInput {
return promise.future
}
let op = gattService.stopGattSync(for: luid.value)
op.on(success: { response in
op.on(success: { [weak self] response in
self?.gattSyncInterruptedByUser = true
promise.succeed(value: (response))
}, failure: {error in
promise.fail(error: .ruuviService(error))
Expand Down
2 changes: 1 addition & 1 deletion station/Resources/Plists/DevInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>397</string>
<string>398</string>
<key>FirebaseMessagingAutoInitEnabled</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down

0 comments on commit 9dcd085

Please sign in to comment.