Skip to content

Commit d040920

Browse files
committed
Merge branch 'dohun'
2 parents 28cbef2 + 8c5c98d commit d040920

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+
import com.intellij.openapi.actionSystem.AnAction
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import kr.co.finda.androidtemplate.util.DeviceHelperImpl
6+
7+
class InstallImmediatelyAction : AnAction(), InstallImmediatelyContract.View {
8+
9+
private val presenter: InstallImmediatelyContract.Presenter by lazy {
10+
InstallImmediatelyPresenter(DeviceHelperImpl())
11+
}
12+
13+
override fun actionPerformed(e: AnActionEvent) {
14+
val project = e.project ?: return
15+
presenter.onInstallPerformed(project)
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+
import com.intellij.openapi.project.Project
4+
5+
interface InstallImmediatelyContract {
6+
7+
interface View {
8+
9+
}
10+
11+
interface Presenter {
12+
fun onInstallPerformed(project: Project)
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package kr.co.finda.androidtemplate.feature.installImmediately
2+
3+
import com.intellij.openapi.project.Project
4+
import kr.co.finda.androidtemplate.util.DeviceHelper
5+
6+
class InstallImmediatelyPresenter(
7+
private val deviceHelper: DeviceHelper
8+
) : InstallImmediatelyContract.Presenter {
9+
10+
override fun onInstallPerformed(project: Project) {
11+
val devices = deviceHelper.getDebugDevices(project)
12+
deviceHelper.installFindaStgImmediately(devices ?: emptyList())
13+
}
14+
}

src/main/kotlin/kr/co/finda/androidtemplate/util/DeviceHelper.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ interface DeviceHelper {
1919
fun getDebugDevices(project: Project): List<IDevice>?
2020

2121
fun clearFindaAppCache(device: IDevice)
22+
23+
fun installFindaStgImmediately(devices: List<IDevice>)
2224
}
2325

2426
class DeviceHelperImpl : DeviceHelper {
@@ -53,7 +55,7 @@ class DeviceHelperImpl : DeviceHelper {
5355
override fun getShowOverdrawEnabled(device: IDevice, on: (isEnabled: Boolean) -> Unit) {
5456
device.executeShellCommand(
5557
"getprop debug.hwui.overdraw",
56-
object: MultiLineReceiver() {
58+
object : MultiLineReceiver() {
5759
var cancelled = false
5860

5961
override fun isCancelled(): Boolean {
@@ -88,4 +90,13 @@ class DeviceHelperImpl : DeviceHelper {
8890
NullOutputReceiver()
8991
)
9092
}
93+
94+
override fun installFindaStgImmediately(devices: List<IDevice>) {
95+
devices.forEach { device ->
96+
device.executeShellCommand(
97+
"install -t app/build/outputs/apk/stg/debug/app-stg-debug.apk",
98+
NullOutputReceiver()
99+
)
100+
}
101+
}
91102
}

src/main/resources/META-INF/plugin.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
icon="Icons.FindaLogo">
4949
<add-to-group group-id="ToolsMenu" anchor="last"/>
5050
</action>
51+
<action id="kr.co.finda.androidtemplate.feature.installImmediately.InstallImmediatelyAction"
52+
class="kr.co.finda.androidtemplate.feature.installImmediately.InstallImmediatelyAction"
53+
text="Install Finda STG Immediately"
54+
description="Install Finda STG Immediately"
55+
icon="Icons.FindaLogo">
56+
<add-to-group group-id="ToolsMenu" anchor="last"/>
57+
</action>
5158
</actions>
5259

5360
<extensions defaultExtensionNs="com.intellij">

0 commit comments

Comments
 (0)