diff --git a/Bouncer.xcodeproj/project.pbxproj b/Bouncer.xcodeproj/project.pbxproj index 6317113..fa210c3 100644 --- a/Bouncer.xcodeproj/project.pbxproj +++ b/Bouncer.xcodeproj/project.pbxproj @@ -687,7 +687,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = SMSFilter/SMSFilter.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1137; + CURRENT_PROJECT_VERSION = 1150; DEVELOPMENT_TEAM = J9F8F3PWTV; INFOPLIST_FILE = SMSFilter/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -715,7 +715,7 @@ CODE_SIGN_ENTITLEMENTS = SMSFilter/SMSFilter.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1137; + CURRENT_PROJECT_VERSION = 1150; DEVELOPMENT_TEAM = J9F8F3PWTV; INFOPLIST_FILE = SMSFilter/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -866,7 +866,7 @@ CODE_SIGN_ENTITLEMENTS = Bouncer/Bouncer.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1137; + CURRENT_PROJECT_VERSION = 1150; DEVELOPMENT_ASSET_PATHS = "\"Bouncer/Preview Content\""; DEVELOPMENT_TEAM = J9F8F3PWTV; ENABLE_PREVIEWS = YES; @@ -901,7 +901,7 @@ CODE_SIGN_ENTITLEMENTS = Bouncer/Bouncer.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1137; + CURRENT_PROJECT_VERSION = 1150; DEVELOPMENT_ASSET_PATHS = "\"Bouncer/Preview Content\""; DEVELOPMENT_TEAM = J9F8F3PWTV; ENABLE_PREVIEWS = YES; diff --git a/Bouncer.xcodeproj/xcuserdata/afterxleep.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Bouncer.xcodeproj/xcuserdata/afterxleep.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 636a8c8..dd9754c 100644 --- a/Bouncer.xcodeproj/xcuserdata/afterxleep.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Bouncer.xcodeproj/xcuserdata/afterxleep.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -20,5 +20,21 @@ landmarkType = "14"> + + + + diff --git a/Bouncer/.DS_Store b/Bouncer/.DS_Store index 1d93c22..0845f4b 100644 Binary files a/Bouncer/.DS_Store and b/Bouncer/.DS_Store differ diff --git a/BouncerTests/Models/SMSOfflineFilter.swift b/BouncerTests/Models/SMSOfflineFilter.swift index 7c2f7d6..acec98a 100644 --- a/BouncerTests/Models/SMSOfflineFilter.swift +++ b/BouncerTests/Models/SMSOfflineFilter.swift @@ -52,14 +52,14 @@ class SMSOfflineFilterTest: XCTestCase { func testRegexFilter() { var smsFilter: SMSOfflineFilter var filterResult: SMSOfflineFilterResponse - - let message = SMSMessage(sender: "ETB Comunicaciones", text: "ETB compra 100 megas y recibe 200 por 6 meses. Incluye extensor de velocidAd mas promocion especial. Llama ya sin costo al 018000413807. Ver TyC. Hasta 31 ago 2020") + + var message = SMSMessage(sender: "ETB Comunicaciones", text: "ETB compra 100 megas y recibe 200 por 6 meses. Incluye extensor de velocidAd mas promocion especial. Llama ya sin costo al 018000413807. Ver TyC. Hasta 31 ago 2020") // Regex filter test smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "[E].*[l][o]cidad", type: .message, action: .junk, useRegex: true)]) filterResult = smsFilter.filterMessage(message: message) XCTAssertEqual(filterResult.action, .junk) - + // Regex filter test (Case sensitive) smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "[E].*[l][o]CidAd", type: .message, action: .junk, useRegex: true, caseSensitive: true)]) filterResult = smsFilter.filterMessage(message: message) @@ -71,23 +71,43 @@ class SMSOfflineFilterTest: XCTestCase { XCTAssertEqual(filterResult.action, .junk) // Regex filter test (Case sensitive) + // Match any string that contains any words “compra,” “extensor,” and “nuevo” in any order and at any position smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "compra|algo|nuevo", type: .message, action: .junk, useRegex: true, caseSensitive: true)]) filterResult = smsFilter.filterMessage(message: message) XCTAssertEqual(filterResult.action, .junk) + // Match any string that contains any words “compra,” “extensor,” and “nuevo” in any order and at any position smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "compra|extensor|nuevo", type: .message, action: .junk, useRegex: true)]) filterResult = smsFilter.filterMessage(message: message) XCTAssertEqual(filterResult.action, .junk) + // Match any string that contains all words “compra,” “meses,” and “megas” in any order and at any position + // All Are included smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "(?=.*especial)(?=.*meses)(?=.*megas).*", type: .message, action: .junk, useRegex: true)]) filterResult = smsFilter.filterMessage(message: message) XCTAssertEqual(filterResult.action, .junk) + // Match any string that contains all words “compra,” “casa,” and “megas” in any order and at any position + // Word casa is not included smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "(?=.*compra)(?=.*casa)(?=.*megas).*", type: .message, action: .junk, useRegex: true)]) filterResult = smsFilter.filterMessage(message: message) print(filterResult.action) XCTAssertEqual(filterResult.action, .none) + message = SMSMessage(sender: "Trump", text: """ + Shocked you didn't sign..will you PLEASE sign to STRIP Trump of immunity by passing the No Kings Act! SIGN: go.freedom-dems.org/0930a3 + + Freedom Dems + + Stop2End + """) + + // Match any word starting with 'dem' or 'Dem' in the message + smsFilter = SMSOfflineFilter(filterList: [Filter(id: UUID(), phrase: "\\bdem\\w+", type: .message, action: .junk, useRegex: true)]) + filterResult = smsFilter.filterMessage(message: message) + print(filterResult.action) + XCTAssertEqual(filterResult.action, .junk) + } func testSubactionFilters() {