Skip to content

Commit 64b87f9

Browse files
authored
Merge pull request #321 from ghostbyte-dev/dev
Dev
2 parents 29a3f1a + 3597c6d commit 64b87f9

File tree

53 files changed

+632
-1177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+632
-1177
lines changed

.github/workflows/crowdin.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ on:
44
push:
55
branches: [ dev ]
66
workflow_dispatch:
7-
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
812
jobs:
913
synchronize-with-crowdin:
1014
runs-on: ubuntu-latest

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
Pixelix is an Android client for [Pixelfed](https://pixelfed.org/), the federated image-sharing social network.
44
It's designed to provide a seamless and high-performance user experience. With Pixelix, you can easily browse, post, and interact with your Pixelfed network on the go.
55

6+
7+
<a href="https://apps.apple.com/app/pixelix-a-pixelfed-client/id6743839819"><img alt="Get it on Google Play" src="https://github.com/ghostbyte-dev/pixelix/blob/db447657e1abd8ec90bbd1e1ca9edac4bb930878/appstorebadgewhite.svg" height="42" align="middle"></a>
8+
<a href="https://play.google.com/store/apps/details?id=com.daniebeler.pfpixelix"><img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" height="60" align="middle"></a>
9+
610
<a href="https://f-droid.org/packages/com.daniebeler.pfpixelix"><img alt="Get it on F-Droid" src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="60" align="middle"></a>
711
<a href="https://github.com/ImranR98/Obtainium/releases"><img alt="Get it on Obtainium banner" src="https://github.com/user-attachments/assets/58fd5f7e-8136-4e92-a462-c7977e119602" height="40" align="middle"/></a>
8-
<a href="https://play.google.com/store/apps/details?id=com.daniebeler.pfpixelix"><img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" height="60" align="middle"></a>
912
<a href="https://apt.izzysoft.de/fdroid/index/apk/com.daniebeler.pfpixelix"><img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" alt="Get it from IzzyOnDroid" height="60" align="middle"></a>
1013

1114
## Please donate

app/build.gradle.kts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import com.google.devtools.ksp.gradle.KspAATask
12
import org.jetbrains.compose.desktop.application.dsl.TargetFormat.*
23

34
plugins {
@@ -93,6 +94,9 @@ kotlin {
9394

9495
//image crop
9596
implementation(libs.krop)
97+
98+
//video player
99+
implementation(libs.composemediaplayer)
96100
}
97101

98102
androidMain.dependencies {
@@ -111,12 +115,8 @@ kotlin {
111115
implementation(libs.material)
112116

113117
//media
114-
implementation(libs.androidx.media3.exoplayer)
115-
implementation(libs.androidx.media3.exoplayer.dash)
116-
implementation(libs.androidx.media3.ui)
117-
implementation(libs.android.image.cropper)
118-
implementation(libs.coil.video)
119118
implementation(libs.coil.gif)
119+
implementation(libs.coil.video)
120120

121121
// widget
122122
implementation(libs.androidx.glance.appwidget)
@@ -133,11 +133,7 @@ kotlin {
133133
implementation(compose.desktop.currentOs)
134134
implementation(libs.kotlinx.coroutines.swing)
135135
implementation(libs.ktor.client.okhttp)
136-
implementation(libs.appdirs)
137136
implementation(libs.slf4j.simple)
138-
implementation(libs.vlcj)
139-
implementation(libs.jna)
140-
implementation(libs.jna.platform)
141137
}
142138
}
143139

@@ -154,8 +150,8 @@ android {
154150
applicationId = "com.daniebeler.pfpixelix"
155151
minSdk = 26
156152
targetSdk = 35
157-
versionCode = 31
158-
versionName = "4.1.0"
153+
versionCode = 32
154+
versionName = "4.1.1"
159155

160156
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
161157
vectorDrawables {
@@ -183,6 +179,9 @@ android {
183179
isDebuggable = false
184180
isProfileable = false
185181
isShrinkResources = true
182+
proguardFiles(
183+
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
184+
)
186185
}
187186
}
188187
packaging.resources {
@@ -243,3 +242,8 @@ compose.desktop {
243242
}
244243
}
245244
}
245+
246+
tasks.configureEach {
247+
if (this is KspAATask && name != "kspCommonMainKotlinMetadata")
248+
dependsOn("kspCommonMainKotlinMetadata")
249+
}

app/proguard-rules.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
22+
-dontobfuscate

app/src/androidMain/AndroidManifest.xml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
<intent-filter>
4242
<category android:name="android.intent.category.LAUNCHER" />
4343
</intent-filter>
44+
<intent-filter>
45+
<category android:name="android.intent.category.DEFAULT" />
46+
<data android:mimeType="image/*" />
47+
</intent-filter>
48+
4449
<intent-filter>
4550
<action android:name="android.intent.action.SEND" />
4651
<category android:name="android.intent.category.DEFAULT" />
@@ -64,20 +69,10 @@
6469
<category android:name="android.intent.category.DEFAULT" />
6570
<data android:mimeType="video/*" />
6671
</intent-filter>
67-
<intent-filter>
68-
<action android:name="android.intent.action.VIEW" />
69-
70-
<category android:name="android.intent.category.BROWSABLE" />
71-
<category android:name="android.intent.category.DEFAULT" />
72-
73-
<data
74-
android:host="callback"
75-
android:scheme="pixelix-android-auth" />
76-
</intent-filter>
7772
</activity>
7873

7974
<activity-alias
80-
android:name=".AppActivity"
75+
android:name=".Icon02"
8176
android:exported="true"
8277
android:enabled="true"
8378
android:icon="@mipmap/ic_launcher_02"
@@ -315,6 +310,16 @@
315310
android:authorities="${applicationId}.androidx-startup"
316311
tools:node="remove">
317312
</provider>
313+
<provider
314+
android:name="androidx.core.content.FileProvider"
315+
android:authorities="${applicationId}.provider"
316+
android:exported="false"
317+
android:grantUriPermissions="true">
318+
<meta-data
319+
android:name="android.support.FILE_PROVIDER_PATHS"
320+
android:resource="@xml/file_paths" />
321+
</provider>
322+
318323
<provider
319324
android:name="androidx.core.content.FileProvider"
320325
android:authorities="com.example.android.appwidget.fileprovider"

app/src/androidMain/kotlin/com/daniebeler/pfpixelix/AppActivity.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,44 @@ import android.content.Intent
55
import android.net.Uri
66
import android.os.Build
77
import android.os.Bundle
8-
import android.view.View
9-
import android.view.ViewGroup
10-
import android.view.WindowManager
118
import androidx.activity.ComponentActivity
129
import androidx.activity.compose.setContent
1310
import androidx.activity.enableEdgeToEdge
14-
import androidx.compose.runtime.Composable
15-
import androidx.compose.ui.ExperimentalComposeUiApi
16-
import androidx.compose.ui.platform.LocalView
17-
import androidx.compose.ui.window.Dialog
1811
import androidx.compose.ui.window.DialogProperties
19-
import androidx.compose.ui.window.DialogWindowProvider
12+
import androidx.core.content.FileProvider
13+
import io.github.vinceglb.filekit.FileKit
14+
import io.github.vinceglb.filekit.dialogs.init
2015
import java.io.File
2116
import java.io.FileOutputStream
2217
import java.io.InputStream
2318
import java.lang.ref.WeakReference
2419

2520
class AppActivity : ComponentActivity() {
2621
override fun onCreate(savedInstanceState: Bundle?) {
22+
FileKit.init(this)
2723
MyApplication.currentActivity = WeakReference(this)
2824
super.onCreate(savedInstanceState)
2925
enableEdgeToEdge()
3026
setContent {
3127
App(MyApplication.appComponent) { finish() }
3228
}
3329
if (savedInstanceState == null) {
34-
handleNewIntent(intent)
30+
handleNewIntent(intent, this)
3531
}
3632
}
3733

3834
override fun onNewIntent(intent: Intent) {
3935
super.onNewIntent(intent)
40-
handleNewIntent(intent)
36+
handleNewIntent(intent, this)
4137
}
4238

43-
private fun handleNewIntent(intent: Intent) {
39+
private fun handleNewIntent(intent: Intent, appActivity: AppActivity) {
4440
when (intent.action) {
4541
Intent.ACTION_VIEW -> {
4642
intent.dataString?.let { onExternalUrl(it) }
4743
}
4844
Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE -> {
49-
val imageUris = handleSharePhotoIntent(intent, contentResolver, cacheDir)
45+
val imageUris = handleSharePhotoIntent(intent, contentResolver, cacheDir, appActivity)
5046
if (imageUris.isNotEmpty()) {
5147
imageUris.forEach { uri ->
5248
try {
@@ -85,15 +81,19 @@ actual fun EdgeToEdgeDialogProperties(
8581
decorFitsSystemWindows = false
8682
)
8783

88-
private fun saveUriToCache(uri: Uri, contentResolver: ContentResolver, cacheDir: File): Uri? {
84+
private fun saveUriToCache(uri: Uri, contentResolver: ContentResolver, cacheDir: File, appActivity: AppActivity): Uri? {
8985
try {
9086
val inputStream: InputStream? = contentResolver.openInputStream(uri)
9187
inputStream?.use { input ->
9288
val file = File(cacheDir, "shared_image_${System.currentTimeMillis()}.jpg")
9389
FileOutputStream(file).use { output ->
9490
input.copyTo(output)
9591
}
96-
return Uri.fromFile(file) // Return the new cached URI
92+
return FileProvider.getUriForFile(
93+
appActivity,
94+
"${appActivity.packageName}.provider",
95+
file
96+
)
9797
}
9898
} catch (e: Exception) {
9999
e.printStackTrace()
@@ -102,7 +102,7 @@ private fun saveUriToCache(uri: Uri, contentResolver: ContentResolver, cacheDir:
102102
}
103103

104104
private fun handleSharePhotoIntent(
105-
intent: Intent, contentResolver: ContentResolver, cacheDir: File
105+
intent: Intent, contentResolver: ContentResolver, cacheDir: File, appActivity: AppActivity
106106
): List<Uri> {
107107
val action = intent.action
108108
val type = intent.type
@@ -122,7 +122,7 @@ private fun handleSharePhotoIntent(
122122
) as? Uri
123123
}
124124
singleUri?.let { uri ->
125-
val cachedUri = saveUriToCache(uri, contentResolver, cacheDir)
125+
val cachedUri = saveUriToCache(uri, contentResolver, cacheDir, appActivity)
126126
imageUris =
127127
cachedUri?.let { listOf(it) } ?: emptyList() // Wrap single image in a list
128128
}
@@ -141,7 +141,7 @@ private fun handleSharePhotoIntent(
141141
}
142142
imageUris = receivedUris?.mapNotNull {
143143
saveUriToCache(
144-
it, contentResolver, cacheDir
144+
it, contentResolver, cacheDir, appActivity
145145
)
146146
} ?: emptyList()
147147
}

app/src/androidMain/kotlin/com/daniebeler/pfpixelix/MyApplication.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.daniebeler.pfpixelix
22

3-
import android.app.Activity
43
import android.app.Application
54
import android.content.Context
65
import androidx.activity.ComponentActivity
@@ -11,7 +10,6 @@ import androidx.work.WorkerParameters
1110
import coil3.SingletonImageLoader
1211
import com.daniebeler.pfpixelix.di.AppComponent
1312
import com.daniebeler.pfpixelix.di.create
14-
import com.daniebeler.pfpixelix.domain.service.file.AndroidFileService
1513
import com.daniebeler.pfpixelix.domain.service.icon.AndroidAppIconManager
1614
import com.daniebeler.pfpixelix.utils.configureLogger
1715
import com.daniebeler.pfpixelix.widget.notifications.work_manager.LatestImageTask
@@ -28,7 +26,6 @@ class MyApplication : Application(), Configuration.Provider {
2826
override fun onCreate() {
2927
appComponent = AppComponent.create(
3028
this,
31-
AndroidFileService(this),
3229
AndroidAppIconManager(this)
3330
)
3431
SingletonImageLoader.setSafe {

0 commit comments

Comments
 (0)