# frozen_string_literal: true
module Danger
# Plugin to make sure View file changes in a Pull Request will have accompanying screenshots in the PR description.
#
# @example Check if a PR changing views needs to have screenshots
#
# # If a PR has view changes, report a warning if there are no screenshots attached
# view_changes_checker.check
#
# @see Automattic/dangermattic
# @tags ios, android, swift, java, kotlin, screenshots
#
class ViewChangesChecker < Plugin
VIEW_EXTENSIONS_IOS = /(View|Button)\.(swift|m)$|\.xib$|\.storyboard$/
VIEW_EXTENSIONS_ANDROID = /(?i)(View|Button)\.(java|kt|xml)$/
MEDIA_IN_PR_BODY_PATTERNS = [
%r{https?://\S*\.(gif|jpg|jpeg|png|svg)},
%r{https?://\S*\.(mp4|avi|mov|mkv)},
%r{https?://\S*github\S+/\S+/assets/},
%r{https?://\S*github\S+/storage/user/},
/!\[(.*?)\]\((.*?)\)/,
/]*src\s*=\s*[^>]*>/,
/