NCUserStatus.swift 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // NCUserStatus.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 23/11/20.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. import SwiftUI
  9. import Foundation
  10. import NCCommunication
  11. @available(iOS 13.0, *)
  12. struct NCUserStatus: View {
  13. var body: some View {
  14. VStack(alignment: .leading) {
  15. HStack {
  16. Image("userStatusAway")
  17. .resizable()
  18. .frame(width: 100.0, height: 100.0)
  19. .clipShape(Circle())
  20. }
  21. Text("Hello World44,2")
  22. .font(.headline)
  23. .foregroundColor(Color.red)
  24. .lineLimit(0)
  25. Text("test")
  26. }
  27. }
  28. }
  29. @available(iOS 13.0, *)
  30. struct NCUserStatus_Previews: PreviewProvider {
  31. static var previews: some View {
  32. Group {
  33. NCUserStatus()
  34. }
  35. }
  36. }
  37. @available(iOS 13.0, *)
  38. @objc class NCUserStatusViewController: NSObject {
  39. @objc func makeUserStatusUI() -> UIViewController{
  40. NCCommunication.shared.getUserStatusPredefinedStatuses { (account, userStatuses, errorCode, errorDescription) in
  41. if errorCode == 0 {
  42. if let userStatuses = userStatuses {
  43. NCManageDatabase.sharedInstance.addUserStatus(userStatuses, account: account, predefined: true)
  44. }
  45. }
  46. }
  47. NCCommunication.shared.getUserStatusRetrieveStatuses(limit: 1000, offset: 0, customUserAgent: nil, addCustomHeaders: nil) { (account, userStatuses, errorCode, errorDescription) in
  48. if errorCode == 0 {
  49. if let userStatuses = userStatuses {
  50. NCManageDatabase.sharedInstance.addUserStatus(userStatuses, account: account, predefined: false)
  51. }
  52. }
  53. }
  54. let userStatus = NCUserStatus()
  55. //details.shipName = name
  56. return UIHostingController(rootView: userStatus)
  57. }
  58. }