Skip to content

Commit c492298

Browse files
authored
Merge pull request #11 from rasoulmiri/develop
Fix show error connect an android device
2 parents fb33080 + 82a059f commit c492298

File tree

5 files changed

+25
-35
lines changed

5 files changed

+25
-35
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "com.androidstudiotoolsmissed"
11-
version = "1.0.4-SNAPSHOT"
11+
version = "1.0.5"
1212

1313
repositories {
1414
mavenCentral()
@@ -85,6 +85,7 @@ tasks {
8585
properties.load(inputStream)
8686
}
8787
val intelliJToken: String = properties.getProperty("token").trim()
88+
println(intelliJToken)
8889
token.set(System.getenv(intelliJToken))
8990
}
9091
}

src/main/kotlin/androidstudio/tools/missed/manager/device/DeviceManagerImpl.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DeviceManagerImpl(
4242
val resultGetDevice = getDevicesFromAdb()
4343
if (resultGetDevice.isFailure) {
4444
return Result.failure(
45-
resultInitialAdb.exceptionOrNull() ?: Throwable(resourceManager.string("getDevicesFromAdbError"))
45+
resultGetDevice.exceptionOrNull() ?: Throwable(resourceManager.string("getDevicesFromAdbError"))
4646
)
4747
}
4848

@@ -71,7 +71,9 @@ class DeviceManagerImpl(
7171
_selectedDeviceStateFlow.emit(_devicesStateFlow.value.getOrNull(0))
7272
Result.success(true)
7373
} else {
74-
Result.failure(Throwable(resourceManager.string("getDevicesFromAdbError")))
74+
Result.failure(
75+
resultGetDevices.exceptionOrNull() ?: Throwable(resourceManager.string("getDevicesFromAdbError"))
76+
)
7577
}
7678
}
7779

src/main/kotlin/androidstudio/tools/missed/missedtoolwindow/di/MissedToolsWindowModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.koin.core.qualifier.named
1616
import org.koin.dsl.module
1717

1818
val missedToolsWindowModule = module {
19-
single { MissedToolsWindowViewModel(get(named("IODispatcher")), get()) }
19+
single { MissedToolsWindowViewModel(get(named("IODispatcher")), get(),get()) }
2020
factory<CollapsibleGroupView<*>>(named("customCommandView")) { CustomCommandView(get(), get(), get()) }
2121
factory<CollapsibleGroupView<*>>(named("networkView")) { NetworkView(get(), get(), get()) }
2222
factory<CollapsibleGroupView<*>>(named("inputTextView")) { InputTextView(get(), get(), get()) }

src/main/kotlin/androidstudio/tools/missed/missedtoolwindow/presenter/MissedToolsWindowViewModel.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package androidstudio.tools.missed.missedtoolwindow.presenter
33
import androidstudio.tools.missed.base.ViewModel
44
import androidstudio.tools.missed.manager.device.DeviceManager
55
import androidstudio.tools.missed.manager.notification.model.BalloonNotificationModel
6+
import androidstudio.tools.missed.manager.resource.ResourceManager
67
import androidstudio.tools.missed.missedtoolwindow.model.MissedToolsWindowStateUi
78
import com.intellij.notification.NotificationType
89
import kotlinx.coroutines.CoroutineDispatcher
@@ -20,6 +21,7 @@ import kotlinx.coroutines.launch
2021

2122
class MissedToolsWindowViewModel(
2223
private val coroutineDispatcher: CoroutineDispatcher,
24+
private val resourceManager: ResourceManager,
2325
private val deviceManager: DeviceManager
2426
) : ViewModel(coroutineDispatcher) {
2527

@@ -59,7 +61,12 @@ class MissedToolsWindowViewModel(
5961
_messageSharedFlow.emit(
6062
BalloonNotificationModel(content = it.message, type = NotificationType.ERROR)
6163
)
62-
_uiStateFlow.emit(MissedToolsWindowStateUi.Error)
64+
65+
if (it.message == resourceManager.string("connectAnAndroidDevice")) {
66+
_uiStateFlow.emit(MissedToolsWindowStateUi.NeedToConnectDevice)
67+
} else {
68+
_uiStateFlow.emit(MissedToolsWindowStateUi.Error)
69+
}
6370
}
6471
}
6572
}

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

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,18 @@
44
<vendor email="[email protected]" url="[email protected]">Rasoul Miri</vendor>
55

66
<description>
7-
<![CDATA[<p>You can use AndroidStudioToolsMissed plugin during the development of Android applications, such as granting and revoking all permissions and activating and deactivating Wi-Fi, cellular mobile, Bluetooth, or Airplane mode
8-
<br>You can also set the Doze mode, Standby, and whitelist, or you can simulate the battery settings.</p>
9-
<p><strong style="color: blue;">All these features are available for emulators and real Android devices.</strong></p>
10-
11-
<strong>Features:</strong>
7+
<![CDATA[
8+
<p>The AndroidStudioToolsMissed plugin enhances Android application development by providing tools to manage device settings and permissions. With this plugin, you can:</p>
129
<ul>
13-
<li><strong>Network</strong>
14-
<ul>
15-
<li>Airplane Mode</li>
16-
<li>Mobile Cellular</li>
17-
<li>Wifi Connection</li>
18-
<li>Bluetooth</li>
19-
</ul>
20-
</li>
21-
<li><strong>Input Text:</strong> You can send your text to an Android device.</li>
22-
<li><strong>Permissions:</strong> You can grant or revoke permission or all permissions for an application.</li>
23-
<li><strong>APK:</strong> Get Apk from which is installed on your device or install APK on a device.</li>
24-
<li><strong>Limitation Modes</strong>
25-
<ul>
26-
<li>Doze Mode</li>
27-
<li>Standby</li>
28-
<li>WhiteList</li>
29-
</ul>
30-
</li>
31-
<li><strong>Battery</strong>
32-
<ul>
33-
<li>Charger Connection</li>
34-
<li>Battery Level</li>
35-
<li>Power Saving Mode</li>
36-
</ul>
37-
</li>
10+
<li><strong style="color: orange;">Custom Command:</strong> Execute custom shell commands directly from Android Studio.</li>
11+
<li><strong style="color: orange;">Network:</strong> Manage network settings like Airplane Mode, Mobile Cellular, WiFi, and Bluetooth.</li>
12+
<li><strong style="color: orange;">Input Text:</strong> Send text to your Android device.</li>
13+
<li><strong style="color: orange;">Permissions:</strong> Grant or revoke permissions easily.</li>
14+
<li><strong style="color: orange;">APK Management:</strong> Extract and install APKs from/to your device.</li>
15+
<li><strong style="color: orange;">Limitation Modes:</strong> Control Doze Mode, Standby Mode, and WhiteList.</li>
16+
<li><strong style="color: orange;">Battery:</strong> Check charger connection, battery level, and power saving mode.</li>
3817
</ul>
18+
<p><strong>Use these features on both emulators and real devices to streamline your testing and development process.</strong></p>
3919
]]>
4020
</description>
4121

0 commit comments

Comments
 (0)