Skip to content

Commit

Permalink
feat: add hidden flag to allow opting out of app id json file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Apr 19, 2022
1 parent ed7d208 commit 5de692c
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions packages/flutterfire_cli/lib/src/commands/config.dart
Expand Up @@ -111,6 +111,15 @@ class ConfigCommand extends FlutterFireCommand {
"Whether to add the Firebase Gradle plugin to your Android app's build.gradle files "
'and create the google-services.json file in your ./android/app folder. ',
);

argParser.addFlag(
'app-id-json',
defaultsTo: true,
hide: true,
abbr: 'j',
help:
'Whether to generate the firebase_app_id.json files used by native iOS and Android builds. ',
);
}

@override
Expand All @@ -135,6 +144,10 @@ class ConfigCommand extends FlutterFireCommand {
return argResults!['apply-gradle-plugin'] as bool;
}

bool get generateAppIdJson {
return argResults!['app-id-json'] as bool;
}

String? get androidApplicationId {
final value = argResults!['android-package-name'] as String?;
final deprecatedValue = argResults!['android-app-id'] as String?;
Expand Down Expand Up @@ -488,22 +501,28 @@ class ConfigCommand extends FlutterFireCommand {
);
futures.add(configFile.write());

if (iosOptions != null) {
final appIDFile = FirebaseAppIDFile(
iosAppIDOutputFilePrefix,
options: iosOptions,
force: isCI || yes,
);
futures.add(appIDFile.write());
}
if (generateAppIdJson) {
if (iosOptions != null) {
final appIDFile = FirebaseAppIDFile(
iosAppIDOutputFilePrefix,
options: iosOptions,
force: isCI || yes,
);
futures.add(appIDFile.write());
}

if (macosOptions != null) {
final appIDFile = FirebaseAppIDFile(
macosAppIDOutputFilePrefix,
options: macosOptions,
force: isCI || yes,
if (macosOptions != null) {
final appIDFile = FirebaseAppIDFile(
macosAppIDOutputFilePrefix,
options: macosOptions,
force: isCI || yes,
);
futures.add(appIDFile.write());
}
} else {
logger.stdout(
'Skipping `firebase_app_id_file.json` generation. Note: this is not recommended as it can cause configuration issues with some FlutterFire plugins such as Crashlytics.',
);
futures.add(appIDFile.write());
}

if (androidOptions != null && applyGradlePlugin) {
Expand Down

0 comments on commit 5de692c

Please sign in to comment.