Skip to content

Commit

Permalink
Refactor code in feedbackview
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-nirali-s committed Jan 2, 2025
1 parent e76e0d4 commit 88c4404
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 223 deletions.
8 changes: 4 additions & 4 deletions Data/Data.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
21559CA42CBD05570039F127 /* ActivityLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21559CA32CBD05570039F127 /* ActivityLog.swift */; };
21559CAE2CBD2AED0039F127 /* ActivityLogStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21559CAD2CBD2AED0039F127 /* ActivityLogStore.swift */; };
21559CB02CBD2B400039F127 /* ActivityLogRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21559CAF2CBD2B400039F127 /* ActivityLogRepository.swift */; };
2163D3B02D265C25004B4F20 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163D3AF2D265C25004B4F20 /* Attachment.swift */; };
2163D3B02D265C25004B4F20 /* Feedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163D3AF2D265C25004B4F20 /* Feedback.swift */; };
2163D3B22D265CF9004B4F20 /* DeviceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163D3B12D265CF9004B4F20 /* DeviceInfo.swift */; };
2163D3B42D269E17004B4F20 /* FeedbackStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163D3B32D269E17004B4F20 /* FeedbackStore.swift */; };
2163D3B62D269E2A004B4F20 /* FeedbackRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163D3B52D269E2A004B4F20 /* FeedbackRepository.swift */; };
Expand Down Expand Up @@ -75,7 +75,7 @@
21559CA32CBD05570039F127 /* ActivityLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityLog.swift; sourceTree = "<group>"; };
21559CAD2CBD2AED0039F127 /* ActivityLogStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityLogStore.swift; sourceTree = "<group>"; };
21559CAF2CBD2B400039F127 /* ActivityLogRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityLogRepository.swift; sourceTree = "<group>"; };
2163D3AF2D265C25004B4F20 /* Attachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
2163D3AF2D265C25004B4F20 /* Feedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feedback.swift; sourceTree = "<group>"; };
2163D3B12D265CF9004B4F20 /* DeviceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceInfo.swift; sourceTree = "<group>"; };
2163D3B32D269E17004B4F20 /* FeedbackStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbackStore.swift; sourceTree = "<group>"; };
2163D3B52D269E2A004B4F20 /* FeedbackRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbackRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -202,7 +202,7 @@
D8CF5A202C1986250014E3AD /* Transaction.swift */,
21559CA32CBD05570039F127 /* ActivityLog.swift */,
D8D14A512BA0917D00F45FF2 /* SharedCode.swift */,
2163D3AF2D265C25004B4F20 /* Attachment.swift */,
2163D3AF2D265C25004B4F20 /* Feedback.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -550,7 +550,7 @@
21559CA42CBD05570039F127 /* ActivityLog.swift in Sources */,
D8A7CA802BA867F80014EC67 /* String+Extension.swift in Sources */,
D89BC2802D1C3DB200CDE86B /* DateTimeHelper.swift in Sources */,
2163D3B02D265C25004B4F20 /* Attachment.swift in Sources */,
2163D3B02D265C25004B4F20 /* Feedback.swift in Sources */,
213D0CCA2C89DBC800D65C73 /* Notification+Extension.swift in Sources */,
D895F2282CA297B900C2E4EB /* NetworkManager.swift in Sources */,
D8910E382BB6D1D300877CE0 /* ExpenseStore.swift in Sources */,
Expand Down
172 changes: 0 additions & 172 deletions Data/Data/Model/Attachment.swift

This file was deleted.

82 changes: 82 additions & 0 deletions Data/Data/Model/Feedback.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// Feedback.swift
// Splito
//
// Created by Nirali Sonani on 02/01/25.
//

import FirebaseFirestore

public struct Feedback: Codable {

@DocumentID public var id: String? // Automatically generated ID by Firestore

var title: String
var description: String
var userId: String
var attachmentUrls: [String]?
var appVersion: String
var deviceName: String
var deviceOsVersion: String
var createdAt: Timestamp

public init(title: String, description: String, userId: String, attachmentUrls: [String]? = nil,
appVersion: String, deviceName: String, deviceOsVersion: String, createdAt: Timestamp = Timestamp()) {
self.title = title
self.description = description
self.userId = userId
self.attachmentUrls = attachmentUrls
self.appVersion = appVersion
self.deviceName = deviceName
self.deviceOsVersion = deviceOsVersion
self.createdAt = createdAt
}

enum CodingKeys: String, CodingKey {
case id
case title
case description
case userId = "user_id"
case attachmentUrls = "attachment_urls"
case appVersion = "app_version"
case deviceName = "device_name"
case deviceOsVersion = "device_os_version"
case createdAt = "created_at"
}
}

public struct Attachment {
public var id = UUID().uuidString
public var image: UIImage?
public var videoData: Data?
public var video: URL?
public var name: String

public init(id: String = UUID().uuidString, image: UIImage? = nil, videoData: Data? = nil, video: URL? = nil, name: String) {
self.id = id
self.image = image
self.videoData = videoData
self.video = video
self.name = name
}
}

public struct AttachmentData {
public var data: Data
public var attachment: Attachment

public init(data: Data, attachment: Attachment) {
self.data = data
self.attachment = attachment
}
}

public struct AttachmentInfo {
public var id = UUID().uuidString
public var url: String

public init(id: String = UUID().uuidString, url: String) {
self.id = id
self.url = url
}
}
6 changes: 3 additions & 3 deletions Splito/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@
},
"Choose mode" : {

},
"Contact support" : {

},
"Contact Support" : {
"extractionState" : "manual"
Expand Down Expand Up @@ -906,6 +903,9 @@
},
"Time to settle up! Track shared expenses and split them in seconds." : {
"extractionState" : "manual"
},
"Title" : {

},
"to" : {
"extractionState" : "manual"
Expand Down
Loading

0 comments on commit 88c4404

Please sign in to comment.