File tree Expand file tree Collapse file tree 4 files changed +47
-1
lines changed
packages/cloud_firestore/cloud_firestore
android/src/main/java/io/flutter/plugins/firebase/firestore
cloud_firestore/Sources/cloud_firestore Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 88import static com .google .firebase .firestore .AggregateField .count ;
99import static com .google .firebase .firestore .AggregateField .sum ;
1010
11+ import android .annotation .SuppressLint ;
1112import android .app .Activity ;
1213import android .util .Log ;
1314import androidx .annotation .NonNull ;
3334import com .google .firebase .firestore .Source ;
3435import com .google .firebase .firestore .Transaction ;
3536import com .google .firebase .firestore .WriteBatch ;
37+ import com .google .firebase .firestore .remote .FirestoreChannel ;
3638import io .flutter .embedding .engine .plugins .FlutterPlugin ;
3739import io .flutter .embedding .engine .plugins .activity .ActivityAware ;
3840import io .flutter .embedding .engine .plugins .activity .ActivityPluginBinding ;
@@ -129,9 +131,12 @@ private static void destroyCachedFirebaseFirestoreInstanceForKey(FirebaseFiresto
129131 }
130132 }
131133
134+ @ SuppressLint ("RestrictedApi" )
132135 @ Override
133136 public void onAttachedToEngine (@ NonNull FlutterPluginBinding binding ) {
134137 initInstance (binding .getBinaryMessenger ());
138+ FirestoreChannel .setClientLanguage (
139+ "gl-dart/" + io .flutter .plugins .firebase .firestore .BuildConfig .LIBRARY_VERSION );
135140 }
136141
137142 @ Override
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Pod::Spec.new do |s|
2424 s . license = { :file => '../LICENSE' }
2525 s . authors = 'The Chromium Authors'
2626 s . source = { :path => '.' }
27- s . source_files = 'cloud_firestore/Sources/cloud_firestore/**/*.{h,m}'
27+ s . source_files = 'cloud_firestore/Sources/cloud_firestore/**/*.{h,m,mm }'
2828 s . public_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Public/**/*.h'
2929 s . private_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Private/**/*.h'
3030
Original file line number Diff line number Diff line change 3333NSString *const kFLTFirebaseFirestoreLoadBundleChannelName =
3434 @" plugins.flutter.io/firebase_firestore/loadBundle" ;
3535
36+ @interface FLTFirestoreClientLanguage : NSObject
37+ + (void )setClientLanguage : (NSString *)language ;
38+ @end
39+
3640@interface FLTFirebaseFirestorePlugin ()
3741@property (nonatomic , retain ) NSMutableDictionary *transactions;
3842
@@ -122,6 +126,10 @@ - (instancetype)init:(NSObject<FlutterBinaryMessenger> *)messenger {
122126+ (void )registerWithRegistrar : (NSObject <FlutterPluginRegistrar> *)registrar {
123127 FLTFirebaseFirestorePlugin *instance =
124128 [[FLTFirebaseFirestorePlugin alloc ] init: [registrar messenger ]];
129+ #if TARGET_OS_IPHONE
130+ [FLTFirestoreClientLanguage
131+ setClientLanguage: [NSString stringWithFormat: @" gl-dart/%@ " , @LIBRARY_VERSION]];
132+ #endif
125133
126134#if TARGET_OS_OSX
127135// TODO(Salakar): Publish does not exist on MacOS version of FlutterPluginRegistrar.
Original file line number Diff line number Diff line change 1+ // Copyright 2025 The Chromium Authors. All rights reserved.
2+ // Use of this source code is governed by a BSD-style license that can be
3+ // found in the LICENSE file.
4+
5+ #import < Foundation/Foundation.h>
6+ #import < string>
7+
8+ namespace firebase {
9+ namespace firestore {
10+ namespace api {
11+
12+ class Firestore {
13+ public:
14+ static void SetClientLanguage (std::string language_token);
15+ };
16+
17+ } // namespace api
18+ } // namespace firestore
19+ } // namespace firebase
20+
21+ @interface FLTFirestoreClientLanguage : NSObject
22+ + (void )setClientLanguage : (NSString *)language ;
23+ @end
24+
25+ @implementation FLTFirestoreClientLanguage
26+ + (void )setClientLanguage : (NSString *)language {
27+ if (language == nil ) {
28+ return ;
29+ }
30+ std::string token = std::string ([language UTF8String ]);
31+ firebase::firestore::api::Firestore::SetClientLanguage (token);
32+ }
33+ @end
You can’t perform that action at this time.
0 commit comments