Skip to content

Instantly share code, notes, and snippets.

@cohen72
Last active November 19, 2020 11:04
Show Gist options
  • Save cohen72/2beb94123a135ed3d8be9c97c33eccf3 to your computer and use it in GitHub Desktop.
Save cohen72/2beb94123a135ed3d8be9c97c33eccf3 to your computer and use it in GitHub Desktop.
def configure_assets(platform)
unique_whitelabel_id = ENV["UNIQUE_WHITELABEL_ID"]
ios_icon_file_path = "whitelabels/#{unique_whitelabel_id}/icon.png"
android_icon_file_path = "whitelabels/#{unique_whitelabel_id}/icon_android.png"
splash_file_path = "whitelabels/#{unique_whitelabel_id}/splash.png"
unless File.exist?(ios_icon_file_path) && File.exist?(android_icon_file_path)
UI.user_error!("1024x1024 'icon.png' file required in white label directory")
end
Dir.chdir("..") do
sh("react-native set-splash --platform #{platform} --path './fastlane/#{splash_file_path}' --resize contain --background '#{ENV["SPLASH_SCREEN_BG_COLOR"]}'")
if platform == "ios"
sh("react-native set-icon --platform #{platform} --path './fastlane/#{ios_icon_file_path}'")
end
if platform == "android"
sh("react-native set-icon --platform #{platform} --path './fastlane/#{android_icon_file_path}'")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment