firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

[rc-swift] RemoteConfig.swift

Open paulb777 opened this issue 11 months ago • 2 comments

FIRRemoteConfig.m -> RemoteConfig.swift

This is a first pass sufficient to pass the fake console integration tests. Open questions include:

  • Keep the Objective-C error domain symbols or not? See the APIBuildTest changes
  • RCNRemoteConfigTest.m is heavily commented out because of mocks and needs to be rethought
  • Queues and synchronization need a deep dive in a Swift 6 Structured Concurrency context
  • Assess client app CI after master rebase

paulb777 avatar Jan 07 '25 00:01 paulb777

1 Warning
:warning: Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by :no_entry_sign: Danger

google-oss-bot avatar Jan 07 '25 00:01 google-oss-bot

Apple API Diff Report

Commit: 54267c8e85325c097d9f78eda7639295488942a9 Last updated: Thu Jan 16 14:29 PST 2025 View workflow logs & download artifacts


FirebaseRemoteConfig

Type Definitions

[REMOVED] FIRRemoteConfigFetchAndActivateCompletion
[REMOVED] FIRRemoteConfigFetchAndActivateCompletion
Objective-C:
-  typedef void ( ^ FIRRemoteConfigFetchAndActivateCompletion )( FIRRemoteConfigFetchAndActivateStatus , NSError * _Nullable )
[REMOVED] FIRRemoteConfigFetchCompletion
[REMOVED] FIRRemoteConfigFetchCompletion
Objective-C:
-  typedef void ( ^ FIRRemoteConfigFetchCompletion )( FIRRemoteConfigFetchStatus , NSError * _Nullable )
[REMOVED] FIRRemoteConfigUpdateCompletion
[REMOVED] FIRRemoteConfigUpdateCompletion

[REMOVED] Enumerations
Swift:
-    typealias RemoteConfigError . Code . _ErrorType = RemoteConfigError
-      case unknown = 8001
-      case throttled = 8002
-      case internalError = 8003
-    enum RemoteConfigFetchAndActivateStatus : Int , @unchecked Sendable
-      case successFetchedFromRemote = 0
-      case successUsingPreFetchedData = 1
-      case error = 2
-    enum RemoteConfigFetchStatus : Int , @unchecked Sendable
-      case noFetchYet = 0
-      case success = 1
-      case failure = 2
-      case throttled = 3
-    enum RemoteConfigSource : Int , @unchecked Sendable
-      case remote = 0
-      case ` default ` = 1
-      case ` static ` = 2
-    typealias RemoteConfigUpdateError . Code . _ErrorType = RemoteConfigUpdateError
-      case streamError = 8001
-      case notFetched = 8002
-      case messageInvalid = 8003
-      case unavailable = 8004
Objective-C:
-    enum FIRRemoteConfigError : NSInteger {}
-      FIRRemoteConfigErrorUnknown = 8001
-      FIRRemoteConfigErrorThrottled = 8002
-      FIRRemoteConfigErrorInternalError = 8003
-    enum FIRRemoteConfigFetchAndActivateStatus : NSInteger {}
-      FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote
-      FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData
-      FIRRemoteConfigFetchAndActivateStatusError
-    enum FIRRemoteConfigFetchStatus : NSInteger {}
-      FIRRemoteConfigFetchStatusNoFetchYet
-      FIRRemoteConfigFetchStatusSuccess
-      FIRRemoteConfigFetchStatusFailure
-      FIRRemoteConfigFetchStatusThrottled
-    enum FIRRemoteConfigSource : NSInteger {}
-      FIRRemoteConfigSourceRemote
-      FIRRemoteConfigSourceDefault
-      FIRRemoteConfigSourceStatic
-    enum FIRRemoteConfigUpdateError : NSInteger {}
-      FIRRemoteConfigUpdateErrorStreamError = 8001
-      FIRRemoteConfigUpdateErrorNotFetched = 8002
-      FIRRemoteConfigUpdateErrorMessageInvalid = 8003
-      FIRRemoteConfigUpdateErrorUnavailable = 8004

