FIRInstallationsStore.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2019 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. @class FBLPromise<ValueType>;
  18. @class FIRInstallationsItem;
  19. @class GULKeychainStorage;
  20. NS_ASSUME_NONNULL_BEGIN
  21. /// The user defaults suite name used to store data.
  22. extern NSString *const kFIRInstallationsStoreUserDefaultsID;
  23. /// The class is responsible for storing and accessing the installations data.
  24. @interface FIRInstallationsStore : NSObject
  25. /**
  26. * The default initializer.
  27. * @param storage The secure storage to save installations data.
  28. * @param accessGroup The Keychain Access Group to store and request the installations data.
  29. */
  30. - (instancetype)initWithSecureStorage:(GULKeychainStorage *)storage
  31. accessGroup:(nullable NSString *)accessGroup;
  32. /**
  33. * Retrieves existing installation ID if there is.
  34. * @param appID The Firebase(Google) Application ID.
  35. * @param appName The Firebase Application Name.
  36. *
  37. * @return Returns a `FBLPromise` instance. The promise is resolved with a FIRInstallationsItem
  38. * instance if there is a valid installation stored for `appID` and `appName`. The promise is
  39. * rejected with a specific error when the installation has not been found or with another possible
  40. * error.
  41. */
  42. - (FBLPromise<FIRInstallationsItem *> *)installationForAppID:(NSString *)appID
  43. appName:(NSString *)appName;
  44. /**
  45. * Saves the given installation.
  46. *
  47. * @param installationItem The installation data.
  48. * @return Returns a promise that is resolved with `[NSNull null]` on success.
  49. */
  50. - (FBLPromise<NSNull *> *)saveInstallation:(FIRInstallationsItem *)installationItem;
  51. /**
  52. * Removes installation data for the given app parameters.
  53. * @param appID The Firebase(Google) Application ID.
  54. * @param appName The Firebase Application Name.
  55. *
  56. * @return Returns a promise that is resolved with `[NSNull null]` on success.
  57. */
  58. - (FBLPromise<NSNull *> *)removeInstallationForAppID:(NSString *)appID appName:(NSString *)appName;
  59. @end
  60. NS_ASSUME_NONNULL_END