Browse Source

IOSAD-72 logTitle... error handling

IOSAD-92
Dirk Zimmermann 4 years ago
parent
commit
7157f3de2c
3 changed files with 33 additions and 18 deletions
  1. +16
    -6
      pEpObjCAdapter/PEPInternalSession.m
  2. +12
    -10
      pEpObjCAdapter/PEPSession.m
  3. +5
    -2
      pEpObjCAdapter/PEPSessionProtocol.h

+ 16
- 6
pEpObjCAdapter/PEPInternalSession.m View File

@ -561,15 +561,25 @@
return YES;
}
- (void)logTitle:(NSString * _Nonnull)title entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description comment:(NSString * _Nullable)comment
- (BOOL)logTitle:(NSString * _Nonnull)title
entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description
comment:(NSString * _Nullable)comment
error:(NSError * _Nullable * _Nullable)error
{
[self lockWrite];
log_event(_session, [[title precomposedStringWithCanonicalMapping] UTF8String],
[[entity precomposedStringWithCanonicalMapping] UTF8String],
[[description precomposedStringWithCanonicalMapping] UTF8String],
[[comment precomposedStringWithCanonicalMapping] UTF8String]);
PEP_STATUS status = log_event(_session,
[[title precomposedStringWithCanonicalMapping] UTF8String],
[[entity precomposedStringWithCanonicalMapping] UTF8String],
[[description precomposedStringWithCanonicalMapping] UTF8String],
[[comment precomposedStringWithCanonicalMapping] UTF8String]);
[self unlockWrite];
if ([NSError setError:error fromPEPStatus:status]) {
return NO;
} else {
return YES;
}
}
- (NSString * _Nullable)getLogWithError:(NSError * _Nullable * _Nullable)error


+ 12
- 10
pEpObjCAdapter/PEPSession.m View File

@ -197,10 +197,19 @@
return [session importKey:keydata error:error];
}
- (void)logTitle:(NSString * _Nonnull)title entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description comment:(NSString * _Nullable)comment
- (BOOL)logTitle:(NSString * _Nonnull)title
entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description
comment:(NSString * _Nullable)comment
error:(NSError * _Nullable * _Nullable)error
{
[PEPSession logTitle:title entity:entity description:description comment:comment];
PEPInternalSession *session = [PEPSessionProvider session];
return [session
logTitle:title
entity:entity
description:description
comment:comment
error:error];
}
- (NSString * _Nullable)getLogWithError:(NSError * _Nullable * _Nullable)error
@ -253,13 +262,6 @@
#pragma mark Internal API (testing etc.)
+ (void)logTitle:(NSString * _Nonnull)title entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description comment:(NSString * _Nullable)comment
{
PEPInternalSession *session = [PEPSessionProvider session];
[session logTitle:title entity:entity description:description comment:comment];
}
+ (NSString * _Nullable)getTrustwordsIdentity1:(PEPIdentity * _Nonnull)identity1
identity2:(PEPIdentity * _Nonnull)identity2
language:(NSString * _Nullable)language


+ 5
- 2
pEpObjCAdapter/PEPSessionProtocol.h View File

@ -164,8 +164,11 @@ typedef NSArray<NSString *> PEPStringList;
/** For testing purpose, manual key import */
- (BOOL)importKey:(NSString * _Nonnull)keydata error:(NSError * _Nullable * _Nullable)error;
- (void)logTitle:(NSString * _Nonnull)title entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description comment:(NSString * _Nullable)comment;
- (BOOL)logTitle:(NSString * _Nonnull)title
entity:(NSString * _Nonnull)entity
description:(NSString * _Nullable)description
comment:(NSString * _Nullable)comment
error:(NSError * _Nullable * _Nullable)error;
/**
Retrieves the log from the engine, or nil, if there is nothing yet.


Loading…
Cancel
Save