IOS-559 separate debug extension
authorDirk Zimmermann <dirk@pep-project.org>
Thu, 07 Jun 2018 10:08:17 +0200
changeset 6225c5d267a32a0
parent 621 d428fc2ba45a
child 623 fade443297e3
IOS-559 separate debug extension
pEpObjCAdapter.xcodeproj/project.pbxproj
pEpObjCAdapter/NSDictionary+Debug.h
pEpObjCAdapter/NSDictionary+Debug.m
pEpObjCAdapter/NSDictionary+Extension.h
pEpObjCAdapter/NSDictionary+Extension.m
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Wed May 30 11:05:16 2018 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Thu Jun 07 10:08:17 2018 +0200
     1.3 @@ -37,6 +37,7 @@
     1.4  		43676B661C57EA1A00233933 /* B623F674_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43676B641C57EA1A00233933 /* B623F674_sec.asc */; };
     1.5  		439393E6208F375800EB1DBD /* NSObject+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 439393E5208F375800EB1DBD /* NSObject+Extension.m */; };
     1.6  		439393F8208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m in Sources */ = {isa = PBXBuildFile; fileRef = 439393F7208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m */; };
     1.7 +		43953B3520C91E2B001C7DDB /* NSDictionary+Debug.m in Sources */ = {isa = PBXBuildFile; fileRef = 43953B3420C91E2B001C7DDB /* NSDictionary+Debug.m */; };
     1.8  		439D91A5208479EE003F6AC2 /* PEPAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 439D91A4208479EE003F6AC2 /* PEPAttachment.m */; };
     1.9  		43D27DE61F5DA7B700795687 /* NSDictionary+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */; };
    1.10  		43DED786203C25E200D45CD6 /* NSError+PEP.m in Sources */ = {isa = PBXBuildFile; fileRef = 43DED785203C25E200D45CD6 /* NSError+PEP.m */; };
    1.11 @@ -173,6 +174,8 @@
    1.12  		439393E5208F375800EB1DBD /* NSObject+Extension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Extension.m"; sourceTree = "<group>"; };
    1.13  		439393F6208F5B5E00EB1DBD /* NSMutableDictionary+PEP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+PEP.h"; sourceTree = "<group>"; };
    1.14  		439393F7208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+PEP.m"; sourceTree = "<group>"; };
    1.15 +		43953B3320C91E2B001C7DDB /* NSDictionary+Debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Debug.h"; sourceTree = "<group>"; };
    1.16 +		43953B3420C91E2B001C7DDB /* NSDictionary+Debug.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Debug.m"; sourceTree = "<group>"; };
    1.17  		439D91A3208479EE003F6AC2 /* PEPAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPAttachment.h; sourceTree = "<group>"; };
    1.18  		439D91A4208479EE003F6AC2 /* PEPAttachment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPAttachment.m; sourceTree = "<group>"; };
    1.19  		43D27DE41F5DA78700795687 /* NSDictionary+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Extension.h"; sourceTree = "<group>"; };
    1.20 @@ -302,6 +305,8 @@
    1.21  				43209B351ECC2ACD007E7E2E /* PEPInternalSession.m */,
    1.22  				43D27DE41F5DA78700795687 /* NSDictionary+Extension.h */,
    1.23  				43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */,
    1.24 +				43953B3320C91E2B001C7DDB /* NSDictionary+Debug.h */,
    1.25 +				43953B3420C91E2B001C7DDB /* NSDictionary+Debug.m */,
    1.26  				1508AEAD1F8792AC001D5230 /* PEPCopyableThread.h */,
    1.27  				1508AEAE1F8792AC001D5230 /* PEPCopyableThread.m */,
    1.28  				15206CA81F8BA183003FF880 /* PEPSessionProvider.h */,
    1.29 @@ -496,6 +501,7 @@
    1.30  				43D27DE61F5DA7B700795687 /* NSDictionary+Extension.m in Sources */,
    1.31  				435796E31FB5E51A00395A9E /* PEPMessage.m in Sources */,
    1.32  				43209B431ECC2DC0007E7E2E /* PEPInternalSession.m in Sources */,
    1.33 +				43953B3520C91E2B001C7DDB /* NSDictionary+Debug.m in Sources */,
    1.34  				43209B3F1ECC2DB0007E7E2E /* PEPLanguage.m in Sources */,
    1.35  				434ED6D6207E27B8000A7590 /* PEPAutoPointer.m in Sources */,
    1.36  				439D91A5208479EE003F6AC2 /* PEPAttachment.m in Sources */,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpObjCAdapter/NSDictionary+Debug.h	Thu Jun 07 10:08:17 2018 +0200
     2.3 @@ -0,0 +1,18 @@
     2.4 +//
     2.5 +//  NSDictionary+Debug.h
     2.6 +//  pEpObjCAdapter
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 07.06.18.
     2.9 +//  Copyright © 2018 p≡p. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import <Foundation/Foundation.h>
    2.13 +
    2.14 +@interface NSDictionary (Debug)
    2.15 +
    2.16 +/**
    2.17 + Saves itself to the filesystem, under `NSApplicationSupportDirectory`.
    2.18 + */
    2.19 +- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath;
    2.20 +
    2.21 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/pEpObjCAdapter/NSDictionary+Debug.m	Thu Jun 07 10:08:17 2018 +0200
     3.3 @@ -0,0 +1,32 @@
     3.4 +//
     3.5 +//  NSDictionary+Debug.m
     3.6 +//  pEpObjCAdapter
     3.7 +//
     3.8 +//  Created by Dirk Zimmermann on 07.06.18.
     3.9 +//  Copyright © 2018 p≡p. All rights reserved.
    3.10 +//
    3.11 +
    3.12 +#import "NSDictionary+Debug.h"
    3.13 +
    3.14 +#import "PEPMessageUtil.h"
    3.15 +
    3.16 +@implementation NSDictionary (Debug)
    3.17 +
    3.18 +- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath
    3.19 +{
    3.20 +    NSFileManager *fileManager = [NSFileManager defaultManager];
    3.21 +    NSURL *parentPath = [[fileManager
    3.22 +                          URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]
    3.23 +                         firstObject];
    3.24 +
    3.25 +    NSDate *now = [NSDate date];
    3.26 +    NSString *nowDesc = [now description];
    3.27 +    NSString *fileName = [NSString stringWithFormat:@"%@_%@.%@",
    3.28 +                          filePath, nowDesc, @"plist"];
    3.29 +
    3.30 +    NSURL *writeURL = [NSURL fileURLWithPath:fileName relativeToURL:parentPath];
    3.31 +    NSLog(@"debugSaveToFilePath: writing %@", writeURL);
    3.32 +    [self writeToURL:writeURL atomically:YES];
    3.33 +}
    3.34 +
    3.35 +@end
     4.1 --- a/pEpObjCAdapter/NSDictionary+Extension.h	Wed May 30 11:05:16 2018 +0200
     4.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.h	Thu Jun 07 10:08:17 2018 +0200
     4.3 @@ -18,9 +18,4 @@
     4.4   */
     4.5  @property (nonatomic, readonly) PEP_comm_type commType;
     4.6  
     4.7 -/**
     4.8 - Saves itself to the filesystem, under `NSApplicationSupportDirectory`.
     4.9 - */
    4.10 -- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath;
    4.11 -
    4.12  @end
     5.1 --- a/pEpObjCAdapter/NSDictionary+Extension.m	Wed May 30 11:05:16 2018 +0200
     5.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.m	Thu Jun 07 10:08:17 2018 +0200
     5.3 @@ -23,21 +23,4 @@
     5.4      return ctNum.intValue;
     5.5  }
     5.6  
     5.7 -- (void)debugSaveToFilePath:(NSString * _Nonnull)filePath
     5.8 -{
     5.9 -    NSFileManager *fileManager = [NSFileManager defaultManager];
    5.10 -    NSURL *parentPath = [[fileManager
    5.11 -                          URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]
    5.12 -                         firstObject];
    5.13 -
    5.14 -    NSDate *now = [NSDate date];
    5.15 -    NSString *nowDesc = [now description];
    5.16 -    NSString *fileName = [NSString stringWithFormat:@"%@_%@.%@",
    5.17 -                          filePath, nowDesc, @"plist"];
    5.18 -
    5.19 -    NSURL *writeURL = [NSURL fileURLWithPath:fileName relativeToURL:parentPath];
    5.20 -    NSLog(@"debugSaveToFilePath: writing %@", writeURL);
    5.21 -    [self writeToURL:writeURL atomically:YES];
    5.22 -}
    5.23 -
    5.24  @end
     6.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Wed May 30 11:05:16 2018 +0200
     6.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Thu Jun 07 10:08:17 2018 +0200
     6.3 @@ -14,6 +14,7 @@
     6.4  #import "PEPCSVScanner.h"
     6.5  #import "NSArray+Extension.h"
     6.6  #import "NSDictionary+Extension.h"
     6.7 +#import "NSDictionary+Debug.h"
     6.8  #import "PEPIdentity.h"
     6.9  #import "PEPMessage.h"
    6.10  #import "NSError+PEP.h"