Skip to content
Merged
22 changes: 21 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,33 @@
android:noHistory="true"
android:taskAffinity=""
android:theme="@style/Theme.AirSync.Transparent">
</activity>

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

<service
android:name=".service.OutboundQuickShareService"
android:exported="false"
android:foregroundServiceType="connectedDevice" />

<service
android:name=".service.MediaNotificationListener"
android:exported="false"
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/sameerasw/airsync/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,9 @@ class MainActivity : ComponentActivity() {
// Not connected and not paused: pause the app on QS tile long-press
runBlocking {
ds.setAppPaused(true)
ds.setUserManuallyDisconnected(true)
}
WebSocketUtil.stopAutoReconnect(this)
WebSocketUtil.disconnect(this)
WebSocketUtil.disconnect(this, manual = true)
com.sameerasw.airsync.utils.discovery.DiscoveryOrchestrator.stop(this)
com.sameerasw.airsync.service.AirSyncService.stop(this)
ShortcutUtil.refreshShortcuts(this, false)
Expand Down Expand Up @@ -578,10 +577,9 @@ class MainActivity : ComponentActivity() {
if (!isPaused && !WebSocketUtil.isConnected()) {
runBlocking {
ds.setAppPaused(true)
ds.setUserManuallyDisconnected(true)
}
WebSocketUtil.stopAutoReconnect(this)
WebSocketUtil.disconnect(this)
WebSocketUtil.disconnect(this, manual = true)
com.sameerasw.airsync.utils.discovery.DiscoveryOrchestrator.stop(this)
com.sameerasw.airsync.service.AirSyncService.stop(this)
ShortcutUtil.refreshShortcuts(this, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ object BleTransportBridge {
fun handleMediaControl(action: String, context: android.content.Context) {
Log.d(TAG, "Media control from BLE: $action")
when {
action == "manual_disconnect" -> {
Log.d(TAG, "Received manual disconnect from Mac via BLE")
com.sameerasw.airsync.utils.WebSocketUtil.disconnect(context, manual = true)
gattServer?.disconnectAllConnectedDevices()
}

action == "playPause" -> com.sameerasw.airsync.utils.MediaControlUtil.playPause(context)
action == "next" -> com.sameerasw.airsync.utils.MediaControlUtil.skipNext(context)
action == "previous" -> com.sameerasw.airsync.utils.MediaControlUtil.skipPrevious(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ private fun ClipboardActionScreen(
ShortcutUtil.DASH_ACTION_PAUSE -> {
val ds = DataStoreManager.getInstance(context)
ds.setAppPaused(true)
ds.setUserManuallyDisconnected(true)
WebSocketUtil.stopAutoReconnect(context)
WebSocketUtil.disconnect(context)
WebSocketUtil.disconnect(context, manual = true)
com.sameerasw.airsync.utils.discovery.DiscoveryOrchestrator.stop(context)
com.sameerasw.airsync.service.AirSyncService.stop(context)
ShortcutUtil.refreshShortcuts(context, false)
Expand All @@ -185,9 +184,7 @@ private fun ClipboardActionScreen(
}

ShortcutUtil.DASH_ACTION_DISCONNECT -> {
val ds = DataStoreManager.getInstance(context)
ds.setUserManuallyDisconnected(true)
WebSocketUtil.disconnect(context)
WebSocketUtil.disconnect(context, manual = true)
uiState = ClipboardUiState.Success
delay(1200)
onFinished()
Expand Down
Loading
Loading