safe.pb.swift 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. import Foundation
  21. import SwiftProtobuf
  22. // If the compiler emits an error on this type, it is because this file
  23. // was generated by a version of the `protoc` Swift plug-in that is
  24. // incompatible with the version of SwiftProtobuf to which you are linking.
  25. // Please ensure that you are building against the same version of the API
  26. // that was used to generate this file.
  27. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  28. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  29. typealias Version = _2
  30. }
  31. /// Visibility of a conversation.
  32. enum Safe_ConversationVisibility: SwiftProtobuf.Enum {
  33. typealias RawValue = Int
  34. /// Appears in the list of conversations
  35. case show // = 0
  36. /// Appears in the archived list of conversations
  37. case archive // = 1
  38. case UNRECOGNIZED(Int)
  39. init() {
  40. self = .show
  41. }
  42. init?(rawValue: Int) {
  43. switch rawValue {
  44. case 0: self = .show
  45. case 1: self = .archive
  46. default: self = .UNRECOGNIZED(rawValue)
  47. }
  48. }
  49. var rawValue: Int {
  50. switch self {
  51. case .show: return 0
  52. case .archive: return 1
  53. case .UNRECOGNIZED(let i): return i
  54. }
  55. }
  56. }
  57. #if swift(>=4.2)
  58. extension Safe_ConversationVisibility: CaseIterable {
  59. // The compiler won't synthesize support with the UNRECOGNIZED case.
  60. static var allCases: [Safe_ConversationVisibility] = [
  61. .show,
  62. .archive,
  63. ]
  64. }
  65. #endif // swift(>=4.2)
  66. /// Category of a conversation.
  67. enum Safe_ConversationCategory: SwiftProtobuf.Enum {
  68. typealias RawValue = Int
  69. /// No specific (default) category
  70. case `default` // = 0
  71. /// Protected conversation (*private chat*)
  72. case protected // = 1
  73. case UNRECOGNIZED(Int)
  74. init() {
  75. self = .default
  76. }
  77. init?(rawValue: Int) {
  78. switch rawValue {
  79. case 0: self = .default
  80. case 1: self = .protected
  81. default: self = .UNRECOGNIZED(rawValue)
  82. }
  83. }
  84. var rawValue: Int {
  85. switch self {
  86. case .default: return 0
  87. case .protected: return 1
  88. case .UNRECOGNIZED(let i): return i
  89. }
  90. }
  91. }
  92. #if swift(>=4.2)
  93. extension Safe_ConversationCategory: CaseIterable {
  94. // The compiler won't synthesize support with the UNRECOGNIZED case.
  95. static var allCases: [Safe_ConversationCategory] = [
  96. .default,
  97. .protected,
  98. ]
  99. }
  100. #endif // swift(>=4.2)
  101. /// Threema Safe backup contents.
  102. struct Safe_Backup {
  103. // SwiftProtobuf.Message conformance is added in an extension below. See the
  104. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  105. // methods supported on all messages.
  106. /// Version of the format
  107. /// References: `info.version`
  108. var version: UInt32 = 0
  109. /// Metadata about the device which created the backup
  110. /// References: `info.device`
  111. var device: String = String()
  112. /// The private key associated with the Threema ID
  113. /// References: `user.privatekey`
  114. var privateKey: Data = SwiftProtobuf.Internal.emptyData
  115. /// The user's profile
  116. /// Note: The data MUST be inlined!
  117. var userProfile: Safe_UserProfile {
  118. get {return _userProfile ?? Safe_UserProfile()}
  119. set {_userProfile = newValue}
  120. }
  121. /// Returns true if `userProfile` has been explicitly set.
  122. var hasUserProfile: Bool {return self._userProfile != nil}
  123. /// Clears the value of `userProfile`. Subsequent reads from it will return its default value.
  124. mutating func clearUserProfile() {self._userProfile = nil}
  125. /// Contacts
  126. /// References: `contacts[]`
  127. var contacts: [Safe_Contact] = []
  128. /// Groups
  129. /// References: `groups[]`
  130. var groups: [Safe_Group] = []
  131. /// Distribution lists
  132. /// References: `distributionlists[]`
  133. var distributionLists: [Safe_DistributionList] = []
  134. /// App settings
  135. /// References: `settings`
  136. var settings: Safe_Settings {
  137. get {return _settings ?? Safe_Settings()}
  138. set {_settings = newValue}
  139. }
  140. /// Returns true if `settings` has been explicitly set.
  141. var hasSettings: Bool {return self._settings != nil}
  142. /// Clears the value of `settings`. Subsequent reads from it will return its default value.
  143. mutating func clearSettings() {self._settings = nil}
  144. var unknownFields = SwiftProtobuf.UnknownStorage()
  145. init() {}
  146. fileprivate var _userProfile: Safe_UserProfile? = nil
  147. fileprivate var _settings: Safe_Settings? = nil
  148. }
  149. /// The user's profile.
  150. struct Safe_UserProfile {
  151. // SwiftProtobuf.Message conformance is added in an extension below. See the
  152. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  153. // methods supported on all messages.
  154. /// Nickname
  155. /// References: `user.nickname`
  156. var nickname: String = String()
  157. /// Profile image
  158. /// References: `user.profilePic`
  159. var profileImage: Common_Image {
  160. get {return _profileImage ?? Common_Image()}
  161. set {_profileImage = newValue}
  162. }
  163. /// Returns true if `profileImage` has been explicitly set.
  164. var hasProfileImage: Bool {return self._profileImage != nil}
  165. /// Clears the value of `profileImage`. Subsequent reads from it will return its default value.
  166. mutating func clearProfileImage() {self._profileImage = nil}
  167. var profileImageSharePolicy: Safe_UserProfile.ProfileImageSharePolicy = .nobody
  168. /// Contact IDs the profile image may be shared with. Should only be filled
  169. /// when the `ProfileImageSharePolicy` is `ALLOW_LIST`.
  170. /// References: `user.profilePicRelease[]`
  171. var profileImageShareWith: [String] = []
  172. /// External entities linked with the identity
  173. /// References: `user.links[]`
  174. var identityLinks: [Safe_IdentityLink] = []
  175. var unknownFields = SwiftProtobuf.UnknownStorage()
  176. /// Profile image share policy
  177. /// References: `user.profilePicRelease[]`
  178. enum ProfileImageSharePolicy: SwiftProtobuf.Enum {
  179. typealias RawValue = Int
  180. /// Don't share
  181. case nobody // = 0
  182. /// Share with everyone
  183. case everyone // = 1
  184. /// Share with a limited amount of contacts explicitly listed
  185. case allowList // = 2
  186. case UNRECOGNIZED(Int)
  187. init() {
  188. self = .nobody
  189. }
  190. init?(rawValue: Int) {
  191. switch rawValue {
  192. case 0: self = .nobody
  193. case 1: self = .everyone
  194. case 2: self = .allowList
  195. default: self = .UNRECOGNIZED(rawValue)
  196. }
  197. }
  198. var rawValue: Int {
  199. switch self {
  200. case .nobody: return 0
  201. case .everyone: return 1
  202. case .allowList: return 2
  203. case .UNRECOGNIZED(let i): return i
  204. }
  205. }
  206. }
  207. init() {}
  208. fileprivate var _profileImage: Common_Image? = nil
  209. }
  210. #if swift(>=4.2)
  211. extension Safe_UserProfile.ProfileImageSharePolicy: CaseIterable {
  212. // The compiler won't synthesize support with the UNRECOGNIZED case.
  213. static var allCases: [Safe_UserProfile.ProfileImageSharePolicy] = [
  214. .nobody,
  215. .everyone,
  216. .allowList,
  217. ]
  218. }
  219. #endif // swift(>=4.2)
  220. /// Threema contact.
  221. struct Safe_Contact {
  222. // SwiftProtobuf.Message conformance is added in an extension below. See the
  223. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  224. // methods supported on all messages.
  225. /// Threema ID of the contact
  226. /// References: `contacts[].identity`
  227. var identity: String = String()
  228. /// Public key of the contact
  229. /// References: `contacts[].publickey`
  230. var publicKey: Data = SwiftProtobuf.Internal.emptyData
  231. /// Unix-ish timestamp in milliseconds when the contact has been created
  232. /// (added) locally.
  233. /// References: `contacts[].createdAt`
  234. var createdAt: UInt64 = 0
  235. var verificationLevel: Safe_Contact.VerificationLevel = .unverified
  236. var identityType: Safe_Contact.IdentityType = .regular
  237. var displayPolicy: Safe_Contact.DisplayPolicy = .show
  238. /// Conversation category of the contact
  239. /// References: `contacts[].private`
  240. var conversationCategory: Safe_ConversationCategory = .default
  241. /// Conversation visbility of the contact
  242. var conversationVisibility: Safe_ConversationVisibility = .show
  243. /// First name of the contact
  244. /// References: `contacts[].firstname`
  245. var firstName: Safe_Contact.OneOf_FirstName? = nil
  246. var firstNameValue: String {
  247. get {
  248. if case .firstNameValue(let v)? = firstName {return v}
  249. return String()
  250. }
  251. set {firstName = .firstNameValue(newValue)}
  252. }
  253. /// Last name of the contact
  254. /// References: `contacts[].lastname`
  255. var lastName: Safe_Contact.OneOf_LastName? = nil
  256. var lastNameValue: String {
  257. get {
  258. if case .lastNameValue(let v)? = lastName {return v}
  259. return String()
  260. }
  261. set {lastName = .lastNameValue(newValue)}
  262. }
  263. /// Nickname of the contact (without `~` prefix)
  264. /// References: `contacts[].nickname`
  265. var nickname: Safe_Contact.OneOf_Nickname? = nil
  266. var nicknameValue: String {
  267. get {
  268. if case .nicknameValue(let v)? = nickname {return v}
  269. return String()
  270. }
  271. set {nickname = .nicknameValue(newValue)}
  272. }
  273. /// Profile image as received from the contact
  274. var profileImage: Common_Image {
  275. get {return _profileImage ?? Common_Image()}
  276. set {_profileImage = newValue}
  277. }
  278. /// Returns true if `profileImage` has been explicitly set.
  279. var hasProfileImage: Bool {return self._profileImage != nil}
  280. /// Clears the value of `profileImage`. Subsequent reads from it will return its default value.
  281. mutating func clearProfileImage() {self._profileImage = nil}
  282. /// Custom profile image set by the user
  283. var customProfileImage: Common_Image {
  284. get {return _customProfileImage ?? Common_Image()}
  285. set {_customProfileImage = newValue}
  286. }
  287. /// Returns true if `customProfileImage` has been explicitly set.
  288. var hasCustomProfileImage: Bool {return self._customProfileImage != nil}
  289. /// Clears the value of `customProfileImage`. Subsequent reads from it will return its default value.
  290. mutating func clearCustomProfileImage() {self._customProfileImage = nil}
  291. var unknownFields = SwiftProtobuf.UnknownStorage()
  292. /// First name of the contact
  293. /// References: `contacts[].firstname`
  294. enum OneOf_FirstName: Equatable {
  295. case firstNameValue(String)
  296. #if !swift(>=4.1)
  297. static func ==(lhs: Safe_Contact.OneOf_FirstName, rhs: Safe_Contact.OneOf_FirstName) -> Bool {
  298. switch (lhs, rhs) {
  299. case (.firstNameValue(let l), .firstNameValue(let r)): return l == r
  300. }
  301. }
  302. #endif
  303. }
  304. /// Last name of the contact
  305. /// References: `contacts[].lastname`
  306. enum OneOf_LastName: Equatable {
  307. case lastNameValue(String)
  308. #if !swift(>=4.1)
  309. static func ==(lhs: Safe_Contact.OneOf_LastName, rhs: Safe_Contact.OneOf_LastName) -> Bool {
  310. switch (lhs, rhs) {
  311. case (.lastNameValue(let l), .lastNameValue(let r)): return l == r
  312. }
  313. }
  314. #endif
  315. }
  316. /// Nickname of the contact (without `~` prefix)
  317. /// References: `contacts[].nickname`
  318. enum OneOf_Nickname: Equatable {
  319. case nicknameValue(String)
  320. #if !swift(>=4.1)
  321. static func ==(lhs: Safe_Contact.OneOf_Nickname, rhs: Safe_Contact.OneOf_Nickname) -> Bool {
  322. switch (lhs, rhs) {
  323. case (.nicknameValue(let l), .nicknameValue(let r)): return l == r
  324. }
  325. }
  326. #endif
  327. }
  328. /// Verification level of the contact
  329. /// References: `contacts[].verification`
  330. enum VerificationLevel: SwiftProtobuf.Enum {
  331. typealias RawValue = Int
  332. /// Unverified, public key has been obtained from the server
  333. case unverified // = 0
  334. /// Verified with one of the account links via the server, or the contact
  335. /// has been obtained via the Work API.
  336. case serverVerified // = 1
  337. /// Verified, public key has been obtained via a secure channel
  338. case fullyVerified // = 2
  339. case UNRECOGNIZED(Int)
  340. init() {
  341. self = .unverified
  342. }
  343. init?(rawValue: Int) {
  344. switch rawValue {
  345. case 0: self = .unverified
  346. case 1: self = .serverVerified
  347. case 2: self = .fullyVerified
  348. default: self = .UNRECOGNIZED(rawValue)
  349. }
  350. }
  351. var rawValue: Int {
  352. switch self {
  353. case .unverified: return 0
  354. case .serverVerified: return 1
  355. case .fullyVerified: return 2
  356. case .UNRECOGNIZED(let i): return i
  357. }
  358. }
  359. }
  360. /// Identity type of the contact
  361. /// References: `contacts[].workVerified`
  362. enum IdentityType: SwiftProtobuf.Enum {
  363. typealias RawValue = Int
  364. /// Regular contact (uses the regular Threema app)
  365. case regular // = 0
  366. /// Work contact (uses the Threema work app)
  367. case work // = 1
  368. case UNRECOGNIZED(Int)
  369. init() {
  370. self = .regular
  371. }
  372. init?(rawValue: Int) {
  373. switch rawValue {
  374. case 0: self = .regular
  375. case 1: self = .work
  376. default: self = .UNRECOGNIZED(rawValue)
  377. }
  378. }
  379. var rawValue: Int {
  380. switch self {
  381. case .regular: return 0
  382. case .work: return 1
  383. case .UNRECOGNIZED(let i): return i
  384. }
  385. }
  386. }
  387. /// Display policy for the contact
  388. /// References: `contacts[].hidden`
  389. enum DisplayPolicy: SwiftProtobuf.Enum {
  390. typealias RawValue = Int
  391. /// Show contact
  392. case show // = 0
  393. /// Hide contact (e.g. group contact not explicitly added)
  394. case hide // = 1
  395. case UNRECOGNIZED(Int)
  396. init() {
  397. self = .show
  398. }
  399. init?(rawValue: Int) {
  400. switch rawValue {
  401. case 0: self = .show
  402. case 1: self = .hide
  403. default: self = .UNRECOGNIZED(rawValue)
  404. }
  405. }
  406. var rawValue: Int {
  407. switch self {
  408. case .show: return 0
  409. case .hide: return 1
  410. case .UNRECOGNIZED(let i): return i
  411. }
  412. }
  413. }
  414. init() {}
  415. fileprivate var _profileImage: Common_Image? = nil
  416. fileprivate var _customProfileImage: Common_Image? = nil
  417. }
  418. #if swift(>=4.2)
  419. extension Safe_Contact.VerificationLevel: CaseIterable {
  420. // The compiler won't synthesize support with the UNRECOGNIZED case.
  421. static var allCases: [Safe_Contact.VerificationLevel] = [
  422. .unverified,
  423. .serverVerified,
  424. .fullyVerified,
  425. ]
  426. }
  427. extension Safe_Contact.IdentityType: CaseIterable {
  428. // The compiler won't synthesize support with the UNRECOGNIZED case.
  429. static var allCases: [Safe_Contact.IdentityType] = [
  430. .regular,
  431. .work,
  432. ]
  433. }
  434. extension Safe_Contact.DisplayPolicy: CaseIterable {
  435. // The compiler won't synthesize support with the UNRECOGNIZED case.
  436. static var allCases: [Safe_Contact.DisplayPolicy] = [
  437. .show,
  438. .hide,
  439. ]
  440. }
  441. #endif // swift(>=4.2)
  442. /// Threema contacts associated to a group.
  443. struct Safe_Group {
  444. // SwiftProtobuf.Message conformance is added in an extension below. See the
  445. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  446. // methods supported on all messages.
  447. /// Unique group identity
  448. /// References: `groups[].id` and `groups[].creator`
  449. var groupIdentity: Common_GroupIdentity {
  450. get {return _groupIdentity ?? Common_GroupIdentity()}
  451. set {_groupIdentity = newValue}
  452. }
  453. /// Returns true if `groupIdentity` has been explicitly set.
  454. var hasGroupIdentity: Bool {return self._groupIdentity != nil}
  455. /// Clears the value of `groupIdentity`. Subsequent reads from it will return its default value.
  456. mutating func clearGroupIdentity() {self._groupIdentity = nil}
  457. /// Name of the group
  458. /// References: `groups[].groupname`
  459. var name: String = String()
  460. /// Unix-ish timestamp in milliseconds when the group has been created locally
  461. /// References: `groups[].createdAt`
  462. var createdAt: UInt64 = 0
  463. /// Conversation category of the group
  464. /// References: `groups[].private`
  465. var conversationCategory: Safe_ConversationCategory = .default
  466. /// Conversation visbility of the group
  467. var conversationVisibility: Safe_ConversationVisibility = .show
  468. var userState: Safe_Group.UserState = .member
  469. /// Group's profile image as received from the group's administrator
  470. var profileImage: Common_Image {
  471. get {return _profileImage ?? Common_Image()}
  472. set {_profileImage = newValue}
  473. }
  474. /// Returns true if `profileImage` has been explicitly set.
  475. var hasProfileImage: Bool {return self._profileImage != nil}
  476. /// Clears the value of `profileImage`. Subsequent reads from it will return its default value.
  477. mutating func clearProfileImage() {self._profileImage = nil}
  478. /// Group members (**NOT** including the user itself)
  479. /// References: `groups[].members`
  480. var memberIdentities: [String] = []
  481. var unknownFields = SwiftProtobuf.UnknownStorage()
  482. /// The user's state within the group
  483. /// References: `groups[].deleted`
  484. enum UserState: SwiftProtobuf.Enum {
  485. typealias RawValue = Int
  486. /// The user is a member (or an admin) of the group
  487. case member // = 0
  488. /// The user has been kicked from the group
  489. case kicked // = 1
  490. /// The user left the group
  491. case left // = 2
  492. case UNRECOGNIZED(Int)
  493. init() {
  494. self = .member
  495. }
  496. init?(rawValue: Int) {
  497. switch rawValue {
  498. case 0: self = .member
  499. case 1: self = .kicked
  500. case 2: self = .left
  501. default: self = .UNRECOGNIZED(rawValue)
  502. }
  503. }
  504. var rawValue: Int {
  505. switch self {
  506. case .member: return 0
  507. case .kicked: return 1
  508. case .left: return 2
  509. case .UNRECOGNIZED(let i): return i
  510. }
  511. }
  512. }
  513. init() {}
  514. fileprivate var _groupIdentity: Common_GroupIdentity? = nil
  515. fileprivate var _profileImage: Common_Image? = nil
  516. }
  517. #if swift(>=4.2)
  518. extension Safe_Group.UserState: CaseIterable {
  519. // The compiler won't synthesize support with the UNRECOGNIZED case.
  520. static var allCases: [Safe_Group.UserState] = [
  521. .member,
  522. .kicked,
  523. .left,
  524. ]
  525. }
  526. #endif // swift(>=4.2)
  527. /// Threema contacts associated to a distribution list.
  528. struct Safe_DistributionList {
  529. // SwiftProtobuf.Message conformance is added in an extension below. See the
  530. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  531. // methods supported on all messages.
  532. /// Unique ID of the distribution list
  533. var distributionListID: UInt64 = 0
  534. /// Name of the distribution list
  535. /// References: `distributionlists[].name`
  536. var name: String = String()
  537. /// Unix-ish timestamp in milliseconds when the group has been created
  538. /// References: `distributionlists[].createdAt`
  539. var createdAt: UInt64 = 0
  540. /// Conversation category of the distribution list
  541. /// References: `distributionlists[].private`
  542. var conversationCategory: Safe_ConversationCategory = .default
  543. /// Conversation visbility of the distribution list
  544. var conversationVisibility: Safe_ConversationVisibility = .show
  545. /// Distribution list members
  546. /// References: `distributionlists[].members`
  547. var memberIdentities: [String] = []
  548. var unknownFields = SwiftProtobuf.UnknownStorage()
  549. init() {}
  550. }
  551. /// App settings
  552. struct Safe_Settings {
  553. // SwiftProtobuf.Message conformance is added in an extension below. See the
  554. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  555. // methods supported on all messages.
  556. var contactSyncPolicy: Safe_Settings.ContactSyncPolicy = .notSynced
  557. var unknownContactPolicy: Safe_Settings.UnknownContactPolicy = .allowUnknown
  558. var readMessagePolicy: Safe_Settings.ReadMessagePolicy = .sendReadReceipt
  559. var composeMessagePolicy: Safe_Settings.ComposeMessagePolicy = .sendTypingIndicator
  560. var callPolicy: Safe_Settings.CallPolicy = .allowCall
  561. var callConnectionPolity: Safe_Settings.CallConnectionPolicy = .allowDirect
  562. var screenshotPolicy: Safe_Settings.ScreenshotPolicy = .allowScreenshot
  563. var keyboardDataCollectionPolicy: Safe_Settings.KeyboardDataCollectionPolicy = .allowDataCollection
  564. /// List of Threema IDs whose messages are blocked
  565. /// References: `settings.blockedContacts[]`
  566. var blockedIdentities: [String] = []
  567. /// Threema IDs to be excluded when syncing
  568. /// References: `settings.syncExcludedIds[]`
  569. var excludeFromSyncIdentities: [String] = []
  570. /// List of recently used emojis, where the most recently used Emoji comes
  571. /// first.
  572. /// References: `settings.recentEmojis[]`
  573. var recentEmojis: [String] = []
  574. var unknownFields = SwiftProtobuf.UnknownStorage()
  575. /// Contact synchronisation policy
  576. /// References: `settings.syncContacts`
  577. enum ContactSyncPolicy: SwiftProtobuf.Enum {
  578. typealias RawValue = Int
  579. /// Not synced
  580. case notSynced // = 0
  581. /// Synced
  582. case sync // = 1
  583. case UNRECOGNIZED(Int)
  584. init() {
  585. self = .notSynced
  586. }
  587. init?(rawValue: Int) {
  588. switch rawValue {
  589. case 0: self = .notSynced
  590. case 1: self = .sync
  591. default: self = .UNRECOGNIZED(rawValue)
  592. }
  593. }
  594. var rawValue: Int {
  595. switch self {
  596. case .notSynced: return 0
  597. case .sync: return 1
  598. case .UNRECOGNIZED(let i): return i
  599. }
  600. }
  601. }
  602. /// Unknown contacts policy
  603. /// References: `settings.blockUnknown`
  604. enum UnknownContactPolicy: SwiftProtobuf.Enum {
  605. typealias RawValue = Int
  606. /// Allowed to contact the user
  607. case allowUnknown // = 0
  608. /// Will be blocked by the user
  609. case blockUnknown // = 1
  610. case UNRECOGNIZED(Int)
  611. init() {
  612. self = .allowUnknown
  613. }
  614. init?(rawValue: Int) {
  615. switch rawValue {
  616. case 0: self = .allowUnknown
  617. case 1: self = .blockUnknown
  618. default: self = .UNRECOGNIZED(rawValue)
  619. }
  620. }
  621. var rawValue: Int {
  622. switch self {
  623. case .allowUnknown: return 0
  624. case .blockUnknown: return 1
  625. case .UNRECOGNIZED(let i): return i
  626. }
  627. }
  628. }
  629. /// Read message policy (when an unread message has been read)
  630. /// References: `settings.readReceipts`
  631. enum ReadMessagePolicy: SwiftProtobuf.Enum {
  632. typealias RawValue = Int
  633. /// Send *read* receipt when an unread message has been read
  634. case sendReadReceipt // = 0
  635. /// Don't send *read* receipts
  636. case ignoreRead // = 1
  637. case UNRECOGNIZED(Int)
  638. init() {
  639. self = .sendReadReceipt
  640. }
  641. init?(rawValue: Int) {
  642. switch rawValue {
  643. case 0: self = .sendReadReceipt
  644. case 1: self = .ignoreRead
  645. default: self = .UNRECOGNIZED(rawValue)
  646. }
  647. }
  648. var rawValue: Int {
  649. switch self {
  650. case .sendReadReceipt: return 0
  651. case .ignoreRead: return 1
  652. case .UNRECOGNIZED(let i): return i
  653. }
  654. }
  655. }
  656. /// Compose message policy
  657. /// References: `settings.sendTyping`
  658. enum ComposeMessagePolicy: SwiftProtobuf.Enum {
  659. typealias RawValue = Int
  660. /// Send *typing* indicator when a message is being composed
  661. case sendTypingIndicator // = 0
  662. /// Don't send *typing* indicators
  663. case ignoreCompose // = 1
  664. case UNRECOGNIZED(Int)
  665. init() {
  666. self = .sendTypingIndicator
  667. }
  668. init?(rawValue: Int) {
  669. switch rawValue {
  670. case 0: self = .sendTypingIndicator
  671. case 1: self = .ignoreCompose
  672. default: self = .UNRECOGNIZED(rawValue)
  673. }
  674. }
  675. var rawValue: Int {
  676. switch self {
  677. case .sendTypingIndicator: return 0
  678. case .ignoreCompose: return 1
  679. case .UNRECOGNIZED(let i): return i
  680. }
  681. }
  682. }
  683. /// Threema Call policy
  684. /// References: `settings.threemaCalls`
  685. enum CallPolicy: SwiftProtobuf.Enum {
  686. typealias RawValue = Int
  687. /// Allow creating/receiving Threema Calls
  688. case allowCall // = 0
  689. /// Denied from creating/receiving any Threema Calls
  690. case denyCall // = 1
  691. case UNRECOGNIZED(Int)
  692. init() {
  693. self = .allowCall
  694. }
  695. init?(rawValue: Int) {
  696. switch rawValue {
  697. case 0: self = .allowCall
  698. case 1: self = .denyCall
  699. default: self = .UNRECOGNIZED(rawValue)
  700. }
  701. }
  702. var rawValue: Int {
  703. switch self {
  704. case .allowCall: return 0
  705. case .denyCall: return 1
  706. case .UNRECOGNIZED(let i): return i
  707. }
  708. }
  709. }
  710. /// Threema Call connection policy
  711. /// References: `settings.relayThreemaCalls`
  712. enum CallConnectionPolicy: SwiftProtobuf.Enum {
  713. typealias RawValue = Int
  714. /// Allow direct (peer-to-peer) connections for Threema Calls
  715. case allowDirect // = 0
  716. /// Require relayed connections for Threema Calls
  717. case requireRelay // = 1
  718. case UNRECOGNIZED(Int)
  719. init() {
  720. self = .allowDirect
  721. }
  722. init?(rawValue: Int) {
  723. switch rawValue {
  724. case 0: self = .allowDirect
  725. case 1: self = .requireRelay
  726. default: self = .UNRECOGNIZED(rawValue)
  727. }
  728. }
  729. var rawValue: Int {
  730. switch self {
  731. case .allowDirect: return 0
  732. case .requireRelay: return 1
  733. case .UNRECOGNIZED(let i): return i
  734. }
  735. }
  736. }
  737. /// Screenshot policy
  738. /// References: `settings.disableScreenshots`
  739. enum ScreenshotPolicy: SwiftProtobuf.Enum {
  740. typealias RawValue = Int
  741. /// Allow taking screenshots
  742. case allowScreenshot // = 0
  743. /// Deny taking screenshots, if possible
  744. case denyScreenshot // = 1
  745. case UNRECOGNIZED(Int)
  746. init() {
  747. self = .allowScreenshot
  748. }
  749. init?(rawValue: Int) {
  750. switch rawValue {
  751. case 0: self = .allowScreenshot
  752. case 1: self = .denyScreenshot
  753. default: self = .UNRECOGNIZED(rawValue)
  754. }
  755. }
  756. var rawValue: Int {
  757. switch self {
  758. case .allowScreenshot: return 0
  759. case .denyScreenshot: return 1
  760. case .UNRECOGNIZED(let i): return i
  761. }
  762. }
  763. }
  764. /// Keyboard data collection policy (e.g. for personalised suggestions)
  765. /// References: `settings.incognitoKeyboard`
  766. enum KeyboardDataCollectionPolicy: SwiftProtobuf.Enum {
  767. typealias RawValue = Int
  768. /// Allow keyboard input data to be collected
  769. case allowDataCollection // = 0
  770. /// Deny collecting of keyboard input data
  771. case denyDataCollection // = 1
  772. case UNRECOGNIZED(Int)
  773. init() {
  774. self = .allowDataCollection
  775. }
  776. init?(rawValue: Int) {
  777. switch rawValue {
  778. case 0: self = .allowDataCollection
  779. case 1: self = .denyDataCollection
  780. default: self = .UNRECOGNIZED(rawValue)
  781. }
  782. }
  783. var rawValue: Int {
  784. switch self {
  785. case .allowDataCollection: return 0
  786. case .denyDataCollection: return 1
  787. case .UNRECOGNIZED(let i): return i
  788. }
  789. }
  790. }
  791. init() {}
  792. }
  793. #if swift(>=4.2)
  794. extension Safe_Settings.ContactSyncPolicy: CaseIterable {
  795. // The compiler won't synthesize support with the UNRECOGNIZED case.
  796. static var allCases: [Safe_Settings.ContactSyncPolicy] = [
  797. .notSynced,
  798. .sync,
  799. ]
  800. }
  801. extension Safe_Settings.UnknownContactPolicy: CaseIterable {
  802. // The compiler won't synthesize support with the UNRECOGNIZED case.
  803. static var allCases: [Safe_Settings.UnknownContactPolicy] = [
  804. .allowUnknown,
  805. .blockUnknown,
  806. ]
  807. }
  808. extension Safe_Settings.ReadMessagePolicy: CaseIterable {
  809. // The compiler won't synthesize support with the UNRECOGNIZED case.
  810. static var allCases: [Safe_Settings.ReadMessagePolicy] = [
  811. .sendReadReceipt,
  812. .ignoreRead,
  813. ]
  814. }
  815. extension Safe_Settings.ComposeMessagePolicy: CaseIterable {
  816. // The compiler won't synthesize support with the UNRECOGNIZED case.
  817. static var allCases: [Safe_Settings.ComposeMessagePolicy] = [
  818. .sendTypingIndicator,
  819. .ignoreCompose,
  820. ]
  821. }
  822. extension Safe_Settings.CallPolicy: CaseIterable {
  823. // The compiler won't synthesize support with the UNRECOGNIZED case.
  824. static var allCases: [Safe_Settings.CallPolicy] = [
  825. .allowCall,
  826. .denyCall,
  827. ]
  828. }
  829. extension Safe_Settings.CallConnectionPolicy: CaseIterable {
  830. // The compiler won't synthesize support with the UNRECOGNIZED case.
  831. static var allCases: [Safe_Settings.CallConnectionPolicy] = [
  832. .allowDirect,
  833. .requireRelay,
  834. ]
  835. }
  836. extension Safe_Settings.ScreenshotPolicy: CaseIterable {
  837. // The compiler won't synthesize support with the UNRECOGNIZED case.
  838. static var allCases: [Safe_Settings.ScreenshotPolicy] = [
  839. .allowScreenshot,
  840. .denyScreenshot,
  841. ]
  842. }
  843. extension Safe_Settings.KeyboardDataCollectionPolicy: CaseIterable {
  844. // The compiler won't synthesize support with the UNRECOGNIZED case.
  845. static var allCases: [Safe_Settings.KeyboardDataCollectionPolicy] = [
  846. .allowDataCollection,
  847. .denyDataCollection,
  848. ]
  849. }
  850. #endif // swift(>=4.2)
  851. /// Threema ID link.
  852. struct Safe_IdentityLink {
  853. // SwiftProtobuf.Message conformance is added in an extension below. See the
  854. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  855. // methods supported on all messages.
  856. /// Identity link type
  857. /// References: `user.links[].type`, `user.links[].value`
  858. var type: Safe_IdentityLink.OneOf_Type? = nil
  859. /// Linked with a verified telephone number (E.164 format without leading
  860. /// `+`)
  861. var phoneNumber: String {
  862. get {
  863. if case .phoneNumber(let v)? = type {return v}
  864. return String()
  865. }
  866. set {type = .phoneNumber(newValue)}
  867. }
  868. /// Linked with a verified email address
  869. var email: String {
  870. get {
  871. if case .email(let v)? = type {return v}
  872. return String()
  873. }
  874. set {type = .email(newValue)}
  875. }
  876. /// Identity link description
  877. /// References: `user.links[].name`
  878. var description_p: String = String()
  879. var unknownFields = SwiftProtobuf.UnknownStorage()
  880. /// Identity link type
  881. /// References: `user.links[].type`, `user.links[].value`
  882. enum OneOf_Type: Equatable {
  883. /// Linked with a verified telephone number (E.164 format without leading
  884. /// `+`)
  885. case phoneNumber(String)
  886. /// Linked with a verified email address
  887. case email(String)
  888. #if !swift(>=4.1)
  889. static func ==(lhs: Safe_IdentityLink.OneOf_Type, rhs: Safe_IdentityLink.OneOf_Type) -> Bool {
  890. switch (lhs, rhs) {
  891. case (.phoneNumber(let l), .phoneNumber(let r)): return l == r
  892. case (.email(let l), .email(let r)): return l == r
  893. default: return false
  894. }
  895. }
  896. #endif
  897. }
  898. init() {}
  899. }
  900. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  901. fileprivate let _protobuf_package = "safe"
  902. extension Safe_ConversationVisibility: SwiftProtobuf._ProtoNameProviding {
  903. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  904. 0: .same(proto: "SHOW"),
  905. 1: .same(proto: "ARCHIVE"),
  906. ]
  907. }
  908. extension Safe_ConversationCategory: SwiftProtobuf._ProtoNameProviding {
  909. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  910. 0: .same(proto: "DEFAULT"),
  911. 1: .same(proto: "PROTECTED"),
  912. ]
  913. }
  914. extension Safe_Backup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  915. static let protoMessageName: String = _protobuf_package + ".Backup"
  916. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  917. 1: .same(proto: "version"),
  918. 2: .same(proto: "device"),
  919. 3: .standard(proto: "private_key"),
  920. 4: .standard(proto: "user_profile"),
  921. 5: .same(proto: "contacts"),
  922. 6: .same(proto: "groups"),
  923. 7: .standard(proto: "distribution_lists"),
  924. 8: .same(proto: "settings"),
  925. ]
  926. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  927. while let fieldNumber = try decoder.nextFieldNumber() {
  928. switch fieldNumber {
  929. case 1: try decoder.decodeSingularUInt32Field(value: &self.version)
  930. case 2: try decoder.decodeSingularStringField(value: &self.device)
  931. case 3: try decoder.decodeSingularBytesField(value: &self.privateKey)
  932. case 4: try decoder.decodeSingularMessageField(value: &self._userProfile)
  933. case 5: try decoder.decodeRepeatedMessageField(value: &self.contacts)
  934. case 6: try decoder.decodeRepeatedMessageField(value: &self.groups)
  935. case 7: try decoder.decodeRepeatedMessageField(value: &self.distributionLists)
  936. case 8: try decoder.decodeSingularMessageField(value: &self._settings)
  937. default: break
  938. }
  939. }
  940. }
  941. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  942. if self.version != 0 {
  943. try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 1)
  944. }
  945. if !self.device.isEmpty {
  946. try visitor.visitSingularStringField(value: self.device, fieldNumber: 2)
  947. }
  948. if !self.privateKey.isEmpty {
  949. try visitor.visitSingularBytesField(value: self.privateKey, fieldNumber: 3)
  950. }
  951. if let v = self._userProfile {
  952. try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
  953. }
  954. if !self.contacts.isEmpty {
  955. try visitor.visitRepeatedMessageField(value: self.contacts, fieldNumber: 5)
  956. }
  957. if !self.groups.isEmpty {
  958. try visitor.visitRepeatedMessageField(value: self.groups, fieldNumber: 6)
  959. }
  960. if !self.distributionLists.isEmpty {
  961. try visitor.visitRepeatedMessageField(value: self.distributionLists, fieldNumber: 7)
  962. }
  963. if let v = self._settings {
  964. try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
  965. }
  966. try unknownFields.traverse(visitor: &visitor)
  967. }
  968. static func ==(lhs: Safe_Backup, rhs: Safe_Backup) -> Bool {
  969. if lhs.version != rhs.version {return false}
  970. if lhs.device != rhs.device {return false}
  971. if lhs.privateKey != rhs.privateKey {return false}
  972. if lhs._userProfile != rhs._userProfile {return false}
  973. if lhs.contacts != rhs.contacts {return false}
  974. if lhs.groups != rhs.groups {return false}
  975. if lhs.distributionLists != rhs.distributionLists {return false}
  976. if lhs._settings != rhs._settings {return false}
  977. if lhs.unknownFields != rhs.unknownFields {return false}
  978. return true
  979. }
  980. }
  981. extension Safe_UserProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  982. static let protoMessageName: String = _protobuf_package + ".UserProfile"
  983. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  984. 1: .same(proto: "nickname"),
  985. 2: .standard(proto: "profile_image"),
  986. 3: .standard(proto: "profile_image_share_policy"),
  987. 4: .standard(proto: "profile_image_share_with"),
  988. 5: .standard(proto: "identity_links"),
  989. ]
  990. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  991. while let fieldNumber = try decoder.nextFieldNumber() {
  992. switch fieldNumber {
  993. case 1: try decoder.decodeSingularStringField(value: &self.nickname)
  994. case 2: try decoder.decodeSingularMessageField(value: &self._profileImage)
  995. case 3: try decoder.decodeSingularEnumField(value: &self.profileImageSharePolicy)
  996. case 4: try decoder.decodeRepeatedStringField(value: &self.profileImageShareWith)
  997. case 5: try decoder.decodeRepeatedMessageField(value: &self.identityLinks)
  998. default: break
  999. }
  1000. }
  1001. }
  1002. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1003. if !self.nickname.isEmpty {
  1004. try visitor.visitSingularStringField(value: self.nickname, fieldNumber: 1)
  1005. }
  1006. if let v = self._profileImage {
  1007. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  1008. }
  1009. if self.profileImageSharePolicy != .nobody {
  1010. try visitor.visitSingularEnumField(value: self.profileImageSharePolicy, fieldNumber: 3)
  1011. }
  1012. if !self.profileImageShareWith.isEmpty {
  1013. try visitor.visitRepeatedStringField(value: self.profileImageShareWith, fieldNumber: 4)
  1014. }
  1015. if !self.identityLinks.isEmpty {
  1016. try visitor.visitRepeatedMessageField(value: self.identityLinks, fieldNumber: 5)
  1017. }
  1018. try unknownFields.traverse(visitor: &visitor)
  1019. }
  1020. static func ==(lhs: Safe_UserProfile, rhs: Safe_UserProfile) -> Bool {
  1021. if lhs.nickname != rhs.nickname {return false}
  1022. if lhs._profileImage != rhs._profileImage {return false}
  1023. if lhs.profileImageSharePolicy != rhs.profileImageSharePolicy {return false}
  1024. if lhs.profileImageShareWith != rhs.profileImageShareWith {return false}
  1025. if lhs.identityLinks != rhs.identityLinks {return false}
  1026. if lhs.unknownFields != rhs.unknownFields {return false}
  1027. return true
  1028. }
  1029. }
  1030. extension Safe_UserProfile.ProfileImageSharePolicy: SwiftProtobuf._ProtoNameProviding {
  1031. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1032. 0: .same(proto: "NOBODY"),
  1033. 1: .same(proto: "EVERYONE"),
  1034. 2: .same(proto: "ALLOW_LIST"),
  1035. ]
  1036. }
  1037. extension Safe_Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1038. static let protoMessageName: String = _protobuf_package + ".Contact"
  1039. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1040. 1: .same(proto: "identity"),
  1041. 2: .standard(proto: "public_key"),
  1042. 3: .standard(proto: "created_at"),
  1043. 4: .standard(proto: "verification_level"),
  1044. 5: .standard(proto: "identity_type"),
  1045. 6: .standard(proto: "display_policy"),
  1046. 7: .standard(proto: "conversation_category"),
  1047. 8: .standard(proto: "conversation_visibility"),
  1048. 9: .standard(proto: "first_name_value"),
  1049. 10: .standard(proto: "last_name_value"),
  1050. 11: .standard(proto: "nickname_value"),
  1051. 12: .standard(proto: "profile_image"),
  1052. 13: .standard(proto: "custom_profile_image"),
  1053. ]
  1054. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1055. while let fieldNumber = try decoder.nextFieldNumber() {
  1056. switch fieldNumber {
  1057. case 1: try decoder.decodeSingularStringField(value: &self.identity)
  1058. case 2: try decoder.decodeSingularBytesField(value: &self.publicKey)
  1059. case 3: try decoder.decodeSingularUInt64Field(value: &self.createdAt)
  1060. case 4: try decoder.decodeSingularEnumField(value: &self.verificationLevel)
  1061. case 5: try decoder.decodeSingularEnumField(value: &self.identityType)
  1062. case 6: try decoder.decodeSingularEnumField(value: &self.displayPolicy)
  1063. case 7: try decoder.decodeSingularEnumField(value: &self.conversationCategory)
  1064. case 8: try decoder.decodeSingularEnumField(value: &self.conversationVisibility)
  1065. case 9:
  1066. if self.firstName != nil {try decoder.handleConflictingOneOf()}
  1067. var v: String?
  1068. try decoder.decodeSingularStringField(value: &v)
  1069. if let v = v {self.firstName = .firstNameValue(v)}
  1070. case 10:
  1071. if self.lastName != nil {try decoder.handleConflictingOneOf()}
  1072. var v: String?
  1073. try decoder.decodeSingularStringField(value: &v)
  1074. if let v = v {self.lastName = .lastNameValue(v)}
  1075. case 11:
  1076. if self.nickname != nil {try decoder.handleConflictingOneOf()}
  1077. var v: String?
  1078. try decoder.decodeSingularStringField(value: &v)
  1079. if let v = v {self.nickname = .nicknameValue(v)}
  1080. case 12: try decoder.decodeSingularMessageField(value: &self._profileImage)
  1081. case 13: try decoder.decodeSingularMessageField(value: &self._customProfileImage)
  1082. default: break
  1083. }
  1084. }
  1085. }
  1086. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1087. if !self.identity.isEmpty {
  1088. try visitor.visitSingularStringField(value: self.identity, fieldNumber: 1)
  1089. }
  1090. if !self.publicKey.isEmpty {
  1091. try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 2)
  1092. }
  1093. if self.createdAt != 0 {
  1094. try visitor.visitSingularUInt64Field(value: self.createdAt, fieldNumber: 3)
  1095. }
  1096. if self.verificationLevel != .unverified {
  1097. try visitor.visitSingularEnumField(value: self.verificationLevel, fieldNumber: 4)
  1098. }
  1099. if self.identityType != .regular {
  1100. try visitor.visitSingularEnumField(value: self.identityType, fieldNumber: 5)
  1101. }
  1102. if self.displayPolicy != .show {
  1103. try visitor.visitSingularEnumField(value: self.displayPolicy, fieldNumber: 6)
  1104. }
  1105. if self.conversationCategory != .default {
  1106. try visitor.visitSingularEnumField(value: self.conversationCategory, fieldNumber: 7)
  1107. }
  1108. if self.conversationVisibility != .show {
  1109. try visitor.visitSingularEnumField(value: self.conversationVisibility, fieldNumber: 8)
  1110. }
  1111. if case .firstNameValue(let v)? = self.firstName {
  1112. try visitor.visitSingularStringField(value: v, fieldNumber: 9)
  1113. }
  1114. if case .lastNameValue(let v)? = self.lastName {
  1115. try visitor.visitSingularStringField(value: v, fieldNumber: 10)
  1116. }
  1117. if case .nicknameValue(let v)? = self.nickname {
  1118. try visitor.visitSingularStringField(value: v, fieldNumber: 11)
  1119. }
  1120. if let v = self._profileImage {
  1121. try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
  1122. }
  1123. if let v = self._customProfileImage {
  1124. try visitor.visitSingularMessageField(value: v, fieldNumber: 13)
  1125. }
  1126. try unknownFields.traverse(visitor: &visitor)
  1127. }
  1128. static func ==(lhs: Safe_Contact, rhs: Safe_Contact) -> Bool {
  1129. if lhs.identity != rhs.identity {return false}
  1130. if lhs.publicKey != rhs.publicKey {return false}
  1131. if lhs.createdAt != rhs.createdAt {return false}
  1132. if lhs.verificationLevel != rhs.verificationLevel {return false}
  1133. if lhs.identityType != rhs.identityType {return false}
  1134. if lhs.displayPolicy != rhs.displayPolicy {return false}
  1135. if lhs.conversationCategory != rhs.conversationCategory {return false}
  1136. if lhs.conversationVisibility != rhs.conversationVisibility {return false}
  1137. if lhs.firstName != rhs.firstName {return false}
  1138. if lhs.lastName != rhs.lastName {return false}
  1139. if lhs.nickname != rhs.nickname {return false}
  1140. if lhs._profileImage != rhs._profileImage {return false}
  1141. if lhs._customProfileImage != rhs._customProfileImage {return false}
  1142. if lhs.unknownFields != rhs.unknownFields {return false}
  1143. return true
  1144. }
  1145. }
  1146. extension Safe_Contact.VerificationLevel: SwiftProtobuf._ProtoNameProviding {
  1147. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1148. 0: .same(proto: "UNVERIFIED"),
  1149. 1: .same(proto: "SERVER_VERIFIED"),
  1150. 2: .same(proto: "FULLY_VERIFIED"),
  1151. ]
  1152. }
  1153. extension Safe_Contact.IdentityType: SwiftProtobuf._ProtoNameProviding {
  1154. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1155. 0: .same(proto: "REGULAR"),
  1156. 1: .same(proto: "WORK"),
  1157. ]
  1158. }
  1159. extension Safe_Contact.DisplayPolicy: SwiftProtobuf._ProtoNameProviding {
  1160. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1161. 0: .same(proto: "SHOW"),
  1162. 1: .same(proto: "HIDE"),
  1163. ]
  1164. }
  1165. extension Safe_Group: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1166. static let protoMessageName: String = _protobuf_package + ".Group"
  1167. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1168. 1: .standard(proto: "group_identity"),
  1169. 2: .same(proto: "name"),
  1170. 3: .standard(proto: "created_at"),
  1171. 4: .standard(proto: "conversation_category"),
  1172. 5: .standard(proto: "conversation_visibility"),
  1173. 6: .standard(proto: "user_state"),
  1174. 7: .standard(proto: "profile_image"),
  1175. 8: .standard(proto: "member_identities"),
  1176. ]
  1177. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1178. while let fieldNumber = try decoder.nextFieldNumber() {
  1179. switch fieldNumber {
  1180. case 1: try decoder.decodeSingularMessageField(value: &self._groupIdentity)
  1181. case 2: try decoder.decodeSingularStringField(value: &self.name)
  1182. case 3: try decoder.decodeSingularUInt64Field(value: &self.createdAt)
  1183. case 4: try decoder.decodeSingularEnumField(value: &self.conversationCategory)
  1184. case 5: try decoder.decodeSingularEnumField(value: &self.conversationVisibility)
  1185. case 6: try decoder.decodeSingularEnumField(value: &self.userState)
  1186. case 7: try decoder.decodeSingularMessageField(value: &self._profileImage)
  1187. case 8: try decoder.decodeRepeatedStringField(value: &self.memberIdentities)
  1188. default: break
  1189. }
  1190. }
  1191. }
  1192. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1193. if let v = self._groupIdentity {
  1194. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  1195. }
  1196. if !self.name.isEmpty {
  1197. try visitor.visitSingularStringField(value: self.name, fieldNumber: 2)
  1198. }
  1199. if self.createdAt != 0 {
  1200. try visitor.visitSingularUInt64Field(value: self.createdAt, fieldNumber: 3)
  1201. }
  1202. if self.conversationCategory != .default {
  1203. try visitor.visitSingularEnumField(value: self.conversationCategory, fieldNumber: 4)
  1204. }
  1205. if self.conversationVisibility != .show {
  1206. try visitor.visitSingularEnumField(value: self.conversationVisibility, fieldNumber: 5)
  1207. }
  1208. if self.userState != .member {
  1209. try visitor.visitSingularEnumField(value: self.userState, fieldNumber: 6)
  1210. }
  1211. if let v = self._profileImage {
  1212. try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
  1213. }
  1214. if !self.memberIdentities.isEmpty {
  1215. try visitor.visitRepeatedStringField(value: self.memberIdentities, fieldNumber: 8)
  1216. }
  1217. try unknownFields.traverse(visitor: &visitor)
  1218. }
  1219. static func ==(lhs: Safe_Group, rhs: Safe_Group) -> Bool {
  1220. if lhs._groupIdentity != rhs._groupIdentity {return false}
  1221. if lhs.name != rhs.name {return false}
  1222. if lhs.createdAt != rhs.createdAt {return false}
  1223. if lhs.conversationCategory != rhs.conversationCategory {return false}
  1224. if lhs.conversationVisibility != rhs.conversationVisibility {return false}
  1225. if lhs.userState != rhs.userState {return false}
  1226. if lhs._profileImage != rhs._profileImage {return false}
  1227. if lhs.memberIdentities != rhs.memberIdentities {return false}
  1228. if lhs.unknownFields != rhs.unknownFields {return false}
  1229. return true
  1230. }
  1231. }
  1232. extension Safe_Group.UserState: SwiftProtobuf._ProtoNameProviding {
  1233. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1234. 0: .same(proto: "MEMBER"),
  1235. 1: .same(proto: "KICKED"),
  1236. 2: .same(proto: "LEFT"),
  1237. ]
  1238. }
  1239. extension Safe_DistributionList: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1240. static let protoMessageName: String = _protobuf_package + ".DistributionList"
  1241. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1242. 1: .standard(proto: "distribution_list_id"),
  1243. 2: .same(proto: "name"),
  1244. 3: .standard(proto: "created_at"),
  1245. 4: .standard(proto: "conversation_category"),
  1246. 5: .standard(proto: "conversation_visibility"),
  1247. 6: .standard(proto: "member_identities"),
  1248. ]
  1249. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1250. while let fieldNumber = try decoder.nextFieldNumber() {
  1251. switch fieldNumber {
  1252. case 1: try decoder.decodeSingularFixed64Field(value: &self.distributionListID)
  1253. case 2: try decoder.decodeSingularStringField(value: &self.name)
  1254. case 3: try decoder.decodeSingularUInt64Field(value: &self.createdAt)
  1255. case 4: try decoder.decodeSingularEnumField(value: &self.conversationCategory)
  1256. case 5: try decoder.decodeSingularEnumField(value: &self.conversationVisibility)
  1257. case 6: try decoder.decodeRepeatedStringField(value: &self.memberIdentities)
  1258. default: break
  1259. }
  1260. }
  1261. }
  1262. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1263. if self.distributionListID != 0 {
  1264. try visitor.visitSingularFixed64Field(value: self.distributionListID, fieldNumber: 1)
  1265. }
  1266. if !self.name.isEmpty {
  1267. try visitor.visitSingularStringField(value: self.name, fieldNumber: 2)
  1268. }
  1269. if self.createdAt != 0 {
  1270. try visitor.visitSingularUInt64Field(value: self.createdAt, fieldNumber: 3)
  1271. }
  1272. if self.conversationCategory != .default {
  1273. try visitor.visitSingularEnumField(value: self.conversationCategory, fieldNumber: 4)
  1274. }
  1275. if self.conversationVisibility != .show {
  1276. try visitor.visitSingularEnumField(value: self.conversationVisibility, fieldNumber: 5)
  1277. }
  1278. if !self.memberIdentities.isEmpty {
  1279. try visitor.visitRepeatedStringField(value: self.memberIdentities, fieldNumber: 6)
  1280. }
  1281. try unknownFields.traverse(visitor: &visitor)
  1282. }
  1283. static func ==(lhs: Safe_DistributionList, rhs: Safe_DistributionList) -> Bool {
  1284. if lhs.distributionListID != rhs.distributionListID {return false}
  1285. if lhs.name != rhs.name {return false}
  1286. if lhs.createdAt != rhs.createdAt {return false}
  1287. if lhs.conversationCategory != rhs.conversationCategory {return false}
  1288. if lhs.conversationVisibility != rhs.conversationVisibility {return false}
  1289. if lhs.memberIdentities != rhs.memberIdentities {return false}
  1290. if lhs.unknownFields != rhs.unknownFields {return false}
  1291. return true
  1292. }
  1293. }
  1294. extension Safe_Settings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1295. static let protoMessageName: String = _protobuf_package + ".Settings"
  1296. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1297. 1: .standard(proto: "contact_sync_policy"),
  1298. 2: .standard(proto: "unknown_contact_policy"),
  1299. 3: .standard(proto: "read_message_policy"),
  1300. 4: .standard(proto: "compose_message_policy"),
  1301. 5: .standard(proto: "call_policy"),
  1302. 6: .standard(proto: "call_connection_polity"),
  1303. 7: .standard(proto: "screenshot_policy"),
  1304. 8: .standard(proto: "keyboard_data_collection_policy"),
  1305. 9: .standard(proto: "blocked_identities"),
  1306. 10: .standard(proto: "exclude_from_sync_identities"),
  1307. 11: .standard(proto: "recent_emojis"),
  1308. ]
  1309. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1310. while let fieldNumber = try decoder.nextFieldNumber() {
  1311. switch fieldNumber {
  1312. case 1: try decoder.decodeSingularEnumField(value: &self.contactSyncPolicy)
  1313. case 2: try decoder.decodeSingularEnumField(value: &self.unknownContactPolicy)
  1314. case 3: try decoder.decodeSingularEnumField(value: &self.readMessagePolicy)
  1315. case 4: try decoder.decodeSingularEnumField(value: &self.composeMessagePolicy)
  1316. case 5: try decoder.decodeSingularEnumField(value: &self.callPolicy)
  1317. case 6: try decoder.decodeSingularEnumField(value: &self.callConnectionPolity)
  1318. case 7: try decoder.decodeSingularEnumField(value: &self.screenshotPolicy)
  1319. case 8: try decoder.decodeSingularEnumField(value: &self.keyboardDataCollectionPolicy)
  1320. case 9: try decoder.decodeRepeatedStringField(value: &self.blockedIdentities)
  1321. case 10: try decoder.decodeRepeatedStringField(value: &self.excludeFromSyncIdentities)
  1322. case 11: try decoder.decodeRepeatedStringField(value: &self.recentEmojis)
  1323. default: break
  1324. }
  1325. }
  1326. }
  1327. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1328. if self.contactSyncPolicy != .notSynced {
  1329. try visitor.visitSingularEnumField(value: self.contactSyncPolicy, fieldNumber: 1)
  1330. }
  1331. if self.unknownContactPolicy != .allowUnknown {
  1332. try visitor.visitSingularEnumField(value: self.unknownContactPolicy, fieldNumber: 2)
  1333. }
  1334. if self.readMessagePolicy != .sendReadReceipt {
  1335. try visitor.visitSingularEnumField(value: self.readMessagePolicy, fieldNumber: 3)
  1336. }
  1337. if self.composeMessagePolicy != .sendTypingIndicator {
  1338. try visitor.visitSingularEnumField(value: self.composeMessagePolicy, fieldNumber: 4)
  1339. }
  1340. if self.callPolicy != .allowCall {
  1341. try visitor.visitSingularEnumField(value: self.callPolicy, fieldNumber: 5)
  1342. }
  1343. if self.callConnectionPolity != .allowDirect {
  1344. try visitor.visitSingularEnumField(value: self.callConnectionPolity, fieldNumber: 6)
  1345. }
  1346. if self.screenshotPolicy != .allowScreenshot {
  1347. try visitor.visitSingularEnumField(value: self.screenshotPolicy, fieldNumber: 7)
  1348. }
  1349. if self.keyboardDataCollectionPolicy != .allowDataCollection {
  1350. try visitor.visitSingularEnumField(value: self.keyboardDataCollectionPolicy, fieldNumber: 8)
  1351. }
  1352. if !self.blockedIdentities.isEmpty {
  1353. try visitor.visitRepeatedStringField(value: self.blockedIdentities, fieldNumber: 9)
  1354. }
  1355. if !self.excludeFromSyncIdentities.isEmpty {
  1356. try visitor.visitRepeatedStringField(value: self.excludeFromSyncIdentities, fieldNumber: 10)
  1357. }
  1358. if !self.recentEmojis.isEmpty {
  1359. try visitor.visitRepeatedStringField(value: self.recentEmojis, fieldNumber: 11)
  1360. }
  1361. try unknownFields.traverse(visitor: &visitor)
  1362. }
  1363. static func ==(lhs: Safe_Settings, rhs: Safe_Settings) -> Bool {
  1364. if lhs.contactSyncPolicy != rhs.contactSyncPolicy {return false}
  1365. if lhs.unknownContactPolicy != rhs.unknownContactPolicy {return false}
  1366. if lhs.readMessagePolicy != rhs.readMessagePolicy {return false}
  1367. if lhs.composeMessagePolicy != rhs.composeMessagePolicy {return false}
  1368. if lhs.callPolicy != rhs.callPolicy {return false}
  1369. if lhs.callConnectionPolity != rhs.callConnectionPolity {return false}
  1370. if lhs.screenshotPolicy != rhs.screenshotPolicy {return false}
  1371. if lhs.keyboardDataCollectionPolicy != rhs.keyboardDataCollectionPolicy {return false}
  1372. if lhs.blockedIdentities != rhs.blockedIdentities {return false}
  1373. if lhs.excludeFromSyncIdentities != rhs.excludeFromSyncIdentities {return false}
  1374. if lhs.recentEmojis != rhs.recentEmojis {return false}
  1375. if lhs.unknownFields != rhs.unknownFields {return false}
  1376. return true
  1377. }
  1378. }
  1379. extension Safe_Settings.ContactSyncPolicy: SwiftProtobuf._ProtoNameProviding {
  1380. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1381. 0: .same(proto: "NOT_SYNCED"),
  1382. 1: .same(proto: "SYNC"),
  1383. ]
  1384. }
  1385. extension Safe_Settings.UnknownContactPolicy: SwiftProtobuf._ProtoNameProviding {
  1386. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1387. 0: .same(proto: "ALLOW_UNKNOWN"),
  1388. 1: .same(proto: "BLOCK_UNKNOWN"),
  1389. ]
  1390. }
  1391. extension Safe_Settings.ReadMessagePolicy: SwiftProtobuf._ProtoNameProviding {
  1392. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1393. 0: .same(proto: "SEND_READ_RECEIPT"),
  1394. 1: .same(proto: "IGNORE_READ"),
  1395. ]
  1396. }
  1397. extension Safe_Settings.ComposeMessagePolicy: SwiftProtobuf._ProtoNameProviding {
  1398. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1399. 0: .same(proto: "SEND_TYPING_INDICATOR"),
  1400. 1: .same(proto: "IGNORE_COMPOSE"),
  1401. ]
  1402. }
  1403. extension Safe_Settings.CallPolicy: SwiftProtobuf._ProtoNameProviding {
  1404. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1405. 0: .same(proto: "ALLOW_CALL"),
  1406. 1: .same(proto: "DENY_CALL"),
  1407. ]
  1408. }
  1409. extension Safe_Settings.CallConnectionPolicy: SwiftProtobuf._ProtoNameProviding {
  1410. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1411. 0: .same(proto: "ALLOW_DIRECT"),
  1412. 1: .same(proto: "REQUIRE_RELAY"),
  1413. ]
  1414. }
  1415. extension Safe_Settings.ScreenshotPolicy: SwiftProtobuf._ProtoNameProviding {
  1416. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1417. 0: .same(proto: "ALLOW_SCREENSHOT"),
  1418. 1: .same(proto: "DENY_SCREENSHOT"),
  1419. ]
  1420. }
  1421. extension Safe_Settings.KeyboardDataCollectionPolicy: SwiftProtobuf._ProtoNameProviding {
  1422. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1423. 0: .same(proto: "ALLOW_DATA_COLLECTION"),
  1424. 1: .same(proto: "DENY_DATA_COLLECTION"),
  1425. ]
  1426. }
  1427. extension Safe_IdentityLink: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1428. static let protoMessageName: String = _protobuf_package + ".IdentityLink"
  1429. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1430. 1: .standard(proto: "phone_number"),
  1431. 2: .same(proto: "email"),
  1432. 3: .same(proto: "description"),
  1433. ]
  1434. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1435. while let fieldNumber = try decoder.nextFieldNumber() {
  1436. switch fieldNumber {
  1437. case 1:
  1438. if self.type != nil {try decoder.handleConflictingOneOf()}
  1439. var v: String?
  1440. try decoder.decodeSingularStringField(value: &v)
  1441. if let v = v {self.type = .phoneNumber(v)}
  1442. case 2:
  1443. if self.type != nil {try decoder.handleConflictingOneOf()}
  1444. var v: String?
  1445. try decoder.decodeSingularStringField(value: &v)
  1446. if let v = v {self.type = .email(v)}
  1447. case 3: try decoder.decodeSingularStringField(value: &self.description_p)
  1448. default: break
  1449. }
  1450. }
  1451. }
  1452. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1453. switch self.type {
  1454. case .phoneNumber(let v)?:
  1455. try visitor.visitSingularStringField(value: v, fieldNumber: 1)
  1456. case .email(let v)?:
  1457. try visitor.visitSingularStringField(value: v, fieldNumber: 2)
  1458. case nil: break
  1459. }
  1460. if !self.description_p.isEmpty {
  1461. try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 3)
  1462. }
  1463. try unknownFields.traverse(visitor: &visitor)
  1464. }
  1465. static func ==(lhs: Safe_IdentityLink, rhs: Safe_IdentityLink) -> Bool {
  1466. if lhs.type != rhs.type {return false}
  1467. if lhs.description_p != rhs.description_p {return false}
  1468. if lhs.unknownFields != rhs.unknownFields {return false}
  1469. return true
  1470. }
  1471. }