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
10 changes: 10 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.google.ksp)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.wire)
}

android {
Expand Down Expand Up @@ -150,4 +151,13 @@ dependencies {
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

implementation(libs.wire.runtime)
implementation(libs.bouncycastle)
}

wire {
kotlin {
// Wire defaults to current project's proto directory
}
}
34 changes: 10 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
<uses-permission android:name="android.permission.POST_PROMOTED_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_WALLPAPER_INTERNAL" />



<!-- Permission for downloading updates -->
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />

Expand Down Expand Up @@ -87,30 +89,7 @@
</intent-filter>
</activity>

<!-- Share target activity for text sharing -->
<activity
android:name=".presentation.ui.activities.ShareActivity"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<!-- Accept any single file type -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- Accept multiple files -->
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>


<activity
android:name=".presentation.ui.activities.ClipboardActionActivity"
Expand Down Expand Up @@ -181,6 +160,8 @@
</intent-filter>
</service>



<!-- Wake-up Service for receiving reconnection requests from Mac -->
<service
android:name=".service.WakeupService"
Expand All @@ -192,6 +173,11 @@
android:exported="false"
android:foregroundServiceType="connectedDevice" />

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

<!-- Call Receiver - listens for telephony events -->
<receiver
android:name=".service.CallReceiver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class DataStoreManager(private val context: Context) {
private val USE_BLUR = booleanPreferencesKey("use_blur")
private val PITCH_BLACK_THEME = booleanPreferencesKey("pitch_black_theme")
private val SENTRY_REPORTING_ENABLED = booleanPreferencesKey("sentry_reporting_enabled")
private val QUICK_SHARE_ENABLED = booleanPreferencesKey("quick_share_enabled")

// Widget preferences
private val WIDGET_TRANSPARENCY = androidx.datastore.preferences.core.floatPreferencesKey("widget_transparency")
Expand Down Expand Up @@ -328,6 +329,18 @@ class DataStoreManager(private val context: Context) {
}
}

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

fun isQuickShareEnabled(): Flow<Boolean> {
return context.dataStore.data.map { preferences ->
preferences[QUICK_SHARE_ENABLED] ?: false // Default to disabled
}
}

suspend fun setDefaultTab(tab: String) {
context.dataStore.edit { prefs ->
prefs[DEFAULT_TAB] = tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,12 @@ class AirSyncRepositoryImpl(
override fun hasRatedApp(): Flow<Boolean> {
return dataStoreManager.hasRatedApp()
}

override suspend fun setQuickShareEnabled(enabled: Boolean) {
dataStoreManager.setQuickShareEnabled(enabled)
}

override fun isQuickShareEnabled(): Flow<Boolean> {
return dataStoreManager.isQuickShareEnabled()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ data class UiState(
val isBlurEnabled: Boolean = true,
val isSentryReportingEnabled: Boolean = true,
val isOnboardingCompleted: Boolean = true,
val widgetTransparency: Float = 1f
val widgetTransparency: Float = 1f,
val isQuickShareEnabled: Boolean = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ interface AirSyncRepository {
fun getLastPromptDismissedVersion(): Flow<Int>
suspend fun setHasRatedApp(hasRated: Boolean)
fun hasRatedApp(): Flow<Boolean>

// Quick Share (receiving)
suspend fun setQuickShareEnabled(enabled: Boolean)
fun isQuickShareEnabled(): Flow<Boolean>
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.foundation.text.ClickableText
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
import com.sameerasw.airsync.R
Expand Down Expand Up @@ -166,6 +173,44 @@ fun AboutSection(
)
}

val creditText = stringResource(id = R.string.label_app_icon_credits)
val annotatedString = buildAnnotatedString {
append(creditText)
val startIndex = creditText.indexOf("@Syntrop2k2")
val endIndex = startIndex + "@Syntrop2k2".length
if (startIndex != -1) {
addStringAnnotation(
tag = "URL",
annotation = stringResource(id = R.string.url_syntrop_telegram),
start = startIndex,
end = endIndex
)
addStyle(
style = SpanStyle(
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.Bold,
textDecoration = TextDecoration.Underline
),
start = startIndex,
end = endIndex
)
}
}

ClickableText(
text = annotatedString,
style = MaterialTheme.typography.bodyMedium.copy(
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
),
onClick = { offset ->
annotatedString.getStringAnnotations(tag = "URL", start = offset, end = offset)
.firstOrNull()?.let { annotation ->
openUrl(context, annotation.item)
}
}
)

Text(
text = "Other Apps",
style = MaterialTheme.typography.titleMedium,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ fun SettingsView(
isClipboardTileAdded = com.sameerasw.airsync.utils.QuickSettingsUtil.isQSTileAdded(
context,
com.sameerasw.airsync.service.ClipboardTileService::class.java
),
isQuickShareTileAdded = com.sameerasw.airsync.utils.QuickSettingsUtil.isQSTileAdded(
context,

)
)
}
Expand Down Expand Up @@ -256,6 +260,15 @@ fun SettingsView(
viewModel.setMacMediaControlsEnabled(enabled)
}
)

SendNowPlayingCard(
isSendNowPlayingEnabled = uiState.isQuickShareEnabled,
onToggleSendNowPlaying = { enabled: Boolean ->
viewModel.setQuickShareEnabled(context, enabled)
},
title = "Quick Share",
subtitle = "Allow receiving files from nearby devices"
)
}
}

Expand Down
Loading