Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep committed Apr 30, 2023
2 parents ddc2b88 + 9792878 commit b888813
Show file tree
Hide file tree
Showing 25 changed files with 294 additions and 212 deletions.
16 changes: 8 additions & 8 deletions Bouncer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
D6CC124D24E4563F00388160 /* SettingsAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CC124C24E4563F00388160 /* SettingsAction.swift */; };
D6CC124F24E47C3900388160 /* SettingsMiddleware.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CC124E24E47C3900388160 /* SettingsMiddleware.swift */; };
D6CC125124E4837800388160 /* SettingsReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CC125024E4837800388160 /* SettingsReducer.swift */; };
D6EA9A8224AD2201000135E7 /* SMSFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EA9A8124AD2201000135E7 /* SMSFilter.swift */; };
D6EA9A8224AD2201000135E7 /* SMSFiltering.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EA9A8124AD2201000135E7 /* SMSFiltering.swift */; };
D6EA9A8424AD2244000135E7 /* FilterStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EA9A8324AD2244000135E7 /* FilterStore.swift */; };
D6EA9A8524AD2319000135E7 /* FilterStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6EA9A8324AD2244000135E7 /* FilterStore.swift */; };
D6F0621124EC69F800F47BA2 /* FilterStoreFileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F0621024EC69F800F47BA2 /* FilterStoreFileTests.swift */; };
Expand Down Expand Up @@ -156,7 +156,7 @@
D6CC124E24E47C3900388160 /* SettingsMiddleware.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsMiddleware.swift; sourceTree = "<group>"; };
D6CC125024E4837800388160 /* SettingsReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsReducer.swift; sourceTree = "<group>"; };
D6DA734729F539B300C3A831 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Localizable.strings; sourceTree = "<group>"; };
D6EA9A8124AD2201000135E7 /* SMSFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SMSFilter.swift; sourceTree = "<group>"; };
D6EA9A8124AD2201000135E7 /* SMSFiltering.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SMSFiltering.swift; sourceTree = "<group>"; };
D6EA9A8324AD2244000135E7 /* FilterStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterStore.swift; sourceTree = "<group>"; };
D6F0621024EC69F800F47BA2 /* FilterStoreFileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterStoreFileTests.swift; sourceTree = "<group>"; };
D6F14E8724E8A1780029A0DF /* ReviewMiddleware.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewMiddleware.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -251,7 +251,7 @@
isa = PBXGroup;
children = (
D60A19C624A69F1F0002E8BD /* SMSMessage.swift */,
D6EA9A8124AD2201000135E7 /* SMSFilter.swift */,
D6EA9A8124AD2201000135E7 /* SMSFiltering.swift */,
D6233A7D24A651A200B37A6A /* SMSOfflineFilter.swift */,
);
path = SMSFilter;
Expand Down Expand Up @@ -640,7 +640,7 @@
D6529F7324A41371009AE3FF /* BouncerApp.swift in Sources */,
D616A7F329F42EEC00D5523F /* FilterStoreFileMigrator.swift in Sources */,
D6C90BF424CAB26700426B31 /* AppStore.swift in Sources */,
D6EA9A8224AD2201000135E7 /* SMSFilter.swift in Sources */,
D6EA9A8224AD2201000135E7 /* SMSFiltering.swift in Sources */,
D61497EE24E4435100AF997E /* AppReducer.swift in Sources */,
09491AEF261D30A400CF8073 /* String+Empty.swift in Sources */,
D67F582F24E4496300165365 /* AppSettingsStore.swift in Sources */,
Expand Down Expand Up @@ -697,7 +697,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = SMSFilter/SMSFilter.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 514;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_TEAM = JM9222EF99;
INFOPLIST_FILE = SMSFilter/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -720,7 +720,7 @@
CODE_SIGN_ENTITLEMENTS = SMSFilter/SMSFilter.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 514;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_TEAM = JM9222EF99;
INFOPLIST_FILE = SMSFilter/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -866,7 +866,7 @@
CODE_SIGN_ENTITLEMENTS = Bouncer/Bouncer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 514;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_ASSET_PATHS = "\"Bouncer/Preview Content\"";
DEVELOPMENT_TEAM = JM9222EF99;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -897,7 +897,7 @@
CODE_SIGN_ENTITLEMENTS = Bouncer/Bouncer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 514;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_ASSET_PATHS = "\"Bouncer/Preview Content\"";
DEVELOPMENT_TEAM = JM9222EF99;
ENABLE_PREVIEWS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,112 +7,48 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "08B74807-DDC9-4F9C-BABF-70DB42B91021"
uuid = "7BC03F19-0BAF-40D3-B3BB-7287C2485646"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SMSFilter/MessageFilterExtension.swift"
filePath = "Bouncer/Views/FilterList/FilterRowView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "handle(_:context:completion:)"
startingLineNumber = "56"
endingLineNumber = "56"
landmarkName = "getFilterDestinationDecoration(filter:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "FFCEE3BC-0B2D-453D-B0AF-261CDB35C6B3"
uuid = "F474ADB6-8709-49E7-BF63-521B48F2747E"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SMSFilter/MessageFilterExtension.swift"
filePath = "Bouncer/Views/FilterList/FilterRowView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "63"
endingLineNumber = "63"
landmarkName = "handle(_:context:completion:)"
startingLineNumber = "76"
endingLineNumber = "76"
landmarkName = "getFilterDestinationDecoration(filter:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "04D2679D-6560-4813-B35D-E88D16F50DC0"
uuid = "0A32DD54-C7CE-4776-A020-53A583CE7605"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SMSFilter/MessageFilterExtension.swift"
filePath = "Bouncer/Views/FilterList/FilterRowView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "49"
endingLineNumber = "49"
landmarkName = "handle(_:context:completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6E2CA1E8-A881-403C-AFD8-0BA999CEAF87"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bouncer/Models/SMSFilter/SMSOfflineFilter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
landmarkName = "applyFilter(filter:message:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "18683189-FB63-43CB-BB2F-11BFB8CA829C"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bouncer/Models/SMSFilter/SMSOfflineFilter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "38"
endingLineNumber = "38"
landmarkName = "applyFilter(filter:message:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6450FA93-4D7E-43A9-A020-A53CECAB0ACF"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bouncer/Models/SMSFilter/SMSOfflineFilter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "applyFilter(filter:message:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "EFE4BDCB-2B9A-4ABB-A280-E5F4D45D19FE"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bouncer/Models/SMSFilter/SMSOfflineFilter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "45"
endingLineNumber = "45"
landmarkName = "applyFilter(filter:message:)"
startingLineNumber = "65"
endingLineNumber = "65"
landmarkName = "getFilterDestinationDecoration(filter:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand Down
10 changes: 5 additions & 5 deletions Bouncer/Config/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ struct SYSTEM_IMAGES {
static let SENDER = SystemImage(image: "person", color: COLORS.DEFAULT_ICON_COLOR)
static let MESSAGE_TEXT = SystemImage(image: "text.quote", color: COLORS.DEFAULT_ICON_COLOR)
static let SPAM = SystemImage(image: "bin.xmark", color: COLORS.ALERT_COLOR)
static let TRANSACTION = SystemImage(image: "arrow.left.arrow.right", color: COLORS.OK_COLOR)
static let TRANSACTION = SystemImage(image: "ellipsis.circle", color: COLORS.OK_COLOR)
static let TRANSACTION_ORDERS = SystemImage(image: "shippingbox", color: COLORS.OK_COLOR)
static let TRANSACTION_FINANCE = SystemImage(image: "banknote", color: COLORS.OK_COLOR)
static let TRANSACTION_REMINDERS = SystemImage(image: "alarm", color: COLORS.OK_COLOR)
static let PROMOTION = SystemImage(image: "megaphone", color: COLORS.WARNING_COLOR)
static let TRANSACTION_FINANCE = SystemImage(image: "creditcard", color: COLORS.OK_COLOR)
static let TRANSACTION_REMINDERS = SystemImage(image: "calendar.badge.clock", color: COLORS.OK_COLOR)
static let PROMOTION = SystemImage(image: "ellipsis.circle", color: COLORS.WARNING_COLOR)
static let PROMOTION_OFFERS = SystemImage(image: "tag", color: COLORS.WARNING_COLOR)
static let PROMOTION_COUPONS = SystemImage(image: "gift", color: COLORS.WARNING_COLOR)
static let PROMOTION_COUPONS = SystemImage(image: "wallet.pass", color: COLORS.WARNING_COLOR)
static let HELP = SystemImage(image: "questionmark.circle", color: COLORS.DEFAULT_COLOR)
static let ADD = SystemImage(image: "plus.circle", color: COLORS.DEFAULT_COLOR)
static let CLOSE = SystemImage(image: "multiply.circle", color: COLORS.ACCENT_COLOR)
Expand Down
12 changes: 9 additions & 3 deletions Bouncer/Models/FilterStore/FilterStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ enum FilterDestination: String, Codable, Equatable, CaseIterable {
case transaction
case promotion

// SubActions (Apple allows 5 max.)
// SubActions
case transactionOrder
case transactionFinance
case transactionReminders
case transactionHealth
case transactionOther
case promotionOffers
case promotionCoupons
case promotionOther

}

Expand All @@ -34,21 +37,24 @@ struct Filter: Hashable, Identifiable, Equatable, Codable {
var phrase: String
var action: FilterDestination
var subAction: FilterDestination
var useRegex: Bool?
var caseSensitive: Bool = false
var useRegex: Bool = false

init(id: UUID,
phrase: String,
type: FilterType = .any,
action: FilterDestination = .junk,
subAction: FilterDestination = .none,
useRegex: Bool? = nil
useRegex: Bool = false,
caseSensitive: Bool = false
) {
self.id = id
self.type = type
self.phrase = phrase
self.action = action
self.subAction = subAction
self.useRegex = useRegex
self.caseSensitive = caseSensitive
}
}

Expand Down
4 changes: 2 additions & 2 deletions Bouncer/Models/FilterStore/FilterStoreFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ extension FilterStoreFile {
var newFilter = filter

// If the filter is not a regular expression
if !(newFilter.useRegex ?? false) {
newFilter.phrase = newFilter.phrase.lowercased()
if !newFilter.useRegex {
newFilter.phrase = newFilter.phrase
}
filters.append(newFilter)
filters = filters.sorted(by: { $1.phrase > $0.phrase })
Expand Down
14 changes: 13 additions & 1 deletion Bouncer/Models/FilterStore/FilterStoreFileMigrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,23 @@ struct FilterStoreFileMigrator {

// Update filters
for filter in filters {
var subAction: FilterDestination
switch filter.action {
case .promotion:
subAction = .promotionOther
case .transaction:
subAction = .transactionOther
default:
subAction = .none
}
let updatedFilter = Filter(id: filter.id,
phrase: filter.phrase,
type: filter.type,
action: filter.action,
useRegex: filter.useRegex)
subAction: subAction,
useRegex: filter.useRegex,
caseSensitive: false)
print(updatedFilter)
_ = store.add(filter: updatedFilter)
}
// Re-fetch data
Expand Down
4 changes: 2 additions & 2 deletions Bouncer/Models/FilterStore/LegacyModels/FilterV1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ struct FilterV1: Identifiable, Equatable, Codable {
var type: FilterType
var phrase: String
var action: FilterDestination
var useRegex: Bool?
var useRegex: Bool = false

init(id: UUID,
phrase: String,
type: FilterType = .any,
action: FilterDestination = .junk,
useRegex: Bool? = nil
useRegex: Bool = false
) {
self.id = id
self.type = type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Foundation
import IdentityLookup

protocol SMSFilter {
protocol SMSFiltering {
var filters: [Filter] { get }
var filterListService: FilterStore { get }
func filterMessage(message: SMSMessage) -> ILMessageFilterAction
Expand Down
Loading

0 comments on commit b888813

Please sign in to comment.