Constants

[REMOVED] FIRRemoteConfigErrorDomain
[REMOVED] FIRRemoteConfigErrorDomain
Swift:
-  let RemoteConfigErrorDomain : String
Objective-C:
-  extern NS_SWIFT_NAME ( RemoteConfigErrorDomain ) NSString * const FIRRemoteConfigErrorDomain
[REMOVED] FIRRemoteConfigUpdateErrorDomain
[REMOVED] FIRRemoteConfigUpdateErrorDomain
Swift:
-  let RemoteConfigUpdateErrorDomain : String
Objective-C:
-  extern NS_SWIFT_NAME ( RemoteConfigUpdateErrorDomain ) NSString * const FIRRemoteConfigUpdateErrorDomain
[REMOVED] Classes
Swift:
-      var lastFetchTime : Date ? { get }
-      var lastFetchStatus : RemoteConfigFetchStatus { get }
-      var configSettings : RemoteConfigSettings { get set }
-      class func remoteConfig () -> RemoteConfig
-      class func remoteConfig ( app : FIRApp ) -> RemoteConfig
-      func ensureInitialized () async throws
-      func fetch () async throws -> RemoteConfigFetchStatus
-      func fetch ( withExpirationDuration expirationDuration : TimeInterval ) async throws -> RemoteConfigFetchStatus
-      func fetchAndActivate () async throws -> RemoteConfigFetchAndActivateStatus
-      func activate () async throws -> Bool
-      subscript ( key : String ) -> FIRRemoteConfigValue { get }
-      func configValue ( forKey key : String ?) -> FIRRemoteConfigValue
-      func configValue ( forKey key : String ?, source : RemoteConfigSource ) -> FIRRemoteConfigValue
-      func allKeys ( from source : RemoteConfigSource ) -> [ String ]
-      func keys ( withPrefix prefix : String ?) -> Set < String >
-      func setDefaults ( _ defaults : [ String : NSObject ]?)
-      func setDefaults ( fromPlist fileName : String ?)
-      func defaultValue ( forKey key : String ?) -> FIRRemoteConfigValue ?
-      func addOnConfigUpdateListener ( remoteConfigUpdateCompletion listener : @escaping ( FIRRemoteConfigUpdate ?, ( any Error )?) -> Void ) -> FIRConfigUpdateListenerRegistration
-      var configRealtime : RCNConfigRealtime { get set }
-      var settings : RCNConfigSettings { get }
-      init ( appName : String , firOptions options : FIROptions , namespace FIRNamespace : String , dbManager DBManager : RCNConfigDBManager , configContent : RCNConfigContent , analytics : ( any FIRAnalyticsInterop )?)
-      init ( appName : String , firOptions options : FIROptions , namespace FIRNamespace : String , dbManager DBManager : RCNConfigDBManager , configContent : RCNConfigContent , userDefaults : UserDefaults ?, analytics : ( any FIRAnalyticsInterop )?, configFetch : RCNConfigFetch ?, configRealtime : RCNConfigRealtime ?)
-      func addInteropSubscriber ( _ subscriber : any FIRRolloutsStateSubscriber )
-    class RemoteConfigSettings : NSObject
-      var minimumFetchInterval : TimeInterval { get set }
-      var fetchTimeout : TimeInterval { get set }
Objective-C:
-      @property ( nonatomic , strong , readonly , nullable ) NSDate * lastFetchTime ;
-      @property ( nonatomic , readonly ) FIRRemoteConfigFetchStatus lastFetchStatus ;
-      @property ( nonatomic , strong , nonnull ) FIRRemoteConfigSettings * configSettings ;
-      + ( nonnull FIRRemoteConfig * ) remoteConfig ;
-      + ( nonnull FIRRemoteConfig * ) remoteConfigWithApp :( nonnull FIRApp * ) app ;
-      - ( nonnull instancetype ) init ;
-      - ( void ) ensureInitializedWithCompletionHandler : ( void ( ^ _Nonnull )( NSError * _Nullable )) completionHandler ;
-      - ( void ) fetchWithCompletionHandler : ( void ( ^ _Nullable )( FIRRemoteConfigFetchStatus , NSError * _Nullable )) completionHandler ;
-      - ( void ) fetchWithExpirationDuration :( NSTimeInterval ) expirationDuration completionHandler : ( void ( ^ _Nullable )( FIRRemoteConfigFetchStatus , NSError * _Nullable )) completionHandler ;
-      - ( void ) fetchAndActivateWithCompletionHandler : ( void ( ^ _Nullable )( FIRRemoteConfigFetchAndActivateStatus , NSError * _Nullable )) completionHandler ;
-      - ( void ) activateWithCompletion : ( void ( ^ _Nullable )( BOOL , NSError * _Nullable )) completion ;
-      - ( nonnull FIRRemoteConfigValue * ) objectForKeyedSubscript : ( nonnull NSString * ) key ;
-      - ( nonnull FIRRemoteConfigValue * ) configValueForKey :( nullable NSString * ) key ;
-      - ( nonnull FIRRemoteConfigValue * ) configValueForKey :( nullable NSString * ) key source : ( FIRRemoteConfigSource ) source ;
-      - ( nonnull NSArray < NSString *> * ) allKeysFromSource : ( FIRRemoteConfigSource ) source ;
-      - ( nonnull NSSet < NSString *> * ) keysWithPrefix :( nullable NSString * ) prefix ;
-      - ( void ) setDefaults :( nullable NSDictionary < NSString * , NSObject *> * ) defaults ;
-      - ( void ) setDefaultsFromPlistFileName :( nullable NSString * ) fileName ;
-      - ( nullable FIRRemoteConfigValue * ) defaultValueForKey :( nullable NSString * ) key ;
-      - ( FIRConfigUpdateListenerRegistration * _Nonnull ) addOnConfigUpdateListener : ( FIRRemoteConfigUpdateCompletion _Nonnull ) listener ;
-      @property ( nonatomic , readwrite , strong , nonnull ) RCNConfigRealtime * configRealtime
-      @property ( nonatomic , readonly , strong ) RCNConfigSettings * settings
-      - ( nonnull instancetype ) initWithAppName :( nonnull NSString * ) appName FIROptions :( nonnull FIROptions * ) options namespace :( nonnull NSString * ) FIRNamespace DBManager :( nonnull RCNConfigDBManager * ) DBManager configContent :( nonnull RCNConfigContent * ) configContent analytics :( nullable id < FIRAnalyticsInterop > ) analytics ;
-      - ( instancetype ) initWithAppName :( NSString * ) appName FIROptions :( FIROptions * ) options namespace :( NSString * ) FIRNamespace DBManager :( RCNConfigDBManager * ) DBManager configContent :( RCNConfigContent * ) configContent userDefaults :( nullable NSUserDefaults * ) userDefaults analytics :( nullable id < FIRAnalyticsInterop > ) analytics configFetch :( nullable RCNConfigFetch * ) configFetch configRealtime :( nullable RCNConfigRealtime * ) configRealtime ;
-      - ( void ) addRemoteConfigInteropSubscriber : ( id < FIRRolloutsStateSubscriber > _Nonnull ) subscriber ;
-    @interface FIRRemoteConfigSettings : NSObject
-      @property ( nonatomic ) NSTimeInterval minimumFetchInterval ;
-      @property ( nonatomic ) NSTimeInterval fetchTimeout ;

github-actions[bot] avatar Jan 07 '25 00:01 github-actions[bot]

@ncooke3 I've only processed your first batch so far - will start on second batch now.

paulb777 avatar Jan 16 '25 21:01 paulb777

I'm going to merge here and rebase with main. Let's address any additional comments and open items in subsequent PRs.

paulb777 avatar Jan 16 '25 23:01 paulb777

Agree with all comments.

paulb777 avatar Jan 17 '25 22:01 paulb777