pEpObjCAdapter/PEPSync.m
branchIOSAD-103
changeset 698 aaf199099cf1
parent 695 26359df4bec8
child 699 924aed6a15e6
     1.1 --- a/pEpObjCAdapter/PEPSync.m	Fri Oct 05 13:46:40 2018 +0200
     1.2 +++ b/pEpObjCAdapter/PEPSync.m	Fri Oct 05 14:42:21 2018 +0200
     1.3 @@ -16,12 +16,11 @@
     1.4  
     1.5  @interface PEPSync ()
     1.6  
     1.7 -+ (void)setPEPSyncSendMessageDelegate:
     1.8 -(PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate;
     1.9 -
    1.10  + (PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate;
    1.11 ++ (PEPNotifyHandshakeDelegate * _Nullable)notifyHandshakeDelegate;
    1.12  
    1.13  @property (nonatomic, nullable, weak) PEPSyncSendMessageDelegate *syncSendMessageDelegate;
    1.14 +@property (nonatomic, nullable, weak) PEPNotifyHandshakeDelegate *notifyHandshakeDelegate;
    1.15  
    1.16  @end
    1.17  
    1.18 @@ -40,12 +39,17 @@
    1.19  
    1.20  int inject_sync_eventObjc(SYNC_EVENT ev, void *management)
    1.21  {
    1.22 -    return 0;
    1.23 +    PEPNotifyHandshakeDelegate *delegate = [PEPSync notifyHandshakeDelegate];
    1.24 +    if (delegate) {
    1.25 +        return 0;
    1.26 +    }
    1.27 +    return 1;
    1.28  }
    1.29  
    1.30  // MARK: - Internal globals
    1.31  
    1.32 -static __weak PEPSyncSendMessageDelegate *s_PEPSyncSendMessageDelegate;
    1.33 +static __weak PEPSyncSendMessageDelegate *s_syncSendMessageDelegate;
    1.34 +static __weak PEPNotifyHandshakeDelegate *s_notifyHandshakeDelegate;
    1.35  
    1.36  // MARK: - PEPSync class
    1.37  
    1.38 @@ -54,12 +58,17 @@
    1.39  + (void)setPEPSyncSendMessageDelegate:
    1.40  (PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate
    1.41  {
    1.42 -    s_PEPSyncSendMessageDelegate = syncSendMessageDelegate;
    1.43 +    s_syncSendMessageDelegate = syncSendMessageDelegate;
    1.44  }
    1.45  
    1.46  + (PEPSyncSendMessageDelegate * _Nullable)syncSendMessageDelegate
    1.47  {
    1.48 -    return s_PEPSyncSendMessageDelegate;
    1.49 +    return s_syncSendMessageDelegate;
    1.50 +}
    1.51 +
    1.52 ++ (PEPNotifyHandshakeDelegate * _Nullable)notifyHandshakeDelegate
    1.53 +{
    1.54 +    return s_notifyHandshakeDelegate;
    1.55  }
    1.56  
    1.57  - (instancetype)initWithSyncSendMessageDelegate:(PEPSyncSendMessageDelegate *
    1.58 @@ -68,7 +77,8 @@
    1.59                                                   _Nonnull)notifyHandshakeDelegate
    1.60  {
    1.61      if (self = [super init]) {
    1.62 -        
    1.63 +        self.syncSendMessageDelegate = syncSendMessageDelegate;
    1.64 +        self.notifyHandshakeDelegate = notifyHandshakeDelegate;
    1.65      }
    1.66      return self;
    1.67  }