parent
2e08a9ee87
commit
f55137b422
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Proton Technologies AG
|
||||
*
|
||||
*
|
||||
* This file is part of ProtonMail.
|
||||
*
|
||||
*
|
||||
* ProtonMail is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* ProtonMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
@ -84,7 +84,6 @@ class PaymentTokenApprovalActivity : BaseActivity() {
|
|||
|
||||
private val handler = Handler()
|
||||
private lateinit var paymentToken: String
|
||||
private lateinit var paymentType: String
|
||||
private lateinit var paymentReturnHost: String
|
||||
private var cancelled = false
|
||||
private var pollingStartTimestamp = 0L
|
||||
|
@ -99,9 +98,8 @@ class PaymentTokenApprovalActivity : BaseActivity() {
|
|||
webView.loadUrl(this.toString())
|
||||
}
|
||||
|
||||
paymentToken = intent.getStringExtra(EXTRA_PAYMENT_TOKEN)
|
||||
paymentType = intent.getStringExtra(EXTRA_PAYMENT_TYPE_STRING)
|
||||
paymentReturnHost = intent.getStringExtra(EXTRA_PAYMENT_RETURN_HOST_STRING)
|
||||
paymentToken = intent.getStringExtra(EXTRA_PAYMENT_TOKEN) ?: ""
|
||||
paymentReturnHost = intent.getStringExtra(EXTRA_PAYMENT_RETURN_HOST_STRING) ?: ""
|
||||
}
|
||||
|
||||
private val checkStatusRunnable = object : Runnable {
|
||||
|
|
|
@ -728,14 +728,14 @@ class MailboxActivity : NavigationActivity(),
|
|||
super.onNewIntent(intent)
|
||||
// force reload of MessageDetailsRepository's internal dependencies in case we just switched user
|
||||
if (intent.extras != null && intent.extras!!.containsKey(EXTRA_SWITCHED_TO_USER)) {
|
||||
switchAccountProcedure(intent.getStringExtra(EXTRA_SWITCHED_TO_USER))
|
||||
switchAccountProcedure(intent.getStringExtra(EXTRA_SWITCHED_TO_USER)!!)
|
||||
} else if (intent.getBooleanExtra(EXTRA_SWITCHED_USER, false)) {
|
||||
onSwitchedAccounts()
|
||||
} else if (intent.getBooleanExtra(EXTRA_LOGOUT, false)) {
|
||||
onLogout()
|
||||
} else if (intent.extras != null && intent.extras!!.containsKey(EXTRA_USERNAME)) {
|
||||
if (mUserManager.username != intent.getStringExtra(EXTRA_USERNAME)) {
|
||||
switchAccountProcedure(intent.getStringExtra(EXTRA_USERNAME))
|
||||
switchAccountProcedure(intent.getStringExtra(EXTRA_USERNAME)!!)
|
||||
}
|
||||
} else {
|
||||
checkRegistration()
|
||||
|
@ -1610,8 +1610,7 @@ class MailboxActivity : NavigationActivity(),
|
|||
}
|
||||
REQUEST_CODE_VALIDATE_PIN -> {
|
||||
if (data!!.hasExtra(EXTRA_TOTAL_COUNT_EVENT)) {
|
||||
val totalCountEvent: Any = data.getSerializableExtra(
|
||||
EXTRA_TOTAL_COUNT_EVENT)
|
||||
val totalCountEvent: Any? = data.getSerializableExtra(EXTRA_TOTAL_COUNT_EVENT)
|
||||
if (totalCountEvent is MessageCountsEvent) {
|
||||
onMessageCountsEvent(totalCountEvent)
|
||||
}
|
||||
|
@ -1684,7 +1683,7 @@ class MailboxActivity : NavigationActivity(),
|
|||
var errorText = getString(R.string.message_drafted)
|
||||
if (intent.hasExtra(Constants.ERROR)) {
|
||||
val extraText = intent.getStringExtra(Constants.ERROR)
|
||||
if (extraText.isNotEmpty()) {
|
||||
if (!extraText.isNullOrEmpty()) {
|
||||
errorText = extraText
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ internal class MessageDetailsActivity : BaseStoragePermissionActivity(),
|
|||
mUserManager.firstMessageDetailsDone()
|
||||
}
|
||||
markAsRead = true
|
||||
messageId = intent.getStringExtra(EXTRA_MESSAGE_ID)
|
||||
messageId = intent.getStringExtra(EXTRA_MESSAGE_ID)!!
|
||||
messageRecipientUsername = intent.getStringExtra(EXTRA_MESSAGE_RECIPIENT_USERNAME)
|
||||
val currentAccountUsername = mUserManager.username
|
||||
isTransientMessage = intent.getBooleanExtra(EXTRA_TRANSIENT_MESSAGE, false)
|
||||
|
|
|
@ -286,7 +286,7 @@ class MessageDetailsAdapter(
|
|||
|
||||
webView.loadDataWithBaseURL(
|
||||
Constants.DUMMY_URL_PREFIX,
|
||||
content.takeIfNotEmpty() ?: message.decryptedHTML,
|
||||
content.takeIfNotEmpty() ?: message.decryptedHTML!!,
|
||||
"text/html",
|
||||
UTF_8,
|
||||
""
|
||||
|
@ -317,7 +317,13 @@ class MessageDetailsAdapter(
|
|||
|
||||
contentItem.content = contentData
|
||||
if (contentItem.isInit()) {
|
||||
contentItem.messageWebView.loadDataWithBaseURL(Constants.DUMMY_URL_PREFIX, if (content.isEmpty()) message.decryptedHTML else content, "text/html", UTF_8, "")
|
||||
contentItem.messageWebView.loadDataWithBaseURL(
|
||||
Constants.DUMMY_URL_PREFIX,
|
||||
if (content.isEmpty()) message.decryptedHTML!! else content,
|
||||
"text/html",
|
||||
UTF_8,
|
||||
""
|
||||
)
|
||||
} else {
|
||||
setItems(arrayListOf(messageItem, contentItem))
|
||||
}
|
||||
|
|
|
@ -298,8 +298,8 @@ class ConnectAccountActivity : ConnectAccountBaseActivity() {
|
|||
password.isFocusableInTouchMode = enable
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
moveToMailbox()
|
||||
saveLastInteraction()
|
||||
|
|
|
@ -94,8 +94,8 @@ class ConnectAccountMailboxLoginActivity : ConnectAccountBaseActivity() {
|
|||
ProtonMailApplication.getApplication().bus.register(this)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> onBackPressed()
|
||||
}
|
||||
return true
|
||||
|
@ -120,7 +120,7 @@ class ConnectAccountMailboxLoginActivity : ConnectAccountBaseActivity() {
|
|||
UiUtil.hideKeyboard(this, mailboxPassword)
|
||||
Handler().postDelayed({
|
||||
setupComplete = false
|
||||
viewModel.mailboxLogin(mailboxPasswordValue, intent.getStringExtra(EXTRA_KEY_SALT))
|
||||
viewModel.mailboxLogin(mailboxPasswordValue, intent.getStringExtra(EXTRA_KEY_SALT)!!)
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,8 @@ internal class NotificationSettingsActivity : BaseActivity(), ViewStateActivity
|
|||
override fun onActivityResult( requestCode: Int, resultCode: Int, data: Intent? ) {
|
||||
if ( resultCode == Activity.RESULT_OK ) {
|
||||
if ( requestCode == REQUEST_CODE_PICK_RINGTONE ) {
|
||||
val uri = data!!.getParcelableExtra<Uri>( RingtoneManager.EXTRA_RINGTONE_PICKED_URI )
|
||||
viewModel.setRingtone( uri )
|
||||
val uri = data!!.getParcelableExtra<Uri>( RingtoneManager.EXTRA_RINGTONE_PICKED_URI )!!
|
||||
viewModel.setRingtone(uri)
|
||||
}
|
||||
} else super.onActivityResult( requestCode, resultCode, data )
|
||||
}
|
||||
|
|
|
@ -34,14 +34,13 @@ import ch.protonmail.android.api.models.room.messages.LocalAttachment
|
|||
import ch.protonmail.android.worker.DeleteAttachmentWorker
|
||||
import java.io.File
|
||||
import java.util.ArrayList
|
||||
import java.util.Collections
|
||||
import java.util.Comparator
|
||||
|
||||
|
||||
class AttachmentListAdapter(
|
||||
context: Context,
|
||||
attachmentsList: List<LocalAttachment>?,
|
||||
private var embeddedImages: Int,
|
||||
private var numberOfEmbeddedImages: Int,
|
||||
private val workManager: WorkManager
|
||||
) : ArrayAdapter<LocalAttachment>(context, 0, attachmentsList ?: emptyList()) {
|
||||
|
||||
|
@ -68,7 +67,7 @@ class AttachmentListAdapter(
|
|||
|
||||
fun updateData(attachmentList: ArrayList<LocalAttachment>, numEmbeddedImages: Int) {
|
||||
clear()
|
||||
embeddedImages = numEmbeddedImages
|
||||
numberOfEmbeddedImages = numEmbeddedImages
|
||||
attachmentsList = attachmentList.sortedWith(attachmentSortComparator)
|
||||
addAll(attachmentsList)
|
||||
sort(attachmentSortComparator)
|
||||
|
@ -96,7 +95,7 @@ class AttachmentListAdapter(
|
|||
|
||||
if (embeddedImageHeader != null && attachment.isEmbeddedImage) {
|
||||
embeddedImageHeader.visibility = View.VISIBLE
|
||||
embeddedImageHeader.text = String.format(context.getString(R.string.inline_header), embeddedImages)
|
||||
embeddedImageHeader.text = String.format(context.getString(R.string.inline_header), numberOfEmbeddedImages)
|
||||
} else if (embeddedImageHeader != null) {
|
||||
embeddedImageHeader.visibility = View.GONE
|
||||
}
|
||||
|
@ -120,9 +119,9 @@ class AttachmentListAdapter(
|
|||
attachment.displayName == it.displayName
|
||||
}
|
||||
if (isEmbedded) {
|
||||
embeddedImages -= 1
|
||||
numberOfEmbeddedImages -= 1
|
||||
}
|
||||
listener.onAttachmentDeleted(count, embeddedImages)
|
||||
listener.onAttachmentDeleted(count, numberOfEmbeddedImages)
|
||||
|
||||
DeleteAttachmentWorker.Enqueuer(workManager).enqueue(attachment.attachmentId)
|
||||
}
|
||||
|
|
|
@ -107,9 +107,13 @@ class MessagesService : JobIntentService() {
|
|||
val refreshMessages = intent.getBooleanExtra(EXTRA_REFRESH_MESSAGES, false)
|
||||
if (Constants.MessageLocationType.fromInt(location)
|
||||
in listOf(Constants.MessageLocationType.LABEL, Constants.MessageLocationType.LABEL_FOLDER)) {
|
||||
val labelId = intent.getStringExtra(EXTRA_LABEL_ID)
|
||||
handleFetchFirstLabelPage(Constants.MessageLocationType.LABEL, labelId,
|
||||
currentUser, refreshMessages)
|
||||
val labelId = intent.getStringExtra(EXTRA_LABEL_ID)!!
|
||||
handleFetchFirstLabelPage(
|
||||
Constants.MessageLocationType.LABEL,
|
||||
labelId,
|
||||
currentUser,
|
||||
refreshMessages
|
||||
)
|
||||
} else {
|
||||
handleFetchFirstPage(Constants.MessageLocationType.fromInt(location), refreshDetails,
|
||||
intent.getStringExtra(EXTRA_UUID), currentUser, refreshMessages)
|
||||
|
@ -122,10 +126,14 @@ class MessagesService : JobIntentService() {
|
|||
val time = minOf(savedTime, extraTime)
|
||||
if (Constants.MessageLocationType.fromInt(location) in listOf(Constants.MessageLocationType.LABEL,
|
||||
Constants.MessageLocationType.LABEL_FOLDER)) {
|
||||
val labelId = intent.getStringExtra(EXTRA_LABEL_ID)
|
||||
val labelId = intent.getStringExtra(EXTRA_LABEL_ID)!!
|
||||
val labelTime = getLastMessageTime(Constants.MessageLocationType.fromInt(location), labelId)
|
||||
handleFetchMessagesByLabel(Constants.MessageLocationType.fromInt(location), labelTime,
|
||||
labelId, currentUser)
|
||||
handleFetchMessagesByLabel(
|
||||
Constants.MessageLocationType.fromInt(location),
|
||||
labelTime,
|
||||
labelId,
|
||||
currentUser
|
||||
)
|
||||
} else {
|
||||
handleFetchMessages(Constants.MessageLocationType.fromInt(location), time, currentUser)
|
||||
}
|
||||
|
|
|
@ -125,16 +125,16 @@ class ContactGroupEditCreateActivity : BaseActivity(), ColorChooserFragment.ICol
|
|||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> onBackPressed()
|
||||
R.id.action_save -> {
|
||||
progress.visibility = View.VISIBLE
|
||||
contactGroupEditCreateViewModel.contactGroupUpdateResult.observe(this, Observer {
|
||||
contactGroupEditCreateViewModel.contactGroupUpdateResult.observe(this, {
|
||||
progress.visibility = View.GONE
|
||||
it?.getContentIfNotHandled()?.let {
|
||||
val status = it.status
|
||||
when(status) {
|
||||
when (status) {
|
||||
Status.FAILED -> showToast(it.message ?: getString(R.string.error))
|
||||
Status.SUCCESS -> {
|
||||
showToast(R.string.contact_group_saved)
|
||||
|
|
|
@ -84,13 +84,16 @@ class AddressChooserActivity : BaseActivity() {
|
|||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean = when (item?.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
onBackPressed()
|
||||
true
|
||||
}
|
||||
R.id.action_save -> {
|
||||
val selected = addressChooserViewModel.updateSelected(contactGroupEmailsAdapter.getUnSelected(), contactGroupEmailsAdapter.getSelected())
|
||||
val selected = addressChooserViewModel.updateSelected(
|
||||
contactGroupEmailsAdapter.getUnSelected(),
|
||||
contactGroupEmailsAdapter.getSelected()
|
||||
)
|
||||
val intent = Intent()
|
||||
intent.putExtra(EXTRA_CONTACT_EMAILS, selected)
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
|
@ -143,4 +146,4 @@ class AddressChooserActivity : BaseActivity() {
|
|||
fun onLogoutEvent(event: LogoutEvent?) {
|
||||
moveToLogin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class PMRegistrationIntentService : ProtonJobIntentService() {
|
|||
* @param token The new token.
|
||||
*/
|
||||
@Throws(Exception::class)
|
||||
private fun sendRegistrationToServer(token: String) {
|
||||
private fun sendRegistrationToServer(token: String?) {
|
||||
FcmUtil.setRegistrationId(token)
|
||||
|
||||
var exception: Exception? = null
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Proton Technologies AG
|
||||
*
|
||||
*
|
||||
* This file is part of ProtonMail.
|
||||
*
|
||||
*
|
||||
* ProtonMail is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* ProtonMail is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ object MockAddAttachmentIntent {
|
|||
return IntentCallback { intent: Intent ->
|
||||
if (intent.action == MediaStore.ACTION_IMAGE_CAPTURE) {
|
||||
try {
|
||||
val imageUri = intent.getParcelableExtra<Uri>(MediaStore.EXTRA_OUTPUT)
|
||||
val imageUri = intent.getParcelableExtra<Uri>(MediaStore.EXTRA_OUTPUT)!!
|
||||
val image = BitmapFactory.decodeResource(
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.resources,
|
||||
resourceId)
|
||||
|
@ -107,4 +107,4 @@ object MockAddAttachmentIntent {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ object ProtonMail {
|
|||
const val versionName = "1.13.17"
|
||||
const val versionCode = 739
|
||||
|
||||
const val targetSdk = 29
|
||||
const val targetSdk = 30
|
||||
const val minSdk = 21
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ const val `jackson version` = "2.10.2" // Released: Jan
|
|||
const val `jsoup version` = "1.8.3" // Released: Aug 02, 2015
|
||||
const val `minidns version` = "0.3.3" // Released: Oct 14, 2018
|
||||
const val `okHttp3 version` = "3.12.5" // Released: Sep 11, 2019 TODO: 4.x requires some refactor / 3.13+ requires minSDK 2
|
||||
const val `rf2 converter version` = "2.7.1" // Released: Jan 02, 2020
|
||||
const val `rf2 converter version` = "2.9.0" // Released: May 20, 2020
|
||||
const val `rxJava version` = "2.0.2" // Released: Dec 02, 201
|
||||
const val `rxRelay version` = "2.1.1" // Released: Aug 23, 201
|
||||
const val `sentry version` = "1.7.30" // Released: Jan 28, 2020 TODO: 2.x requires minor refactor for captureEvent and different imports
|
||||
|
|
Loading…
Reference in New Issue