Skip to content

Commit cf4c625

Browse files
authored
Merge pull request #106 from sameerasw/develop
Develop - Adb and connection fixes, improved ui overlay and toolbar fixes, share entry, clipboard and connection pill, remote layout switch, service manager, dynamic app shortcuts
2 parents 3d0efe4 + 0f9cc15 commit cf4c625

23 files changed

Lines changed: 799 additions & 255 deletions

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
applicationId = "com.sameerasw.airsync"
1818
minSdk = 30
1919
targetSdk = 36
20-
versionCode = 26
21-
versionName = "3.0.0"
20+
versionCode = 27
21+
versionName = "3.1.0"
2222

2323
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2424
}

app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,30 @@
8383
<data android:scheme="airsync" />
8484
</intent-filter>
8585

86-
<!-- Long-press Quick Settings tile should open this activity -->
8786
<intent-filter>
8887
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
8988
</intent-filter>
89+
90+
<meta-data
91+
android:name="android.app.shortcuts"
92+
android:resource="@xml/shortcuts" />
9093
</activity>
9194

9295

9396

9497
<activity
9598
android:name=".presentation.ui.activities.ClipboardActionActivity"
9699
android:theme="@style/Theme.AirSync.Transparent"
97-
android:exported="false"
100+
android:exported="true"
98101
android:excludeFromRecents="true"
99102
android:noHistory="true"
100-
android:taskAffinity="" />
103+
android:taskAffinity="">
104+
<intent-filter>
105+
<action android:name="android.intent.action.SEND" />
106+
<category android:name="android.intent.category.DEFAULT" />
107+
<data android:mimeType="text/plain" />
108+
</intent-filter>
109+
</activity>
101110

102111
<service
103112
android:name=".service.MediaNotificationListener"

app/src/main/java/com/sameerasw/airsync/MainActivity.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import com.sameerasw.airsync.utils.DevicePreviewResolver
5959
import com.sameerasw.airsync.utils.KeyguardHelper
6060
import com.sameerasw.airsync.utils.NotesRoleManager
6161
import com.sameerasw.airsync.utils.PermissionUtil
62+
import com.sameerasw.airsync.utils.ShortcutUtil
6263
import com.sameerasw.airsync.utils.WebSocketUtil
6364
import kotlinx.coroutines.flow.first
6465
import kotlinx.coroutines.runBlocking
@@ -75,6 +76,17 @@ object AdbDiscoveryHolder {
7576
}
7677
}
7778

79+
fun restartDiscovery(context: android.content.Context) {
80+
Log.d("AdbDiscoveryHolder", "Restarting ADB discovery")
81+
discovery?.stopDiscovery()
82+
discovery = null
83+
initialize(context)
84+
}
85+
86+
fun isDiscoveryActive(): Boolean {
87+
return discovery != null
88+
}
89+
7890
fun getDiscoveredServices(): List<AdbMdnsDiscovery.AdbServiceInfo> {
7991
return discovery?.getDiscoveredServices() ?: emptyList()
8092
}
@@ -395,13 +407,15 @@ class MainActivity : ComponentActivity() {
395407
modifier = Modifier.padding(innerPadding)
396408
) {
397409
composable("main") {
410+
val initialPage = if (intent?.action == ShortcutUtil.DASH_ACTION_REMOTE) 1 else 0
398411
AirSyncMainScreen(
399412
initialIp = ip,
400413
initialPort = port,
401414
showConnectionDialog = isFromQrScan,
402415
pcName = pcName,
403416
isPlus = isPlus,
404-
symmetricKey = symmetricKey
417+
symmetricKey = symmetricKey,
418+
initialPage = initialPage
405419
)
406420
}
407421
}
@@ -548,6 +562,7 @@ class MainActivity : ComponentActivity() {
548562

549563
override fun onNewIntent(intent: Intent?) {
550564
super.onNewIntent(intent)
565+
setIntent(intent)
551566

552567
// Handle Notes Role intent
553568
handleNotesRoleIntent(intent)

app/src/main/java/com/sameerasw/airsync/data/local/DataStoreManager.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class DataStoreManager(private val context: Context) {
9696
// Widget preferences
9797
private val WIDGET_TRANSPARENCY = androidx.datastore.preferences.core.floatPreferencesKey("widget_transparency")
9898

99+
private val REMOTE_FLIPPED = booleanPreferencesKey("remote_flipped")
100+
99101
private const val NETWORK_DEVICES_PREFIX = "network_device_"
100102
private const val NETWORK_CONNECTIONS_PREFIX = "network_connections_"
101103

@@ -604,6 +606,18 @@ class DataStoreManager(private val context: Context) {
604606
}
605607
}
606608

609+
suspend fun setRemoteFlipped(enabled: Boolean) {
610+
context.dataStore.edit { preferences ->
611+
preferences[REMOTE_FLIPPED] = enabled
612+
}
613+
}
614+
615+
fun isRemoteFlipped(): Flow<Boolean> {
616+
return context.dataStore.data.map { preferences ->
617+
preferences[REMOTE_FLIPPED] ?: false
618+
}
619+
}
620+
607621
// Network-aware device connections
608622
suspend fun saveNetworkDeviceConnection(
609623
deviceName: String,

0 commit comments

Comments
 (0)