IOSAD-72 languageListWithError

IOSAD-92
Dirk Zimmermann 5 years ago
parent 7abce9a300
commit a77631ac83
  1. 13
      pEpObjCAdapter/PEPInternalSession.m
  2. 11
      pEpObjCAdapter/PEPSession.m
  3. 2
      pEpObjCAdapter/PEPSessionProtocol.h
  4. 4
      pEpObjCTests/PepTests.m

@ -641,11 +641,18 @@
return result;
}
- (NSArray<PEPLanguage *> * _Nonnull)languageList
- (NSArray<PEPLanguage *> * _Nullable)languageListWithError:(NSError * _Nullable * _Nullable)error
{
char *chLangs;
get_languagelist(_session, &chLangs);
char *chLangs = NULL;
PEP_STATUS status = get_languagelist(_session, &chLangs);
if ([NSError setError:error fromPEPStatus:status]) {
free(chLangs);
return nil;
}
NSString *parserInput = [NSString stringWithUTF8String:chLangs];
free(chLangs);
NSMutableArray<NSString *> *tokens = [NSMutableArray array];
PEPCSVScanner *scanner = [[PEPCSVScanner alloc] initWithString:parserInput];

@ -244,9 +244,10 @@
error:error];
}
- (NSArray<PEPLanguage *> * _Nonnull)languageList
- (NSArray<PEPLanguage *> * _Nullable)languageListWithError:(NSError * _Nullable * _Nullable)error
{
return [PEPSession languageList];
PEPInternalSession *session = [PEPSessionProvider session];
return [session languageListWithError:error];
}
- (PEP_STATUS)undoLastMistrust
@ -277,12 +278,6 @@
#pragma mark Internal API (testing etc.)
+ (NSArray<PEPLanguage *> * _Nonnull)languageList
{
PEPInternalSession *session = [PEPSessionProvider session];
return [session languageList];
}
+ (PEP_STATUS)undoLastMistrust
{
PEPInternalSession *session = [PEPSessionProvider session];

@ -187,7 +187,7 @@ typedef NSArray<NSString *> PEPStringList;
/**
@returns The list of supported languages for trustwords.
*/
- (NSArray<PEPLanguage *> * _Nonnull)languageList;
- (NSArray<PEPLanguage *> * _Nullable)languageListWithError:(NSError * _Nullable * _Nullable)error;
/**
Directly invokes the engine's undo_last_mistrust() function

@ -29,7 +29,9 @@
- (void)testLanguageList {
PEPSession *session = [[PEPSession alloc] init];
NSArray<PEPLanguage *> *langs = [session languageList];
NSError *error = nil;
NSArray<PEPLanguage *> *langs = [session languageListWithError:&error];
XCTAssertNil(error);
XCTAssertGreaterThan(langs.count, 0);
BOOL foundEn = NO;
for (PEPLanguage *lang in langs) {

Loading…
Cancel
Save