Skip to content

Commit

Permalink
see RN2.2.3 (20200728)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeng-git committed Jul 28, 2020
1 parent 3bb934b commit 5a49507
Show file tree
Hide file tree
Showing 41 changed files with 540 additions and 1,550 deletions.
16 changes: 16 additions & 0 deletions aTalk/ReleaseNotes.txt
@@ -1,4 +1,20 @@
Project aTalk-Android Release Notes
=========================================================================
Author: cmeng
Upload Date: 07/28/2020
Version: 2.3.3 (1133)

- Table metaContactGroup must be initialized to contain the RootMetaContactGroup on new database creation
Was accidentally removed when MigrateDir.aTalkDirMigrate() was removed.
- Include 'Online help' and 'About' in newly installed account creation UI pull down menu.
- Fix certificate view problem for compileSdkVersion = 29+; replacing • with • in X509CertificateView
- Update source to remove dependency on the obsoleted NetworkInfo class.

- Upgrade compile SdkVersion to support API-29
- Port to use build:gradle:4.0.1 and gradle-6.1.1
- Move StringUtils.hexStringToByteArray() into AesgcmUrl.class; eliminating patched StringUtils
- Update RecipientSelectView to conform to "com.splitwise:tokenautocomplete:3.0.2"

=========================================================================
Author: cmeng
Upload Date: 07/24/2020
Expand Down
42 changes: 18 additions & 24 deletions aTalk/build.gradle
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.anarres.jarjar:jarjar-gradle:1.0.1" // working jarjar.repackage version
}
}
Expand All @@ -16,6 +16,11 @@ apply plugin: 'org.anarres.jarjar'
repositories {
maven {
url 'third_party/m2'
// Must include this for gradle 5.0+
metadataSources {
mavenPom()
artifact()
}
}
google()
jcenter()
Expand All @@ -32,12 +37,6 @@ repositories {
// Git project library as local library project (ucrop) - see https://jitpack.io/docs/
url 'https://jitpack.io'
}
// maven {
// Custom library for org.jitsi - maven-metadata.xml not compatible
// Unable to load Maven meta-data from https://github.com/jitsi/jitsi-maven-repository/tree/master/snapshots/org/jitsi/ice4j/2.0.0-SNAPSHOT/maven-metadata.xml.
// org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 91; Attribute name "data-pjax-transient" associated with an element type "meta" must be followed by the ' = ' character.
// url 'https://github.com/jitsi/jitsi-maven-repository/tree/master/snapshots'
// }
}

