Skip to content

Commit

Permalink
[Deploy] 1.0.5 버전 배포 (#596)
Browse files Browse the repository at this point in the history
* [Feature] FireBaseanalytics Error Handler 작성 #594

* prj: update build version

* chore: apply swift-format

* feat: update graph, errorHandler feature dependencies
  • Loading branch information
MaraMincho authored Sep 26, 2024
1 parent cc7f65e commit 3fffccf
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let project = Project.makeModule(
"UILaunchStoryboardName": "LaunchScreen",
"BGTaskSchedulerPermittedIdentifiers": "com.oksusu.susu.app",
"CFBundleShortVersionString": "1.0.5",
"CFBundleVersion": "2024092531",
"CFBundleVersion": "2024092632",
"UIUserInterfaceStyle": "Light",
"ITSAppUsesNonExemptEncryption": "No",
"AppstoreAPPID": "6503701515",
Expand Down
3 changes: 2 additions & 1 deletion Projects/Feature/SSErrorHandler/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ let project = Project.makeModule(
name: "SSErrorHandler",
targets: .feature(
.sSErrorHandler,
product: .framework,
testingOptions: [],
dependencies: [
.core(.sSNotification),
.core(.coreLayers),
],
testDependencies: [],
infoPlist: ["DISCORD_WEB_HOOK_URL": "$(DISCORD_WEB_HOOK_URL"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class DiscordErrorHandler {
os_log("Discord Web Hook URL이 잘못되었습니다. 확인해주세요")
return
}
let messages = message.splitByLength(1500)
let messages = message.splitByLength(1800)

Task {
do {
Expand Down
55 changes: 55 additions & 0 deletions Projects/Feature/SSErrorHandler/Sources/FireBaseErrorHandler.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// FireBaseErrorHandler.swift
// SSErrorHandler
//
// Created by MaraMincho on 9/26/24.
// Copyright © 2024 com.oksusu. All rights reserved.
//

import Combine
import FirebaseAnalytics
import Foundation
import OSLog
import SSNotification

// MARK: - FireBaseErrorHandler

public final class FireBaseErrorHandler {
public static let shared = FireBaseErrorHandler()
var subscription: AnyCancellable?
private init() {}

public func registerFirebaseLogSystem() {
subscription = NotificationCenter.default.publisher(for: SSNotificationName.logError)
.sink { @Sendable errorObjectOutput in
let errorObject = errorObjectOutput.object as? String
Self.sendErrorToFirebase(errorMessage: errorObject)
}
}

public func removeDiscordLogSystem() {
subscription = nil
}

@Sendable private static func sendErrorToFirebase(errorMessage message: String?) {
guard let message else {
return
}
Analytics.logEvent("iOS Error", parameters: ["description": message])
}
}

private extension String {
func splitByLength(_ length: Int) -> [String] {
var result: [String] = []
var currentIndex = startIndex

while currentIndex < endIndex {
let nextIndex = index(currentIndex, offsetBy: length, limitedBy: endIndex) ?? endIndex
result.append(String(self[currentIndex ..< nextIndex]))
currentIndex = nextIndex
}

return result
}
}
Binary file modified graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3fffccf

Please sign in to comment.