Skip to content

Commit 0dbf51e

Browse files
Merge pull request #13 from session-foundation/release/1.20.5
Release/1.20.5
2 parents 6e34269 + d447371 commit 0dbf51e

File tree

7 files changed

+50
-18
lines changed

7 files changed

+50
-18
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ configurations.forEach {
1313
it.exclude module: "commons-logging"
1414
}
1515

16-
def canonicalVersionCode = 386
17-
def canonicalVersionName = "1.20.4"
16+
def canonicalVersionCode = 387
17+
def canonicalVersionName = "1.20.5"
1818

1919
def postFixSize = 10
2020
def abiPostFix = ['armeabi-v7a' : 1,

app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
8282
private String mimeType;
8383
private boolean isPassingAlongMedia;
8484

85+
private ResolveMediaTask resolveTask;
86+
8587
@Override
8688
protected void onCreate(Bundle icicle, boolean ready) {
8789
if (!getIntent().hasExtra(ContactSelectionListFragment.DISPLAY_MODE)) {
@@ -190,7 +192,8 @@ private void initializeMedia() {
190192
} else {
191193
contactsFragment.getView().setVisibility(View.GONE);
192194
progressWheel.setVisibility(View.VISIBLE);
193-
new ResolveMediaTask(context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, streamExtra);
195+
resolveTask = new ResolveMediaTask(context);
196+
resolveTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, streamExtra);
194197
}
195198
}
196199

@@ -262,6 +265,12 @@ public void onContactSelected(String number) {
262265
public void onContactDeselected(String number) {
263266
}
264267

268+
@Override
269+
protected void onDestroy() {
270+
super.onDestroy();
271+
if (resolveTask != null) resolveTask.cancel(true);
272+
}
273+
265274
@SuppressLint("StaticFieldLeak")
266275
private class ResolveMediaTask extends AsyncTask<Uri, Void, Uri> {
267276
private final Context context;

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ class ConversationViewModel(
169169
communityWriteAccessJob = viewModelScope.launch {
170170
OpenGroupManager.getCommunitiesWriteAccessFlow()
171171
.map {
172-
if(openGroup?.groupId != null)
173-
it[openGroup?.groupId]
174-
else null
172+
withContext(Dispatchers.Default) {
173+
if (openGroup?.groupId != null)
174+
it[openGroup?.groupId]
175+
else null
176+
}
175177
}
176178
.filterNotNull()
177179
.collect{

app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,17 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
630630
}
631631

632632
if (oldVersion < lokiV47) {
633-
db.execSQL(SmsDatabase.ADD_IS_DELETED_COLUMN);
634-
db.execSQL(MmsDatabase.ADD_IS_DELETED_COLUMN);
633+
// Ideally we shouldn't need to check if the column exists, but somehow we get
634+
// "duplicated column" from play store crashes.
635+
// If you are keen you can investigate
636+
// deep into this but for now, we will just check if the column exists before adding it.
637+
if (!columnExists(db, SmsDatabase.TABLE_NAME, SmsDatabase.IS_DELETED)) {
638+
db.execSQL(SmsDatabase.ADD_IS_DELETED_COLUMN);
639+
}
640+
641+
if (!columnExists(db, MmsDatabase.TABLE_NAME, MmsDatabase.IS_DELETED)) {
642+
db.execSQL(MmsDatabase.ADD_IS_DELETED_COLUMN);
643+
}
635644
}
636645

637646
db.setTransactionSuccessful();

app/src/main/java/org/thoughtcrime/securesms/messagerequests/MessageRequestsActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
3737
private val viewModel: MessageRequestsViewModel by viewModels()
3838

3939
private val adapter: MessageRequestsAdapter by lazy {
40-
MessageRequestsAdapter(context = this, cursor = threadDb.unapprovedConversationList, listener = this)
40+
MessageRequestsAdapter(context = this, cursor = null, listener = this)
4141
}
4242

4343
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
@@ -114,7 +114,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
114114
}
115115

116116
private fun updateEmptyState() {
117-
val threadCount = (binding.recyclerView.adapter as MessageRequestsAdapter).itemCount
117+
val threadCount = adapter.itemCount
118118
binding.emptyStateContainer.isVisible = threadCount == 0
119119
binding.clearAllMessageRequestsButton.isVisible = threadCount != 0
120120
}

app/src/main/java/org/thoughtcrime/securesms/preferences/ClearAllDataDialog.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ClearAllDataDialog : DialogFragment() {
127127
ApplicationContext.getInstance(context).clearAllDataAndRestart().let { success ->
128128
withContext(Main) {
129129
if (success) {
130-
dismiss()
130+
dismissAllowingStateLoss()
131131
} else {
132132
Toast.makeText(ApplicationContext.getInstance(requireContext()), R.string.errorUnknown, Toast.LENGTH_LONG).show()
133133
}
@@ -161,8 +161,15 @@ class ClearAllDataDialog : DialogFragment() {
161161
}
162162
else if (deletionResultMap.values.all { it }) {
163163
// ..otherwise if the network data deletion was successful proceed to delete the local data as well.
164-
ApplicationContext.getInstance(context).clearAllDataAndRestart()
165-
withContext(Main) { dismiss() }
164+
ApplicationContext.getInstance(context).clearAllDataAndRestart().let { success ->
165+
withContext(Main) {
166+
if (success) {
167+
dismissAllowingStateLoss()
168+
} else {
169+
Toast.makeText(ApplicationContext.getInstance(requireContext()), R.string.errorUnknown, Toast.LENGTH_LONG).show()
170+
}
171+
}
172+
}
166173
}
167174
}
168175
}

scripts/build-and-release.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, credentials: dict):
4040
self.key_password = credentials['key_password']
4141

4242
def build_releases(project_root: str, flavor: str, credentials_property_prefix: str, credentials: BuildCredentials, huawei: bool=False) -> BuildResult:
43-
(keystore_fd, keystore_file) = tempfile.mkstemp(prefix='keystore_', suffix='.jks', dir=os.path.join(project_root, 'build'))
43+
(keystore_fd, keystore_file) = tempfile.mkstemp(prefix='keystore_', suffix='.jks', dir=build_dir)
4444
try:
4545
with os.fdopen(keystore_fd, 'wb') as f:
4646
f.write(base64.b64decode(credentials.keystore_b64))
@@ -82,8 +82,9 @@ def build_releases(project_root: str, flavor: str, credentials_property_prefix:
8282

8383

8484
project_root = os.path.dirname(sys.path[0])
85+
build_dir = os.path.join(project_root, 'build')
8586
credentials_file_path = os.path.join(project_root, 'release-creds.toml')
86-
fdroid_repo_path = os.path.join(project_root, 'build/fdroidrepo')
87+
fdroid_repo_path = os.path.join(build_dir, 'fdroidrepo')
8788

8889
def detect_android_sdk() -> str:
8990
sdk_dir = os.environ.get('ANDROID_HOME')
@@ -102,11 +103,11 @@ def update_fdroid(build: BuildResult, fdroid_workspace: str, creds: BuildCredent
102103
# Check if there's a git repo at the fdroid repo path by running git status
103104
try:
104105
subprocess.check_call(f'git -C {fdroid_repo_path} status', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
105-
subprocess.check_call(f'git fetch', shell=True, cwd=fdroid_workspace)
106+
subprocess.check_call(f'git fetch --depth=1', shell=True, cwd=fdroid_workspace)
106107
print(f'Found fdroid git repo at {fdroid_repo_path}')
107108
except subprocess.CalledProcessError:
108109
print(f'No fdroid git repo found at {fdroid_repo_path}. Cloning using gh.')
109-
subprocess.run(f'gh repo clone session-foundation/session-fdroid {fdroid_repo_path} -- --depth=1', shell=True, check=True)
110+
subprocess.run(f'gh repo clone session-foundation/session-fdroid {fdroid_repo_path} -- -b master --depth=1', shell=True, check=True)
110111

111112
# Create a branch for the release
112113
print(f'Creating a branch for the fdroid release: {build.version_name}')
@@ -162,7 +163,7 @@ def update_fdroid(build: BuildResult, fdroid_workspace: str, creds: BuildCredent
162163
with open(metadata_file, 'w') as file:
163164
file.write(metadata_contents)
164165

165-
[keystore_fd, keystore_path] = tempfile.mkstemp(prefix='fdroid_keystore_', suffix='.p12', dir=os.path.join(project_root, 'build'))
166+
[keystore_fd, keystore_path] = tempfile.mkstemp(prefix='fdroid_keystore_', suffix='.p12', dir=build_dir)
166167
config_file_path = os.path.join(fdroid_workspace, 'config.yml')
167168

168169
try:
@@ -207,6 +208,7 @@ def update_fdroid(build: BuildResult, fdroid_workspace: str, creds: BuildCredent
207208
subprocess.run(f'''\
208209
gh pr create --base master \
209210
--title "Release {build.version_name}" \
211+
-R session-foundation/session-fdroid \
210212
--body "This is an automated release preparation for Release {build.version_name}. Human beings are still required to approve and merge this PR."\
211213
''', shell=True, check=True, cwd=fdroid_workspace)
212214

@@ -224,6 +226,9 @@ def update_fdroid(build: BuildResult, fdroid_workspace: str, creds: BuildCredent
224226
with open(credentials_file_path, 'rb') as f:
225227
credentials = tomllib.load(f)
226228

229+
# Make sure build folder exists
230+
if not os.path.isdir(build_dir):
231+
os.makedirs(build_dir)
227232

228233
print("Building play releases...")
229234
play_build_result = build_releases(

0 commit comments

Comments
 (0)