@@ -506,17 +506,15 @@ export class Query<T extends DocumentData = DocumentData> implements IQuery<T> {
506506 return Query . fromNative ( this . native . limitToLast ( limitToLast ) ) ;
507507 }
508508
509- onSnapshot ( observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : QuerySnapshot ) => void ; } ) : ( ) => void ;
510- onSnapshot ( options : SnapshotListenOptions , observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : QuerySnapshot ) => void ; } ) : ( ) => void ;
509+ onSnapshot ( observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : QuerySnapshot ) => void } ) : ( ) => void ;
510+ onSnapshot ( options : SnapshotListenOptions , observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : QuerySnapshot ) => void } ) : ( ) => void ;
511511 onSnapshot ( onNext : ( snapshot : QuerySnapshot ) => void , onError ?: ( error : Error ) => void , onCompletion ?: ( ) => void ) : ( ) => void ;
512512 onSnapshot ( options : SnapshotListenOptions , onNext : ( snapshot : QuerySnapshot ) => void , onError ?: ( error : Error ) => void , onCompletion ?: ( ) => void ) : ( ) => void ;
513513 onSnapshot ( ...args : OnSnapshotParameters < QuerySnapshot > ) : ( ) => void {
514514 const { includeMetadataChanges, ...handlers } = parseOnSnapshotArgs ( args ) ;
515515
516516 const listener = this . native . addSnapshotListener (
517- includeMetadataChanges
518- ? com . google . firebase . firestore . MetadataChanges . INCLUDE
519- : com . google . firebase . firestore . MetadataChanges . EXCLUDE ,
517+ includeMetadataChanges ? com . google . firebase . firestore . MetadataChanges . INCLUDE : com . google . firebase . firestore . MetadataChanges . EXCLUDE ,
520518 new com . google . firebase . firestore . EventListener < com . google . firebase . firestore . QuerySnapshot > ( {
521519 onEvent ( querySnapshot , error : com . google . firebase . firestore . FirebaseFirestoreException ) {
522520 if ( error ) {
@@ -907,17 +905,15 @@ export class DocumentReference<T extends DocumentData = DocumentData> implements
907905 } ) ;
908906 }
909907
910- onSnapshot ( observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void ; } ) : ( ) => void ;
911- onSnapshot ( options : SnapshotListenOptions , observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void ; } ) : ( ) => void ;
908+ onSnapshot ( observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void } ) : ( ) => void ;
909+ onSnapshot ( options : SnapshotListenOptions , observer : { complete ?: ( ) => void ; error ?: ( error : Error ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void } ) : ( ) => void ;
912910 onSnapshot ( onNext : ( snapshot : DocumentSnapshot < T > ) => void , onError ?: ( error : Error ) => void , onCompletion ?: ( ) => void ) : ( ) => void ;
913911 onSnapshot ( options : SnapshotListenOptions , onNext : ( snapshot : DocumentSnapshot < T > ) => void , onError ?: ( error : Error ) => void , onCompletion ?: ( ) => void ) : ( ) => void ;
914912 onSnapshot ( ...args : OnSnapshotParameters < DocumentSnapshot < T > > ) : ( ) => void {
915913 const { includeMetadataChanges, ...handlers } = parseOnSnapshotArgs ( args ) ;
916914
917915 const listener = this . native . addSnapshotListener (
918- includeMetadataChanges
919- ? com . google . firebase . firestore . MetadataChanges . INCLUDE
920- : com . google . firebase . firestore . MetadataChanges . EXCLUDE ,
916+ includeMetadataChanges ? com . google . firebase . firestore . MetadataChanges . INCLUDE : com . google . firebase . firestore . MetadataChanges . EXCLUDE ,
921917 new com . google . firebase . firestore . EventListener < com . google . firebase . firestore . DocumentSnapshot > ( {
922918 onEvent ( docSnapshot , error : com . google . firebase . firestore . FirebaseFirestoreException ) {
923919 if ( error ) {
@@ -1362,26 +1358,35 @@ export class WriteBatch implements IWriteBatch {
13621358
13631359export class Settings implements ISettings {
13641360 _builder : com . google . firebase . firestore . FirebaseFirestoreSettings . Builder ;
1361+ _firestore : com . google . firebase . firestore . FirebaseFirestore ;
13651362
13661363 constructor ( ) {
13671364 this . _builder = new com . google . firebase . firestore . FirebaseFirestoreSettings . Builder ( ) ;
13681365 }
13691366
1370- static fromNative ( ffs : com . google . firebase . firestore . FirebaseFirestoreSettings ) {
1367+ static fromNative ( ffs : com . google . firebase . firestore . FirebaseFirestoreSettings , firestore = undefined ) {
13711368 if ( ffs instanceof com . google . firebase . firestore . FirebaseFirestoreSettings ) {
13721369 const settings = new Settings ( ) ;
1370+ settings . _firestore = firestore ?? undefined ;
13731371 settings . _builder = new com . google . firebase . firestore . FirebaseFirestoreSettings . Builder ( ffs ) ;
13741372 return settings ;
13751373 }
13761374 return null ;
13771375 }
13781376
1377+ _updateStoreSettings ( ) {
1378+ if ( this . _firestore !== undefined ) {
1379+ this . _firestore . setFirestoreSettings ( this . native ) ;
1380+ }
1381+ }
1382+
13791383 get cacheSizeBytes ( ) : number {
13801384 return this . native . getCacheSizeBytes ( ) ;
13811385 }
13821386
13831387 set cacheSizeBytes ( value ) {
13841388 this . _builder . setCacheSizeBytes ( value ) ;
1389+ this . _updateStoreSettings ( ) ;
13851390 }
13861391
13871392 get host ( ) : string {
@@ -1390,6 +1395,7 @@ export class Settings implements ISettings {
13901395
13911396 set host ( value ) {
13921397 this . _builder . setHost ( value ) ;
1398+ this . _updateStoreSettings ( ) ;
13931399 }
13941400
13951401 ignoreUndefinedProperties : boolean ;
@@ -1400,6 +1406,7 @@ export class Settings implements ISettings {
14001406
14011407 set persistence ( value ) {
14021408 this . _builder . setPersistenceEnabled ( value ) ;
1409+ this . _updateStoreSettings ( ) ;
14031410 }
14041411
14051412 get ssl ( ) : boolean {
@@ -1408,6 +1415,7 @@ export class Settings implements ISettings {
14081415
14091416 set ssl ( value ) {
14101417 this . _builder . setSslEnabled ( value ) ;
1418+ this . _updateStoreSettings ( ) ;
14111419 }
14121420
14131421 toJSON ( ) {
@@ -1620,7 +1628,7 @@ export class Firestore implements IFirestore {
16201628 }
16211629
16221630 get settings ( ) {
1623- return Settings . fromNative ( this . native ?. getFirestoreSettings ?.( ) ) ;
1631+ return Settings . fromNative ( this . native ?. getFirestoreSettings ?.( ) , this . native ) ;
16241632 }
16251633
16261634 set settings ( value ) {
0 commit comments