Compare commits

...

13 Commits

Author SHA1 Message Date
B. Petersen a42996892d bump version 2018-05-15 23:24:44 +02:00
B. Petersen 3e926becba Update messenger-backend submodule. 2018-05-15 23:23:47 +02:00
B. Petersen a1eeb25dff changelog 2018-05-15 23:23:33 +02:00
B. Petersen a1f4b64c4a Update messenger-backend submodule. 2018-05-12 00:37:40 +02:00
B. Petersen 5673b25e52 refactor connect-functions 2018-05-12 00:36:40 +02:00
B. Petersen f755add1d2 bump version 2018-05-11 15:21:58 +02:00
B. Petersen 60dd8098c4 Update messenger-backend submodule. 2018-05-11 15:20:49 +02:00
B. Petersen 5823d04a20 update changelog and translations 2018-05-11 15:20:30 +02:00
B. Petersen 3cdfa949e9 Update messenger-backend submodule. 2018-05-11 15:13:39 +02:00
B. Petersen b69eaddddf add a labs-option to disable the logo overlay 2018-05-11 15:13:15 +02:00
B. Petersen 137b32303f refine qr-show layout 2018-05-09 12:51:16 +02:00
B. Petersen da87705fb8 layout show-qr activity 2018-05-09 01:21:55 +02:00
B. Petersen d808adeb39 derive qr-scan and qr-show activities from AppCompat, add back button and title 2018-05-08 17:28:07 +02:00
15 changed files with 190 additions and 32 deletions
+13
View File
@@ -1,5 +1,18 @@
# Delta Chat Changelog
## v0.17.2
2018-05-15
* Fix problem with adding formerly uncontacted members to groups
* Unblock manually blocked members when they are created manually as contact again
## v0.17.1
2018-05-11
* Improve QR code scanning screens
* Add a labs-option to disabled the new QR logo overlay
* Update Russian translations
## v0.17.0
2018-05-07
+2 -2
View File
@@ -124,7 +124,7 @@ android {
targetSdkVersion 25 // 25: Nougat. CAVE: Do NOT target "Andoid O" without checking the background tasks carefully, see https://developer.android.com/preview/behavior-changes.html#back-all . As long as we target "Nougat", everything works as expected even for "Andoid O" or later
// in general, we should not change the target without reason; eg. after the switch to Nougat, the camera stops working (see https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en )
versionName "0.17.0" // do NOT forget to increase defaultConfig.versionCode!
versionCode 517
versionName "0.17.2" // do NOT forget to increase defaultConfig.versionCode!
versionCode 519
}
}
+2
View File
@@ -1647,6 +1647,7 @@ LOCAL_SRC_FILES += \
./messenger-backend/src/mrlot.c \
./messenger-backend/src/mrmailbox.c \
./messenger-backend/src/mrmailbox_configure.c \
./messenger-backend/src/mrmailbox_connect.c \
./messenger-backend/src/mrmailbox_e2ee.c \
./messenger-backend/src/mrmailbox_imex.c \
./messenger-backend/src/mrmailbox_keyhistory.c \
@@ -1664,6 +1665,7 @@ LOCAL_SRC_FILES += \
./messenger-backend/src/mrsmtp.c \
./messenger-backend/src/mrsqlite3.c \
./messenger-backend/src/mrstock.c \
./messenger-backend/src/mrtoken.c \
./messenger-backend/src/mrtools.c \
./messenger-backend/src/mruudecode.c \
./messenger-backend/cmdline/cmdline.c \
@@ -113,11 +113,13 @@
<activity
android:name=".QRshowActivity"
android:theme="@style/Theme.MessengerProj.AppCompat"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
</activity>
<activity
android:name=".QRscanActivity"
android:theme="@style/Theme.MessengerProj.AppCompat"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
</activity>
@@ -196,13 +196,6 @@ public class ChatlistActivity extends BaseFragment implements NotificationCenter
if( !showArchivedOnly ) {
ActionBarMenu menu = actionBar.createMenu();
if (!onlySelect) {
if( qr_enabled ) {
qrScanItem = menu.addItem(ID_SCAN_QR, R.drawable.ic_ab_qr);
}
passcodeItem = menu.addItem(ID_LOCK_APP, R.drawable.ic_ab_lock_screen);
updateButtons();
}
final ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true, true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
@@ -277,6 +270,13 @@ public class ChatlistActivity extends BaseFragment implements NotificationCenter
}
});
item.getSearchField().setHint(ApplicationLoader.applicationContext.getString(R.string.Search));
if (!onlySelect) {
passcodeItem = menu.addItem(ID_LOCK_APP, R.drawable.ic_ab_lock_screen);
if( qr_enabled ) {
qrScanItem = menu.addItem(ID_SCAN_QR, R.drawable.ic_ab_qr);
}
updateButtons();
}
headerItem = menu.addItem(0, R.drawable.ic_ab_other);
headerItem.addSubItem(ID_NEW_CHAT, ApplicationLoader.applicationContext.getString(R.string.NewChat));
@@ -284,7 +284,7 @@ public class ChatlistActivity extends BaseFragment implements NotificationCenter
if(!onlySelect) {
if( qr_enabled ) {
//headerItem.addSubItem(ID_NEW_VERIFIED_GROUP, ApplicationLoader.applicationContext.getString(R.string.NewVerifiedGroup));
headerItem.addSubItem(ID_SHOW_QR, ApplicationLoader.applicationContext.getString(R.string.QrShowInviteCode));
headerItem.addSubItem(ID_SHOW_QR, ApplicationLoader.applicationContext.getString(R.string.QrShowVerifyCode));
}
headerItem.addSubItem(ID_DEADDROP, ApplicationLoader.applicationContext.getString(R.string.Deaddrop));
headerItem.addSubItem(ID_SETTINGS, ApplicationLoader.applicationContext.getString(R.string.Settings));
@@ -838,7 +838,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
textCell.setText(mContext.getString(R.string.NewContactTitle), false);
}
else if( i == rowInviteViaQr) {
textCell.setText(mContext.getString(R.string.QrShowInviteCode), false);
textCell.setText(mContext.getString(R.string.QrShowVerifyCode), false);
}
}
else if( type == ROWTYPE_CONTACT ) {
@@ -1,6 +1,7 @@
package com.b44t.messenger;
import android.Manifest;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -8,7 +9,9 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.zxing.integration.android.IntentIntegrator;
@@ -16,7 +19,7 @@ import com.google.zxing.integration.android.IntentResult;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.CompoundBarcodeView;
public class QRscanActivity extends Activity {
public class QRscanActivity extends AppCompatActivity {
private CaptureManager capture;
private CompoundBarcodeView barcodeScannerView;
@@ -28,8 +31,12 @@ public class QRscanActivity extends Activity {
setContentView(R.layout.activity_qrscan);
assert getSupportActionBar() != null;
getSupportActionBar().setTitle(R.string.QrScan);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
barcodeScannerView = (CompoundBarcodeView)findViewById(R.id.zxing_barcode_scanner);
barcodeScannerView.setStatusText(getString(R.string.QrScan));
barcodeScannerView.setStatusText(getString(R.string.QrScanHint)+"\n ");
if (savedInstanceState != null) {
init(barcodeScannerView, getIntent(), savedInstanceState);
@@ -46,6 +53,17 @@ public class QRscanActivity extends Activity {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home: finish(); return true;
}
return false;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
@NonNull int[] grantResults) {
@@ -1,16 +1,25 @@
package com.b44t.messenger;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
public class QRshowActivity extends Activity implements NotificationCenter.NotificationCenterDelegate {
import java.util.Hashtable;
public class QRshowActivity extends AppCompatActivity implements NotificationCenter.NotificationCenterDelegate {
public final static int WHITE = 0xFFFFFFFF;
public final static int BLACK = 0xFF000000;
@@ -24,15 +33,45 @@ public class QRshowActivity extends Activity implements NotificationCenter.Notif
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qrshow);
num_joiners = 0;
Bundle b = getIntent().getExtras();
int chat_id = 0;
if(b != null) {
chat_id = b.getInt("chat_id");
}
ImageView imageView = (ImageView) findViewById(R.id.myImage);
assert getSupportActionBar() != null;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
String hint = "";
if( chat_id != 0 ) {
// verified-group
String groupName = MrMailbox.getChat(chat_id).getName();
hint = String.format(ApplicationLoader.applicationContext.getString(R.string.QrJoinVerifiedGroupHint), groupName);
getSupportActionBar().setTitle(groupName);
getSupportActionBar().setSubtitle(R.string.QrJoinVerifiedGroupTitle);
}
else {
// verify-contact
String selfName = MrMailbox.getConfig("displayname", ""); // we cannot use MrContact.getDisplayName() as this would result in "Me" instead of
String nameNaddr = "";
if( selfName.isEmpty() ) {
selfName = MrMailbox.getConfig("addr", "unknown");
nameNaddr = selfName;
}
else {
nameNaddr = String.format("%s (%s)", selfName, MrMailbox.getConfig("addr", ""));
}
hint = String.format(ApplicationLoader.applicationContext.getString(R.string.QrVerifyContactHint), nameNaddr);
getSupportActionBar().setTitle(selfName);
getSupportActionBar().setSubtitle(R.string.QrVerifyContactTitle);
}
TextView hintBelowQr = (TextView) findViewById(R.id.qrShowHint);
hintBelowQr.setText(AndroidUtilities.replaceTags(hint));
num_joiners = 0;
ImageView imageView = (ImageView) findViewById(R.id.qrImage);
try {
Bitmap bitmap = encodeAsBitmap(MrMailbox.getSecurejoinQr(chat_id));
imageView.setImageBitmap(bitmap);
@@ -49,9 +88,22 @@ public class QRshowActivity extends Activity implements NotificationCenter.Notif
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.secureJoinInviterProgress);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home: finish(); return true;
}
return false;
}
Bitmap encodeAsBitmap(String str) throws WriterException {
BitMatrix result;
try {
Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();
hints.put(EncodeHintType.ERROR_CORRECTION, "8");
result = new MultiFormatWriter().encode(str,
BarcodeFormat.QR_CODE, WIDTH, HEIGHT, null);
} catch (IllegalArgumentException iae) {
@@ -71,9 +123,26 @@ public class QRshowActivity extends Activity implements NotificationCenter.Notif
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, w, 0, 0, w, h);
if( MrMailbox.getConfigInt("qr_overlay_logo", 1)!=0 ) {
Bitmap overlay = BitmapFactory.decodeResource(ApplicationLoader.applicationContext.getResources(), R.drawable.qr_overlay);
putOverlay(bitmap, overlay);
}
return bitmap;
}
public void putOverlay(Bitmap bitmap, Bitmap overlay) {
int bw = bitmap.getWidth();
int bh = bitmap.getHeight();
int ow = bw/6;
int oh = bh/6;
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
canvas.drawBitmap(overlay, null, new Rect(bw/2-ow/2, bh/2-oh/2, bw/2+ow/2, bh/2+oh/2), paint);
}
@Override
public void didReceivedNotification(int id, Object... args) {
if( id==NotificationCenter.secureJoinInviterProgress) {
@@ -82,6 +82,7 @@ public class SettingsAdvFragment extends BaseFragment implements NotificationCen
private int passcodeRow;
private int manageKeysRow;
private int labsEnableQrRow;
private int labsQrOverlayLogoRow;
private int backupRow;
private int backupShadowRow;
private int rowCount;
@@ -142,6 +143,14 @@ public class SettingsAdvFragment extends BaseFragment implements NotificationCen
cacheRow = -1;// for now, the - non-functional - page is reachable by the "storage settings" in the "android App Settings" only
manageKeysRow = rowCount++;
labsEnableQrRow = rowCount++;
if( MrMailbox.getConfigInt("qr_enabled", 0) != 0 ) {
labsQrOverlayLogoRow = rowCount++;
}
else {
labsQrOverlayLogoRow = -1;
}
backupRow = rowCount++;
backupShadowRow = rowCount++;
@@ -238,6 +247,9 @@ public class SettingsAdvFragment extends BaseFragment implements NotificationCen
showDialog(builder1.create());
}
}
else if( i == labsQrOverlayLogoRow ) {
MrMailbox.setConfigInt("qr_overlay_logo", MrMailbox.getConfigInt("qr_overlay_logo", 1)!=0? 0 : 1);
}
else if (i == blockedRow) {
presentFragment(new BlockedUsersActivity());
}
@@ -710,6 +722,9 @@ public class SettingsAdvFragment extends BaseFragment implements NotificationCen
} else if (i == labsEnableQrRow) {
boolean qr_enabled = MrMailbox.getConfigInt("qr_enabled", 0)!=0;
textCell.setTextAndCheck("Labs: QR code options", qr_enabled, true);
} else if (i == labsQrOverlayLogoRow) {
boolean qr_overlay_logo = MrMailbox.getConfigInt("qr_overlay_logo", 1)!=0;
textCell.setTextAndCheck("Labs: QR logo overlay", qr_overlay_logo, true);
}
}
else if (type == ROWTYPE_HEADER) {
@@ -739,7 +754,7 @@ public class SettingsAdvFragment extends BaseFragment implements NotificationCen
return ROWTYPE_HEADER;
} else if ( i == sendByEnterRow || i == raiseToSpeakRow || i == autoplayGifsRow
|| i==showUnknownSendersRow || i == directShareRow || i==e2eEncryptionRow
|| i==labsEnableQrRow) {
|| i==labsEnableQrRow || i==labsQrOverlayLogoRow ) {
return ROWTYPE_CHECK;
} else {
return ROWTYPE_TEXT_SETTINGS;
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@@ -1,12 +1,25 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/myImage"
android:id="@+id/qrImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
android:layout_height="wrap_content"
android:layout_weight="1"/>
</RelativeLayout>
<TextView
android:id="@+id/qrShowHint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:layout_marginEnd="8sp"
android:layout_marginStart="8sp"
android:text=""
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="16sp"/>
</LinearLayout>
@@ -63,7 +63,7 @@
<string name="Notifications">Уведомления</string>
<string name="RemoveMember">Удалить участника</string>
<!--contact info view-->
<string name="NewContactTitle">Новый контакт</string>
<string name="NewContactTitle">Добавить контакт</string>
<string name="BlockContact">Заблокировать контакт</string>
<string name="DeleteContact">Удалить контакт</string>
<string name="Info">Инфо</string>
@@ -385,7 +385,7 @@
<string name="AskRemoveMemberFromGroup">Удалить <![CDATA[<b>]]>%1$s<![CDATA[</b>]]> из группы?</string>
<string name="ErrSelfNotInGroup">Чтобы выполнить это действие, вы должны быть участником группы.</string>
<string name="MsgGroupLeft">Группа оставлена.</string>
<string name="NoMessagesHint">Отправить сообщение <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>:\n\n• Общение будет возможным, даже если <![CDATA[<b>]]>%2$s<![CDATA[</b>]]> не используют Delta Chat.\n\n• Доставка первого сообщения может занять некоторое время.</string>
<string name="NoMessagesHint">Отправить сообщение <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>:\n\n• Общение будет возможным, даже если <![CDATA[<b>]]>%2$s<![CDATA[</b>]]> не использует Delta Chat.\n\n• Доставка первого сообщения может занять некоторое время.</string>
<string name="SendNRcvReadReceipts">Получать и отправлять уведомления о доставке</string>
<string name="PreferE2EEncryption">Предпочитать сквозное шифрование</string>
<string name="E2EManagePrivateKeys">Управление закрытыми ключами</string>
@@ -454,6 +454,7 @@
<string name="QrScan">Сканировать QR код</string>
<string name="QrShow">Показать QR код</string>
<string name="QrScanContainsText">Отсканированный QR код содержит текст:\n\n%1$s</string>
<string name="QrScanContainsUrl">QR код для перехода по ссылке URL:\n\n%1$s</string>
<string name="OobFingerprint">Ключ</string>
<string name="OobFingerprintAskOob">Верифицировать контакт и начать общение с <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>?</string>
<string name="OobFingerprintOk">Контакт <![CDATA[<i>]]>%1$s<![CDATA[</i>]]> верифицирован. Начать общение?</string>
@@ -474,4 +475,14 @@
<string name="E2EEncryptionPreferred">Предпочтено сквозное шифрование.</string>
<string name="OobAddrVerified">%1$s верифицирован.</string>
<string name="OobAddrVerifiedIntroduceMyself">%1$s верифицирован, представьтесь …</string>
</resources>
<string name="OobAskJoinVerifiedGroup">Вы хотите присоединиться к верифицированной группе <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>?</string>
<!-- Translators: %1$s is replaced by an action, eg. MsgMemberAddedToGroup, MsgMemberRemovedFromToGroup, MsgGroupNameChanged or MsgGroupImageChanged. If the action ends with a full stop, this is removed.
%2$s is replaced by a the name of the user that made this action.
Resulting strings might be "Member Alice added by Bob." or 'Group name changed from "Foo" to "Bar" by Claire.
If you do not find a correct grammar for your language you can just use "%1$s (by %2$s)" or "%2$s: %1$s" -->
<string name="ActionByUser">%1$s от %2$s.</string>
<!-- Translators: %1$s is replaced by an action, eg. MsgMemberAddedToGroup, MsgMemberRemovedFromToGroup, MsgGroupNameChanged or MsgGroupImageChanged. If the action ends with a full stop, this is removed.
Resulting strings might be "Member Alice added by me." or 'Group name changed from "Foo" to "Bar" by me.
If you do not find a correct grammar for your language you can just use "%1$s (by me)" or "Me: %1$s" -->
<string name="ActionBySelf">%1$s от меня.</string>
</resources>
@@ -443,7 +443,6 @@
<string name="VerifiedGroup">Verified group</string>
<string name="Group">Group</string>
<string name="EditedNameWillBeShared">The edited name will be shared with all group members.</string>
<string name="QrShowInviteCode">Show QR invite code</string>
<string name="E2EEncryptionPreferred">End-to-end encryption preferred.</string>
<string name="OobAddrVerified">%1$s verified.</string>
<string name="OobAddrVerifiedIntroduceMyself">%1$s verified, introduce myself …</string>
@@ -458,4 +457,13 @@
If you do not find a correct grammar for your language you can just use "%1$s (by me)" or "Me: %1$s" -->
<string name="ActionBySelf">%1$s by me.</string>
<string name="ExampleEmailAddr">user@example.org</string>
<string name="QrScanHint">Place your camera over the QR code</string>
<string name="QrShowVerifyCode">Show QR verify code</string>
<string name="QrVerifyContactTitle">QR verify code</string>
<string name="QrVerifyContactHint"><![CDATA[<b>]]>%1$s<![CDATA[</b>]]>\nScan this to setup a verified contact.</string>
<string name="QrShowInviteCode">Show QR invite code</string>
<string name="QrJoinVerifiedGroupTitle">QR invite code</string>
<string name="QrJoinVerifiedGroupHint">Scan this to join the verified group <![CDATA[<b>]]>%1$s<![CDATA[</b>]]>.</string>
</resources>
@@ -10,6 +10,13 @@
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="Theme.MessengerProj.AppCompat" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#415e6b</item>
<item name="colorPrimaryDark">#364e59</item>
<item name="android:colorBackground">@android:color/white</item>
<item name="android:windowBackground">@android:color/white</item>
</style>
<style name="Theme.MessengerProj" parent="@android:style/Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>