(config: Config, xmlData: any)
| 64 | } |
| 65 | |
| 66 | async function checkAndroidManifestData(config: Config, xmlData: any): Promise<string | null> { |
| 67 | const manifestNode: any = xmlData.manifest; |
| 68 | if (!manifestNode) { |
| 69 | return `Missing ${c.input('<manifest>')} XML node in ${c.strong(config.android.srcMainDir)}`; |
| 70 | } |
| 71 | |
| 72 | const applicationChildNodes: any[] = manifestNode.application; |
| 73 | if (!Array.isArray(manifestNode.application)) { |
| 74 | return `Missing ${c.input('<application>')} XML node as a child node of ${c.input('<manifest>')} in ${c.strong( |
| 75 | config.android.srcMainDir, |
| 76 | )}`; |
| 77 | } |
| 78 | |
| 79 | let mainActivityClassPath = ''; |
| 80 | |
| 81 | const mainApplicationNode = applicationChildNodes.find((applicationChildNode) => { |
| 82 | const activityChildNodes: any[] = applicationChildNode.activity; |
| 83 | if (!Array.isArray(activityChildNodes)) { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | const mainActivityNode = activityChildNodes.find((activityChildNode) => { |
| 88 | const intentFilterChildNodes: any[] = activityChildNode['intent-filter']; |
| 89 | if (!Array.isArray(intentFilterChildNodes)) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | return intentFilterChildNodes.find((intentFilterChildNode) => { |
| 94 | const actionChildNodes: any[] = intentFilterChildNode.action; |
| 95 | if (!Array.isArray(actionChildNodes)) { |
| 96 | return false; |
| 97 | } |
| 98 | |
| 99 | const mainActionChildNode = actionChildNodes.find((actionChildNode) => { |
| 100 | const androidName = actionChildNode.$['android:name']; |
| 101 | return androidName === 'android.intent.action.MAIN'; |
| 102 | }); |
| 103 | |
| 104 | if (!mainActionChildNode) { |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | const categoryChildNodes: any[] = intentFilterChildNode.category; |
| 109 | if (!Array.isArray(categoryChildNodes)) { |
| 110 | return false; |
| 111 | } |
| 112 | |
| 113 | return categoryChildNodes.find((categoryChildNode) => { |
| 114 | const androidName = categoryChildNode.$['android:name']; |
| 115 | return androidName === 'android.intent.category.LAUNCHER'; |
| 116 | }); |
| 117 | }); |
| 118 | }); |
| 119 | |
| 120 | if (mainActivityNode) { |
| 121 | mainActivityClassPath = mainActivityNode.$['android:name']; |
| 122 | } |
| 123 |
no test coverage detected