File tree 2 files changed +18
-2
lines changed
packages/firebase_app_check/firebase_app_check/android
src/main/java/io/flutter/plugins/firebase/appcheck
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ android {
45
45
defaultConfig {
46
46
minSdk 19
47
47
testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
48
+ buildConfigField " String" , " FIREBASE_APP_CHECK_DEBUG_TOKEN" , " \" ${ System.env.FIREBASE_APP_CHECK_DEBUG_TOKEN} \" "
48
49
}
49
50
50
51
compileOptions {
Original file line number Diff line number Diff line change 5
5
package io .flutter .plugins .firebase .appcheck ;
6
6
7
7
import androidx .annotation .Keep ;
8
+
9
+ import com .google .firebase .appcheck .debug .InternalDebugSecretProvider ;
8
10
import com .google .firebase .components .Component ;
9
11
import com .google .firebase .components .ComponentRegistrar ;
10
12
import com .google .firebase .platforminfo .LibraryVersionComponent ;
13
+
14
+ import java .util .Arrays ;
11
15
import java .util .Collections ;
12
16
import java .util .List ;
13
17
14
18
@ Keep
15
19
public class FlutterFirebaseAppRegistrar implements ComponentRegistrar {
20
+ private static final String DEBUG_SECRET_NAME = "fire-app-check-debug-secret" ;
21
+
16
22
@ Override
17
23
public List <Component <?>> getComponents () {
18
- return Collections .<Component <?>>singletonList (
19
- LibraryVersionComponent .create (BuildConfig .LIBRARY_NAME , BuildConfig .LIBRARY_VERSION ));
24
+ Component <?> library = LibraryVersionComponent .create (BuildConfig .LIBRARY_NAME ,
25
+ BuildConfig .LIBRARY_VERSION );
26
+
27
+ if (BuildConfig .FIREBASE_APP_CHECK_DEBUG_TOKEN == null )
28
+ return Collections .<Component <?>>singletonList (library );
29
+
30
+ Component <InternalDebugSecretProvider > debugSecretProvider = Component .builder (InternalDebugSecretProvider .class )
31
+ .name (DEBUG_SECRET_NAME )
32
+ .factory (container -> () -> BuildConfig .FIREBASE_APP_CHECK_DEBUG_TOKEN ).build ();
33
+
34
+ return Arrays .<Component <?>>asList (library , debugSecretProvider );
20
35
}
21
36
}
You can’t perform that action at this time.
0 commit comments