22 lines
1.0 KiB
Bash
22 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
ruby - "$root" <<'RUBY'
|
|
root = ARGV.fetch(0)
|
|
source = File.read(File.join(root, 'SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift'))
|
|
.gsub(%r{"(?:\\.|[^"\\])*"|//[^\n]*|/\*.*?\*/}m) { |token| token.start_with?('"') ? token : '' }
|
|
.gsub(/\s+/, ' ').gsub(/\s*([(),:])\s*/, '\1').strip
|
|
|
|
completion = source[/self\.onCanceled\(self\.applicationNo\)\s*\{ \[weak self\] didReplace in (.*?) self\.fetch\(\)\s*\}/, 1]
|
|
abort 'RED gift-detail cancel loading: cancellation completion block not found' unless completion
|
|
|
|
reset = completion.index('self.isCancelSubmitting = false')
|
|
successful_return = completion.index('guard !didReplace else { return }')
|
|
unless reset && successful_return && reset < successful_return
|
|
abort 'RED gift-detail cancel loading: successful replacement must clear isCancelSubmitting before returning'
|
|
end
|
|
|
|
puts 'PASS gift-detail cancel loading: successful replacement clears submission state'
|
|
RUBY
|