setupProjectIos method

void setupProjectIos(
  1. String bundleId,
  2. Map appstoreDeployment
)

Implementation

void setupProjectIos(String bundleId, Map appstoreDeployment) {
  final path = join(current, 'ios', 'Runner.xcodeproj', 'project.pbxproj');

  String file = readFile(path);
  file = file.replaceAll(
      RegExp(r'"?CODE_SIGN_IDENTITY"?(\s+)?=(\s+)?"?.+"?;'),
      'CODE_SIGN_IDENTITY = "iPhone Distribution";');
  file = file.replaceAll(
      RegExp(r'"?CODE_SIGN_IDENTITY\[sdk=iphoneos\*\]"?(\s+)?=(\s+)?"?.+"?;'),
      '"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";');
  file = file.replaceAll(RegExp(r'"?DEVELOPMENT_TEAM"?(\s+)?=(\s+)?"?.+"?;'),
      'DEVELOPMENT_TEAM = ${appstoreDeployment['team_id']};');
  file = file.replaceAll(
      RegExp(r'"?DEVELOPMENT_TEAM\[sdk=iphoneos\*\]"?(\s+)?=(\s+)?"?.+"?;'),
      '"DEVELOPMENT_TEAM[sdk=iphoneos*]" = ${appstoreDeployment['team_id']};');
  file = file.replaceAll(
      RegExp(r'"?PRODUCT_BUNDLE_IDENTIFIER"?(\s+)?=(\s+)?"?.+"?;'),
      'PRODUCT_BUNDLE_IDENTIFIER = "\${IOS_APPLICATION_ID}";');
  file = file.replaceAll(
      RegExp(
          r'"?PRODUCT_BUNDLE_IDENTIFIER\[sdk=iphoneos\*\]"?(\s+)?=(\s+)?"?.+"?;'),
      '"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "\${IOS_APPLICATION_ID}";');
  file = file.replaceAll(
      RegExp(r'"?PROVISIONING_PROFILE_SPECIFIER"?(\s+)?=(\s+)?"?.+"?;'),
      'PROVISIONING_PROFILE_SPECIFIER = "${appstoreDeployment['provisioning_profiles']}";');
  file = file.replaceAll(
      RegExp(
          r'"?PROVISIONING_PROFILE_SPECIFIER\[sdk=iphoneos\*\]"?(\s+)?=(\s+)?"?.+"?;'),
      '"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "${appstoreDeployment['provisioning_profiles']}";');

  path.write(file);
  StatusHelper.generated(path);
}