FIRDatabaseConfig.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2017 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. @protocol FAuthTokenProvider;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * TODO: Merge FIRDatabaseConfig into FIRDatabase.
  21. */
  22. @interface FIRDatabaseConfig : NSObject
  23. - (id)initWithSessionIdentifier:(NSString *)identifier
  24. googleAppID:(NSString *)googleAppID
  25. authTokenProvider:(id<FAuthTokenProvider>)authTokenProvider;
  26. /**
  27. * By default the Firebase Database client will keep data in memory while your
  28. * application is running, but not when it is restarted. By setting this value
  29. * to YES, the data will be persisted to on-device (disk) storage and will thus
  30. * be available again when the app is restarted (even when there is no network
  31. * connectivity at that time). Note that this property must be set before
  32. * creating your first FIRDatabaseReference and only needs to be called once per
  33. * application.
  34. *
  35. * If your app uses Firebase Authentication, the client will automatically
  36. * persist the user's authentication token across restarts, even without
  37. * persistence enabled. But if the auth token expired while offline and you've
  38. * enabled persistence, the client will pause write operations until you
  39. * successfully re-authenticate (or explicitly unauthenticate) to prevent your
  40. * writes from being sent unauthenticated and failing due to security rules.
  41. */
  42. @property(nonatomic) BOOL persistenceEnabled;
  43. /**
  44. * By default the Firebase Database client will use up to 10MB of disk space to
  45. * cache data. If the cache grows beyond this size, the client will start
  46. * removing data that hasn't been recently used. If you find that your
  47. * application caches too little or too much data, call this method to change
  48. * the cache size. This property must be set before creating your first
  49. * FIRDatabaseReference and only needs to be called once per application.
  50. *
  51. * Note that the specified cache size is only an approximation and the size on
  52. * disk may temporarily exceed it at times.
  53. */
  54. @property(nonatomic) NSUInteger persistenceCacheSizeBytes;
  55. /**
  56. * Sets the dispatch queue on which all events are raised. The default queue is
  57. * the main queue.
  58. */
  59. @property(nonatomic, strong) dispatch_queue_t callbackQueue;
  60. @end
  61. NS_ASSUME_NONNULL_END