Skip to content

Commit

Permalink
add notification, clear codes
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrture committed Sep 14, 2024
1 parent 3535a55 commit c6ee7b0
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fun emptyManifestXml(styleName: String, isHiltEnable: Boolean, dataDiDomainPrese
isHiltEnable && dataDiDomainPresentationUiPackages -> hilt(
styleName
)

else -> withoutHilt(styleName)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package com.github.cnrture.quickprojectwizard.gradle

import com.github.cnrture.quickprojectwizard.gradle.network.VersionModel
import io.ktor.client.statement.*
import kotlinx.serialization.json.Json
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import io.ktor.client.request.get
import io.ktor.client.statement.HttpResponse

object Versions {
val versionList = mutableMapOf(
"agp" to "8.5.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@ import com.android.tools.idea.wizard.template.RecipeExecutor
import com.android.tools.idea.wizard.template.escapeKotlinIdentifier
import com.github.cnrture.quickprojectwizard.addRootFile
import com.github.cnrture.quickprojectwizard.addSrcFile
import com.github.cnrture.quickprojectwizard.general.data.model.emptyMainEntityModel
import com.github.cnrture.quickprojectwizard.general.data.repository.emptyMainRepositoryImpl
import com.github.cnrture.quickprojectwizard.general.data.source.local.emptyMainDao
import com.github.cnrture.quickprojectwizard.general.data.source.local.emptyMainRoomDB
import com.github.cnrture.quickprojectwizard.general.data.source.remote.emptyKtorApi
import com.github.cnrture.quickprojectwizard.general.data.source.remote.emptyMainService
import com.github.cnrture.quickprojectwizard.general.detekt.emptyDetektConfig
import com.github.cnrture.quickprojectwizard.general.di.emptyLocalModule
import com.github.cnrture.quickprojectwizard.general.di.emptyMainRepositoryModule
import com.github.cnrture.quickprojectwizard.general.di.emptyNetworkModule
import com.github.cnrture.quickprojectwizard.general.domain.emptyMainRepository
import com.github.cnrture.quickprojectwizard.composearch.common.emptyCollectExtension
import com.github.cnrture.quickprojectwizard.composearch.ui.components.emptyEmptyScreen
import com.github.cnrture.quickprojectwizard.composearch.ui.components.emptyLoadingBar
import com.github.cnrture.quickprojectwizard.composearch.ui.emptyActivity
Expand All @@ -29,11 +19,22 @@ import com.github.cnrture.quickprojectwizard.composearch.ui.navigation.emptyNavi
import com.github.cnrture.quickprojectwizard.composearch.ui.theme.emptyColor
import com.github.cnrture.quickprojectwizard.composearch.ui.theme.emptyTheme
import com.github.cnrture.quickprojectwizard.composearch.ui.theme.emptyType
import com.github.cnrture.quickprojectwizard.composearch.common.emptyCollectExtension
import com.github.cnrture.quickprojectwizard.general.*
import com.github.cnrture.quickprojectwizard.general.data.model.emptyMainEntityModel
import com.github.cnrture.quickprojectwizard.general.data.repository.emptyMainRepositoryImpl
import com.github.cnrture.quickprojectwizard.general.data.source.local.emptyMainDao
import com.github.cnrture.quickprojectwizard.general.data.source.local.emptyMainRoomDB
import com.github.cnrture.quickprojectwizard.general.data.source.remote.emptyKtorApi
import com.github.cnrture.quickprojectwizard.general.data.source.remote.emptyMainService
import com.github.cnrture.quickprojectwizard.general.detekt.emptyDetektConfig
import com.github.cnrture.quickprojectwizard.general.di.emptyLocalModule
import com.github.cnrture.quickprojectwizard.general.di.emptyMainRepositoryModule
import com.github.cnrture.quickprojectwizard.general.di.emptyNetworkModule
import com.github.cnrture.quickprojectwizard.general.domain.emptyMainRepository
import com.github.cnrture.quickprojectwizard.gradle.getDependencies
import com.github.cnrture.quickprojectwizard.gradle.getGradleKts
import com.github.cnrture.quickprojectwizard.gradle.getProjectGradleKts
import com.github.cnrture.quickprojectwizard.util.NotificationUtil
import java.io.File

fun RecipeExecutor.composeProjectRecipe(
Expand Down Expand Up @@ -163,6 +164,11 @@ fun RecipeExecutor.composeProjectRecipe(
moduleData.apis.minApi.api,
javaJvmVersion,
)

NotificationUtil.showInfo(
title = "Quick Project Wizard",
message = "Your project is ready! 🚀 If you like the plugin, please comment and rate it on the plugin page. 🙏",
)
}

private fun RecipeExecutor.addExtensions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.android.tools.idea.wizard.template.RecipeExecutor
import com.android.tools.idea.wizard.template.escapeKotlinIdentifier
import com.github.cnrture.quickprojectwizard.addRootFile
import com.github.cnrture.quickprojectwizard.addSrcFile
import com.github.cnrture.quickprojectwizard.general.*
import com.github.cnrture.quickprojectwizard.general.data.model.emptyMainEntityModel
import com.github.cnrture.quickprojectwizard.general.data.repository.emptyMainRepositoryImpl
import com.github.cnrture.quickprojectwizard.general.data.source.local.emptyMainDao
Expand All @@ -18,12 +19,11 @@ import com.github.cnrture.quickprojectwizard.general.di.emptyLocalModule
import com.github.cnrture.quickprojectwizard.general.di.emptyMainRepositoryModule
import com.github.cnrture.quickprojectwizard.general.di.emptyNetworkModule
import com.github.cnrture.quickprojectwizard.general.domain.emptyMainRepository
import com.github.cnrture.quickprojectwizard.xmlarch.ui.emptyMainNavGraphXML
import com.github.cnrture.quickprojectwizard.xmlarch.common.emptyCollectExtension
import com.github.cnrture.quickprojectwizard.general.*
import com.github.cnrture.quickprojectwizard.gradle.getDependencies
import com.github.cnrture.quickprojectwizard.gradle.getGradleKts
import com.github.cnrture.quickprojectwizard.gradle.getProjectGradleKts
import com.github.cnrture.quickprojectwizard.util.NotificationUtil
import com.github.cnrture.quickprojectwizard.xmlarch.common.emptyCollectExtension
import com.github.cnrture.quickprojectwizard.xmlarch.ui.*
import java.io.File

Expand Down Expand Up @@ -146,6 +146,11 @@ fun RecipeExecutor.xmlProjectRecipe(
javaJvmVersion,
moduleData.themesData.main.name,
)

NotificationUtil.showInfo(
title = "Quick Project Wizard",
message = "Your project is ready! 🚀 If you like the plugin, please comment and rate it on the plugin page. 🙏",
)
}

private fun RecipeExecutor.addExtensions(
Expand Down Expand Up @@ -308,7 +313,7 @@ private fun addDependenciesAndGradle(

if (themesFile.exists() && themesFile.isFile) {
themesFile.writeText(
"""
"""
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.${styleName}" parent="Theme.Material3.DayNight.NoActionBar">
Expand All @@ -324,7 +329,7 @@ private fun addDependenciesAndGradle(

if (themesNightFile.exists() && themesNightFile.isFile) {
themesNightFile.writeText(
"""
"""
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.${styleName}" parent="Theme.Material3.DayNight.NoActionBar">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.github.cnrture.quickprojectwizard.util

import com.intellij.ide.BrowserUtil
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent

object NotificationUtil {
fun showInfo(
title: String,
message: String,
) {
val notification = NotificationGroupManager.getInstance()
.getNotificationGroup("QPW Notification Group")
.createNotification(
title = title,
content = message,
type = NotificationType.INFORMATION,
)
notification.addAction(object : AnAction("Contact Developer") {
override fun actionPerformed(e: AnActionEvent) {
BrowserUtil.browse("https://bento.me/canerture")
}
})
notification.addAction(object : AnAction("Open Plugin Page") {
override fun actionPerformed(e: AnActionEvent) {
BrowserUtil.browse("https://plugins.jetbrains.com/plugin/25221-quickprojectwizard?noRedirect=true")
}
})
notification.notify(null)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.github.cnrture.quickprojectwizard.xmlarch.ui

fun emptyActivityXML(packageName: String, isHiltEnable: Boolean, dataDiDomainPresentationUiPackages: Boolean,): String {
fun emptyActivityXML(
packageName: String,
isHiltEnable: Boolean,
dataDiDomainPresentationUiPackages: Boolean,
): String {
return when {
!dataDiDomainPresentationUiPackages -> withoutHilt(packageName)
isHiltEnable -> hilt(packageName)
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
<extensions defaultExtensionNs="com.android.tools.idea.wizard.template">
<wizardTemplateProvider implementation="com.github.cnrture.quickprojectwizard.AndroidStudioTemplateProvider"/>
</extensions>

<extensions defaultExtensionNs="com.intellij">
<notificationGroup id="QPW Notification Group"
displayType="BALLOON"
key="notification.group.qpw"/>
</extensions>
</idea-plugin>

0 comments on commit c6ee7b0

Please sign in to comment.