Align `develop` branch with other main ones
Now `develop` is aligned with `prerelease` and other branches, it contains the configuration for build release versions of the app. Also many BuildConfig fields have been removed: some of them have been replaced by `BuildConfig.DEBUG`, instead of make that differentiation on branches; other didn't have sense to exist, so a comment has been left there. Sentry logs ( before not present on `develop` ) have been added with a check `if (!BuildConfig.DEBUG)` for bein' executed only on release version. Gradle version has been updated to 6.3 for being able to work with JDK 14. Affected: Gradle version, release config for `develop`, Sentry logs on `develop`, BuildConfig fields Ticket: none
This commit is contained in:
parent
5ce164d00a
commit
579e3aa4c2
|
@ -1,5 +1,6 @@
|
|||
import Plugin
|
||||
import Project
|
||||
import Module
|
||||
|
||||
apply plugin: Plugin.android_application.id
|
||||
apply plugin: Plugin.kotlin_android.id
|
||||
|
@ -179,7 +180,7 @@ android {
|
|||
multiDexEnabled true
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
|
||||
// Sensitive data
|
||||
buildConfigField "String", "SENTRY_DNS_1", "\"${privateProperties.sentryDNS_1}\""
|
||||
buildConfigField "String", "SENTRY_DNS_2", "\"${privateProperties.sentryDNS_2}\""
|
||||
buildConfigField "String", "SAFETY_NET_API_KEY", "\"${privateProperties.safetyNet_apiKey}\""
|
||||
|
@ -188,21 +189,9 @@ android {
|
|||
buildConfigField "String", "H_ENDPOINT_URL", "\"${privateProperties.h_endpointUrl}\""
|
||||
buildConfigField "String", "PM_CLIENT_SECRET", "\"${privateProperties.pm_clientSecret}\""
|
||||
|
||||
buildConfigField "boolean", "LOGOUT_WHEN_UPDATE", "false" // master key
|
||||
buildConfigField "boolean", "LOGOUT_EVERY_PREVIOUS_VERSION", "false"
|
||||
buildConfigField "int[]", "LOGOUT_PREVIOUS_VERSIONS", "{}"
|
||||
buildConfigField "int", "SETTINGS_UPDATED_VERSION", "${versionCode}"
|
||||
buildConfigField "boolean", "FETCH_FULL_CONTACTS", "true"
|
||||
buildConfigField "boolean", "CLEAR_MESSAGES_TABLE", "false"
|
||||
buildConfigField "boolean", "FETCH_USER_INFO", "true"
|
||||
buildConfigField "boolean", "REREGISTER_FOR_PUSH", "true"
|
||||
buildConfigField "boolean", "REFETCH_MAIL_SETTINGS", "true"
|
||||
buildConfigField "boolean", "MIGRATE_TO_1_12_3", "false"
|
||||
buildConfigField "boolean", "MIGRATE_TO_703", "false"
|
||||
buildConfigField "boolean", "MIGRATE_MULTI_USER", "true"
|
||||
buildConfigField "int", "MIGRATE_MULTI_USER_MIN_VERSION", "652"
|
||||
buildConfigField "int", "ROOM_DB_VERSION", "${databaseVersion}"
|
||||
buildConfigField "boolean", "MIGRATE_VALUES_TO_USER_SPECIFIC_SHARED_PREFERENCES", "true"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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/.
|
||||
*/
|
||||
package ch.protonmail.android
|
||||
|
||||
/**
|
||||
* Using toggle ( Boolean ) for trigger events for specific app version is a bad pattern, a better
|
||||
* pattern would be to store the previous app version in SharedPreferences and, if needed store
|
||||
* the ( or a list of ) version where the specific action needs to be triggered.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ###### Trigger on current versions
|
||||
* ```kotlin
|
||||
* // Gradle file
|
||||
* buildConfigField("int[]", "CLEAN_CONTACTS_VERSIONS", "{ 710; 724; 750 }")
|
||||
*
|
||||
* // Code
|
||||
* if (BuildConfig.VERSION_CODE in BuildConfig.CLEAN_CONTACTS_VERSIONS) {
|
||||
* cleanContactsTable()
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ###### Trigger on previous versions
|
||||
* ```kotlin
|
||||
* // Gradle file
|
||||
* buildConfigField("int[]", "CLEAN_CONTACTS_PREVIOUS_VERSIONS", "{ 710; 724; 750 }")
|
||||
*
|
||||
* // Code
|
||||
* val previousInstalledVersion: Int = TO\\DO("Get previous installed version from preferences")
|
||||
* if (previousInstalledVersion in BuildConfig.CLEAN_CONTACTS_PREVIOUS_VERSIONS) {
|
||||
* cleanContactsTable()
|
||||
* saveNewVersionToPreferences(BuildConfig.VERSION_CODE)
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
const val MIGRATE_FROM_BUILD_CONFIG_FIELD_DOC = 0
|
|
@ -19,6 +19,7 @@
|
|||
package ch.protonmail.android.api.models
|
||||
|
||||
import android.os.Build
|
||||
import ch.protonmail.android.BuildConfig
|
||||
import ch.protonmail.android.core.Constants
|
||||
import ch.protonmail.android.utils.AppUtil
|
||||
import ch.protonmail.android.utils.crypto.OpenPGP
|
||||
|
@ -38,6 +39,7 @@ import timber.log.Timber
|
|||
*
|
||||
* @return null if we couldn't determine passphrase for some reason
|
||||
*/
|
||||
// TODO: Better logging and move direct Sentry call to Timber
|
||||
fun Keys.getKeyPassphrase(openPgp: OpenPGP, userKeys: List<Keys>, userKeysPassphrase: ByteArray): ByteArray? {
|
||||
if (this.Token.isNullOrBlank() || this.Signature.isNullOrBlank()) {
|
||||
return userKeysPassphrase
|
||||
|
@ -52,11 +54,19 @@ fun Keys.getKeyPassphrase(openPgp: OpenPGP, userKeys: List<Keys>, userKeysPassph
|
|||
} catch (e: Exception) {
|
||||
Timber.d(e, "exception decrypting AddressKey's Token")
|
||||
}
|
||||
val message = "failed getting passphrase for key $id, primary = $isPrimary, signature.isNullOrBlank = ${signature.isNullOrBlank()}, token.isNullOrBlank = ${token.isNullOrBlank()}, activation.isNullOrBlank = ${activation.isNullOrBlank()}"
|
||||
val eventBuilder = EventBuilder()
|
||||
if (!BuildConfig.DEBUG) {
|
||||
val message = """
|
||||
failed getting passphrase for key $id,
|
||||
primary = $isPrimary,
|
||||
signature = ${signature},
|
||||
token = ${token},
|
||||
activation = $activation
|
||||
""".trimIndent()
|
||||
val eventBuilder = EventBuilder()
|
||||
.withTag(Constants.LogTags.SENDING_FAILED_TAG, AppUtil.getAppVersion())
|
||||
.withTag(Constants.LogTags.SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
Sentry.capture(eventBuilder.withMessage(message).build())
|
||||
Sentry.capture(eventBuilder.withMessage(message).build())
|
||||
}
|
||||
}
|
||||
|
||||
Timber.e("failed getting passphrase for key %s, primary = %s, signature.isNullOrBlank = %s, token.isNullOrBlank = %s, activation.isNullOrBlank = %s",
|
||||
|
@ -71,6 +81,7 @@ fun Keys.getKeyPassphrase(openPgp: OpenPGP, userKeys: List<Keys>, userKeysPassph
|
|||
*
|
||||
* @return null if we couldn't determine passphrase for some reason
|
||||
*/
|
||||
// TODO: Better logging and move direct Sentry call to Timber
|
||||
fun Keys.getActivationToken(openPgp: OpenPGP, userKeys: List<Keys>, userKeysPassphrase: ByteArray): String? {
|
||||
|
||||
if (!this.Activation.isNullOrBlank()) {
|
||||
|
@ -83,11 +94,18 @@ fun Keys.getActivationToken(openPgp: OpenPGP, userKeys: List<Keys>, userKeysPass
|
|||
} catch (e: Exception) {
|
||||
Timber.d(e, "exception decrypting Activation Token")
|
||||
}
|
||||
val message = "failed obtaining activation for key $id, primary = ${isPrimary}, signature.isNullOrBlank = ${signature.isNullOrBlank()}, token.isNullOrBlank = ${token.isNullOrBlank()}, activation.isNullOrBlank = ${activation.isNullOrBlank()}"
|
||||
val eventBuilder = EventBuilder()
|
||||
if (!BuildConfig.DEBUG) {
|
||||
val message = """
|
||||
failed obtaining activation for key $id, primary = ${isPrimary},
|
||||
signature = ${signature},
|
||||
token${token},
|
||||
activation = $activation
|
||||
""".trimIndent()
|
||||
val eventBuilder = EventBuilder()
|
||||
.withTag(Constants.LogTags.SENDING_FAILED_TAG, AppUtil.getAppVersion())
|
||||
.withTag(Constants.LogTags.SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
Sentry.capture(eventBuilder.withMessage(message).build())
|
||||
Sentry.capture(eventBuilder.withMessage(message).build())
|
||||
}
|
||||
}
|
||||
|
||||
Timber.e("failed obtaining activation for key %s, primary = %s, signature.isNullOrBlank = %s, token.isNullOrBlank = %s, activation.isNullOrBlank = %s",
|
||||
|
|
|
@ -138,7 +138,7 @@ abstract class MessagesDatabase {
|
|||
preservedAtt.setMessage(message)
|
||||
}
|
||||
}
|
||||
preservedAtt.isUploaded = it.isUploaded
|
||||
preservedAtt.isUploaded = it.isUploaded
|
||||
preservedAtt.isUploading = it.isUploading
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package ch.protonmail.android.api.services
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import ch.protonmail.android.activities.messageDetails.repository.MessageDetailsRepository
|
||||
import ch.protonmail.android.api.models.SendPreference
|
||||
import ch.protonmail.android.api.models.room.messages.Message
|
||||
|
@ -28,8 +27,6 @@ import ch.protonmail.android.api.models.room.pendingActions.PendingDraft
|
|||
import ch.protonmail.android.api.models.room.pendingActions.PendingSend
|
||||
import ch.protonmail.android.api.models.room.pendingActions.PendingUpload
|
||||
import ch.protonmail.android.core.Constants
|
||||
import ch.protonmail.android.core.Constants.LogTags.SENDING_FAILED_DEVICE_TAG
|
||||
import ch.protonmail.android.core.Constants.LogTags.SENDING_FAILED_TAG
|
||||
import ch.protonmail.android.core.ProtonMailApplication
|
||||
import ch.protonmail.android.core.QueueNetworkUtil
|
||||
import ch.protonmail.android.core.UserManager
|
||||
|
@ -42,13 +39,9 @@ import ch.protonmail.android.utils.AppUtil
|
|||
import ch.protonmail.android.utils.ServerTime
|
||||
import ch.protonmail.android.utils.crypto.Crypto
|
||||
import com.birbit.android.jobqueue.JobManager
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.*
|
||||
import timber.log.Timber
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class PostMessageServiceFactory {
|
||||
|
|
|
@ -20,8 +20,8 @@ package ch.protonmail.android.core
|
|||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import ch.protonmail.android.R
|
||||
|
||||
import ch.protonmail.android.R
|
||||
|
||||
object Constants {
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@ import com.squareup.otto.Bus;
|
|||
import com.squareup.otto.Produce;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -209,8 +207,6 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
ViewStateStoreConfig.INSTANCE
|
||||
.setErrorStateGenerator(ErrorStateGeneratorsKt.getErrorStateGenerator());
|
||||
|
||||
// Sentry will look for uncaught exceptions from previous runs and send them
|
||||
Sentry.init(String.format(getString(R.string.sentry_url), BuildConfig.SENTRY_DNS_1, BuildConfig.SENTRY_DNS_2), new AndroidSentryClientFactory(this));
|
||||
contactsDatabase = ContactsDatabaseFactory.Companion.getInstance(getApplicationContext()).getDatabase();
|
||||
messagesDatabase = MessagesDatabaseFactory.Companion.getInstance(getApplicationContext()).getDatabase();
|
||||
|
||||
|
@ -550,6 +546,9 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link MIGRATE_FROM_BUILD_CONFIG_FIELD_DOC}
|
||||
*/
|
||||
private void checkForUpdateAndClearCache() {
|
||||
final SharedPreferences prefs = getDefaultSharedPreferences();
|
||||
int currentAppVersion = AppUtil.getAppVersionCode(this);
|
||||
|
@ -564,7 +563,7 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
mUserManager.setLoginState(LOGIN_STATE_TO_INBOX);
|
||||
}
|
||||
|
||||
if (BuildConfig.CLEAR_MESSAGES_TABLE) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
new RefreshMessagesAndAttachments(messagesDatabase).execute();
|
||||
}
|
||||
if (BuildConfig.FETCH_FULL_CONTACTS && mUserManager.isLoggedIn()) {
|
||||
|
@ -580,12 +579,14 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
// if this version requires the user to be logged out when updatingAttachmentMetadataDatabase
|
||||
// and if every single previous version should be force logged out
|
||||
// or any specific previous version should be logged out
|
||||
if (BuildConfig.LOGOUT_WHEN_UPDATE && (BuildConfig.LOGOUT_EVERY_PREVIOUS_VERSION || ArrayUtils.contains(BuildConfig.LOGOUT_PREVIOUS_VERSIONS, previousVersion))) {
|
||||
|
||||
// Removed check for updates where we need to logout as it was always false. See doc ref in method header
|
||||
if (false) {
|
||||
mUserManager.logoutOffline();
|
||||
AppUtil.deleteDatabases(this, mUserManager.getUsername());
|
||||
AppUtil.deletePrefs();
|
||||
}
|
||||
if (BuildConfig.MIGRATE_TO_1_12_3) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
List<String> loggedInUsers = AccountManager.Companion.getInstance(this).getLoggedInUsers();
|
||||
long elapsedTime = SystemClock.elapsedRealtime();
|
||||
for (String userName : loggedInUsers) {
|
||||
|
@ -597,7 +598,7 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
user.setLastInteraction(elapsedTime);
|
||||
}
|
||||
}
|
||||
if (BuildConfig.MIGRATE_TO_703) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
AlarmReceiver alarmReceiver = new AlarmReceiver();
|
||||
alarmReceiver.cancelAlarm(this);
|
||||
startJobManager();
|
||||
|
@ -624,20 +625,18 @@ public class ProtonMailApplication extends MultiDexApplication implements HasAct
|
|||
}
|
||||
}
|
||||
}
|
||||
if (BuildConfig.MIGRATE_VALUES_TO_USER_SPECIFIC_SHARED_PREFERENCES) {
|
||||
SharedPreferences secureSharedPreferences = getSecureSharedPreferences(mUserManager.getUsername());
|
||||
SharedPreferences defaultSharedPreferences = getDefaultSharedPreferences();
|
||||
SharedPreferences secureSharedPreferences = getSecureSharedPreferences(mUserManager.getUsername());
|
||||
SharedPreferences defaultSharedPreferences = getDefaultSharedPreferences();
|
||||
|
||||
if (defaultSharedPreferences.contains(PREF_SHOW_STORAGE_LIMIT_WARNING)) {
|
||||
secureSharedPreferences.edit().putBoolean(PREF_SHOW_STORAGE_LIMIT_WARNING,
|
||||
defaultSharedPreferences.getBoolean(PREF_SHOW_STORAGE_LIMIT_WARNING, true)).apply();
|
||||
defaultSharedPreferences.edit().remove(PREF_SHOW_STORAGE_LIMIT_WARNING).apply();
|
||||
}
|
||||
if (defaultSharedPreferences.contains(PREF_SHOW_STORAGE_LIMIT_REACHED)) {
|
||||
secureSharedPreferences.edit().putBoolean(PREF_SHOW_STORAGE_LIMIT_REACHED,
|
||||
defaultSharedPreferences.getBoolean(PREF_SHOW_STORAGE_LIMIT_REACHED, true)).apply();
|
||||
defaultSharedPreferences.edit().remove(PREF_SHOW_STORAGE_LIMIT_REACHED).apply();
|
||||
}
|
||||
if (defaultSharedPreferences.contains(PREF_SHOW_STORAGE_LIMIT_WARNING)) {
|
||||
secureSharedPreferences.edit().putBoolean(PREF_SHOW_STORAGE_LIMIT_WARNING,
|
||||
defaultSharedPreferences.getBoolean(PREF_SHOW_STORAGE_LIMIT_WARNING, true)).apply();
|
||||
defaultSharedPreferences.edit().remove(PREF_SHOW_STORAGE_LIMIT_WARNING).apply();
|
||||
}
|
||||
if (defaultSharedPreferences.contains(PREF_SHOW_STORAGE_LIMIT_REACHED)) {
|
||||
secureSharedPreferences.edit().putBoolean(PREF_SHOW_STORAGE_LIMIT_REACHED,
|
||||
defaultSharedPreferences.getBoolean(PREF_SHOW_STORAGE_LIMIT_REACHED, true)).apply();
|
||||
defaultSharedPreferences.edit().remove(PREF_SHOW_STORAGE_LIMIT_REACHED).apply();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -28,12 +28,7 @@ import ch.protonmail.android.BuildConfig
|
|||
import ch.protonmail.android.api.AccountManager
|
||||
import ch.protonmail.android.api.TokenManager
|
||||
import ch.protonmail.android.api.local.SnoozeSettings
|
||||
import ch.protonmail.android.api.models.LoginInfoResponse
|
||||
import ch.protonmail.android.api.models.LoginResponse
|
||||
import ch.protonmail.android.api.models.MailSettings
|
||||
import ch.protonmail.android.api.models.User
|
||||
import ch.protonmail.android.api.models.UserInfo
|
||||
import ch.protonmail.android.api.models.UserSettings
|
||||
import ch.protonmail.android.api.models.*
|
||||
import ch.protonmail.android.api.models.address.Address
|
||||
import ch.protonmail.android.api.services.LoginService
|
||||
import ch.protonmail.android.api.services.LogoutService
|
||||
|
@ -44,8 +39,7 @@ import ch.protonmail.android.events.Status
|
|||
import ch.protonmail.android.utils.AppUtil
|
||||
import ch.protonmail.android.utils.crypto.OpenPGP
|
||||
import com.squareup.otto.Produce
|
||||
import org.apache.commons.lang3.ArrayUtils
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -291,6 +285,8 @@ class UserManager(
|
|||
|
||||
/**
|
||||
* Do not instantiate on Main thread!
|
||||
*
|
||||
* @see MIGRATE_FROM_BUILD_CONFIG_FIELD_DOC
|
||||
*/
|
||||
init {
|
||||
app.appComponent.inject(this)
|
||||
|
@ -301,7 +297,9 @@ class UserManager(
|
|||
// and if every single previous version should be force logged out
|
||||
// or any specific previous version should be logged out
|
||||
if (previousVersion != currentAppVersion) {
|
||||
if (BuildConfig.LOGOUT_WHEN_UPDATE && (BuildConfig.LOGOUT_EVERY_PREVIOUS_VERSION || ArrayUtils.contains(BuildConfig.LOGOUT_PREVIOUS_VERSIONS, previousVersion))) {
|
||||
|
||||
// Removed check for updates where we need to logout as it was always false. See doc ref in method header
|
||||
if (false) {
|
||||
val pin = mailboxPin
|
||||
logoutOffline()
|
||||
savePin(pin)
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import ch.protonmail.android.BuildConfig;
|
||||
import ch.protonmail.android.activities.messageDetails.repository.MessageDetailsRepository;
|
||||
import ch.protonmail.android.api.ProtonMailApi;
|
||||
import ch.protonmail.android.api.local.SnoozeSettings;
|
||||
|
@ -149,9 +150,11 @@ public class GcmIntentService extends IntentService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
// can not deliver notification
|
||||
EventBuilder eventBuilder = new EventBuilder().withTag("GCM_MU", TextUtils.isEmpty(notificationUsername) ? "EMPTY" : "NOT_EMPTY");
|
||||
Sentry.capture(eventBuilder);
|
||||
Sentry.capture(e);
|
||||
if (!BuildConfig.DEBUG) {
|
||||
EventBuilder eventBuilder = new EventBuilder().withTag("GCM_MU", TextUtils.isEmpty(notificationUsername) ? "EMPTY" : "NOT_EMPTY");
|
||||
Sentry.capture(eventBuilder);
|
||||
Sentry.capture(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (notificationData == null || messageData == null) {
|
||||
|
|
|
@ -139,17 +139,17 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
PendingActionsDatabase pendingActionsDatabase = PendingActionsDatabaseFactory.Companion.getInstance(getApplicationContext(), mUsername).getDatabase();
|
||||
Message message = messageDetailsRepository.findMessageByMessageDbId(mMessageDbId);
|
||||
if (message != null) {
|
||||
// region sentry
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_REASON_TAG, String.valueOf(cancelReason))
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag("LOCATION", "CANCEL - NOTNULL")
|
||||
.withTag("DBID", String.valueOf(mMessageDbId))
|
||||
.withTag("EXCEPTION", (throwable != null) ? throwable.getMessage() : "NO EXCEPTION");
|
||||
StringBuilder exceptionStringBuilder = getExceptionStringBuilder(throwable);
|
||||
Sentry.capture(eventBuilder.withMessage(exceptionStringBuilder.toString()).build());
|
||||
// endregion
|
||||
if (!BuildConfig.DEBUG) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_REASON_TAG, String.valueOf(cancelReason))
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag("LOCATION", "CANCEL - NOTNULL")
|
||||
.withTag("DBID", String.valueOf(mMessageDbId))
|
||||
.withTag("EXCEPTION", (throwable != null) ? throwable.getMessage() : "NO EXCEPTION");
|
||||
StringBuilder exceptionStringBuilder = getExceptionStringBuilder(throwable);
|
||||
Sentry.capture(eventBuilder.withMessage(exceptionStringBuilder.toString()).build());
|
||||
}
|
||||
message.setLocation(Constants.MessageLocationType.ALL_DRAFT.getMessageLocationTypeValue());
|
||||
message.setLabelIDs(Arrays.asList(String.valueOf(Constants.MessageLocationType.ALL_DRAFT.getMessageLocationTypeValue()), String.valueOf(Constants.MessageLocationType.ALL_MAIL.getMessageLocationTypeValue()), String.valueOf(Constants.MessageLocationType.DRAFT.getMessageLocationTypeValue())));
|
||||
message.setTime(ServerTime.currentTimeMillis() / 1000);
|
||||
|
@ -160,17 +160,17 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
pendingActionsDatabase.insertPendingForSend(pendingSend);
|
||||
}
|
||||
} else {
|
||||
// region sentry
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_REASON_TAG, String.valueOf(cancelReason))
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag("LOCATION", "CANCEL - NULL")
|
||||
.withTag("EXCEPTION", (throwable != null) ? throwable.getMessage() : "NO EXCEPTION")
|
||||
.withTag("DBID", String.valueOf(mMessageDbId));
|
||||
StringBuilder exceptionStringBuilder = getExceptionStringBuilder(throwable);
|
||||
Sentry.capture(eventBuilder.withMessage(exceptionStringBuilder.toString()).build());
|
||||
// endregion
|
||||
if (!BuildConfig.DEBUG) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_REASON_TAG, String.valueOf(cancelReason))
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag("LOCATION", "CANCEL - NULL")
|
||||
.withTag("EXCEPTION", (throwable != null) ? throwable.getMessage() : "NO EXCEPTION")
|
||||
.withTag("DBID", String.valueOf(mMessageDbId));
|
||||
StringBuilder exceptionStringBuilder = getExceptionStringBuilder(throwable);
|
||||
Sentry.capture(eventBuilder.withMessage(exceptionStringBuilder.toString()).build());
|
||||
}
|
||||
}
|
||||
|
||||
sendErrorSending(null);
|
||||
|
@ -185,13 +185,15 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
PendingActionsDatabase pendingActionsDatabase = PendingActionsDatabaseFactory.Companion.getInstance(getApplicationContext(), mUsername).getDatabase();
|
||||
if (mMessageDbId == null) {
|
||||
Exception e = new RuntimeException("Message id is null");
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
if (!BuildConfig.DEBUG) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
Message message = messageDetailsRepository.findMessageByMessageDbId(mMessageDbId);
|
||||
if (message == null) {
|
||||
if (!BuildConfig.DEBUG && message == null) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
|
@ -234,22 +236,26 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
uploadAttachments(message, crypto, mailSettings);
|
||||
fetchMissingSendPreferences(contactsDatabase, message, mailSettings);
|
||||
} catch (Exception e) {
|
||||
if (message != null) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag(SENDING_FAILED_SAME_USER_TAG, String.valueOf(username.equals(mUserManager.getUsername())))
|
||||
.withTag("LOC", "ONRUN - 1")
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
if (BuildConfig.DEBUG) {
|
||||
throw e;
|
||||
} else {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag(SENDING_FAILED_SAME_USER_TAG, String.valueOf(username.equals(mUserManager.getUsername())))
|
||||
.withTag("LOC", "ONRUN - 2")
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
if (message != null) {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag(SENDING_FAILED_SAME_USER_TAG, String.valueOf(username.equals(mUserManager.getUsername())))
|
||||
.withTag("LOC", "ONRUN - 1")
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
} else {
|
||||
EventBuilder eventBuilder = new EventBuilder()
|
||||
.withTag(SENDING_FAILED_TAG, getAppVersion())
|
||||
.withTag(SENDING_FAILED_DEVICE_TAG, Build.MODEL + " " + Build.VERSION.SDK_INT)
|
||||
.withTag(SENDING_FAILED_SAME_USER_TAG, String.valueOf(username.equals(mUserManager.getUsername())))
|
||||
.withTag("LOC", "ONRUN - 2")
|
||||
.withMessage(getExceptionStringBuilder(e).toString());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,15 +346,19 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
.withTag("LOC", "ONRUNPOSTMESSAGE");
|
||||
|
||||
if (draftResponse == null) {
|
||||
eventBuilder.withMessage("Draft response is null");
|
||||
Sentry.capture(eventBuilder.build());
|
||||
if (!BuildConfig.DEBUG) {
|
||||
eventBuilder.withMessage("Draft response is null");
|
||||
Sentry.capture(eventBuilder.build());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (draftResponse.getCode() != RESPONSE_CODE_OK) {
|
||||
eventBuilder.withMessage(draftResponse.getCode() + " " + draftResponse.getError());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
sendErrorSending(draftResponse.getError());
|
||||
if (!BuildConfig.DEBUG) {
|
||||
eventBuilder.withMessage(draftResponse.getCode() + " " + draftResponse.getError());
|
||||
Sentry.capture(eventBuilder.build());
|
||||
sendErrorSending(draftResponse.getError());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -395,7 +405,9 @@ public class PostMessageJob extends ProtonMailBaseJob {
|
|||
verifyIntent.putExtra(VerificationOnSendReceiver.EXTRA_MESSAGE_ADDRESS_ID, message.getAddressID());
|
||||
ProtonMailApplication.getApplication().sendOrderedBroadcast(verifyIntent, null);
|
||||
} else {
|
||||
Sentry.capture(eventBuilder.withMessage(builder.toString()).build());
|
||||
if (!BuildConfig.DEBUG) {
|
||||
Sentry.capture(eventBuilder.withMessage(builder.toString()).build());
|
||||
}
|
||||
sendErrorSending(errorSending);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ package ch.protonmail.android.utils.crypto;
|
|||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
@ -41,7 +39,6 @@ import ch.protonmail.android.api.models.KeyExtensionsKt;
|
|||
import ch.protonmail.android.api.models.Keys;
|
||||
import ch.protonmail.android.api.models.address.Address;
|
||||
import ch.protonmail.android.core.UserManager;
|
||||
import ch.protonmail.android.utils.AppUtil;
|
||||
import ch.protonmail.android.utils.Logger;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
|
|
@ -195,12 +195,10 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
|||
app:layout_constraintTop_toBottomOf="@+id/messageTitleContainerLinearLayout"
|
||||
app:layout_constraintLeft_toRightOf="@+id/checkboxImageView"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_below="@id/message_title_container"
|
||||
android:layout_toEndOf="@id/checkbox"
|
||||
android:gravity="top"
|
||||
android:orientation="horizontal">
|
||||
<!-- FIXME don't apply to ConstraintLayout
|
||||
android:layout_below="@id/message_title_container"
|
||||
android:layout_toEndOf="@id/checkbox"
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/attributes_container"
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||
|
|
Loading…
Reference in New Issue