diff --git a/packages/firebase_remote_config/firebase_remote_config/example/android/app/google-services.json b/packages/firebase_remote_config/firebase_remote_config/example/android/app/google-services.json index 5de4fcc09915..edb152d15fe4 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/android/app/google-services.json +++ b/packages/firebase_remote_config/firebase_remote_config/example/android/app/google-services.json @@ -1,231 +1,724 @@ { "project_info": { - "project_number": "297855924061", - "firebase_url": "https://flutterfire-cd2f7.firebaseio.com", - "project_id": "flutterfire-cd2f7", - "storage_bucket": "flutterfire-cd2f7.appspot.com" + "project_number": "448618578101", + "firebase_url": "https://react-native-firebase-testing.firebaseio.com", + "project_id": "react-native-firebase-testing", + "storage_bucket": "react-native-firebase-testing.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:297855924061:android:669871c998cc21bd", + "mobilesdk_app_id": "1:448618578101:android:b427df3ef43d44caac3efc", "android_client_info": { - "package_name": "com.yourcompany.firebaseauth.example" + "package_name": "com.example.test_app" } }, "oauth_client": [ { - "client_id": "297855924061-r1u58cnh4p6l1ghpkteil46erlkfll62.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:cc6c1dc7a65cc83c", + "android_client_info": { + "package_name": "com.invertase.testing" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-a9p7bj5jlakabp22fo3cbkj7nsmag24e.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.invertase.testing", + "certificate_hash": "889b4292c735f371168a372cc7778992cd8a5052" + } + }, + { + "client_id": "448618578101-gva3jv7cr8qquj04k0o7cni674j65kha.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.invertase.testing", + "certificate_hash": "5e8f16062ea3cd2c4a0d547876baa6f38cabf625" + } + }, + { + "client_id": "448618578101-h0o9b94jnhcoal2qgjn7s7ckkc2n7okq.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.invertase.testing", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" + } + }, + { + "client_id": "448618578101-pdjje2lkv3p941e03hkrhfa7459cr2v8.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "com.yourcompany.firebaseauth.example", - "certificate_hash": "c3adef7e7773e40e777d5c236dbba7461cbea5f0" + "package_name": "com.invertase.testing", + "certificate_hash": "992e468b990cc418f306d0131be61ecfad800ac1" } }, { - "client_id": "297855924061-col4in4uubarifm60nbq8id01ec3ss4c.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:cc5ce91648e65dbeac3efc", + "android_client_info": { + "package_name": "com.notifeetestapp" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-j9nluebtat700ua550esfvaf64gbo5l5.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "com.yourcompany.firebaseauth.example", - "certificate_hash": "8a4e194f5bfc3fb1075e7daae8dcddd526fde207" + "package_name": "com.notifeetestapp", + "certificate_hash": "5e8f16062ea3cd2c4a0d547876baa6f38cabf625" } }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyD_shO5mfO9lhy2TVWhfo1VUmARKlG4suk" + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" } ], "services": { - "analytics_service": { - "status": 1 + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:6aa085e64d694703ac3efc", + "android_client_info": { + "package_name": "com.rnfbdemo" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-a8tk83htomfvrelhu71j93safubvipdj.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.rnfbdemo", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" + } }, + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { "appinvite_service": { - "status": 2, "other_platform_oauth_client": [ { - "client_id": "297855924061-1skfqv2sc9avlclefi3q2l229t98dpda.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.yourcompany.firestoreExample" + "bundle_id": "org.reactjs.native.example.testIos" } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:6bf0706c1f27114dac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.cloudfunctions.cloudfunctionsexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:5cc04a661d27c405ac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.crashlytics.firebasecrashlyticsexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } } ] - }, - "ads_service": { - "status": 2 } } }, { "client_info": { - "mobilesdk_app_id": "1:297855924061:android:92efa9a0df6f077f", + "mobilesdk_app_id": "1:448618578101:android:e005c2b7f723853fac3efc", "android_client_info": { - "package_name": "io.flutter.plugins.firebase_storage_example" + "package_name": "io.flutter.plugins.firebase.firebaseremoteconfigexample" } }, "oauth_client": [ { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyD_shO5mfO9lhy2TVWhfo1VUmARKlG4suk" + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" } ], "services": { - "analytics_service": { - "status": 1 - }, "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 2 + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] } } }, { "client_info": { - "mobilesdk_app_id": "1:297855924061:android:db912bec12847bd9", + "mobilesdk_app_id": "1:448618578101:android:3ad281c0067ccf97ac3efc", "android_client_info": { - "package_name": "io.flutter.plugins.firebase_database_example" + "package_name": "io.flutter.plugins.firebase.firestoreexample" } }, "oauth_client": [ { - "client_id": "297855924061-fbg7lp8bvtbibn2edns7d5fc3k0fhsa3.apps.googleusercontent.com", + "client_id": "448618578101-npu5ll2fj4emgvtietpb685fvdm7fg3s.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "io.flutter.plugins.firebase_database_example", - "certificate_hash": "c3adef7e7773e40e777d5c236dbba7461cbea5f0" + "package_name": "io.flutter.plugins.firebase.firestoreexample", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" } }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyD_shO5mfO9lhy2TVWhfo1VUmARKlG4suk" + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" } ], "services": { - "analytics_service": { - "status": 1 - }, "appinvite_service": { - "status": 2, "other_platform_oauth_client": [ { - "client_id": "297855924061-1skfqv2sc9avlclefi3q2l229t98dpda.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.yourcompany.firestoreExample" + "bundle_id": "org.reactjs.native.example.testIos" } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:0568e76dc62e89bcac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.messaging.example" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:507d24bc5fc4d20eac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebaseanalyticsexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } } ] - }, - "ads_service": { - "status": 2 } } }, { "client_info": { - "mobilesdk_app_id": "1:297855924061:android:236f9daea101f77e", + "mobilesdk_app_id": "1:448618578101:android:9d44a7b85d1ab0baac3efc", "android_client_info": { - "package_name": "io.flutter.plugins.firebase.firestoreexample" + "package_name": "io.flutter.plugins.firebaseauthexample" } }, "oauth_client": [ { - "client_id": "297855924061-n8i063j2dib6goh5or4lrctg6sccpevi.apps.googleusercontent.com", + "client_id": "448618578101-2brn4509s8513kjf9a0i6kvtb9qnght5.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "io.flutter.plugins.firebase.firestoreexample", - "certificate_hash": "a8fc78a37cd4f0471580936de67a2cb2ae4657c7" + "package_name": "io.flutter.plugins.firebaseauthexample", + "certificate_hash": "e1604565b51994d10886de1d91da9968dfec02ed" + } + }, + { + "client_id": "448618578101-2kqet2itdu42g0avs2v3fbsmtf6a45gg.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseauthexample", + "certificate_hash": "939efbe8eaa5aaf50396b19fe980ef4a8df1c6e7" + } + }, + { + "client_id": "448618578101-qd7qb4i251kmq2ju79bl7sif96si0ve3.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseauthexample", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" } }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-velutq65ok2dr5ohh0oi1q62irr920ss.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseauthexample", + "certificate_hash": "29142b8612b4b6a0ba0fefd1dbf65ab565fb2cbd" + } + }, + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyD_shO5mfO9lhy2TVWhfo1VUmARKlG4suk" + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" } ], "services": { - "analytics_service": { - "status": 1 - }, "appinvite_service": { - "status": 2, "other_platform_oauth_client": [ { - "client_id": "297855924061-1skfqv2sc9avlclefi3q2l229t98dpda.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.yourcompany.firestoreExample" + "bundle_id": "org.reactjs.native.example.testIos" } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:29bf96f913c195f5ac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasecrashlyticsexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 }, { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:a7b3b683e70a7a17ac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasedatabaseexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } } ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:d767a536227718bcac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasemessagingexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-rthm8sh42ifgn9vp60914nol7u8h7mgq.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebasemessagingexample", + "certificate_hash": "29142b8612b4b6a0ba0fefd1dbf65ab565fb2cbd" + } }, - "ads_service": { - "status": 2 + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] } } }, { "client_info": { - "mobilesdk_app_id": "1:297855924061:android:6ef94ae486218531", + "mobilesdk_app_id": "1:448618578101:android:56e2f97d61c5da38ac3efc", "android_client_info": { - "package_name": "io.flutter.plugins.firebase.firebaseremoteconfigexample" + "package_name": "io.flutter.plugins.firebasemlcustomexample" } }, "oauth_client": [ { - "client_id": "297855924061-f68m5v860ms5faiotn5mv9f50cmpacdq.apps.googleusercontent.com", + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyD_shO5mfO9lhy2TVWhfo1VUmARKlG4suk" + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" } ], "services": { - "analytics_service": { - "status": 1 - }, "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:f2548276e02d9ddbac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebaseperformanceexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sn6oicnu6cmq0lfa84hit4t5vs0e6676.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseperformanceexample", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" + } }, - "ads_service": { - "status": 2 + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:448618578101:android:553625b1be8cf2efac3efc", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasestorageexample" + } + }, + "oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCuu4tbv9CwwTudNOweMNstzZHIDBhgJxA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "448618578101-sg12d2qin42cpr00f8b0gehs5s7inm0v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "448618578101-0ori6oss7mbsffchjtupd425nb9b3krp.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "org.reactjs.native.example.testIos" + } + } + ] } } } diff --git a/packages/firebase_remote_config/firebase_remote_config/example/lib/main.dart b/packages/firebase_remote_config/firebase_remote_config/example/lib/main.dart index b3fa66f43066..a09c75c0cf40 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/lib/main.dart +++ b/packages/firebase_remote_config/firebase_remote_config/example/lib/main.dart @@ -44,6 +44,7 @@ class WelcomeWidget extends AnimatedWidget { const SizedBox( height: 20, ), + Text('Nested object: ${remoteConfig.getJson('locale')}'), Text('(${remoteConfig.getValue('welcome').source})'), Text('(${remoteConfig.lastFetchTime})'), Text('(${remoteConfig.lastFetchStatus})'), @@ -85,6 +86,10 @@ Future setupRemoteConfig() async { await remoteConfig.setDefaults({ 'welcome': 'default welcome', 'hello': 'default hello', + 'locale': { + 'languageCode': 'en', + 'countryCode': 'US', + } }); RemoteConfigValue(null, ValueSource.valueStatic); return remoteConfig; diff --git a/packages/firebase_remote_config/firebase_remote_config/example/macos/Podfile b/packages/firebase_remote_config/firebase_remote_config/example/macos/Podfile index 07712c0a33e8..22d9caad2e9d 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/macos/Podfile +++ b/packages/firebase_remote_config/firebase_remote_config/example/macos/Podfile @@ -9,74 +9,32 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary -end -def pubspec_supports_macos(file) - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return false; + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - File.foreach(file_abs_path) { |line| - return true if line =~ /^\s*macos:/ - } - return false + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + target 'Runner' do use_frameworks! use_modular_headers! - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - ephemeral_dir = File.join('Flutter', 'ephemeral') - symlink_dir = File.join(ephemeral_dir, '.symlinks') - symlink_plugins_dir = File.join(symlink_dir, 'plugins') - system("rm -rf #{symlink_dir}") - system("mkdir -p #{symlink_plugins_dir}") + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end - # Flutter Pods - generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig')) - if generated_xcconfig.empty? - puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) end - generated_xcconfig.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join(symlink_dir, 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path])) - end - } - - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join(symlink_plugins_dir, p[:name]) - File.symlink(p[:path], symlink) - if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml')) - pod p[:name], :path => File.join(symlink, 'macos') - end - } end - -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true diff --git a/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner.xcodeproj/project.pbxproj b/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner.xcodeproj/project.pbxproj index af33fb04454a..39ebea3a18f2 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,11 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; }; - 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B550B1FE23F53792007DADD5 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B550B1FD23F53792007DADD5 /* GoogleService-Info.plist */; }; - D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; }; - D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; E1A3C0FEB219DE3059F49DD9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDA759B4F18DE63DF0790FB /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -51,8 +47,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */, - 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -72,7 +66,6 @@ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; }; 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; @@ -82,7 +75,6 @@ B51643519054BD100F273F38 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; B550B1FD23F53792007DADD5 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; D71BFD332DFDD49FEC2851C7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -90,8 +82,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D73912F022F37F9E000D13A0 /* App.framework in Frameworks */, - 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */, E1A3C0FEB219DE3059F49DD9 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -157,8 +147,6 @@ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - D73912EF22F37F9E000D13A0 /* App.framework */, - 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */, ); path = Flutter; sourceTree = ""; @@ -284,7 +272,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n"; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; }; 33CC111E2044C6BF0003C045 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -311,10 +299,29 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/FirebaseABTesting/FirebaseABTesting.framework", + "${BUILT_PRODUCTS_DIR}/FirebaseCore/FirebaseCore.framework", + "${BUILT_PRODUCTS_DIR}/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework", + "${BUILT_PRODUCTS_DIR}/FirebaseInstallations/FirebaseInstallations.framework", + "${BUILT_PRODUCTS_DIR}/FirebaseRemoteConfig/FirebaseRemoteConfig.framework", + "${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework", + "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", + "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", + "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseABTesting.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCore.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreDiagnostics.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseInstallations.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseRemoteConfig.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -574,7 +581,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.firebaseRemoteConfigExample; + PRODUCT_BUNDLE_IDENTIFIER = com.firebase.firebaseRemoteConfigExample; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; diff --git a/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner/GoogleService-Info.plist b/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner/GoogleService-Info.plist index ac1700e202bf..5eec0f1054f6 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner/GoogleService-Info.plist +++ b/packages/firebase_remote_config/firebase_remote_config/example/macos/Runner/GoogleService-Info.plist @@ -2,39 +2,37 @@ - AD_UNIT_ID_FOR_BANNER_TEST - ca-app-pub-3940256099942544/2934735716 - AD_UNIT_ID_FOR_INTERSTITIAL_TEST - ca-app-pub-3940256099942544/4411468910 CLIENT_ID - 297855924061-g2np3o504qtqpuip8ud0f884j8kfp9jf.apps.googleusercontent.com + 448618578101-t3qs2qlt33t53bemq7lhqdarkuc9a6rq.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.297855924061-g2np3o504qtqpuip8ud0f884j8kfp9jf + com.googleusercontent.apps.448618578101-t3qs2qlt33t53bemq7lhqdarkuc9a6rq + ANDROID_CLIENT_ID + 448618578101-26jgjs0rtl4ts2i667vjb28kldvs2kp6.apps.googleusercontent.com API_KEY - AIzaSyBq6mcufFXfyqr79uELCiqM_O_1-G72PVU + AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0 GCM_SENDER_ID - 297855924061 + 448618578101 PLIST_VERSION 1 BUNDLE_ID - io.flutter.plugins.firebase.firebaseRemoteConfigExample + com.firebase.firebaseRemoteConfigExample PROJECT_ID - flutterfire-cd2f7 + react-native-firebase-testing STORAGE_BUCKET - flutterfire-cd2f7.appspot.com + react-native-firebase-testing.appspot.com IS_ADS_ENABLED - + IS_ANALYTICS_ENABLED IS_APPINVITE_ENABLED - + IS_GCM_ENABLED IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:297855924061:ios:ea6d07263d05c514 + 1:448618578101:ios:285b06fe16e960bbac3efc DATABASE_URL - https://flutterfire-cd2f7.firebaseio.com + https://react-native-firebase-testing.firebaseio.com \ No newline at end of file diff --git a/packages/firebase_remote_config/firebase_remote_config/example/test_driver/firebase_remote_config_e2e.dart b/packages/firebase_remote_config/firebase_remote_config/example/test_driver/firebase_remote_config_e2e.dart index 5764ba80fb30..f07386e77b77 100644 --- a/packages/firebase_remote_config/firebase_remote_config/example/test_driver/firebase_remote_config_e2e.dart +++ b/packages/firebase_remote_config/firebase_remote_config/example/test_driver/firebase_remote_config_e2e.dart @@ -34,6 +34,11 @@ void testsMain() { expect(remoteConfig.getString('hello'), 'default hello'); expect(remoteConfig.getValue('hello').source, ValueSource.valueDefault); + final locale = remoteConfig.getJson('locale'); + expect(locale['languageCode'], 'de'); + expect(locale['countryCode'], 'DE'); + expect(remoteConfig.getValue('locale').source, ValueSource.valueRemote); + expect(remoteConfig.getInt('nonexisting'), 0); expect( diff --git a/packages/firebase_remote_config/firebase_remote_config/ios/Classes/FLTFirebaseRemoteConfigUtils.m b/packages/firebase_remote_config/firebase_remote_config/ios/Classes/FLTFirebaseRemoteConfigUtils.m index a3aff6835a38..a69b3de5429e 100644 --- a/packages/firebase_remote_config/firebase_remote_config/ios/Classes/FLTFirebaseRemoteConfigUtils.m +++ b/packages/firebase_remote_config/firebase_remote_config/ios/Classes/FLTFirebaseRemoteConfigUtils.m @@ -12,7 +12,7 @@ + (NSDictionary *)ErrorCodeAndMessageFromNSError:(NSError *)error { switch (error.code) { case FIRRemoteConfigErrorInternalError: [codeAndMessage setValue:@"internal" forKey:@"code"]; - [codeAndMessage setValue:@"internal remote config fetch error" forKey:@"message"]; + [codeAndMessage setValue:error.userInfo[NSLocalizedDescriptionKey] forKey:@"message"]; break; case FIRRemoteConfigErrorThrottled: [codeAndMessage setValue:@"throttled" forKey:@"code"]; diff --git a/packages/firebase_remote_config/firebase_remote_config/lib/firebase_remote_config.dart b/packages/firebase_remote_config/firebase_remote_config/lib/firebase_remote_config.dart index 34ad0b54cafb..54aeb17cbaab 100644 --- a/packages/firebase_remote_config/firebase_remote_config/lib/firebase_remote_config.dart +++ b/packages/firebase_remote_config/firebase_remote_config/lib/firebase_remote_config.dart @@ -5,6 +5,7 @@ library firebase_remote_config; import 'dart:async'; +import 'dart:convert'; import 'package:firebase_remote_config_platform_interface/firebase_remote_config_platform_interface.dart'; import 'package:firebase_core/firebase_core.dart'; diff --git a/packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart b/packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart index 719fb6ad5945..1d9c9ba7c73d 100644 --- a/packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart +++ b/packages/firebase_remote_config/firebase_remote_config/lib/src/remote_config.dart @@ -113,6 +113,11 @@ class RemoteConfig extends FirebasePluginPlatform with ChangeNotifier { return _delegate.getString(key); } + /// Gets the value for a given key as json (calls json.decode on underlying string value) + Map? getJson(String key) { + return _delegate.getJson(key); + } + /// Gets the [RemoteConfigValue] for a given key. RemoteConfigValue getValue(String key) { return _delegate.getValue(key); @@ -132,6 +137,19 @@ class RemoteConfig extends FirebasePluginPlatform with ChangeNotifier { /// Sets the default parameter values for the current instance. Future setDefaults(Map defaultParameters) { - return _delegate.setDefaults(defaultParameters); + final encodedParams = defaultParameters + .map( + (key, value) => MapEntry( + key, + _isSupportedType(value) ? value : json.encode(value), + ), + ) + .cast(); + + return _delegate.setDefaults(encodedParams); + } + + bool _isSupportedType(dynamic value) { + return value is bool || value is num || value is String; } } diff --git a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart index d69c7841a19f..5ae556e0fea2 100644 --- a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart +++ b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/method_channel/method_channel_firebase_remote_config.dart @@ -193,6 +193,11 @@ class MethodChannelFirebaseRemoteConfig extends FirebaseRemoteConfigPlatform { return _activeParameters[key]!.asString(); } + @override + Map? getJson(String key) { + return _activeParameters[key]?.asJson(); + } + @override RemoteConfigValue getValue(String key) { if (!_activeParameters.containsKey(key)) { @@ -224,7 +229,7 @@ class MethodChannelFirebaseRemoteConfig extends FirebaseRemoteConfigPlatform { try { await channel.invokeMethod('RemoteConfig#setDefaults', { 'appName': app.name, - 'defaults': defaultParameters + 'defaults': defaultParameters, }); await _updateConfigParameters(); } catch (exception, stackTrace) { diff --git a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/platform_interface/platform_interface_firebase_remote_config.dart b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/platform_interface/platform_interface_firebase_remote_config.dart index cf03ac9e91f8..6acbdd5b81bd 100644 --- a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/platform_interface/platform_interface_firebase_remote_config.dart +++ b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/platform_interface/platform_interface_firebase_remote_config.dart @@ -146,6 +146,11 @@ abstract class FirebaseRemoteConfigPlatform extends PlatformInterface { throw UnimplementedError('getString() is not implemented'); } + /// Gets the value for a given key as json (calls json.decode on underlying string value) + Map? getJson(String key) { + throw UnimplementedError('getJson() is not implemented'); + } + /// Gets the [RemoteConfigValue] for a given key. RemoteConfigValue getValue(String key) { throw UnimplementedError('getValue() is not implemented'); diff --git a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/remote_config_value.dart b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/remote_config_value.dart index b6c3f140e308..46a1bb20f9a2 100644 --- a/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/remote_config_value.dart +++ b/packages/firebase_remote_config/firebase_remote_config_platform_interface/lib/src/remote_config_value.dart @@ -19,7 +19,8 @@ enum ValueSource { class RemoteConfigValue { /// Wraps a value with metadata and type-safe getters. @protected - RemoteConfigValue(this._value, this.source); + RemoteConfigValue(List? value, this.source) + : _value = utf8.decode(value ?? const []); /// Default value for String static const String defaultValueForString = ''; @@ -33,53 +34,34 @@ class RemoteConfigValue { /// Default value for Bool static const bool defaultValueForBool = false; - List? _value; + String _value; /// Indicates at which source this value came from. final ValueSource source; /// Decode value to string. String asString() { - final value = _value; - return value != null - ? const Utf8Codec().decode(value) - : defaultValueForString; + return _value; } /// Decode value to int. int asInt() { - final value = _value; - if (value != null) { - final String strValue = const Utf8Codec().decode(value); - final int intValue = int.tryParse(strValue) ?? defaultValueForInt; - return intValue; - } else { - return defaultValueForInt; - } + return int.tryParse(_value) ?? defaultValueForInt; } /// Decode value to double. double asDouble() { - final value = _value; - if (value != null) { - final String strValue = const Utf8Codec().decode(value); - final double doubleValue = - double.tryParse(strValue) ?? defaultValueForDouble; - return doubleValue; - } else { - return defaultValueForDouble; - } + return double.tryParse(_value) ?? defaultValueForDouble; } /// Decode value to bool. bool asBool() { - final value = _value; - if (value != null) { - final String strValue = const Utf8Codec().decode(value); - final lowerCase = strValue.toLowerCase(); - return lowerCase == 'true' || lowerCase == '1'; - } else { - return defaultValueForBool; - } + final lowerCase = _value.toLowerCase(); + return lowerCase == '1' || lowerCase == 'true'; + } + + /// Decode value as json + Map asJson() { + return json.decode(_value); } }