Compare commits
No commits in common. "af25897bb5f5a915286e97f6b6701fdf2310dd02" and "bb9053fb61e97ab834040be3863877bbb95de60c" have entirely different histories.
af25897bb5
...
bb9053fb61
3 changed files with 8 additions and 19 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,6 +10,8 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
|
/app
|
||||||
|
/.gradle
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
|
|
@ -11,12 +11,10 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import okhttp3.Call
|
import okhttp3.Call
|
||||||
import okhttp3.Callback
|
import okhttp3.Callback
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.FormBody
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.json.JSONObject
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class ShareActivity : AppCompatActivity() {
|
class ShareActivity : AppCompatActivity() {
|
||||||
|
@ -46,16 +44,10 @@ class ShareActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private fun sendPostRequest(url: String, token: String, sharedText: String) {
|
private fun sendPostRequest(url: String, token: String, sharedText: String) {
|
||||||
isRequestRunning = true
|
isRequestRunning = true
|
||||||
val fullUrl = "$url/api/recipes/create/url"
|
val fullUrl = "$url/api/recipe/create/url"
|
||||||
|
val requestBody = FormBody.Builder()
|
||||||
// Create JSON object for the request body
|
.add("data", sharedText)
|
||||||
val jsonBody = JSONObject()
|
.build()
|
||||||
jsonBody.put("includeTags", false) // Set includeTags to false
|
|
||||||
jsonBody.put("url", sharedText) // Set the URL to the shared text
|
|
||||||
|
|
||||||
// Create the request body with JSON media type
|
|
||||||
val requestBody = jsonBody.toString()
|
|
||||||
.toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull())
|
|
||||||
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(fullUrl)
|
.url(fullUrl)
|
||||||
|
@ -108,7 +100,7 @@ class ShareActivity : AppCompatActivity() {
|
||||||
val notification = NotificationCompat.Builder(this, channelId)
|
val notification = NotificationCompat.Builder(this, channelId)
|
||||||
.setContentTitle("Mealie URL Share")
|
.setContentTitle("Mealie URL Share")
|
||||||
.setContentText(message)
|
.setContentText(message)
|
||||||
.setSmallIcon(R.drawable.baseline_error_24) // Replace with your notification icon
|
//.setSmallIcon(R.drawable.ic_notification) // Replace with your notification icon
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
|
||||||
|
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
Loading…
Reference in a new issue