@@ -5,8 +5,6 @@ import android.content.Context
5
5
import android.content.Intent
6
6
import android.content.res.Configuration.UI_MODE_NIGHT_NO
7
7
import android.content.res.Configuration.UI_MODE_NIGHT_YES
8
- import android.graphics.Bitmap
9
- import android.graphics.BitmapFactory
10
8
import android.location.Location
11
9
import android.net.Uri
12
10
import androidx.activity.compose.BackHandler
@@ -80,7 +78,6 @@ import com.and04.naturealbum.utils.network.NetworkState
80
78
import com.and04.naturealbum.utils.network.NetworkState.DISCONNECTED
81
79
import com.google.firebase.auth.ktx.auth
82
80
import com.google.firebase.ktx.Firebase
83
- import java.io.IOException
84
81
import java.time.LocalDateTime
85
82
import java.time.format.DateTimeFormatter
86
83
@@ -89,7 +86,6 @@ fun SavePhotoScreen(
89
86
locationHandler : LocationHandler ,
90
87
location : Location ? ,
91
88
model : Uri ,
92
- fileName : String ,
93
89
onBack : () -> Unit ,
94
90
onSave : () -> Unit ,
95
91
onCancel : () -> Unit ,
@@ -141,7 +137,6 @@ fun SavePhotoScreen(
141
137
142
138
SavePhotoScreen (
143
139
model = model,
144
- fileName = fileName,
145
140
location = newLocation,
146
141
photoSaveState = photoSaveState,
147
142
rememberDescription = rememberDescription,
@@ -165,7 +160,6 @@ fun SavePhotoScreen(
165
160
@Composable
166
161
fun SavePhotoScreen (
167
162
model : Uri ,
168
- fileName : String ,
169
163
location : State <Location ?>,
170
164
rememberDescription : State <String >,
171
165
onDescriptionChange : (String ) -> Unit ,
@@ -200,8 +194,7 @@ fun SavePhotoScreen(
200
194
if (context.isPortrait()) {
201
195
SavePhotoScreenPortrait (
202
196
innerPadding = innerPadding,
203
- model = model,
204
- fileName = fileName,
197
+ uri = model,
205
198
label = label,
206
199
location = location.value!! ,
207
200
rememberDescription = rememberDescription,
@@ -216,8 +209,7 @@ fun SavePhotoScreen(
216
209
} else {
217
210
SavePhotoScreenLandscape (
218
211
innerPadding = innerPadding,
219
- model = model,
220
- fileName = fileName,
212
+ uri = model,
221
213
label = label,
222
214
location = location.value!! ,
223
215
rememberDescription = rememberDescription,
@@ -381,19 +373,9 @@ fun Description(
381
373
}
382
374
}
383
375
384
- private fun loadImageFromUri (context : Context , uri : Uri ): Bitmap ? {
385
- return try {
386
- context.contentResolver.openInputStream(uri)?.use { inputStream ->
387
- BitmapFactory .decodeStream(inputStream)
388
- }
389
- } catch (e: IOException ) {
390
- null
391
- }
392
- }
393
-
394
376
fun insertFirebaseService (
395
377
context : Context ,
396
- model : Uri ,
378
+ uri : String ,
397
379
fileName : String ,
398
380
label : Label ,
399
381
location : Location ,
@@ -403,7 +385,7 @@ fun insertFirebaseService(
403
385
if (Firebase .auth.currentUser == null || NetworkState .getNetWorkCode() == DISCONNECTED ) return
404
386
val newTime = time.format(DateTimeFormatter .ISO_LOCAL_DATE_TIME )
405
387
val intent = Intent (context, FirebaseInsertService ::class .java).apply {
406
- putExtra(SERVICE_URI , model.toString() )
388
+ putExtra(SERVICE_URI , uri )
407
389
putExtra(SERVICE_FILENAME , fileName)
408
390
putExtra(SERVICE_LABEL , label)
409
391
putExtra(SERVICE_LOCATION_LATITUDE , location.latitude)
@@ -428,7 +410,6 @@ private fun ScreenPreview() {
428
410
SavePhotoScreen (
429
411
model = " " .toUri(),
430
412
location = location,
431
- fileName = " fileName.jpg" ,
432
413
rememberDescription = rememberDescription,
433
414
onDescriptionChange = { },
434
415
isRepresented = isRepresented,
0 commit comments