Skip to content

Commit

Permalink
#17 in progress - hotfixes and updated movies
Browse files Browse the repository at this point in the history
  • Loading branch information
mjureczko committed Sep 10, 2024
1 parent 5b60bf3 commit aecad44
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "pl.marianjureczko.poszukiwacz"
minSdkVersion 23
targetSdkVersion 34
versionCode 3
versionName "0.3"
versionCode 5
versionName "0.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [facebookToken: FACEBOOK_TOKEN]
}
Expand Down Expand Up @@ -129,7 +129,7 @@ dependencies {
implementation 'androidx.hilt:hilt-navigation-compose:1.1.0-alpha01'
implementation 'com.google.accompanist:accompanist-permissions:0.30.1'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.mapbox.maps:android:10.8.1'
implementation 'com.mapbox.maps:android:10.18.0'
implementation 'com.facebook.android:facebook-share:latest.release'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
Expand Down
Binary file modified app/src/kalinowice/assets/kalinowice_07.mp4
Binary file not shown.
Binary file modified app/src/kalinowice/assets/kalinowice_11.mp4
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pl.marianjureczko.poszukiwacz.activity.facebook.n

import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
Expand Down Expand Up @@ -117,9 +118,10 @@ private fun ShareOnFacebookButton(model: FacebookReportModel) {
Box {
val context = LocalContext.current
val sharingErrorMsg = stringResource(R.string.facebook_share_error)
val noFacebookErrorMsg = stringResource(id = R.string.facebook_share_impossible)
LargeButton(R.string.share_button) {
ReportGenerator().create(context, model) { bitmap ->
FacebookShareHelper.shareBitmapOnFacebook(context, bitmap, sharingErrorMsg)
FacebookShareHelper.shareBitmapOnFacebook(context, bitmap, sharingErrorMsg, noFacebookErrorMsg)
}
}
FacebookImage(Modifier.align(AbsoluteAlignment.CenterLeft))
Expand Down Expand Up @@ -185,8 +187,7 @@ fun FacebookElement(it: ElementDescription, viewModel: FacebookViewModel, onRota
modifier = Modifier
.padding(1.dp)
.height(60.dp)
.clickable { onRotatePhoto(it.index) }
,
.clickable { onRotatePhoto(it.index) },
contentScale = ContentScale.Inside
)
}
Expand All @@ -196,10 +197,14 @@ fun FacebookElement(it: ElementDescription, viewModel: FacebookViewModel, onRota

object FacebookShareHelper {

fun shareBitmapOnFacebook(context: Context, bitmap: Bitmap, errorMsg: String) {
fun shareBitmapOnFacebook(context: Context, bitmap: Bitmap, errorMsg: String, noFacebookErrorMsg: String) {
val uri = bitmapToUri(context, bitmap)
if (uri != null) {
shareContent(context, uri)
try {
shareContent(context, uri)
} catch (ex: ActivityNotFoundException) {
Toast.makeText(context, noFacebookErrorMsg, Toast.LENGTH_LONG).show()
}
} else {
Toast.makeText(context, errorMsg, Toast.LENGTH_LONG).show()
}
Expand Down

0 comments on commit aecad44

Please sign in to comment.