Skip to content

Commit c9c8a29

Browse files
authored
fix(datastore): Remove temporary fix to issue #395 (#967)
1 parent 2db512b commit c9c8a29

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

packages/amplify_datastore/example/ios/unit_tests/DataStorePluginUnitTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,21 +334,14 @@ class DataStorePluginUnitTests: XCTestCase {
334334
// Return from the mock
335335
completion(.emptyResult)
336336
}
337-
338-
let mockPublisher = PassthroughSubject<MutationEvent, DataStoreError>()
339-
override func onObserve() throws -> AnyPublisher<MutationEvent, DataStoreError> {
340-
mockPublisher.eraseToAnyPublisher()
341-
}
342337
}
343338
let dataStoreBridge: MockDataStoreBridge = MockDataStoreBridge()
344339
pluginUnderTest = SwiftAmplifyDataStorePlugin(bridge: dataStoreBridge, flutterModelRegistration: flutterModelSchemaRegistration)
345340

346-
XCTAssertNil(pluginUnderTest.observeSubscription)
347341
pluginUnderTest.onClear(
348342
flutterResult: {(result) in
349343
XCTAssertNil(result)
350344
})
351-
XCTAssertNotNil(pluginUnderTest.observeSubscription)
352345
}
353346

354347
func test_clear_failure_with_unknown_error() throws {

packages/amplify_datastore/ios/Classes/SwiftAmplifyDataStorePlugin.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin {
2828
private let dataStoreObserveEventStreamHandler: DataStoreObserveEventStreamHandler?
2929
private let dataStoreHubEventStreamHandler: DataStoreHubEventStreamHandler?
3030
private var channel: FlutterMethodChannel?
31-
var observeSubscription: AnyCancellable?
31+
private var observeSubscription: AnyCancellable?
3232

3333
init(bridge: DataStoreBridge = DataStoreBridge(),
3434
flutterModelRegistration: FlutterModels = FlutterModels(),
@@ -341,10 +341,6 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin {
341341
flutterResult: flutterResult)
342342
case .success():
343343
print("Successfully cleared the store")
344-
// iOS tears down the publisher after clear. Let's setup again.
345-
// See https://github.com/aws-amplify/amplify-flutter/issues/395
346-
self.observeSubscription = nil
347-
self.onSetUpObserve(flutterResult: flutterResult)
348344
flutterResult(nil)
349345
}
350346
}

0 commit comments

Comments
 (0)