Skip to content

Commit

Permalink
Merge pull request #887 from redsolution/develop
Browse files Browse the repository at this point in the history
Merge Develop to Master. Release 2.6.4
  • Loading branch information
Str4tocaster authored Jul 23, 2019
2 parents 952b489 + f5fe2c9 commit 33314e0
Show file tree
Hide file tree
Showing 203 changed files with 6,938 additions and 2,096 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ android:
licenses:
- '.+'

before_install:
- yes | sdkmanager "platforms;android-27"

install:
# Check install section: http://docs.travis-ci.com/user/build-configuration/#install
# If you'd like to skip the install stage entirely, set it to true and nothing will be run.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "io.realm:realm-gradle-plugin:3.1.1"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.4'
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
android.enableJetifier=false
android.useAndroidX=false
android.enableR8=false
android.enableUnitTestBinaryResources=false
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Feb 15 11:01:28 YEKT 2019
#Thu Apr 18 14:07:31 YEKT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
27 changes: 25 additions & 2 deletions xabber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 602
versionName '2.6.3(602)'
versionCode 634
versionName '2.6.4(634)'
manifestPlaceholders = [crashlytics:getLocalProperty("crashlytics.key")]
}

lintOptions {
Expand Down Expand Up @@ -95,6 +96,12 @@ android {
universalApk true
}
}

testOptions {
unitTests {
includeAndroidResources = true
}
}
}

def build_param = "${build}";
Expand All @@ -108,6 +115,17 @@ if (build_param == "open") {
}
}

def getLocalProperty(String propertyName) {
def propsFile = rootProject.file('local.properties')
if (propsFile.exists()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
return props[propertyName]
} else {
return ""
}
}

ext {
smackVersion = '4.2.1-SNAPSHOT'
supportVersion = '28.0.0'
Expand Down Expand Up @@ -180,9 +198,14 @@ dependencies {
debugImplementation 'com.github.markzhai:blockcanary-android:1.5.0'
releaseImplementation 'com.github.markzhai:blockcanary-no-op:1.5.0'

// test
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.0"
testImplementation "org.robolectric:shadows-multidex:4.0.1"
}
apply plugin: 'com.google.gms.google-services'

configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
all*.exclude group: 'com.google.guava', module:'guava-jdk5'
}
1 change: 1 addition & 0 deletions xabber/src/dev/res/values/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<!-- preference_debug -->
<bool name="debug_file_log_default">true</bool>
<bool name="debug_use_develop_api_default">true</bool>
<bool name="debug_sync_bookmarks_on_start_default">false</bool>

</resources>
14 changes: 14 additions & 0 deletions xabber/src/dev/res/xml/preference_debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,18 @@
android:title="@string/debug_fetch_crowdfunding_feed_title">
</Preference>

<Preference
android:key="@string/push_log_activity_key"
android:title="@string/push_log_title">
<intent
android:targetClass="com.xabber.android.ui.activity.PushLogActivity"
android:targetPackage="@string/application_package" />
</Preference>

<CheckBoxPreference
android:title="@string/debug_sync_bookmarks_on_start_title"
android:key="@string/debug_sync_bookmarks_on_start_key"
android:defaultValue="@bool/debug_sync_bookmarks_on_start_default"
/>

</PreferenceScreen>
12 changes: 12 additions & 0 deletions xabber/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
android:label="@string/application_title_full"
android:theme="@style/Theme"
tools:replace="label, icon, allowBackup">

<meta-data
android:name="io.fabric.ApiKey"
android:value="${crashlytics}"
/>

<activity
android:name=".ui.activity.ContactListActivity"
android:label="@string/application_title_full"
Expand Down Expand Up @@ -571,6 +577,12 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.activity.ChatActivity" />
</activity>
<activity android:name=".ui.activity.AccountPushActivity" />
<activity android:name=".ui.activity.PushLogActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.preferences.DebugSettings"/>
</activity>
</application>

