SEGDatabaseManager.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2019 Google
  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 <Foundation/Foundation.h>
  15. #import "FirebaseSegmentation/Sources/SEGSegmentationConstants.h"
  16. NS_ASSUME_NONNULL_BEGIN
  17. /// Persist config data in sqlite database on device. Managing data read/write from/to database.
  18. @interface SEGDatabaseManager : NSObject
  19. /// Shared Singleton Instance
  20. + (instancetype)sharedInstance;
  21. /// Open the database.
  22. - (void)createOrOpenDatabaseWithCompletion:(SEGRequestCompletion)completionHandler;
  23. /// Read all contents of main table.
  24. - (void)loadMainTableWithCompletion:(SEGRequestCompletion)completionHandler;
  25. /// Insert a record in main table.
  26. /// @param firebaseApplication The name of the Firebase App that this segmentation instance is
  27. /// associated with.
  28. /// @param customInstanceIdentifier The custom instance identifier provided by the developer.
  29. /// @param firebaseInstanceIdentifier The firebase instance identifier provided by the IID/FIS SDK.
  30. /// @param associationStatus The current status of the association - Pending until reported to the
  31. /// backend.
  32. - (void)insertMainTableApplicationNamed:(NSString *)firebaseApplication
  33. customInstanceIdentifier:(NSString *)customInstanceIdentifier
  34. firebaseInstanceIdentifier:(NSString *)firebaseInstanceIdentifier
  35. associationStatus:(NSString *)associationStatus
  36. completionHandler:(nullable SEGRequestCompletion)handler;
  37. /// Clear the record of given namespace and package name
  38. /// before updating the table.//TODO: Add delete.
  39. - (void)deleteRecordFromMainTableWithCustomInstanceIdentifier:(NSString *)customInstanceIdentifier;
  40. /// Remove all the records from a config content table.
  41. - (void)deleteAllRecordsFromTable;
  42. NS_ASSUME_NONNULL_END
  43. @end