User

class User: NSObject

Represents a user account within the JubiAudio application with authentication and data storage capabilities. The User model supports multiple authentication methods and stores audio equalizer settings for persistence across sessions. User data is synchronized with Firebase Realtime Database to provide cross-device consistency.

Authentication Methods:

  • Email/Password: Traditional Firebase authentication with username and password
  • Social OAuth: Facebook and Google Sign-In via access tokens

Data Storage:

User equalizer settings (28 float values representing 14-band dual-channel EQ) are stored in the data property and persisted to Firebase using a hash of the user's email as the key.

  • Note: At least one authentication method must be used (uid/pw OR token)
  • Important: The data array contains 28 float values: 14 bands × 2 channels (left/right)
  • SeeAlso: APIManager for authentication flow and data synchronization
  • uid

    The username for a given user.

    Declaration

    Swift

    var uid: String?
  • pw

    The password for a given user.

    Declaration

    Swift

    var pw: String?
  • The token if using AUTH.

    Declaration

    Swift

    var token: String?
  • The data to be stored in the server.

    Declaration

    Swift

    var data: [Float]?
  • Determines if the user signed in with an email or a phone number

    Declaration

    Swift

    var email: Bool?
  • Initializer for the user object with a username, password, and a Boolean describing if using an email or phonenumber.

    Declaration

    Swift

    init(uid: String?, pw: String, email: Bool?)
  • Initializes user with an API token that can be attained through social media login.

    Declaration

    Swift

    init(token: String?)
  • A function that sets the data object of the user.

    Declaration

    Swift

    func setData(data: [Float]?)