IOSAD-50 cleanup IOSAD-50
authorbuff <andreas@pep-project.org>
Fri, 13 Oct 2017 17:09:46 +0200
branchIOSAD-50
changeset 2763a09f74f0c11
parent 275 061b0419a96a
child 277 6ff73d1432e8
IOSAD-50 cleanup
pEpObjCAdapter/PEPInternalSession.h
pEpObjCAdapter/PEPInternalSession.m
pEpObjCAdapter/PEPObjCAdapter.m
pEpObjCAdapter/PEPSession.h
pEpObjCAdapter/PEPSessionProvider.h
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.h	Fri Oct 13 17:09:34 2017 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.h	Fri Oct 13 17:09:46 2017 +0200
     1.3 @@ -8,7 +8,7 @@
     1.4  
     1.5  #import <Foundation/Foundation.h>
     1.6  
     1.7 -#import "PEPObjCAdapter.h" //BUFF: remove 
     1.8 +#import "PEPObjCAdapter.h"
     1.9  
    1.10  /**
    1.11   Represents a real pEp session (in contrat to PEPSession, which is a fake session to handle to the client).
     2.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Fri Oct 13 17:09:34 2017 +0200
     2.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Fri Oct 13 17:09:46 2017 +0200
     2.3 @@ -25,7 +25,7 @@
     2.4      });
     2.5  }
     2.6  
     2.7 -- (instancetype)init
     2.8 +- (instancetype)initInternal
     2.9  {
    2.10      self = [super init];
    2.11      if (self) {
    2.12 @@ -44,6 +44,13 @@
    2.13      return self;
    2.14  }
    2.15  
    2.16 +- (instancetype)init
    2.17 +{
    2.18 +    NSAssert(false,  @"Sorry. We have a strict door policy here at the VIP entrance. Please wait in queue \
    2.19 +             like everybody else and use [PEPSessionProvider session] to get an instance");
    2.20 +    return nil;
    2.21 +}
    2.22 +
    2.23  - (void)dealloc
    2.24  {
    2.25      [PEPObjCAdapter unbindSession:self];
     3.1 --- a/pEpObjCAdapter/PEPObjCAdapter.m	Fri Oct 13 17:09:34 2017 +0200
     3.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.m	Fri Oct 13 17:09:46 2017 +0200
     3.3 @@ -11,14 +11,12 @@
     3.4  #import "PEPObjCAdapter.h"
     3.5  #import "PEPObjCAdapter+Internal.h"
     3.6  #import "PEPMessage.h"
     3.7 -#import "PEPSessionProvider.h"
     3.8  #include "keymanagement.h"
     3.9  #import "PEPCopyableThread.h"
    3.10  
    3.11  ///////////////////////////////////////////////////////////////////////////////
    3.12  //  Keyserver and Identity lookup - C part
    3.13  
    3.14 -
    3.15  int examine_identity(pEp_identity *ident, void *management)
    3.16  {
    3.17      //PEPQueue *q = (__bridge PEPQueue *)management;
    3.18 @@ -75,7 +73,6 @@
    3.19  int inject_sync_msg(void *msg, void *unused_management)
    3.20  {
    3.21      PEPQueue *q = [PEPObjCAdapter getSyncQueue];
    3.22 -    
    3.23      [q enqueue:[NSValue valueWithPointer:msg]];
    3.24      
    3.25      return 0;
    3.26 @@ -172,14 +169,14 @@
    3.27      return s_homeURL;
    3.28  }
    3.29  
    3.30 -+ (NSString *) getBundlePathFor: (NSString *) filename
    3.31 ++ (NSString *)getBundlePathFor: (NSString *) filename
    3.32  {
    3.33      return nil;
    3.34  }
    3.35  
    3.36 -+ (NSString *) copyAssetIntoDocumentsDirectory:(NSBundle *)rootBundle
    3.37 -                                              :(NSString *)bundleName
    3.38 -                                              :(NSString *)fileName{
    3.39 ++ (NSString *)copyAssetIntoDocumentsDirectory:(NSBundle *)rootBundle
    3.40 +                                             :(NSString *)bundleName
    3.41 +                                             :(NSString *)fileName{
    3.42      
    3.43      NSURL *homeUrl = [PEPObjCAdapter createAndSetHomeDirectory];
    3.44      NSString *documentsDirectory = [homeUrl path];
    3.45 @@ -194,7 +191,6 @@
    3.46          NSBundle *bundleObj = [NSBundle bundleWithPath:
    3.47                                 [[rootBundle resourcePath]
    3.48                                  stringByAppendingPathComponent: bundleName]];
    3.49 -        
    3.50          if (!bundleObj)
    3.51              return nil;
    3.52          
    3.53 @@ -322,8 +318,7 @@
    3.54                                "NOTNULL");
    3.55      
    3.56      // TODO : log something if status not as expected
    3.57 -    
    3.58 -    
    3.59 +
    3.60      [syncThreadJoinCond unlockWithCondition:YES];
    3.61  }
    3.62  
    3.63 @@ -446,7 +441,6 @@
    3.64      @synchronized (sessionList) {
    3.65          [sessionList removeObject:[NSValue valueWithNonretainedObject:session]];
    3.66      }
    3.67 -    
    3.68  }
    3.69  
    3.70  @end
     4.1 --- a/pEpObjCAdapter/PEPSession.h	Fri Oct 13 17:09:34 2017 +0200
     4.2 +++ b/pEpObjCAdapter/PEPSession.h	Fri Oct 13 17:09:46 2017 +0200
     4.3 @@ -23,9 +23,14 @@
     4.4   You can instatntiate and use this session how often and wherever you want. Also over multiple threads.
     4.5  
     4.6   Note: You must call `cleanup()` once before your process gets terminated to be able to gracefully shutdown.
     4.7 + It is the clients responsibility not to make any calls to PEPSession after calling cleanup.
     4.8   */
     4.9  @interface PEPSession : NSObject
    4.10  
    4.11 +/**
    4.12 + You must call this method once before your process gets terminated to be able to gracefully shutdown.
    4.13 + You must not make any calls to PEPSession after calling cleanup.
    4.14 + */
    4.15  - (void)cleanup;
    4.16  
    4.17  /** Decrypt a message */
     5.1 --- a/pEpObjCAdapter/PEPSessionProvider.h	Fri Oct 13 17:09:34 2017 +0200
     5.2 +++ b/pEpObjCAdapter/PEPSessionProvider.h	Fri Oct 13 17:09:46 2017 +0200
     5.3 @@ -10,8 +10,19 @@
     5.4  
     5.5  @class PEPInternalSession;
     5.6  
     5.7 +/**
     5.8 + If you need a PEPInternaSession instance, PEPSessionProvider (and only PEPSessionProvider)
     5.9 + provides you with one.
    5.10 +
    5.11 + Internally session provider creates a session per thread and caches it for as long as thread is not finished.
    5.12 + */
    5.13  @interface PEPSessionProvider : NSObject
    5.14  
    5.15 +/**
    5.16 + Provides a PEPInternalSession intance.
    5.17 +
    5.18 + @return interna session instance suitable for the callers thread.
    5.19 + */
    5.20  + (PEPInternalSession * _Nonnull)session;
    5.21  
    5.22  + (void)cleanup;