RLMProviderClient.mm 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2020 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import "RLMProviderClient_Private.hpp"
  19. #import "RLMApp_Private.hpp"
  20. #import <realm/object-store/sync/app.hpp>
  21. #import <realm/util/optional.hpp>
  22. @implementation RLMProviderClient
  23. - (instancetype)initWithApp:(RLMApp *)app {
  24. self = [super init];
  25. if (self) {
  26. _app = app;
  27. }
  28. return self;
  29. }
  30. realm::util::UniqueFunction<void(std::optional<realm::app::AppError>)>
  31. RLMWrapCompletion(RLMProviderClientOptionalErrorBlock completion) {
  32. return [completion](std::optional<realm::app::AppError> error) {
  33. if (error) {
  34. return completion(makeError(*error));
  35. }
  36. completion(nil);
  37. };
  38. }
  39. @end