NetworkConnectionView.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <UIKit/UIKit.h>
  15. typedef enum : NSUInteger {
  16. ConnectionStatus_NA = 0,
  17. ConnectionStatus_Fail,
  18. ConnectionStatus_Success
  19. } PerfConnectionStatus;
  20. @class NetworkConnectionView;
  21. @protocol NetworkConnectionViewDelegate <NSObject>
  22. /**
  23. * Delegate method that is called on start request button tapped.
  24. *
  25. * @param connectionView Instance of the NetworkConnectionView.
  26. */
  27. - (void)networkConnectionViewDidTapRequestButton:(nonnull NetworkConnectionView *)connectionView;
  28. @end
  29. /**
  30. * A view which represents Network Connection operation.
  31. */
  32. @interface NetworkConnectionView : UIView
  33. @property(nonatomic, assign) PerfConnectionStatus connectionStatus;
  34. @property(nonatomic, weak, nullable) id<NetworkConnectionViewDelegate> delegate;
  35. @property(nonatomic, copy, nullable) NSString *title;
  36. @property(nonatomic, nullable) UIColor *progressViewColor;
  37. @property(nonatomic, nullable) UIButton *networkCallButton;
  38. @property(nonatomic, nullable) UILabel *connectionStatusLabel;
  39. /** @brief Not a valid initializer. */
  40. - (nonnull instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
  41. /** @brief Not a valid initializer. */
  42. - (nonnull instancetype)initWithCoder:(nullable NSCoder *)coder NS_UNAVAILABLE;
  43. - (void)setProgress:(float)progress animated:(BOOL)animated;
  44. @end