mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Lint.
- Check for permissions. - Fix Welsh positional format. - Remove UIThread restriction. - Asynchronous method does not need to be restricted to UIThread and there is no StaticFieldLeak to suppress. - Fix or Ignore New API errors. - Reduce severity of some errors from L10N.
This commit is contained in:
parent
2ccdf0e396
commit
b1057d63a1
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,7 +8,6 @@ gen/
|
||||
*.iml
|
||||
out
|
||||
tests
|
||||
lint.xml
|
||||
local.properties
|
||||
ant.properties
|
||||
.DS_Store
|
||||
|
14
lint.xml
Normal file
14
lint.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
|
||||
<!-- L10N errors -->
|
||||
<!-- This is a runtime crash so we don't want to ship with this. -->
|
||||
<issue id="StringFormatMatches" severity="error" />
|
||||
|
||||
<!-- L10N warnings -->
|
||||
<issue id="MissingTranslation" severity="warning" />
|
||||
<issue id="MissingQuantity" severity="warning" />
|
||||
<issue id="ExtraTranslation" severity="warning" />
|
||||
<issue id="ImpliedQuantity" severity="warning" />
|
||||
|
||||
</lint>
|
@ -85,7 +85,7 @@
|
||||
<!--CommunicationActions-->
|
||||
<string name="CommunicationActions_no_browser_found">Heb ganfod porwr gwe.</string>
|
||||
<!--ConfirmIdentityDialog-->
|
||||
<string name="ConfirmIdentityDialog_your_safety_number_with_s_has_changed">Mae\'ch rhif diogelwch gyda %1$s wedi newid. Gall hyn olygu bod rhywun yn ceisio ymyrryd a\'ch cyfathrebu, neu bod % 2$s wedi cael ei ail-osod.</string>
|
||||
<string name="ConfirmIdentityDialog_your_safety_number_with_s_has_changed">Mae\'ch rhif diogelwch gyda %1$s wedi newid. Gall hyn olygu bod rhywun yn ceisio ymyrryd a\'ch cyfathrebu, neu bod %2$s wedi cael ei ail-osod.</string>
|
||||
<string name="ConfirmIdentityDialog_you_may_wish_to_verify_your_safety_number_with_this_contact">Efallai yr hoffech wirio\'ch rhif diogelwch gyda\'r cyswllt hwn.</string>
|
||||
<string name="ConfirmIdentityDialog_accept">Derbyn</string>
|
||||
<!--ContactsCursorLoader-->
|
||||
@ -868,10 +868,10 @@ Send neges heb ei ddiogelu?</string>
|
||||
<!--unverified safety numbers-->
|
||||
<string name="IdentityUtil_unverified_banner_one">Mae\'ch rhif diogelwch gyda %1$s wedi newid ac nid yw wedi\'i dilysu bellach.</string>
|
||||
<string name="IdentityUtil_unverified_banner_two">Nid yw eich rhif diogelwch gyda %1$s a %2$s wedi\'i dilysu bellach</string>
|
||||
<string name="IdentityUtil_unverified_banner_many">Nid yw eich rhifau diogelwch gyda %1$s,%2$s, a %3$s bellach yn cael eu gwirio</string>
|
||||
<string name="IdentityUtil_unverified_dialog_one">Mae\'ch rhif diogelwch gyda %1$s wedi newid ac nid yw wedi\'i dilysu bellach. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod %1$s wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_unverified_dialog_two">Nid yw eich rhif diogelwch gyda %1$s wedi\'i dilysu bellach. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod %1$s wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_unverified_dialog_many">Nid yw eich rhifau diogelwch gyda %1$s, %2$s, a %3$s bellach yn cael eu gwirio. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod %1$s wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_unverified_banner_many">Nid yw eich rhifau diogelwch gyda %1$s, %2$s, a %3$s bellach yn cael eu gwirio</string>
|
||||
<string name="IdentityUtil_unverified_dialog_one">Mae\'ch rhif diogelwch gyda %1$s wedi newid ac nid yw wedi\'i dilysu bellach. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod %1$s wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_unverified_dialog_two">Mae\'ch rhifau diogelwch gyda %1$s a %2$s wedi\'i dilysu bellach. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod nhw wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_unverified_dialog_many">Mae\'ch rhifau diogelwch gyda %1$s, %2$s, a %3$s wedi\'i dilysi bellach. Gall hyn olygu bod rhywun yn ceisio rhyng-gipio eich cyfathrebu, neu bod nhw wedi ail-osod Signal.</string>
|
||||
<string name="IdentityUtil_untrusted_dialog_one">Mae\'ch rhif diogelwch gyda %1$s wedi newid yn ddiweddar.</string>
|
||||
<string name="IdentityUtil_untrusted_dialog_two">Mae\'ch rhif diogelwch gyda %1$s wedi newid yn ddiweddar.</string>
|
||||
<string name="IdentityUtil_untrusted_dialog_many">Mae\'ch rhif diogelwch gyda %1$s a %3$s wedi newid.</string>
|
||||
|
@ -42,7 +42,7 @@
|
||||
<style name="TextSecure.DarkActionBar"
|
||||
parent="@style/Widget.AppCompat.ActionBar">
|
||||
<item name="background">@color/core_grey_90</item>
|
||||
<item name="android:popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="android:popupTheme" tools:ignore="NewApi">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="elevation">4dp</item>
|
||||
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
|
||||
@ -155,8 +155,8 @@
|
||||
</style>
|
||||
|
||||
<style name="MaterialButton">
|
||||
<item name="android:elevation">1dp</item>
|
||||
<item name="android:translationZ">1dp</item>
|
||||
<item name="android:elevation" tools:ignore="NewApi">1dp</item>
|
||||
<item name="android:translationZ" tools:ignore="NewApi">1dp</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="Signal.Text.Headline" parent="Base.TextAppearance.AppCompat.Headline">
|
||||
<item name="android:textSize">28sp</item>
|
||||
<item name="android:lineSpacingExtra">3sp</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:letterSpacing">0</item>
|
||||
<item name="android:letterSpacing" tools:ignore="NewApi">0</item>
|
||||
</style>
|
||||
|
||||
<style name="Signal.Text.Headline.Registration" parent="Signal.Text.Headline">
|
||||
@ -15,21 +15,21 @@
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:lineSpacingExtra">4sp</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:letterSpacing">0.01</item>
|
||||
<item name="android:letterSpacing" tools:ignore="NewApi">0.01</item>
|
||||
</style>
|
||||
|
||||
<style name="Signal.Text.Preview" parent="Base.TextAppearance.AppCompat.Body2">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:lineSpacingExtra">3sp</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:letterSpacing">0.01</item>
|
||||
<item name="android:letterSpacing" tools:ignore="NewApi">0.01</item>
|
||||
</style>
|
||||
|
||||
<style name="Signal.Text.Caption" parent="Base.TextAppearance.AppCompat.Caption">
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:lineSpacingExtra">2sp</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:letterSpacing">0.03</item>
|
||||
<item name="android:letterSpacing" tools:ignore="NewApi">0.03</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="colorPrimary">@color/gray95</item>
|
||||
<item name="colorAccent">@color/signal_primary_dark</item>
|
||||
<item name="android:colorControlActivated">@color/signal_primary_dark</item>
|
||||
<item name="android:colorControlActivated" tools:ignore="NewApi">@color/signal_primary_dark</item>
|
||||
|
||||
<item name="recipient_preference_blocked">#d00000</item>
|
||||
<item name="contact_selection_label_text">#66eeeeee</item>
|
||||
|
@ -48,7 +48,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
||||
|
||||
Recipient recipient = Recipient.from(context, mismatch.getAddress(), false);
|
||||
String name = recipient.toShortString();
|
||||
String introduction = String.format(context.getString(R.string.ConfirmIdentityDialog_your_safety_number_with_s_has_changed), name, name);
|
||||
String introduction = context.getString(R.string.ConfirmIdentityDialog_your_safety_number_with_s_has_changed, name, name);
|
||||
SpannableString spannableString = new SpannableString(introduction + " " +
|
||||
context.getString(R.string.ConfirmIdentityDialog_you_may_wish_to_verify_your_safety_number_with_this_contact));
|
||||
|
||||
|
@ -161,7 +161,9 @@ public class AudioSlidePlayer implements SensorEventListener {
|
||||
sensorManager.unregisterListener(AudioSlidePlayer.this);
|
||||
|
||||
if (wakeLock != null && wakeLock.isHeld()) {
|
||||
wakeLock.release(PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
wakeLock.release(PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +189,9 @@ public class AudioSlidePlayer implements SensorEventListener {
|
||||
sensorManager.unregisterListener(AudioSlidePlayer.this);
|
||||
|
||||
if (wakeLock != null && wakeLock.isHeld()) {
|
||||
wakeLock.release(PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
wakeLock.release(PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,16 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import org.apache.http.Header;
|
||||
@ -209,7 +215,7 @@ public abstract class LegacyMmsConnection {
|
||||
}
|
||||
|
||||
protected List<Header> getBaseHeaders() {
|
||||
final String number = TelephonyUtil.getManager(context).getLine1Number(); ;
|
||||
final String number = getLine1Number(context);
|
||||
|
||||
return new LinkedList<Header>() {{
|
||||
add(new BasicHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"));
|
||||
@ -223,6 +229,17 @@ public abstract class LegacyMmsConnection {
|
||||
}};
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
private static String getLine1Number(@NonNull Context context) {
|
||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED ||
|
||||
ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_NUMBERS) == PackageManager.PERMISSION_GRANTED ||
|
||||
ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
return TelephonyUtil.getManager(context).getLine1Number();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Apn {
|
||||
|
||||
public static Apn EMPTY = new Apn("", "", "", "", "");
|
||||
|
@ -1,12 +1,10 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.UiThread;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
||||
@ -47,8 +45,6 @@ public class IdentityUtil {
|
||||
|
||||
private static final String TAG = IdentityUtil.class.getSimpleName();
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@UiThread
|
||||
public static ListenableFuture<Optional<IdentityRecord>> getRemoteIdentityKey(final Context context, final Recipient recipient) {
|
||||
final SettableFuture<Optional<IdentityRecord>> future = new SettableFuture<>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user