Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(firebase_app_check): provide androidDebugProvider boolean for android debug provider & update app check example app #9412

Merged
merged 20 commits into from Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a5ee743
chore(app-check): Update example app and android config for debug use
russellwheatley Aug 24, 2022
d0c4cc7
docs(app-check): note on debug instructions
russellwheatley Aug 24, 2022
b8b738a
chore(app-check): format & resolve analyze issue
russellwheatley Aug 24, 2022
f08d242
chore(app-check): format & resolve analyze issue
russellwheatley Aug 24, 2022
e4a2d70
Merge branch 'master' into @russell/app-check-6551
russellwheatley Aug 24, 2022
0fb6f44
chore: format
russellwheatley Aug 24, 2022
74b1aa7
chore(app-check): spelling
russellwheatley Aug 24, 2022
aba0389
chore(app-check): wording
russellwheatley Aug 24, 2022
af4efe3
chore(app-check): wording
russellwheatley Aug 24, 2022
df013a7
feat(app-check): new "androidDebugProvider" API
russellwheatley Sep 12, 2022
b2bfe1e
chore(app-check): analyze issues
russellwheatley Sep 12, 2022
cfcd8b5
test(app-check): add tests for androidDebugProvider
russellwheatley Sep 27, 2022
4eb6c7c
Merge branch 'master' into @russell/app-check-6551
russellwheatley Sep 27, 2022
3783f8e
chore(app-check): remove issue link & print()
russellwheatley Sep 27, 2022
b34db8b
Merge remote-tracking branch 'origin/@russell/app-check-6551' into @r…
russellwheatley Sep 27, 2022
9d74c93
chore(app-check, android): update so it does not require nonNull obje…
russellwheatley Sep 27, 2022
20e4945
chore(app-check, android): rm unnecessary dependencies
russellwheatley Sep 27, 2022
b2b43bb
Merge branch 'master' into @russell/app-check-6551
russellwheatley Sep 28, 2022
3bb5e08
chore(app-check, android): update kotlin version
russellwheatley Sep 28, 2022
35a8215
chore(app-check, android): update kotlin version
russellwheatley Sep 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,9 +77,16 @@ private Task<Void> activate(Map<String, Object> arguments) {
cachedThreadPool.execute(
() -> {
try {
// To test your app in debug mode, you may uncomment the following
russellwheatley marked this conversation as resolved.
Show resolved Hide resolved
// if(BuildConfig.DEBUG) {
// FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
// firebaseAppCheck.installAppCheckProviderFactory(
// DebugAppCheckProviderFactory.getInstance());
// } else {
FirebaseAppCheck firebaseAppCheck = getAppCheck(arguments);
firebaseAppCheck.installAppCheckProviderFactory(
SafetyNetAppCheckProviderFactory.getInstance());
// }
taskCompletionSource.setResult(null);
} catch (Exception e) {
taskCompletionSource.setException(e);
Expand Down
Expand Up @@ -28,15 +28,16 @@ apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
compileSdkVersion 33

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.flutter.plugins.firebase.appcheck.example"
minSdkVersion 16
targetSdkVersion 30
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
Expand All @@ -51,3 +52,8 @@ android {
flutter {
source '../..'
}

dependencies {
implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0'
implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0'
}
@@ -1,21 +1,21 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:4.1.3'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.gms:google-services:4.3.13'
// END: FlutterFire Configuration
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
Expand Up @@ -2,11 +2,14 @@ import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

import 'firebase_options.dart';

const kWebRecaptchaSiteKey = '6Lemcn0dAAAAABLkf6aiiHvpGD6x-zF3nOSDU2M8';

// For iOS debug instructions, please visit: https://github.com/firebase/flutterfire/issues/8969#issuecomment-1202544521
// For android debug instructions, please visit: https://github.com/firebase/flutterfire/issues/6551#issuecomment-1225502729
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
Expand Down Expand Up @@ -79,6 +82,26 @@ class _FirebaseAppCheck extends State<FirebaseAppCheckExample> {
body: Center(
child: Column(
children: [
ElevatedButton(
onPressed: () async {
// Use this button to check whether the request was validated on the Firebase console
// Gets first document in collection
final result = await FirebaseFirestore.instance
.collection('flutter-tests')
.limit(1)
.get();

if (result.docs.isNotEmpty) {
setMessage('Document found');
print('${result.docs[0].data()}');
} else {
setMessage(
'Document not found, please add a document to the collection',
);
}
},
child: const Text('Test App Check validates requests'),
),
ElevatedButton(
onPressed: () async {
if (kIsWeb) {
Expand Down
Expand Up @@ -9,6 +9,8 @@ environment:
sdk: ">=2.16.0 <3.0.0"

dependencies:
cloud_firestore:
path: ../../../cloud_firestore/cloud_firestore
cupertino_icons: ^0.1.2
firebase_app_check:
path: ../
Expand All @@ -18,6 +20,12 @@ dependencies:
sdk: flutter

dependency_overrides:
cloud_firestore:
path: ../../../cloud_firestore/cloud_firestore
cloud_firestore_platform_interface:
path: ../../../cloud_firestore/cloud_firestore_platform_interface
cloud_firestore_web:
path: ../../../cloud_firestore/cloud_firestore_web
firebase_app_check_platform_interface:
path: ../../../firebase_app_check/firebase_app_check_platform_interface
firebase_app_check_web:
Expand All @@ -28,6 +36,5 @@ dependency_overrides:
path: ../../../firebase_core/firebase_core_platform_interface
firebase_core_web:
path: ../../../firebase_core/firebase_core_web

flutter:
uses-material-design: true