Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId = "com.sameerasw.airsync"
minSdk = 30
targetSdk = 36
versionCode = 26
versionName = "3.0.0"
versionCode = 27
versionName = "3.1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
15 changes: 12 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,30 @@
<data android:scheme="airsync" />
</intent-filter>

<!-- Long-press Quick Settings tile should open this activity -->
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter>

<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>



<activity
android:name=".presentation.ui.activities.ClipboardActionActivity"
android:theme="@style/Theme.AirSync.Transparent"
android:exported="false"
android:exported="true"
android:excludeFromRecents="true"
android:noHistory="true"
android:taskAffinity="" />
android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>

<service
android:name=".service.MediaNotificationListener"
Expand Down
17 changes: 16 additions & 1 deletion app/src/main/java/com/sameerasw/airsync/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.sameerasw.airsync.utils.DevicePreviewResolver
import com.sameerasw.airsync.utils.KeyguardHelper
import com.sameerasw.airsync.utils.NotesRoleManager
import com.sameerasw.airsync.utils.PermissionUtil
import com.sameerasw.airsync.utils.ShortcutUtil
import com.sameerasw.airsync.utils.WebSocketUtil
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
Expand All @@ -75,6 +76,17 @@ object AdbDiscoveryHolder {
}
}

fun restartDiscovery(context: android.content.Context) {
Log.d("AdbDiscoveryHolder", "Restarting ADB discovery")
discovery?.stopDiscovery()
discovery = null
initialize(context)
}

fun isDiscoveryActive(): Boolean {
return discovery != null
}

fun getDiscoveredServices(): List<AdbMdnsDiscovery.AdbServiceInfo> {
return discovery?.getDiscoveredServices() ?: emptyList()
}
Expand Down Expand Up @@ -395,13 +407,15 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.padding(innerPadding)
) {
composable("main") {
val initialPage = if (intent?.action == ShortcutUtil.DASH_ACTION_REMOTE) 1 else 0
AirSyncMainScreen(
initialIp = ip,
initialPort = port,
showConnectionDialog = isFromQrScan,
pcName = pcName,
isPlus = isPlus,
symmetricKey = symmetricKey
symmetricKey = symmetricKey,
initialPage = initialPage
)
}
}
Expand Down Expand Up @@ -548,6 +562,7 @@ class MainActivity : ComponentActivity() {

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)

// Handle Notes Role intent
handleNotesRoleIntent(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class DataStoreManager(private val context: Context) {
// Widget preferences
private val WIDGET_TRANSPARENCY = androidx.datastore.preferences.core.floatPreferencesKey("widget_transparency")

private val REMOTE_FLIPPED = booleanPreferencesKey("remote_flipped")

private const val NETWORK_DEVICES_PREFIX = "network_device_"
private const val NETWORK_CONNECTIONS_PREFIX = "network_connections_"

Expand Down Expand Up @@ -604,6 +606,18 @@ class DataStoreManager(private val context: Context) {
}
}

suspend fun setRemoteFlipped(enabled: Boolean) {
context.dataStore.edit { preferences ->
preferences[REMOTE_FLIPPED] = enabled
}
}

fun isRemoteFlipped(): Flow<Boolean> {
return context.dataStore.data.map { preferences ->
preferences[REMOTE_FLIPPED] ?: false
}
}

// Network-aware device connections
suspend fun saveNetworkDeviceConnection(
deviceName: String,
Expand Down
Loading