</manifest>
29 changes: 27 additions & 2 deletions xabber/src/main/java/com/xabber/android/data/ActivityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
import com.xabber.android.R;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.connection.CertificateManager;
import com.xabber.android.data.extension.avatar.AvatarManager;
import com.xabber.android.data.log.LogManager;
import com.xabber.android.data.push.SyncManager;
import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.service.XabberService;
import com.xabber.android.ui.activity.AboutActivity;
import com.xabber.android.ui.activity.ContactListActivity;
import com.xabber.android.ui.activity.LoadActivity;
Expand All @@ -42,6 +46,7 @@
public class ActivityManager implements OnUnloadListener {

private static final String EXTRA_TASK_INDEX = "com.xabber.android.data.ActivityManager.EXTRA_TASK_INDEX";
private static final long START_SERVICE_DELAY = 1000;

private static final boolean LOG = true;
private static ActivityManager instance;
Expand Down Expand Up @@ -201,11 +206,30 @@ public void onResume(final Activity activity) {
if (LOG) {
LogManager.i(activity, "onResume");
}
if (!application.isInitialized() && !(activity instanceof LoadActivity)) {
if((!application.isInitialized() || SyncManager.getInstance().isSyncMode())
&& !Application.getInstance().isClosing()) {

if (LOG) {
LogManager.i(this, "Wait for loading");
}
activity.startActivity(LoadActivity.createIntent(activity));
AccountManager.getInstance().onPreInitialize();
RosterManager.getInstance().onPreInitialize();
Application.getInstance().runInBackground(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(START_SERVICE_DELAY);
} catch (InterruptedException e) {
e.printStackTrace();
}
Application.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
activity.startService(XabberService.createIntent(activity));
}
});
}
});
}
if (onErrorListener != null) {
application.removeUIListener(OnErrorListener.class, onErrorListener);
Expand All @@ -221,6 +245,7 @@ public void onError(final int resourceId) {

CertificateManager.getInstance().registerActivity(activity);
AccountManager.getInstance().stopGracePeriod();
SyncManager.getInstance().onActivityResume();
}

/**
Expand Down
15 changes: 13 additions & 2 deletions xabber/src/main/java/com/xabber/android/data/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
import com.xabber.android.data.extension.chat_markers.ChatMarkerManager;
import com.xabber.android.data.extension.cs.ChatStateManager;
import com.xabber.android.data.extension.httpfileupload.HttpFileUploadManager;
import com.xabber.android.data.extension.mam.MamManager;
import com.xabber.android.data.extension.iqlast.LastActivityInteractor;
import com.xabber.android.data.extension.mam.NextMamManager;
import com.xabber.android.data.extension.muc.MUCManager;
import com.xabber.android.data.extension.otr.OTRManager;
import com.xabber.android.data.extension.ssn.SSNManager;
Expand All @@ -56,8 +57,11 @@
import com.xabber.android.data.message.ReceiptManager;
import com.xabber.android.data.message.chat.ChatManager;
import com.xabber.android.data.message.phrase.PhraseManager;
import com.xabber.android.data.notification.DelayedNotificationActionManager;
import com.xabber.android.data.notification.NotificationManager;
import com.xabber.android.data.notification.custom_notification.CustomNotifyPrefsManager;
import com.xabber.android.data.push.PushManager;
import com.xabber.android.data.push.SyncManager;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.PresenceManager;
import com.xabber.android.data.roster.RosterManager;
Expand Down Expand Up @@ -349,6 +353,7 @@ public void onCreate() {
}

private void addManagers() {
addManager(SyncManager.getInstance());
addManager(SettingsManager.getInstance());
addManager(LogManager.getInstance());
addManager(DatabaseManager.getInstance());
Expand Down Expand Up @@ -383,9 +388,12 @@ private void addManagers() {
addManager(CarbonManager.getInstance());
addManager(HttpFileUploadManager.getInstance());
addManager(BlockingManager.getInstance());
addManager(MamManager.getInstance());
addManager(NextMamManager.getInstance());
addManager(CertificateManager.getInstance());
addManager(XMPPAuthManager.getInstance());
addManager(PushManager.getInstance());
addManager(DelayedNotificationActionManager.getInstance());
addManager(LastActivityInteractor.getInstance());
}

/**
Expand Down Expand Up @@ -603,4 +611,7 @@ public void runOnUiThreadDelay(final Runnable runnable, long delayMillis) {
handler.postDelayed(runnable, delayMillis);
}

public boolean isServiceStarted() {
return serviceStarted;
}
}
28 changes: 22 additions & 6 deletions xabber/src/main/java/com/xabber/android/data/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ public static boolean eventsLightningForMuc() {
R.bool.events_lightning_default);
}

public static boolean eventsPersistent() {
return getBoolean(R.string.events_persistent_key,
R.bool.events_persistent_default);
}
// public static boolean eventsPersistent() {
// return getBoolean(R.string.events_persistent_key,
// R.bool.events_persistent_default);
// }

public static boolean eventsShowText() {
return getNotifBoolean(R.string.events_show_text_key,
Expand Down Expand Up @@ -367,9 +367,8 @@ public static boolean eventsOnMuc() {
// R.bool.events_in_app_preview_default);
// }

@Deprecated
public static boolean eventsInChatSounds() {
return getBoolean(R.string.events_in_chat_sounds_key,
return getNotifBoolean(R.string.events_in_chat_sounds_key,
R.bool.events_in_chat_sounds_default);
}

Expand Down Expand Up @@ -528,6 +527,11 @@ public static boolean connectionUseCarbons() {
R.bool.connection_use_carbons_default);
}

public static boolean connectionCompressImage() {
return getBoolean(R.string.connection_compress_image_on_upload_key,
R.bool.connection_compress_image_on_upload_default);
}

public static DnsResolverType connectionDnsResolver() {
String value = getString(R.string.connection_dns_resolver_type_key,
R.string.connection_dns_resolver_type_default);
Expand Down Expand Up @@ -600,6 +604,10 @@ public static boolean useDevelopAPI() {
return getBoolean(R.string.debug_use_develop_api_key, R.bool.debug_use_develop_api_default);
}

public static boolean syncBookmarksOnStart() {
return getBoolean(R.string.debug_sync_bookmarks_on_start_key, R.bool.debug_sync_bookmarks_on_start_default);
}

public static boolean isCrashReportsSupported() {
return BuildConfig.FLAVOR.equals("beta")
|| BuildConfig.FLAVOR.equals("vip")
Expand Down Expand Up @@ -854,6 +862,14 @@ public static int getLastCrowdfundingPosition() {
return getInteger(R.string.crowdfunding_last_position_key, 0);
}

public static void setEnabledPushNodes(String enabledPushNodes) {
setString(R.string.enabled_push_nodes, enabledPushNodes);
}

public static String getEnabledPushNodes() {
return getString(R.string.enabled_push_nodes, "");
}

public static void resetPreferences(Context context, String preferencesName) {
context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE).edit().clear().apply();
}
Expand Down
Loading

0 comments on commit 33314e0

Please sign in to comment.