Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrture committed Sep 14, 2024
1 parent 16d171d commit ed85ab8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ package $packageName.ui
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.navigation.ui.rememberNavController
import androidx.navigation.compose.rememberNavController
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -92,7 +92,7 @@ package $packageName.ui
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.navigation.ui.rememberNavController
import androidx.navigation.compose.rememberNavController
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package com.github.cnrture.quickprojectwizard.general

fun emptyManifestXml(styleName: String, isHiltEnable: Boolean, dataDiDomainPresentationUiPackages: Boolean): String {
return when {
isHiltEnable && dataDiDomainPresentationUiPackages -> hilt(
styleName
)

else -> withoutHilt(styleName)
fun emptyManifestXml(
styleName: String,
isHiltEnable: Boolean,
dataDiDomainPresentationUiPackages: Boolean,
projectName: String
): String {
return if (isHiltEnable && dataDiDomainPresentationUiPackages) {
hilt(styleName, projectName)
} else {
withoutHilt(styleName)
}
}

fun hilt(styleName: String) = """
fun hilt(styleName: String, projectName: String) = """
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:name=".${projectName}Application"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ fun RecipeExecutor.composeProjectRecipe(
val (_, _, _, manifestOut) = moduleData

mergeXml(
emptyManifestXml("@style/${moduleData.themesData.main.name}", isHiltEnable, dataDiDomainPresentationUiPackages),
emptyManifestXml(
"@style/${moduleData.themesData.main.name}",
isHiltEnable,
dataDiDomainPresentationUiPackages,
projectName
),
manifestOut.resolve("AndroidManifest.xml")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ fun RecipeExecutor.xmlProjectRecipe(
val (_, _, _, manifestOut) = moduleData

mergeXml(
emptyManifestXml("@style/${moduleData.themesData.main.name}", isHiltEnable, dataDiDomainPresentationUiPackages),
emptyManifestXml(
"@style/${moduleData.themesData.main.name}",
isHiltEnable,
dataDiDomainPresentationUiPackages,
projectName
),
manifestOut.resolve("AndroidManifest.xml")
)

Expand Down

0 comments on commit ed85ab8

Please sign in to comment.