Skip to content

Commit

Permalink
Performed a PR pass to fix up anything obvious - there's still a few …
Browse files Browse the repository at this point in the history
…things left TODO
  • Loading branch information
alansley committed Aug 26, 2024
1 parent 53978f8 commit 404fb80
Show file tree
Hide file tree
Showing 82 changed files with 147 additions and 1,129 deletions.
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ dependencies {

ksp("androidx.hilt:hilt-compiler:$jetpackHiltVersion")
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")
ksp "com.github.bumptech.glide:ksp:$glideVersion"
ksp("com.github.bumptech.glide:ksp:$glideVersion")

implementation 'androidx.compose.material3:material3-android:1.2.1'
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
Expand Down Expand Up @@ -273,7 +273,6 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:compose:1.0.0-beta01"
ksp "com.github.bumptech.glide:ksp:$glideVersion"
implementation 'com.makeramen:roundedimageview:2.1.0'
implementation 'com.pnikosis:materialish-progress:1.5'
implementation 'org.greenrobot:eventbus:3.0.0'
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,6 @@
android:theme="@style/Theme.Session.DayNight.NoActionBar"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="org.thoughtcrime.securesms.MediaOverviewActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Theme.Session.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="org.thoughtcrime.securesms.DummyActivity"
android:allowTaskReparenting="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ private void forward() {
@SuppressWarnings("CodeBlock2Expr")
@SuppressLint("InlinedApi")
private void saveToDisk() {
Log.w("ACL", "Asked to save to disk!");
MediaItem mediaItem = getCurrentMediaItem();
if (mediaItem == null) return;

Expand Down Expand Up @@ -487,6 +486,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);

switch (item.getItemId()) {
// TODO / WARNING: R.id values are NON-CONSTANT in Gradle 8.0+ - what would be the best way to address this?! -AL 2024/08/26
case R.id.media_preview__overview: showOverview(); return true;
case R.id.media_preview__forward: forward(); return true;
case R.id.save: saveToDisk(); return true;
Expand Down Expand Up @@ -537,15 +537,11 @@ public void onLoadFinished(@NonNull Loader<Pair<Cursor, Integer>> loader, @Nulla
throw new RuntimeException("restartItem = " + restartItem + ", data.second = " + data.second + " leftIsRecent = " + leftIsRecent, e);
}

if (item == 0) {
viewPagerListener.onPageSelected(0);
}
if (item == 0) { viewPagerListener.onPageSelected(0); }
}

@Override
public void onLoaderReset(@NonNull Loader<Pair<Cursor, Integer>> loader) {

}
public void onLoaderReset(@NonNull Loader<Pair<Cursor, Integer>> loader) { /* Do nothing */ }

private class ViewPagerListener implements ViewPager.OnPageChangeListener {

Expand Down Expand Up @@ -580,13 +576,11 @@ public void onPageUnselected(int position) {

@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

/* Do nothing */
}

@Override
public void onPageScrollStateChanged(int state) {

}
public void onPageScrollStateChanged(int state) { /* Do nothing */ }
}

private static class SingleItemPagerAdapter extends MediaItemAdapter {
Expand Down Expand Up @@ -651,9 +645,7 @@ public MediaItem getMediaItemFor(int position) {
}

@Override
public void pause(int position) {

}
public void pause(int position) { /* Do nothing */ }

@Override
public @Nullable View getPlaybackControls(int position) {
Expand Down
13 changes: 4 additions & 9 deletions app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import network.loki.messenger.R;
import org.session.libsession.utilities.Address;
import org.session.libsession.utilities.DistributionTypes;
import org.session.libsession.utilities.ViewUtil;
Expand All @@ -49,12 +51,6 @@
import org.thoughtcrime.securesms.providers.BlobProvider;
import org.thoughtcrime.securesms.util.MediaUtil;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import network.loki.messenger.R;

/**
* An activity to quickly share content with contacts
*
Expand All @@ -69,7 +65,6 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
public static final String EXTRA_ADDRESS_MARSHALLED = "address_marshalled";
public static final String EXTRA_DISTRIBUTION_TYPE = "distribution_type";


private ContactSelectionListFragment contactsFragment;
private SearchToolbar searchToolbar;
private ImageView searchAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public void onPlaybackStateChanged(int playbackState) {
}
}


@Override
public void onPlayerError(PlaybackException error) {
Log.w(TAG, "MediaPlayer Error: " + error);
Expand Down Expand Up @@ -206,9 +205,7 @@ public synchronized void stop() {
this.mediaPlayer.release();
}

if (this.audioAttachmentServer != null) {
this.audioAttachmentServer.stop();
}
if (this.audioAttachmentServer != null) { this.audioAttachmentServer.stop(); }

sensorManager.unregisterListener(AudioSlidePlayer.this);

Expand All @@ -217,9 +214,7 @@ public synchronized void stop() {
}

public synchronized static void stopAll() {
if (playing.isPresent()) {
playing.get().stop();
}
if (playing.isPresent()) { playing.get().stop(); }
}

public synchronized boolean isReady() {
Expand Down Expand Up @@ -361,9 +356,8 @@ public void onSensorChanged(SensorEvent event) {
}

@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
public void onAccuracyChanged(Sensor sensor, int accuracy) { /* Do nothing */ }

}

public interface Listener {
void onPlayerStart(@NonNull AudioSlidePlayer player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void setLayoutRes() {
// Substitute app name into lockscreen preference summary
if (key.equalsIgnoreCase(LOCK_SCREEN_KEY)) {
Context c = getContext();
CharSequence substitutedSummaryCS = Phrase.from(c, R.string.lockAppDescriptionAndroid)
CharSequence substitutedSummaryCS = Phrase.from(c, R.string.lockAppDescription)
.put(APP_NAME_KEY, c.getString(R.string.app_name))
.format();
this.setSummary(substitutedSummaryCS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.bumptech.glide.RequestManager

class UserView : LinearLayout {
private lateinit var binding: ViewUserBinding
var openGroupThreadID: Long = -1L // FIXME: This is a bit ugly

enum class ActionIndicator {
None,
Expand Down Expand Up @@ -86,8 +85,6 @@ class UserView : LinearLayout {
}
}

fun unbind() {
binding.profilePictureView.recycle()
}
fun unbind() { binding.profilePictureView.recycle() }
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ internal class NewMessageViewModel @Inject constructor(
override fun onChange(value: String) {
loadOnsJob?.cancel()
loadOnsJob = null

_state.update { it.copy(newMessageIdOrOns = value, isTextErrorColor = false, loading = false) }
}

Expand Down Expand Up @@ -112,4 +111,4 @@ internal data class State(
val isNextButtonEnabled: Boolean get() = newMessageIdOrOns.isNotBlank()
}

internal data class Success(val publicKey: String)
internal data class Success(val publicKey: String)
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
return false
} else {
// ..otherwise if the earliest emoji reaction was more than a minute ago we'll
// remove that early reaction to move the timestamp at index 1 into index 0,, add
// remove that early reaction to move the timestamp at index 1 into index 0, add
// our new timestamp and return true to accept the emoji reaction.
emojiRateLimiterQueue.removeFirst()
emojiRateLimiterQueue.addLast(timestamp)
Expand Down Expand Up @@ -1843,7 +1843,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe

// ..otherwise we can attempt to send the attachment(s).
// Note: The only multi-attachment message type is when sending images - all others
// attempt send on initial attachment selection.
// attempt send the attachment immediately upon file selection.
sendAttachments(attachmentManager.buildSlideDeck().asAttachments(), null)
}

Expand Down Expand Up @@ -1931,8 +1931,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
} else {
Permissions.with(this)
.request(Manifest.permission.RECORD_AUDIO)
.withRationaleDialog(getString(R.string.permissionsMicrophoneAccessRequiredAndroid), R.drawable.ic_baseline_mic_48)
.withPermanentDenialDialog(Phrase.from(applicationContext, R.string.permissionsMicrophoneAccessRequiredAndroid)
.withRationaleDialog(getString(R.string.permissionsMicrophoneAccessRequired), R.drawable.ic_baseline_mic_48)
.withPermanentDenialDialog(Phrase.from(applicationContext, R.string.permissionsMicrophoneAccessRequired)
.put(APP_NAME_KEY, getString(R.string.app_name))
.format().toString())
.execute()
Expand Down Expand Up @@ -2119,7 +2119,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
override fun banUser(messages: Set<MessageRecord>) {
showSessionDialog {
title(R.string.banUser)
// ACL TODO - We need a string for the below `text` element
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
text("This will ban the selected user from this room. It won't ban them from other rooms.")
button(R.string.banUser) { viewModel.banUser(messages.first().individualRecipient); endActionMode() }
cancelButton(::endActionMode)
Expand All @@ -2129,7 +2129,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
override fun banAndDeleteAll(messages: Set<MessageRecord>) {
showSessionDialog {
title(R.string.banUser)
// ACL TODO - We need a string for the below `text` element
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
text("This will ban the selected user from this room and delete all messages sent by them. It won't ban them from other rooms or delete the messages they sent there.")
button(R.string.banUser) { viewModel.banAndDeleteAll(messages.first()); endActionMode() }
cancelButton(::endActionMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BlockedDialog(private val recipient: Recipient, private val context: Conte

title(resources.getString(R.string.blockUnblock))
text(spannable)
dangerButton(R.string.blockUnblock,R.string.AccessibilityId_unblockConfirm) { unblock() }
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { unblock() }
cancelButton { dismiss() }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ open class Storage(
val threadID = getOrCreateThreadIdFor(Address.fromSerialized(groupId))
threadDb.setDate(threadID, formationTimestamp)

// ACL Note: Commenting out this line prevents the timestamp of room creation being added to a new closed group,
// Note: Commenting out this line prevents the timestamp of room creation being added to a new closed group,
// which in turn allows us to show the `groupNoMessages` control message text.
//insertOutgoingInfoMessage(context, groupId, SignalServiceGroup.Type.CREATION, title, members.map { it.serialize() }, admins.map { it.serialize() }, threadID, formationTimestamp)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
import android.app.NotificationManager;
import android.content.Context;
import android.database.Cursor;

import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;

import com.squareup.phrase.Phrase;

import java.io.File;
import net.zetetic.database.sqlcipher.SQLiteConnection;
import net.zetetic.database.sqlcipher.SQLiteDatabase;
import net.zetetic.database.sqlcipher.SQLiteDatabaseHook;
import net.zetetic.database.sqlcipher.SQLiteOpenHelper;

import network.loki.messenger.R;
import org.session.libsession.utilities.TextSecurePreferences;
import org.session.libsignal.utilities.Log;
import org.thoughtcrime.securesms.crypto.DatabaseSecret;
Expand All @@ -43,13 +41,8 @@
import org.thoughtcrime.securesms.database.SessionJobDatabase;
import org.thoughtcrime.securesms.database.SmsDatabase;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.notifications.NotificationChannels;
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities;

import java.io.File;

import network.loki.messenger.R;

public class SQLCipherOpenHelper extends SQLiteOpenHelper {

@SuppressWarnings("unused")
Expand Down
Loading

0 comments on commit 404fb80

Please sign in to comment.