configurations {
Expand All @@ -46,21 +45,15 @@ configurations {

// dependency libraries duplication conflict cause by smack-xmlparser-xpp3
all*.exclude group: 'xpp3', module: 'xpp3_min'

// No further required for >= sdk-26, httpclient is used in jbosh#ApacheHTTPSender; Do not exclude otherwise
// "Could not load org.igniterealtime.jbosh.HTTPSender implementation" with fdroidDebug apk
// all*.exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}

configurations.all {
it.resolutionStrategy {
eachDependency { details ->
// multiple actions can be specified
if (details.requested.group == "org.igniterealtime.smack" && ['smack-experimental', 'smack-core', 'smack-extensions'].contains(details.requested.name)) {
if (details.requested.group == "org.igniterealtime.smack" && ['smack-core', 'smack-experimental', 'smack-extensions'].contains(details.requested.name)) {
//changing the name reference to smack libraries to its individual jar
details.useTarget group: details.requested.group, name: "${details.requested.name}-jarjar", version: details.requested.version
// reference to smack libraries as a single merged jarjar
// details.useTarget group: details.requested.group, name: "smack-jarjared", version: details.requested.version
}
}
}
Expand All @@ -72,8 +65,8 @@ android {

defaultConfig {
applicationId "org.atalk.android"
versionCode 1132
versionName "2.3.2"
versionCode 1133
versionName "2.3.3"

minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.compileSdkVersion
Expand Down Expand Up @@ -191,6 +184,7 @@ dependencies {
implementation "androidx.legacy:legacy-support-v13:${rootProject.supportLibraryVersion}"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.preference:preference:1.1.1"

implementation "com.google.android.material:material:1.1.0"

Expand All @@ -210,10 +204,8 @@ dependencies {
implementation 'com.github.yalantis:ucrop:2.2.2'

implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.5'
implementation 'com.splitwise:tokenautocomplete:2.0.8'
implementation 'com.splitwise:tokenautocomplete:3.0.2'

// when targeting Android API 23 and newer - class obsoleted
// implementation 'cz.msebera.android:httpclient:4.5.8' // duplicate class
implementation 'de.cketti.library.changelog:ckchangelog:1.2.2'

implementation 'commons-codec:commons-codec:1.14'
Expand All @@ -228,7 +220,7 @@ dependencies {
implementation 'org.bouncycastle:bcpkix-jdk15on:1.65'
implementation 'org.bouncycastle:bctls-jdk15on:1.65'

// Required for debug and tracing - do not removed
// Required for debug and tracing for bouncycastle - do not removed
// implementation jarjar.repackage {
// from('org.bouncycastle:bctls-jdk15on:1.65') {
// transitive = false
Expand Down Expand Up @@ -283,7 +275,7 @@ dependencies {
* May use className and className$** to delete only the related, but excluding classes with same prefix
*/
implementation jarjar.repackage {
from ('org.jitsi:fmj:1.0.0-jitsi')
from('org.jitsi:fmj:1.0.0-jitsi')
destinationDir new File("${projectDir}/libs")
destinationName "fmj-1.0.0-jitsi.jar"

Expand All @@ -302,10 +294,10 @@ dependencies {
// ice4j-2.0.0 work only with AWS disabled - otherwise hang in AWS EC2 conn.getContent()
// System.setProperty(MappingCandidateHarvesters.DISABLE_AWS_HARVESTER_PNAME, "true")
implementation jarjar.repackage {
// Do not use the latest master-SNAPSHOT => not compatible with aTalk
// use the latest release version: ice4j-2.0.0-20190607.184546-36.jar
// Do not use the latest master-SNAPSHOT => not compatible with aTalk
// use the latest release version: ice4j-2.0.0-20190607.184546-36.jar
// 'ice4j:0b052e8f857653c32ef17ae8e35283f7993972ac' == 'ice4j:ice4j-2.0.0-20190607.184546-36'
from('com.github.jitsi:ice4j:0b052e8f857653c32ef17ae8e35283f7993972ac') {
// duplication in dependency conflict
transitive = false
}
destinationDir new File("${projectDir}/libs")
Expand Down Expand Up @@ -401,6 +393,8 @@ task updateVersionFile(type: Copy) {
// cmeng - need to perform setup libs (first time & after clean)
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
// options.compilerArgs << '-Xlint:unchecked'
// options.deprecation = true
}

// will clean /libs/armeabi/*.so
Expand Down
Expand Up @@ -667,6 +667,7 @@ else if (serverCheck)
List<String> storedCerts = new LinkedList<>();
String appName = aTalkApp.getResString(R.string.APPLICATION_NAME);

Timber.w("SSL certificate untrusted chain: %s", e.getMessage());
if ((identitiesToTest == null) || !identitiesToTest.iterator().hasNext()) {
String propName = PNAME_CERT_TRUST_PREFIX + CERT_TRUST_SERVER_SUBFIX + thumbprint;
propNames.add(propName);
Expand Down
Expand Up @@ -147,6 +147,7 @@ private void processGroupContact(String accountUuid, String accountUid)
String persistentData = cursor.getString(cursor.getColumnIndex(MetaContactGroup.PERSISTENT_DATA));

Timber.d("### Fetching contact group: %s: %s for %s", parentProtoGroupUID, protoGroupUID, accountUuid);
// Must be the first item in the Table metaContactGroup where the ROOT_GROUP_UID is the tree root
if (ContactGroup.ROOT_GROUP_UID.equals(groupUID)) {
metaGroup = mclServiceImpl.rootMetaGroup;
parentProtoGroup = null;
Expand Down Expand Up @@ -175,7 +176,7 @@ private void processGroupContact(String accountUuid, String accountUid)
String protoGroupUID = cursor.getString(cursor.getColumnIndex(MetaContactGroup.PROTO_GROUP_UID));
String contactAddress = cursor.getString(cursor.getColumnIndex(MetaContactGroup.CONTACT_JID));
String displayName = cursor.getString(cursor.getColumnIndex(MetaContactGroup.MC_DISPLAY_NAME));
boolean isDisplayNameUserDefined = Boolean.valueOf(
boolean isDisplayNameUserDefined = Boolean.parseBoolean(
cursor.getString(cursor.getColumnIndex(MetaContactGroup.MC_USER_DEFINED)));
String persistentData = cursor.getString(cursor.getColumnIndex(MetaContactGroup.PERSISTENT_DATA));
JSONObject details = new JSONObject();
Expand Down Expand Up @@ -1108,4 +1109,22 @@ public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
{
// TODO Store MetaContact avatar.
}

/**
* Fills the metaContactGroup table with the rootGroup necessary for it to be filled properly
* as the meta contact list evolves. This must be executed on a new database creation.
*/
public static void initMCLDataBase(SQLiteDatabase db)
{
ContentValues mclValues = new ContentValues();
// dummy account for root group
String accNodeName = "acc" + Long.toString(System.currentTimeMillis());

mclValues.put(MetaContactGroup.ACCOUNT_UUID, accNodeName);
mclValues.put(MetaContactGroup.PARENT_PROTO_GROUP_UID, ContactGroup.ROOT_NAME);
mclValues.put(MetaContactGroup.MC_GROUP_UID, ContactGroup.ROOT_GROUP_UID);
mclValues.put(MetaContactGroup.PROTO_GROUP_UID, ContactGroup.ROOT_PROTO_GROUP_UID);
mclValues.put(MetaContactGroup.MC_GROUP_NAME, ContactGroup.ROOT_GROUP_NAME);
db.insert(MetaContactGroup.TABLE_NAME, null, mclValues);
}
}
Expand Up @@ -2251,8 +2251,8 @@ public MetaContactGroupImpl loadStoredMetaContactGroup(MetaContactGroupImpl pare
String metaContactGroupUID, String displayName)
{
// first check if the group exists already.
MetaContactGroupImpl newMetaGroup = (MetaContactGroupImpl) parentGroup
.getMetaContactSubgroupByUID(metaContactGroupUID);
MetaContactGroupImpl newMetaGroup
= (MetaContactGroupImpl) parentGroup.getMetaContactSubgroupByUID(metaContactGroupUID);

// if the group exists then we have already loaded it for another
// account and we should reuse the same instance.
Expand Down
Expand Up @@ -39,15 +39,15 @@ public class AnonymousLoginStrategy implements JabberLoginStrategy
* <tt>UserCredentials</tt> used by accompanying services.
*/
private final UserCredentials credentials;
private ConnectionConfiguration.Builder ccBuilder;
private ConnectionConfiguration.Builder<?, ?> ccBuilder;

/**
* Creates new anonymous login strategy instance.
*
* @param login user login only for the purpose of returning <tt>UserCredentials</tt> that are used by
* accompanying services.
*/
public AnonymousLoginStrategy(String login, ConnectionConfiguration.Builder ccBuilder)
public AnonymousLoginStrategy(String login, ConnectionConfiguration.Builder<?, ?> ccBuilder)
{
this.credentials = new UserCredentials();
this.ccBuilder = ccBuilder;
Expand Down Expand Up @@ -102,7 +102,7 @@ public SSLContext createSslContext(CertificateService certificateService,
}

@Override
public ConnectionConfiguration.Builder getConnectionConfigurationBuilder()
public ConnectionConfiguration.Builder<?, ?> getConnectionConfigurationBuilder()
{
return ccBuilder;
}
Expand Down
Expand Up @@ -81,5 +81,5 @@ SSLContext createSslContext(CertificateService certificateService, X509TrustMana
*
* @return The connection configuration builder configured for this login strategy.
*/
ConnectionConfiguration.Builder getConnectionConfigurationBuilder();
ConnectionConfiguration.Builder<?, ?> getConnectionConfigurationBuilder();
}
Expand Up @@ -31,15 +31,15 @@
class LoginByClientCertificateStrategy implements JabberLoginStrategy
{
private AccountID accountID;
private ConnectionConfiguration.Builder ccBuilder;
private ConnectionConfiguration.Builder<?, ?> ccBuilder;

/**
* Creates a new instance of this class.
*
* @param accountID The account to use for the strategy.
* @param ccBuilder
* @param ccBuilder ConnectionConfiguration.Builder
*/
public LoginByClientCertificateStrategy(AccountID accountID, ConnectionConfiguration.Builder ccBuilder)
public LoginByClientCertificateStrategy(AccountID accountID, ConnectionConfiguration.Builder<?, ?> ccBuilder)
{
this.accountID = accountID;
this.ccBuilder = ccBuilder;
Expand Down Expand Up @@ -138,7 +138,7 @@ public boolean registerAccount(ProtocolProviderServiceJabberImpl pps, AccountID
}

@Override
public ConnectionConfiguration.Builder getConnectionConfigurationBuilder()
public ConnectionConfiguration.Builder<?, ?> getConnectionConfigurationBuilder()
{
return ccBuilder;
}
Expand Down
Expand Up @@ -39,7 +39,7 @@ public class LoginByPasswordStrategy implements JabberLoginStrategy
{
private final AbstractProtocolProviderService protocolProvider;
private final AccountID accountID;
private ConnectionConfiguration.Builder ccBuilder;
private ConnectionConfiguration.Builder<?, ?> ccBuilder;
private String password;

/**
Expand All @@ -49,7 +49,7 @@ public class LoginByPasswordStrategy implements JabberLoginStrategy
* @param accountID The accountID to use for the login.
*/
public LoginByPasswordStrategy(AbstractProtocolProviderService protocolProvider, AccountID accountID,
ConnectionConfiguration.Builder ccBuilder)
ConnectionConfiguration.Builder<?, ?> ccBuilder)
{
this.protocolProvider = protocolProvider;
this.accountID = accountID;
Expand Down Expand Up @@ -246,7 +246,7 @@ private UserCredentials loadPassword(SecurityAuthority authority, int reasonCode
}

@Override
public ConnectionConfiguration.Builder getConnectionConfigurationBuilder()
public ConnectionConfiguration.Builder<?, ?> getConnectionConfigurationBuilder()
{
return ccBuilder;
}
Expand Down
Expand Up @@ -6,8 +6,8 @@
package net.java.sip.communicator.impl.protocol.jabber;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.*;
import android.os.Build;
import android.text.TextUtils;

import net.java.sip.communicator.impl.msghistory.MessageHistoryServiceImpl;
Expand Down Expand Up @@ -780,7 +780,7 @@ private void initializeConnectAndLogin(SecurityAuthority authority, int reasonCo
*/
private JabberLoginStrategy createLoginStrategy()
{
ConnectionConfiguration.Builder<?,?> ccBuilder;
ConnectionConfiguration.Builder<?, ?> ccBuilder;
if (mAccountID.isBOSHEnable()) {
ccBuilder = BOSHConfiguration.builder();
}
Expand Down Expand Up @@ -890,7 +890,7 @@ private void loadProxy()
private ConnectState connectAndLogin(String userName, JabberLoginStrategy loginStrategy)
throws XMPPException, SmackException
{
ConnectionConfiguration.Builder<?,?> config = loginStrategy.getConnectionConfigurationBuilder();
ConnectionConfiguration.Builder<?, ?> config = loginStrategy.getConnectionConfigurationBuilder();

// Set XmppDomain to serviceName - default for no server-overridden and Bosh connection.
DomainBareJid serviceName = mAccountID.getXmppDomain();
Expand Down Expand Up @@ -1177,7 +1177,7 @@ else if (DNSSEC_AND_DANE.equals(dnssecMode)) {
* If account is not registered on server, send IB registration request to server if user
* enable the option. Otherwise throw back to user and ask for InBand registration confirmation.
*/
if (errMsg.contains("not-authorized")) {
if (StringUtils.isNotEmpty(errMsg) && errMsg.contains("not-authorized")) {
if (mAccountID.isIbRegistration()) {
try {
// Server sends stream disconnect on "not-authorized". So perform manual connect again before
Expand Down Expand Up @@ -1205,7 +1205,7 @@ else if (DNSSEC_AND_DANE.equals(dnssecMode)) {
loginStrategy.getClass().getName() + " requests abort");

errMsg = err.getMessage();
if (!errMsg.contains("registration-required")) {
if (StringUtils.isNotEmpty(errMsg) && !errMsg.contains("registration-required")) {
errMsg = aTalkApp.getResString(R.string.service_gui_REGISTRATION_REQUIRED, errMsg);
Timber.e("%s", errMsg);
StanzaError stanzaError = StanzaError.from(Condition.forbidden, errMsg).build();
Expand Down Expand Up @@ -1507,9 +1507,21 @@ private boolean isConnectedMobile()
{
Context context = aTalkApp.getGlobalContext();
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
return (info != null && info.isConnected()
&& info.getType() == ConnectivityManager.TYPE_MOBILE);
if (cm != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final Network network = cm.getActiveNetwork();
if (network != null) {
final NetworkCapabilities nc = cm.getNetworkCapabilities(network);
return (nc != null) && nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
}
}
else {
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected()
&& networkInfo.getType() == ConnectivityManager.TYPE_MOBILE);
}
}
return false;
}

/**
Expand Down Expand Up @@ -2552,7 +2564,7 @@ else if (failMode == SecurityAuthority.CONFLICT) {
if ((failMode == SecurityAuthority.REASON_UNKNOWN)
|| (failMode == SecurityAuthority.SECURITY_EXCEPTION)
|| (failMode == SecurityAuthority.POLICY_VIOLATION)) {
if (TextUtils.isEmpty(reason))
if (TextUtils.isEmpty(reason) && (ex.getCause() != null))
reason = ex.getCause().getMessage();
DialogActivity.showDialog(aTalkApp.getGlobalContext(),
aTalkApp.getResString(R.string.service_gui_ERROR), reason);
Expand Down

0 comments on commit 5a49507

Please sign in to comment.