Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete CocoaSyncUserContext #8470

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Realm/RLMSyncManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ @implementation RLMSyncManager {

- (instancetype)initWithSyncManager:(std::shared_ptr<realm::SyncManager>)syncManager {
if (self = [super init]) {
[RLMUser _setUpBindingContextFactory];
_syncManager = syncManager;
return self;
}
Expand Down
5 changes: 0 additions & 5 deletions Realm/RLMSyncUtil.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,3 @@ SyncSessionStopPolicy translateStopPolicy(RLMSyncStopPolicy stopPolicy) {
RLMSyncStopPolicy translateStopPolicy(SyncSessionStopPolicy stopPolicy) {
return static_cast<RLMSyncStopPolicy>(stopPolicy);
}

CocoaSyncUserContext& context_for(const std::shared_ptr<realm::SyncUser>& user)
{
return *std::static_pointer_cast<CocoaSyncUserContext>(user->binding_context());
}
6 changes: 0 additions & 6 deletions Realm/RLMSyncUtil_Private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@

#import <realm/object-store/sync/sync_manager.hpp>

class CocoaSyncUserContext;

realm::SyncSessionStopPolicy translateStopPolicy(RLMSyncStopPolicy stopPolicy);
RLMSyncStopPolicy translateStopPolicy(realm::SyncSessionStopPolicy stop_policy);

typedef NS_ENUM(NSUInteger, RLMClientResetMode);
RLMClientResetMode translateClientResetMode(realm::ClientResyncMode mode);
realm::ClientResyncMode translateClientResetMode(RLMClientResetMode mode);

#pragma mark - Get user context

CocoaSyncUserContext& context_for(const std::shared_ptr<realm::SyncUser>& user);
6 changes: 0 additions & 6 deletions Realm/RLMUser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,6 @@ - (void)handleResponse:(std::optional<realm::app::AppError>)error

#pragma mark - Private API

+ (void)_setUpBindingContextFactory {
SyncUser::set_binding_context_factory([] {
return std::make_shared<CocoaSyncUserContext>();
});
}

- (NSString *)refreshToken {
if (!_user || _user->refresh_token().empty()) {
return nil;
Expand Down
18 changes: 1 addition & 17 deletions Realm/RLMUser_Private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,15 @@
#import <realm/object-store/sync/sync_user.hpp>
#import <realm/sync/config.hpp>

@class RLMSyncConfiguration, RLMSyncSessionRefreshHandle, RLMApp;
@class RLMSyncConfiguration, RLMApp;

RLM_HEADER_AUDIT_BEGIN(nullability, sendability)

class CocoaSyncUserContext : public realm::SyncUserContext {
public:

private:
/**
A map of paths to 'refresh handles'.

A refresh handle is an object that encapsulates the concept of periodically
refreshing the Realm's access token before it expires. Tokens are indexed by their
paths (e.g. `/~/path/to/realm`).
*/
std::unordered_map<std::string, RLMSyncSessionRefreshHandle *> m_refresh_handles;
std::mutex m_mutex;
};

@interface RLMUser ()
- (instancetype)initWithUser:(std::shared_ptr<realm::SyncUser>)user app:(RLMApp *)app;
- (std::string)pathForPartitionValue:(std::string const&)partitionValue;
- (std::string)pathForFlexibleSync;
- (std::shared_ptr<realm::SyncUser>)_syncUser;
+ (void)_setUpBindingContextFactory;
@property (weak, readonly) RLMApp *app;

@end
Expand Down
Loading