({
platforms,
html,
flavor,
plist,
...rawProps
}: {
platforms: Array<"android" | "ios" | "web">;
html: string;
flavor: string;
plist?: string;
logo: string;
background: string;
logoWidth: number;
assetsOutput: string;
licenseKey?: string;
brand?: string;
brandWidth: number;
darkBackground?: string;
darkLogo?: string;
darkBrand?: string;
})
| 163 | }; |
| 164 | |
| 165 | export const generate = async ({ |
| 166 | platforms, |
| 167 | html, |
| 168 | flavor, |
| 169 | plist, |
| 170 | ...rawProps |
| 171 | }: { |
| 172 | platforms: Array<"android" | "ios" | "web">; |
| 173 | html: string; |
| 174 | flavor: string; |
| 175 | plist?: string; |
| 176 | |
| 177 | logo: string; |
| 178 | background: string; |
| 179 | logoWidth: number; |
| 180 | assetsOutput: string; |
| 181 | licenseKey?: string; |
| 182 | brand?: string; |
| 183 | brandWidth: number; |
| 184 | darkBackground?: string; |
| 185 | darkLogo?: string; |
| 186 | darkBrand?: string; |
| 187 | }) => { |
| 188 | const props = await transformProps(cwd, rawProps); |
| 189 | const addon = requireAddon(props); |
| 190 | |
| 191 | const { background, brand } = props; |
| 192 | |
| 193 | const androidOutputPath = platforms.includes("android") |
| 194 | ? getAndroidOutputPath({ flavor }) |
| 195 | : undefined; |
| 196 | |
| 197 | const iosOutputPath = platforms.includes("ios") |
| 198 | ? getIOSOutputPath() |
| 199 | : undefined; |
| 200 | |
| 201 | const htmlTemplatePath = platforms.includes("web") |
| 202 | ? getHtmlTemplatePath({ html }) |
| 203 | : undefined; |
| 204 | |
| 205 | if (androidOutputPath != null) { |
| 206 | await writeAndroidAssets({ androidOutputPath, props }); |
| 207 | |
| 208 | const manifestXmlPath = path.resolve( |
| 209 | androidOutputPath, |
| 210 | "..", |
| 211 | "AndroidManifest.xml", |
| 212 | ); |
| 213 | |
| 214 | if (hfs.exists(manifestXmlPath)) { |
| 215 | const manifestXml = readXmlLike(manifestXmlPath); |
| 216 | const activities = manifestXml.root.querySelectorAll("activity"); |
| 217 | |
| 218 | for (const activity of activities) { |
| 219 | if (activity.getAttribute("android:name") === ".MainActivity") { |
| 220 | activity.setAttribute("android:theme", "@style/BootTheme"); |
| 221 | } |
| 222 | } |
no test coverage detected
searching dependent graphs…