From 4349f73b8322db02d5d6577ede2e2f6757f023b0 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Thu, 14 Apr 2022 15:10:39 +0300 Subject: [PATCH] Don't show notification on macOS 12 (#30) It is already shown in Pin Dialog IB-7235 Signed-off-by: Raul Metsma --- EstEIDToken/TokenSession.m | 14 ++++++++++---- EstEIDTokenApp.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/EstEIDToken/TokenSession.m b/EstEIDToken/TokenSession.m index e1484fe..75c4040 100644 --- a/EstEIDToken/TokenSession.m +++ b/EstEIDToken/TokenSession.m @@ -37,11 +37,11 @@ - (BOOL)isAllDigits:(NSString*)data { return r.location == NSNotFound && data.length > 0; } -- (nullable instancetype)initWithSmartCard:(TKSmartCard *)smartCard tokenSession:(TokenSession *)esteidsession { +- (nullable instancetype)initWithSmartCard:(TKSmartCard *)smartCard tokenSession:(TokenSession *)eidsession { if (self = [super init]) { self.smartCard = smartCard; - [esteidsession pinPadTemplate:self]; - session = esteidsession; + [eidsession pinPadTemplate:self]; + session = eidsession; } return self; } @@ -64,7 +64,13 @@ - (BOOL)finishWithError:(NSError **)error { if ((sw & 0xff00) == 0x6300 || sw == 0x6983) { int triesLeft = sw == 0x6983 ? 0 : sw & 0x3f; NSLog(@"EstEIDAuthOperation finishWithError Failed to verify PIN sw:0x%04x retries: %d", sw, triesLeft); - [EstEIDTokenDriver showNotification:[NSString localizedStringWithFormat:NSLocalizedString(@"VERIFY_TRY_LEFT", nil), triesLeft]]; + if (@available(macOS 12, *)) { + if (triesLeft == 0) { + [EstEIDTokenDriver showNotification:[NSString localizedStringWithFormat:NSLocalizedString(@"VERIFY_TRY_LEFT", nil), triesLeft]]; + } + } else { + [EstEIDTokenDriver showNotification:[NSString localizedStringWithFormat:NSLocalizedString(@"VERIFY_TRY_LEFT", nil), triesLeft]]; + } if (triesLeft == 0) { [session closeSession]; } diff --git a/EstEIDTokenApp.xcodeproj/project.pbxproj b/EstEIDTokenApp.xcodeproj/project.pbxproj index 4f82b25..8adddbf 100644 --- a/EstEIDTokenApp.xcodeproj/project.pbxproj +++ b/EstEIDTokenApp.xcodeproj/project.pbxproj @@ -505,7 +505,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 1.3.3; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; @@ -562,7 +562,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 1.3.3; OTHER_CODE_SIGN_FLAGS = "--timestamp --options=runtime"; SDKROOT = macosx; };