| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // Copyright 2022 Google LLC
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- import Foundation
- ///
- /// These extensions allows us to console log properties of our Session Events
- /// proto for development and debugging purposes without having to call decode
- /// on each field manually. Instead you can read `<field>.description`.
- ///
- extension firebase_appquality_sessions_EventType: CustomStringConvertible {
- public var description: String {
- switch self {
- case firebase_appquality_sessions_EventType_SESSION_START:
- return "SESSION_START"
- case firebase_appquality_sessions_EventType_EVENT_TYPE_UNKNOWN:
- return "UNKNOWN"
- default:
- return "Unrecognized EventType. Please update the firebase_appquality_sessions_EventType CustomStringConvertible extension"
- }
- }
- }
- extension firebase_appquality_sessions_DataCollectionState: CustomStringConvertible {
- public var description: String {
- switch self {
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_ENABLED:
- return "ENABLED"
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_SAMPLED:
- return "SAMPLED"
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_UNKNOWN:
- return "UNKNOWN"
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_DISABLED:
- return "DISABLED"
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_DISABLED_REMOTE:
- return "DISABLED_REMOTE"
- case firebase_appquality_sessions_DataCollectionState_COLLECTION_SDK_NOT_INSTALLED:
- return "SDK_NOT_INSTALLED"
- default:
- return "Unrecognized DataCollectionState. Please update the firebase_appquality_sessions_DataCollectionState CustomStringConvertible extension"
- }
- }
- }
- extension firebase_appquality_sessions_OsName: CustomStringConvertible {
- public var description: String {
- switch self {
- case firebase_appquality_sessions_OsName_IOS:
- return "IOS"
- case firebase_appquality_sessions_OsName_IPADOS:
- return "IPADOS"
- case firebase_appquality_sessions_OsName_TVOS:
- return "TVOS"
- case firebase_appquality_sessions_OsName_IOS_ON_MAC:
- return "IOS_ON_MAC"
- case firebase_appquality_sessions_OsName_MACOS:
- return "MACOS"
- case firebase_appquality_sessions_OsName_MACCATALYST:
- return "MACCATALYST"
- case firebase_appquality_sessions_OsName_WATCHOS:
- return "WATCHOS"
- case firebase_appquality_sessions_OsName_UNKNOWN_OSNAME:
- return "UNKNOWN_OSNAME"
- case firebase_appquality_sessions_OsName_UNSPECIFIED:
- return "UNSPECIFIED"
- default:
- return "Unrecognized OsName. Please update the firebase_appquality_sessions_OsName CustomStringConvertible extension"
- }
- }
- }
- extension UnsafeMutablePointer<pb_bytes_array_t>: CustomStringConvertible {
- public var description: String {
- let decoded = FIRSESDecodeString(self)
- if decoded.count == 0 {
- return "<EMPTY>"
- }
- return decoded
- }
- }
- // For an optional field
- extension UnsafeMutablePointer<pb_bytes_array_t>?: CustomStringConvertible {
- public var description: String {
- guard let this = self else {
- return "<NULL>"
- }
- return this.description
- }
- }
|