Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jc/develop/chat deletion by age #237

Open
wants to merge 9 commits into
base: test-flight
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sphinx.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
CE3133B12977747E00E91E3A /* BadgeAdminDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3133AA2977747E00E91E3A /* BadgeAdminDetailVC.swift */; };
CE3133B22977747E00E91E3A /* BadgeAdminListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE3133AB2977747E00E91E3A /* BadgeAdminListTableViewCell.xib */; };
CE3133B32977747E00E91E3A /* BadgeAdminManagementListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3133AC2977747E00E91E3A /* BadgeAdminManagementListVC.swift */; };
CE3BE5762A55D5C800C152ED /* MaxContentAgeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3BE5742A55D5C800C152ED /* MaxContentAgeTableViewCell.swift */; };
CE3BE5772A55D5C800C152ED /* MaxContentAgeTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE3BE5752A55D5C800C152ED /* MaxContentAgeTableViewCell.xib */; };
CE3D8CA129B0FF7100EDB637 /* FeedItemDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3D8CA029B0FF7100EDB637 /* FeedItemDetailVC.swift */; };
CE3D8CA329B10FA500EDB637 /* FeedItemDetailVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3D8CA229B10FA500EDB637 /* FeedItemDetailVM.swift */; };
CE3D8CAC29B1124E00EDB637 /* FeedItemDetailHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3D8CAA29B1124E00EDB637 /* FeedItemDetailHeaderCell.swift */; };
Expand Down Expand Up @@ -1585,6 +1587,8 @@
CE3133AA2977747E00E91E3A /* BadgeAdminDetailVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BadgeAdminDetailVC.swift; sourceTree = "<group>"; };
CE3133AB2977747E00E91E3A /* BadgeAdminListTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BadgeAdminListTableViewCell.xib; sourceTree = "<group>"; };
CE3133AC2977747E00E91E3A /* BadgeAdminManagementListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BadgeAdminManagementListVC.swift; sourceTree = "<group>"; };
CE3BE5742A55D5C800C152ED /* MaxContentAgeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaxContentAgeTableViewCell.swift; sourceTree = "<group>"; };
CE3BE5752A55D5C800C152ED /* MaxContentAgeTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MaxContentAgeTableViewCell.xib; sourceTree = "<group>"; };
CE3D8CA029B0FF7100EDB637 /* FeedItemDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemDetailVC.swift; sourceTree = "<group>"; };
CE3D8CA229B10FA500EDB637 /* FeedItemDetailVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemDetailVM.swift; sourceTree = "<group>"; };
CE3D8CAA29B1124E00EDB637 /* FeedItemDetailHeaderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemDetailHeaderCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3326,6 +3330,8 @@
47904C1C24BF401400710E7A /* Table View Cells */ = {
isa = PBXGroup;
children = (
CE3BE5742A55D5C800C152ED /* MaxContentAgeTableViewCell.swift */,
CE3BE5752A55D5C800C152ED /* MaxContentAgeTableViewCell.xib */,
CEE8CFFB2A211DDE00DF7112 /* ChatImageCollectionViewCell.swift */,
CEE8CFFC2A211DDE00DF7112 /* ChatImageCollectionViewCell.xib */,
47904C1D24BF403400710E7A /* NotificationSoundTableViewCell.swift */,
Expand Down Expand Up @@ -4571,6 +4577,7 @@
47904C0E24BF352300710E7A /* popcorn.caf in Resources */,
470F4C49257E708400288A9B /* TribeMemberInfoView.xib in Resources */,
477BCF3C2A014CC20080ED65 /* TransactionTableViewCell.xib in Resources */,
CE3BE5772A55D5C800C152ED /* MaxContentAgeTableViewCell.xib in Resources */,
4797E77224B8E51E00D13270 /* Chat.storyboard in Resources */,
4797E7A524B8F06A00D13270 /* PaidAttachmentView.xib in Resources */,
4749356A2A29250200AB5FFA /* PodcastAudioView.xib in Resources */,
Expand Down Expand Up @@ -4839,6 +4846,7 @@
F3CE637C26AFE823006E37A0 /* FeedFilterChipCollectionViewCell.swift in Sources */,
471161E229156511008EAFF2 /* Rake.swift in Sources */,
4787F8942476B8E600CCE8B9 /* CGFloat.swift in Sources */,
CE3BE5762A55D5C800C152ED /* MaxContentAgeTableViewCell.swift in Sources */,
472092C32A2676C000468796 /* ChatMessageTextFieldView+AttachmentExtension.swift in Sources */,
478B05C829786F8900A1B254 /* PodcastPlayerController+ActionsTracking.swift in Sources */,
F32A696126CFEF600004B8B3 /* PodcastEpisode+Properties.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "selected-radio-button.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "selected-radio-button2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "selected-radio-button3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "unselected-radio-button.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "unselected-radio-button2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "unselected-radio-button3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions sphinx/Colors.xcassets/Sphinx/Divider2.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "229",
"green" : "225",
"red" : "221"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "23",
"green" : "19",
"red" : "16"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
22 changes: 22 additions & 0 deletions sphinx/Configuration/UserData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,28 @@ class UserData {
}
}

func getMaxAge() -> MessageAgePossibilities {
let intValue = UserDefaults.Keys.maxAge.get(defaultValue: 0)
let possibility = MessageAgePossibilities.allCases[intValue]
return possibility
}


func setMaxAge(possibility: MessageAgePossibilities) {
if let intValue = MessageAgePossibilities.allCases.firstIndex(where: { $0 == possibility }) {
UserDefaults.Keys.maxAge.set(intValue)
}
}

func getCustomMaxAgeValueInDays()-> Int{
let result = UserDefaults.Keys.customMaxAge.get(defaultValue: 100)
return result
}

func setCustomMaxAgeValueInDays(days: Int) {
UserDefaults.Keys.customMaxAge.set(days)
}

func getMaxMemoryGB() -> Int {
let result = UserDefaults.Keys.maxMemory.get(defaultValue: UserData.kMaximumMemoryFootprintGB)
return result
Expand Down
3 changes: 2 additions & 1 deletion sphinx/Core Data/StorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ class StorageManager {

func deleteAllOldChatMedia(completion: @escaping ()->()){
let now = Date()
if let cutoffDatetime = Calendar.current.date(byAdding: .day, value: -30, to: now){
let daysValue = UserData.sharedInstance.getMaxAge().valueInDays * -1
if let cutoffDatetime = Calendar.current.date(byAdding: .day, value: daysValue, to: now){
let oldMediaOnChoppingBlock = allItems.filter({$0.source == .chats && $0.date < cutoffDatetime}).compactMap({$0.cachedMedia})
deleteCacheItems(cms: oldMediaOnChoppingBlock, completion: {
print("done")
Expand Down
1 change: 1 addition & 0 deletions sphinx/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public extension UIColor {
public static let Shadow = color("Shadow")
public static let BubbleShadow = color("BubbleShadow")
public static let Divider = color("Divider")
public static let Divider2 = color("Divider2")
public static let LightDivider = color("LightDivider")
public static let ExpiredInvoice = color("ExpiredInvoice")
public static let AddressBookHeader = color("AddressBookHeader")
Expand Down
4 changes: 4 additions & 0 deletions sphinx/Extensions/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ extension UserDefaults {

public static let maxMemory = DefaultKey<Int>("maxMemory")

public static let maxAge = DefaultKey<Int>("maxAge")

public static let customMaxAge = DefaultKey<Int>("customMaxAge")

public static let inviteServerURL = DefaultKey<String>("inviteServerURL")
public static let fileServerURL = DefaultKey<String>("fileServerURL")
public static let meetingServerURL = DefaultKey<String>("meetingServerURL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ extension DashboardFeedsContainerViewController {
titleForDisplay: "dashboard.feeds.filters.play".localized,
displayOrder: 5
)
static var downloaded: Self = .init(
titleForDisplay: "Downloaded",
displayOrder: 6
)
}
}

Expand All @@ -50,8 +46,7 @@ extension DashboardFeedsContainerViewController.ContentFilterOption: CaseIterabl
.listen,
.watch,
.read,
.play,
.downloaded
.play
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,6 @@ class DashboardFeedsContainerViewController: UIViewController {
)
}()

internal lazy var downloadedPodcastsVC : ProfileManageStorageSourceDetailsVC = {
let vc = ProfileManageStorageSourceDetailsVC.instantiate(
items: StorageManager.sharedManager.allItems,
source: .podcasts,
sourceTotalSize: 69420
)
vc.presentationContext = .downloadedPodcastList
return vc
}()

static func instantiate(
managedObjectContext: NSManagedObjectContext = CoreDataManager.sharedManager.persistentContainer.viewContext,
feedsListContainerDelegate: DashboardFeedsListContainerViewControllerDelegate
Expand Down Expand Up @@ -250,8 +240,6 @@ extension DashboardFeedsContainerViewController {
return newsletterFeedCollectionViewController
case ContentFilterOption.play.id:
return playFeedCollectionViewController
case ContentFilterOption.downloaded.id:
return downloadedPodcastsVC
default:
preconditionFailure()
}
Expand Down
Loading