Skip to content

Commit

Permalink
Mobile 358/359 (#350)
Browse files Browse the repository at this point in the history
* Don't send validation errors to Sentry.

* MOBILE-358

Song filter doesn't filter out song previews

* MOBILE-359

Playing song by selecting from list causes endless play button spinner

---------

Co-authored-by: Gohan <[email protected]>
  • Loading branch information
martyu and cristhianescobar authored Jan 28, 2025
1 parent 479c1f3 commit 91c739b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public class VLCAudioPlayer: ObservableObject {
public func seek(toTrack track: NFTTrack) {
guard track != currentTrack else {
seek(toTime: 0)
playCurrentTrackInQueue()
return
}
do {
Expand Down
20 changes: 20 additions & 0 deletions iosApp/Modules/DI/ModuleLinker/Errors/LoginErrors.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation

public enum LoginValidationError: Error {
case invalidPassword
case invalidEmail
case passwordsDoNotMatch
}

extension LoginValidationError: LocalizedError {
public var errorDescription: String? {
switch self {
case .invalidPassword:
return "Password must contain at least 8 characters, 1 uppercase letter, 1 lowercase letter and 1 number."
case .invalidEmail:
return "Invalid email format"
case .passwordsDoNotMatch:
return "Passwords do not match"
}
}
}
6 changes: 3 additions & 3 deletions iosApp/Modules/Helpers/Logging/SentryErrorReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import Sentry
import ModuleLinker
import shared

class SentryErrorReporter: ErrorReporting {
final class SentryErrorReporter: ErrorReporting {
func logError(_ error: String) {
#if !DEBUG
print("ERROR: \(error)")
SentrySDK.capture(error: error)
#endif
}

func logError(_ error: Error) {
#if !DEBUG
guard reportError(error) else { return }
print("ERROR: \(error.kmmException?.description() ?? error)")
SentrySDK.capture(error: error.kmmException ?? error)
#endif
}
Expand All @@ -25,6 +23,8 @@ class SentryErrorReporter: ErrorReporting {
case "Invalid login. Please try again.": false
default: true
}
} else if let error = error as? LoginValidationError {
return false
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension NFTTrack {
func isAboveDurationFilter(_ durationFilter: Int?) -> Bool {
let trackIsAboveDurationFilter: Bool
if let durationFilter {
if duration > durationFilter {
if duration >= durationFilter {
trackIsAboveDurationFilter = true
} else {
trackIsAboveDurationFilter = false
Expand Down
2 changes: 1 addition & 1 deletion iosApp/Modules/Screens/Library/UI/LibraryViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class LibraryViewModel: ObservableObject {

do {
try await walletNFTTracksUseCase.refresh()
tracks = try await walletNFTTracksUseCase.getAllTracks()
tracks = try await walletNFTTracksUseCase.getAllCollectableTracks()
} catch {
logger.logError(error)
errors.append(NEWMError(errorDescription: "Unable to fetch songs. Please try again."))
Expand Down
20 changes: 1 addition & 19 deletions iosApp/Modules/Screens/Login/Utilities/LoginFieldValidator.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import Foundation

enum LoginValidationError: Error {
case invalidPassword
case invalidEmail
case passwordsDoNotMatch
}

extension LoginValidationError: LocalizedError {
var errorDescription: String? {
switch self {
case .invalidPassword:
return "Password must contain at least 8 characters, 1 uppercase letter, 1 lowercase letter and 1 number."
case .invalidEmail:
return "Invalid email format"
case .passwordsDoNotMatch:
return "Passwords do not match"
}
}
}
import ModuleLinker

struct LoginFieldValidator {
private let passwordRegex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,}$"
Expand Down
5 changes: 5 additions & 0 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,7 @@

/* Begin PBXFileSystemSynchronizedRootGroup section */
76610AA92CBB45CE009F5693 /* Analytics */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Analytics; sourceTree = "<group>"; };
7679128B2D2B240300EEDB85 /* Errors */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Errors; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -2632,6 +2633,7 @@
76D01D9F28164B2100305605 /* ModuleLinker */ = {
isa = PBXGroup;
children = (
7679128B2D2B240300EEDB85 /* Errors */,
7618FCBB28164BB5007573B4 /* Protocols */,
);
path = ModuleLinker;
Expand Down Expand Up @@ -3395,6 +3397,9 @@
);
dependencies = (
);
fileSystemSynchronizedGroups = (
7679128B2D2B240300EEDB85 /* Errors */,
);
name = ModuleLinker;
packageProductDependencies = (
760C2C4D281653C00030ACF4 /* Resolver */,
Expand Down

0 comments on commit 91c739b

Please sign in to comment.