Skip to content

Commit

Permalink
Merge branch 'trunk' into address_gradle_build_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba authored Aug 26, 2024
2 parents c6c32e4 + a2a5b03 commit 93d75f3
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 60 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]

25.4
-----


25.3
-----
* [**] [internal] Set remaining foreground service types for Android 14 [https://github.com/wordpress-mobile/WordPress-Android/pull/21047]
Expand Down
19 changes: 8 additions & 11 deletions WordPress/jetpack_metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Jetpack - Apps - Android - Release Notes\n"

msgctxt "release_note_253"
msgid ""
"25.3:\n"
"Fixed an annoying bug where users would be repeatedly prompted for feedback.\n"
"Android 14 improvements.\n"
"Improved the user feedback form – please feel free to suggest anything that would make the app better for you!\n"
msgstr ""

msgctxt "release_note_252"
msgid ""
"25.2:\n"
Expand All @@ -19,17 +27,6 @@ msgid ""
"As always, please reach out to support if anything isn't working right!\n"
msgstr ""

msgctxt "release_note_251"
msgid ""
"25.1:\n"
"We have no updates in a house.\n"
"We have no updates with a mouse.\n"
"We have no updates here or there.\n"
"We have no updates anywhere.\n"
"We have no updates to report.\n"
"If you need help, ask tech support.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Title to be displayed in the Play Store. Limit to 30 characters including spaces and commas!
msgctxt "play_store_app_title"
Expand Down
7 changes: 3 additions & 4 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
We fixed two big issues in this release:
* You can now update a publish post's date again.
* Some users couldn't update their post's content.
As always, please reach out to support if anything isn't working right!
Fixed an annoying bug where users would be repeatedly prompted for feedback.
Android 14 improvements.
Improved the user feedback form – please feel free to suggest anything that would make the app better for you!
19 changes: 8 additions & 11 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

msgctxt "release_note_253"
msgid ""
"25.3:\n"
"Fixed an annoying bug where users would be repeatedly prompted for feedback.\n"
"Android 14 improvements.\n"
"Improved the user feedback form – please feel free to suggest anything that would make the app better for you!\n"
msgstr ""

msgctxt "release_note_252"
msgid ""
"25.2:\n"
Expand All @@ -19,17 +27,6 @@ msgid ""
"As always, please reach out to support if anything isn't working right!\n"
msgstr ""

msgctxt "release_note_251"
msgid ""
"25.1:\n"
"We have no updates in a house.\n"
"We have no updates with a mouse.\n"
"We have no updates here or there.\n"
"We have no updates anywhere.\n"
"We have no updates to report.\n"
"If you need help, ask tech support.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Shorter Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "sample_post_content"
Expand Down
7 changes: 3 additions & 4 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
We fixed two big issues in this release:
* You can now update a publish post's date again.
* Some users couldn't update their post's content.
As always, please reach out to support if anything isn't working right!
Fixed an annoying bug where users would be repeatedly prompted for feedback.
Android 14 improvements.
Improved the user feedback form – please feel free to suggest anything that would make the app better for you!
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package org.wordpress.android.ui.main.feedbackform

import android.net.Uri
import java.io.File

data class FeedbackFormAttachment(
val uri: Uri,
val tempFile: File,
val mimeType: String,
val attachmentType: FeedbackFormAttachmentType,
val size: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.flow.MutableStateFlow
import org.wordpress.android.R
import org.wordpress.android.ui.compose.components.MediaUriPager
import org.wordpress.android.ui.compose.components.ProgressDialog
import org.wordpress.android.ui.compose.components.ProgressDialogState
import org.wordpress.android.ui.compose.components.MediaUriPager
import org.wordpress.android.ui.compose.theme.M3Theme
import java.io.File

@Composable
fun FeedbackFormScreen(
Expand Down Expand Up @@ -243,14 +242,12 @@ private fun FeedbackFormScreenPreview() {
attachmentType = FeedbackFormAttachmentType.IMAGE,
size = 123456789,
mimeType = "image/jpeg",
tempFile = File("/tmp/attachment.jpg")
)
val attachment2 = FeedbackFormAttachment(
uri = Uri.parse("https://via.placeholder.com/150"),
attachmentType = FeedbackFormAttachmentType.VIDEO,
size = 123456789,
mimeType = "video/mp4",
tempFile = File("/tmp/attachment.mp4")
)
val attachments = MutableStateFlow(listOf(attachment1, attachment2))
val messageText = MutableStateFlow("I love this app!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.wordpress.android.util.extensions.copyToTempFile
import org.wordpress.android.util.extensions.fileSize
import org.wordpress.android.util.extensions.mimeType
import org.wordpress.android.viewmodel.ScopedViewModel
import java.io.File
import java.io.IOException
import javax.inject.Inject
import javax.inject.Named
Expand Down Expand Up @@ -76,26 +77,58 @@ class FeedbackFormViewModel @Inject constructor(
if (_attachments.value.isNotEmpty()) {
showProgressDialog(R.string.uploading)
launch {
val files = _attachments.value.map { it.tempFile }
val tempFiles = createAttachmentTempFiles(context)
try {
val tokens = zendeskUploadHelper.uploadFileAttachments(files)
withContext(Dispatchers.Main) {
createZendeskFeedbackRequest(
context = context,
attachmentTokens = tokens
)
try {
val tokens = zendeskUploadHelper.uploadFileAttachments(tempFiles)
withContext(Dispatchers.Main) {
createZendeskFeedbackRequest(
context = context,
attachmentTokens = tokens
)
}
} catch (e: IOException) {
hideProgressDialog()
onFailure(context, e.message)
return@launch
}
} catch (e: IOException) {
hideProgressDialog()
onFailure(context, e.message)
return@launch
} finally {
deleteTempFiles(tempFiles)
}
}
} else {
createZendeskFeedbackRequest(context)
}
}

/**
* Creates temporary files for each attachment and returns a list of their paths
*/
private fun createAttachmentTempFiles(context: Context): List<File> {
val tempFiles = ArrayList<File>()
val uris = _attachments.value.map { it.uri }
for (uri in uris) {
uri.copyToTempFile(context)?.let {
tempFiles.add(it)
} ?: appLogWrapper.e(T.SUPPORT, "Failed to copy attachment to temp file: $uri")
}
return tempFiles
}

private fun deleteTempFiles(files: List<File>) {
for (file in files) {
try {
if (file.exists()) {
file.delete()
}
} catch (e: SecurityException) {
appLogWrapper.e(T.SUPPORT, "Failed to delete temp file")
} catch (e: IOException) {
appLogWrapper.e(T.SUPPORT, "Failed to delete temp file")
}
}
}

private fun createZendeskFeedbackRequest(
context: Context,
attachmentTokens: List<String> = emptyList()
Expand Down Expand Up @@ -226,12 +259,6 @@ class FeedbackFormViewModel @Inject constructor(
return false
}

val file = uri.copyToTempFile(context)
if (file == null) {
showToast(R.string.feedback_form_unable_to_create_tempfile)
return false
}

val attachmentType = if (mimeType.startsWith("video")) {
FeedbackFormAttachmentType.VIDEO
} else {
Expand All @@ -240,7 +267,6 @@ class FeedbackFormViewModel @Inject constructor(
list.add(
FeedbackFormAttachment(
uri = uri,
tempFile = file,
size = fileSize,
mimeType = mimeType,
attachmentType = attachmentType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.android.ui.prefs;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
Expand Down Expand Up @@ -71,6 +72,7 @@ protected void onBindView(@NonNull View view) {
}

// style custom switch preference
@SuppressLint("UseSwitchCompatOrMaterialCode")
Switch switchControl = getSwitch((ViewGroup) view);
if (switchControl != null) {
if (mThumbTint != null) {
Expand All @@ -90,6 +92,7 @@ private Switch getSwitch(ViewGroup parentView) {
if (childView instanceof Switch) {
return (Switch) childView;
} else if (childView instanceof ViewGroup) {
@SuppressLint("UseSwitchCompatOrMaterialCode")
Switch theSwitch = getSwitch((ViewGroup) childView);
if (theSwitch != null) {
return theSwitch;
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ ext {
gravatarVersion = '1.0.0'

// debug
flipperVersion = '0.247.0'
flipperVersion = '0.262.0'
soLoaderVersion = '0.10.5'

// main
androidInstallReferrerVersion = '2.2'
androidVolleyVersion = '1.2.1'
androidxAnnotationVersion = '1.8.0'
androidxAppcompatVersion = '1.6.1'
androidxAppcompatVersion = '1.7.0'
androidxArchCoreVersion = '2.2.0'
androidxCameraVersion = '1.3.4'
androidxComposeBomVersion = '2023.10.00'
Expand All @@ -62,7 +62,7 @@ ext {
androidxRecyclerviewVersion = '1.3.2'
androidxSwipeToRefreshVersion = '1.1.0'
androidxViewpager2Version = '1.0.0'
androidxWorkManagerVersion = "2.9.0"
androidxWorkManagerVersion = "2.9.1"
androidxComposeMaterial3Version = '1.2.1'
androidxWebkitVersion = '1.11.0'
apacheCommonsTextVersion = '1.12.0'
Expand All @@ -76,7 +76,7 @@ ext {
googleAutoServiceVersion = '1.0.1'
googleExoPlayerVersion = '2.13.3'
googleFlexboxlayoutVersion = '3.0.0'
googleGsonVersion = '2.10.1'
googleGsonVersion = '2.11.0'
googleMaterialVersion = '1.9.0'

googleMLKitBarcodeScanningVersion = '17.2.0'
Expand Down
18 changes: 18 additions & 0 deletions fastlane/resources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<string name="status_and_visibility">Status &amp; Visibility</string>
<string name="free">Free</string>
<string name="dismiss">Dismiss</string>
<string name="sending">Sending</string>

<string name="button_not_now">Not now</string>
<string name="button_skip">Skip</string>
Expand Down Expand Up @@ -617,6 +618,8 @@
<string name="weeks_quantity_one">1 week</string>
<string name="weeks_quantity_other">%d weeks</string>
<string name="https" translatable="false">https:\/\/</string>
<string name="close">Close</string>
<string name="submit">Submit</string>

<!-- PreferenceCategory Headers -->
<string name="site_settings_general_header">General</string>
Expand Down Expand Up @@ -1126,6 +1129,20 @@
<string name="jetpack_plugin_install_error_button_retry">Retry</string>
<string name="jetpack_plugin_install_error_button_contact_support">Contact Support</string>

<!-- feedback form -->
<string name="feedback_form_title">Feedback</string>
<string name="feedback_form_message_hint">Your feedback is appreciated!</string>
<string name="feedback_form_discard">Discard your feedback?</string>
<string name="feedback_form_success">Thanks for submitting your feedback!</string>
<string name="feedback_form_failure">We were unable to submit your feedback</string>
<string name="feedback_form_max_attachments_reached">Maximum number of attachments reached</string>
<string name="feedback_form_unsupported_attachment">This file type is not supported</string>
<string name="feedback_form_attachment_too_large">Attachments must be 32MB or smaller</string>
<string name="feedback_form_attachment_already_added">Attachment already added</string>
<string name="feedback_form_unable_to_create_tempfile">Unable to create temporary file</string>
<string name="feedback_form_add_attachments">Add attachments</string>
<string name="media_pager_remove_item_content_description">Remove item %1$d</string>

<!-- activity log -->
<string name="activity_log">Activity Log</string>
<string name="activity_log_icon">Activity icon</string>
Expand Down Expand Up @@ -2557,6 +2574,7 @@
<string name="me_profile_photo">Profile Photo</string>
<string name="me_btn_app_settings">App Settings</string>
<string name="me_btn_help">Help</string>
<string name="me_btn_feedback">Send feedback</string>
<string name="me_btn_share">Share WordPress with a friend</string>
<string name="me_btn_about">About WordPress</string>
<string name="me_btn_login_logout">Login/Logout</string>
Expand Down
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
versionName=25.2.1
versionCode=1444
versionName=25.3-rc-1
versionCode=1445

0 comments on commit 93d75f3

Please sign in to comment.