FIRIAMActionURLFollower.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <UIKit/UIKit.h>
  18. NS_ASSUME_NONNULL_BEGIN
  19. // A class for handling action url following.
  20. // It tries to handle these cases:
  21. // 1 Follow a universal link.
  22. // 2 Follow a custom url scheme link.
  23. // 3 Follow other types of links.
  24. @interface FIRIAMActionURLFollower : NSObject
  25. // Create an FIRIAMActionURLFollower object by inspecting the app's main bundle info.
  26. + (instancetype)actionURLFollower;
  27. - (instancetype)init NS_UNAVAILABLE;
  28. // initialize the instance with an array of supported custom url schemes and
  29. // the main application object
  30. - (instancetype)initWithCustomURLSchemeArray:(NSArray<NSString *> *)customURLScheme
  31. withApplication:(UIApplication *)application NS_DESIGNATED_INITIALIZER;
  32. /**
  33. * Follow a given URL. Report success in the completion block parameter. Notice that
  34. * it can not always be fully sure about whether the operation is successful. So it's a clue
  35. * in some cases.
  36. * Check its implementation about the details in the following logic.
  37. */
  38. - (void)followActionURL:(NSURL *)actionURL withCompletionBlock:(void (^)(BOOL success))completion;
  39. @end
  40. NS_ASSUME_NONNULL_END