Skip to content

Commit

Permalink
Remove unused messaging system (#3047)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1199230911884351/1207938980070863/f
Tech Design URL:
CC:

Description:

This PR removes the now-unused messaging system from the app.
  • Loading branch information
samsymons authored Jul 31, 2024
1 parent 007cbae commit d8a1637
Show file tree
Hide file tree
Showing 19 changed files with 10 additions and 1,438 deletions.
50 changes: 0 additions & 50 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

remoteMessagingClient?.startRefreshingRemoteMessages()

// This messaging system has been replaced by RMF, but we need to clean up the message manifest for any users who had it stored.
let deprecatedRemoteMessagingStorage = DefaultSurveyRemoteMessagingStorage.surveys()
deprecatedRemoteMessagingStorage.removeStoredMessagesIfNecessary()

if didCrashDuringCrashHandlersSetUp {
PixelKit.fire(GeneralPixel.crashOnCrashHandlersSetUp)
didCrashDuringCrashHandlersSetUp = false
Expand Down

This file was deleted.

Binary file not shown.
85 changes: 0 additions & 85 deletions DuckDuckGo/Common/Surveys/HomePageRemoteMessagingRequest.swift

This file was deleted.

25 changes: 4 additions & 21 deletions DuckDuckGo/Common/Surveys/HomePageRemoteMessagingStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import Foundation

protocol SurveyRemoteMessagingStorage {

func store(messages: [SurveyRemoteMessage]) throws
func storedMessages() -> [SurveyRemoteMessage]

func dismissRemoteMessage(with id: String)
func dismissedMessageIDs() -> [String]

Expand Down Expand Up @@ -61,24 +58,6 @@ final class DefaultSurveyRemoteMessagingStorage: SurveyRemoteMessagingStorage {
self.dismissedMessageIdentifiersKey = dismissedMessageIdentifiersKey
}

func store(messages: [SurveyRemoteMessage]) throws {
let encoded = try JSONEncoder().encode(messages)
try encoded.write(to: messagesURL)
}

func storedMessages() -> [SurveyRemoteMessage] {
do {
let messagesData = try Data(contentsOf: messagesURL)
let messages = try JSONDecoder().decode([SurveyRemoteMessage].self, from: messagesData)

return messages
} catch {
// Errors can occur if the file doesn't exist or the schema changed, in which case the app will fetch the file again later and
// overwrite it.
return []
}
}

func dismissRemoteMessage(with id: String) {
var dismissedMessages = dismissedMessageIDs()

Expand All @@ -95,6 +74,10 @@ final class DefaultSurveyRemoteMessagingStorage: SurveyRemoteMessagingStorage {
return messages ?? []
}

func removeStoredMessagesIfNecessary() {
try? FileManager.default.removeItem(at: messagesURL)
}

func removeStoredAndDismissedMessages() {
userDefaults.removeObject(forKey: dismissedMessageIdentifiersKey)
try? FileManager.default.removeItem(at: messagesURL)
Expand Down
85 changes: 0 additions & 85 deletions DuckDuckGo/Common/Surveys/SurveyRemoteMessage.swift

This file was deleted.

Loading

0 comments on commit d8a1637

Please sign in to comment.