Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 70 lines (49 sloc) 1.994 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
//
// SyncSessionController.h
// Notation
//
// Created by Zachary Schneirov on 1/23/10.
// Copyright 2010 Northwestern University. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#include <SystemConfiguration/SystemConfiguration.h>

#import "SyncServiceSessionProtocol.h"

@class NotationPrefs;

extern NSString *SyncSessionsChangedVisibleStatusNotification;

@interface SyncSessionController : NSObject {

NSMutableDictionary *syncServiceTimers;
NSMutableDictionary *syncServiceSessions;
id syncDelegate;
NSMenu *statusMenu;

NotationPrefs *notationPrefs;

//shouldn't go in the SimplenoteSession class as we probably don't even want an instance hanging around if there's no network:
//do we have one reachableref for every service? maybe this class should manage a series of SyncServicePref objs instead
SCNetworkReachabilityRef reachableRef;

BOOL isConnectedToNetwork;
BOOL isWaitingForUncommittedChanges;
id uncommittedWaitTarget;
SEL uncommittedWaitSelector;
}

+ (NSArray*)allServiceNames;
+ (NSArray*)allServiceClasses;

- (void)setSyncDelegate:(id)aDelegate;
- (id)syncDelegate;

- (id)initWithSyncDelegate:(id)aSyncDelegate notationPrefs:(NotationPrefs*)prefs;

- (id<SyncServiceSession>)_sessionForSyncService:(NSString*)serviceName;
- (void)invalidateSyncService:(NSString*)serviceName;
- (void)invalidateAllServices;

- (void)disableService:(NSString*)serviceName;
- (void)initializeService:(NSString*)serviceName;
- (void)initializeAllServices;

- (void)schedulePushToAllInitializedSessionsForNote:(id <SynchronizedNote>)aNote;
- (NSArray*)activeSessions;

- (void)invalidateReachabilityRefs;

- (void)_updateMenuWithCurrentStatus:(NSMenu*)aMenu;
- (NSMenu*)syncStatusMenu;

- (BOOL)hasRunningSessions;
- (BOOL)hasErrors;
- (void)queueStatusNotification;

- (void)_invokeUncommittedCallback;
- (void)invokeUncommmitedWaitCallbackIfNecessaryReturningError:(NSString*)errString;
- (BOOL)waitForUncommitedChangesWithTarget:(id)aTarget selector:(SEL)aSEL;


@end
Something went wrong with that request. Please try again.