(info: &Value)
| 604 | } |
| 605 | |
| 606 | fn inspector_available_sources(info: &Value) -> Vec<String> { |
| 607 | let mut sources = Vec::new(); |
| 608 | let snapshot_source = info.get("source").and_then(Value::as_str).unwrap_or(""); |
| 609 | let react_native_available = info |
| 610 | .get("reactNative") |
| 611 | .and_then(|value| value.get("available")) |
| 612 | .and_then(Value::as_bool) |
| 613 | .unwrap_or(snapshot_source == "react-native"); |
| 614 | if react_native_available { |
| 615 | sources.push("react-native".to_owned()); |
| 616 | } |
| 617 | let flutter_available = info |
| 618 | .get("flutter") |
| 619 | .and_then(|value| value.get("available")) |
| 620 | .and_then(Value::as_bool) |
| 621 | .unwrap_or(false); |
| 622 | if flutter_available { |
| 623 | sources.push("flutter".to_owned()); |
| 624 | } |
| 625 | match snapshot_source { |
| 626 | "nativescript" => push_unique_source(&mut sources, "nativescript"), |
| 627 | "swiftui" => push_unique_source(&mut sources, "swiftui"), |
| 628 | _ => {} |
| 629 | } |
| 630 | let app_hierarchy = info.get("appHierarchy"); |
| 631 | let app_hierarchy_available = app_hierarchy |
| 632 | .and_then(|value| value.get("available")) |
| 633 | .and_then(Value::as_bool) |
| 634 | .unwrap_or(false); |
| 635 | let app_hierarchy_source = app_hierarchy |
| 636 | .and_then(|value| value.get("source")) |
| 637 | .and_then(Value::as_str) |
| 638 | .unwrap_or(""); |
| 639 | if app_hierarchy_available { |
| 640 | match app_hierarchy_source { |
| 641 | "nativescript" => push_unique_source(&mut sources, "nativescript"), |
| 642 | "react-native" => push_unique_source(&mut sources, "react-native"), |
| 643 | "flutter" => push_unique_source(&mut sources, "flutter"), |
| 644 | "swiftui" => push_unique_source(&mut sources, "swiftui"), |
| 645 | _ => {} |
| 646 | } |
| 647 | } |
| 648 | let uikit_available = info |
| 649 | .get("uikit") |
| 650 | .and_then(|value| value.get("available")) |
| 651 | .and_then(Value::as_bool) |
| 652 | .unwrap_or_else(|| { |
| 653 | !(react_native_available |
| 654 | || flutter_available |
| 655 | || snapshot_source == "nativescript" |
| 656 | || app_hierarchy_source == "react-native" |
| 657 | || app_hierarchy_source == "flutter" |
| 658 | || snapshot_source == "react-native" |
| 659 | || snapshot_source == "flutter") |
| 660 | }); |
| 661 | if uikit_available { |
| 662 | sources.push("in-app-inspector".to_owned()); |
| 663 | } |
no test coverage detected