PerfNetworkConnection.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // Non-google3 relative import to support building with Xcode.
  15. #import "PerfNetworkConnection.h"
  16. #import "../Models/PerfLogger.h"
  17. #import "PerfNetworkConnection+Protected.h"
  18. @interface PerfNetworkConnection () {
  19. NSString *_urlString;
  20. }
  21. @end
  22. @implementation PerfNetworkConnection
  23. #pragma mark - Initialization
  24. - (instancetype)initWithURLString:(NSString *)urlString {
  25. self = [super init];
  26. if (self) {
  27. self.urlString = urlString;
  28. }
  29. return self;
  30. }
  31. #pragma mark - Properties
  32. - (void)setUrlString:(NSString *)urlString {
  33. _urlString = [urlString copy];
  34. PerfLog(@"Set URL %@", urlString);
  35. }
  36. - (NSString *)urlString {
  37. return _urlString;
  38. }
  39. #pragma mark - NetworkConnection
  40. - (void)makeNetworkRequestWithSuccessCallback:(SuccessNetworkCallback)success
  41. failureCallback:(FailureNetworkCallback)fail {
  42. NSAssert(NO, @"Abstract class. The method must be overridden.");
  43. }
  44. @end