This commit is contained in:
Mateusz Hinc 2020-01-12 11:44:58 +01:00
parent 61f2af2cb9
commit bd164ff832
4 changed files with 18 additions and 10 deletions

View File

@ -77,7 +77,7 @@
<!-- <meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="@array/snap_connect_scopes" />-->
<provider
android:authorities="${applicationId}.fileprovider,pl.edu.amu.wmi.socialaggregator.activity.NewPostActivity"
android:authorities="${applicationId}.fileprovider"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">

View File

@ -16,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.Snackbar
import com.jakewharton.rxbinding2.view.RxView
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.BiFunction
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject
@ -75,12 +76,14 @@ class NewPostActivity : AppCompatActivity() {
}
.observeOn(Schedulers.io())
.doOnNext {
resumedSubject.zipWith(
resumedSubject
.zipWith(
Observable.fromIterable(availablesRecycler.chips.entries
.filter { (_, chip) -> chip.isChecked }
.map { it.key }),
BiFunction<Any, SocialPlatform, SocialPlatform> { _, t2 -> t2 }
)
.observeOn(Schedulers.io())
.doOnNext {
val bitmap = BitmapFactory.decodeFile(file!!)
it.addPost(
@ -90,8 +93,9 @@ class NewPostActivity : AppCompatActivity() {
listOf(file!!)
)
}
.take(availablesRecycler.chips.count { it.value.isChecked }.toLong())
.take(availablesRecycler.chips.count { it.value.isChecked }.toLong() + 1)
.toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { _ ->
finish()
}

View File

@ -47,6 +47,10 @@ class Snapchat : SocialPlatform {
SnapPhotoContent(photoFile!!)
}.first()
if (text.isNotBlank()) {
content.captionText = text
}
snapCreativeKitApi.sendWithCompletionHandler(
content,
object : SnapCreativeKitCompletionCallback {

View File

@ -1,8 +1,8 @@
<resources>
<string name="app_name">Social Aggregator</string>
<string name="title_activity_new_post">NewPostActivity</string>
<string name="title_activity_new_post">Create new post!</string>
<string name="title_activity_add_social">AddSocialActivity</string>
<string name="title_activity_post_history">PostHistoryActivity</string>
<string name="title_activity_post_history">Posts history</string>
<string name="facebook_app_id">2437098899888167</string>
<string name="fb_login_protocol_scheme">fb2437098899888167</string>