Skip to content

Commit

Permalink
fix: conditions for writing service file
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Jan 18, 2023
1 parent 2aee4f6 commit 4113cdb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
4 changes: 0 additions & 4 deletions packages/flutterfire_cli/lib/src/common/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,6 @@ String getProjectConfigurationProperty(
}
}





Future<void> writeFirebaseJsonFile(
FlutterApp flutterApp,
) async {
Expand Down
22 changes: 11 additions & 11 deletions packages/flutterfire_cli/lib/src/firebase/firebase_apple_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,12 @@ end
}

Future<void> apply() async {
if (!googleServicePathSpecified) {
// if the user has selected a "build-config" but no "[ios-macos]-out" argument, they need to specify the location of "GoogleService-Info.plist" so it can be used at build time.
if (!googleServicePathSpecified && target != null) {
fullPathToServiceFile = _promptForPathToServiceFile();

if (target != null) {
await _createTargetSetup(fullPathToServiceFile!);
}
if (buildConfiguration != null) {
await _createBuildConfigurationSetup(fullPathToServiceFile!);
}
await _createTargetSetup(fullPathToServiceFile!);
} else if (!googleServicePathSpecified && buildConfiguration != null) {
fullPathToServiceFile = _promptForPathToServiceFile();
await _createBuildConfigurationSetup(fullPathToServiceFile!);
} else if (googleServicePathSpecified) {
final googleServiceFileName = path.basename(fullPathToServiceFile!);

Expand All @@ -586,7 +582,8 @@ end
} else if (target != null) {
await _createTargetSetup(fullPathToServiceFile!);
} else {
// We need to prompt user whether they want a build configuration, a target configured or to simply write to the path provided
// User has specified an output for service file. We need to prompt user whether they
// want a build configuration, a target configured or to simply write to the path provided
final fileName = path.basename(fullPathToServiceFile!);
final response = promptSelect(
'Would you like your $platform $fileName to be associated with your $platform Build configuration or Target (use arrow keys & space to select)?',
Expand Down Expand Up @@ -620,10 +617,13 @@ end
);
target = targets[response];
await _targetWrites(fullPathToServiceFile!);
} else {
// Write the service file to the desired location. No other configuration
await _writeGoogleServiceFileToPath(fullPathToServiceFile!);
}
}
} else {
// Continue to write file to Runner/GoogleService-Info.plist if no "fullPathToServiceFile", "build configuration" and "target" is provided
// Default setup. Continue to write file to Runner/GoogleService-Info.plist if no "fullPathToServiceFile", "build configuration" and "target" is provided
// Update "Runner", default target
final defaultProjectPath =
'${Directory.current.path}/${platform.toLowerCase()}/Runner/${platformOptions.optionsSourceFileName}';
Expand Down

0 comments on commit 4113cdb

Please sign in to comment.