From 859165c895c595af93921cdcb568184b16fa2729 Mon Sep 17 00:00:00 2001 From: Still Hsu Date: Wed, 1 Nov 2023 11:21:59 +0800 Subject: [PATCH 1/3] Add unit tests for zh-tw cases Signed-off-by: Still Hsu --- .../jd1378/otphelper/CodeDetectionUnitTest.kt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/src/test/java/io/github/jd1378/otphelper/CodeDetectionUnitTest.kt b/app/src/test/java/io/github/jd1378/otphelper/CodeDetectionUnitTest.kt index 5a3ab46d..5de609e1 100644 --- a/app/src/test/java/io/github/jd1378/otphelper/CodeDetectionUnitTest.kt +++ b/app/src/test/java/io/github/jd1378/otphelper/CodeDetectionUnitTest.kt @@ -228,6 +228,34 @@ www.iranketab.ir assertEquals("123456", CodeExtractor.getCode(msg)) } + @Test + fun alibabaCode() { + val msg = "【阿里巴巴】验证码123456,您正在登录验证,切勿将验证码泄露于他人,验证码15分钟内有效。" + assertEquals(false, CodeIgnore.shouldIgnore(msg)) + assertEquals("123456", CodeExtractor.getCode(msg)) + } + + @Test + fun twBankingOneCode() { + val msg = "請提防詐騙!密碼勿提供他人或輸入不明網頁,您的信用卡網路消費幣別新台幣金額9876元,交易驗證碼『123456』請十分鐘內認證" + assertEquals(false, CodeIgnore.shouldIgnore(msg)) + assertEquals("123456", CodeExtractor.getCode(msg)) + } + + @Test + fun twBankingTwoCode() { + val msg = "【銀行轉帳】OTP密碼1234567網頁識別碼ABCD轉入帳號後四碼8888、TWD\$9876,密碼勿告知他人以防詐騙" + assertEquals(false, CodeIgnore.shouldIgnore(msg)) + assertEquals("1234567", CodeExtractor.getCode(msg)) + } + + @Test + fun twShopeeCode() { + val msg = "【蝦皮購物】輸入 123456 以登入您的帳號,15 分鐘有效。請不要將驗證碼分享給任何人,包括蝦皮員工。" + assertEquals(false, CodeIgnore.shouldIgnore(msg)) + assertEquals("123456", CodeExtractor.getCode(msg)) + } + @Test fun gitubCode() { val msg = """123456 is your GitHub authentication code. From 408d8337a4d3102d83aa838259c33386d3658948 Mon Sep 17 00:00:00 2001 From: Still Hsu Date: Wed, 1 Nov 2023 11:22:22 +0800 Subject: [PATCH 2/3] Add additional keyword for zh-tw Signed-off-by: Still Hsu --- .../main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt b/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt index d3c8784c..3e55f67d 100644 --- a/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt +++ b/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt @@ -17,6 +17,7 @@ class CodeExtractor { "識別碼", "認證", "驗證", + "碼", "код", "סיסמ", "קוד", From b8bb10f8e289643d61c40232e19ee7203d8d2cf8 Mon Sep 17 00:00:00 2001 From: Still Hsu Date: Wed, 1 Nov 2023 11:27:20 +0800 Subject: [PATCH 3/3] Remove incomplete code hotword Signed-off-by: Still Hsu --- .../main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt b/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt index 3e55f67d..d3c8784c 100644 --- a/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt +++ b/app/src/main/java/io/github/jd1378/otphelper/utils/CodeExtractor.kt @@ -17,7 +17,6 @@ class CodeExtractor { "識別碼", "認證", "驗證", - "碼", "код", "סיסמ", "קוד",