Skip to content

Commit 60923ad

Browse files
authored
Merge pull request #875 from redsolution/develop
Update 2.6.2 (591)
2 parents 7db2ed7 + 922e42e commit 60923ad

File tree

584 files changed

+22610
-16806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

584 files changed

+22610
-16806
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ buildscript {
66
maven { url 'https://maven.fabric.io/public' }
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.2.1'
9+
classpath 'com.android.tools.build:gradle:3.3.1'
1010
classpath "io.realm:realm-gradle-plugin:3.1.1"
1111
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
1212
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.4'
1313
classpath 'io.fabric.tools:gradle:1.25.4'
14-
classpath 'com.google.gms:google-services:3.1.1'
14+
classpath 'com.google.gms:google-services:4.2.0'
1515
}
1616
}
1717

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Sep 25 11:30:28 YEKT 2018
1+
#Fri Feb 15 11:01:28 YEKT 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

xabber/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion 15
1212
targetSdkVersion 28
13-
versionCode 568
14-
versionName '2.6(568)'
13+
versionCode 591
14+
versionName '2.6.2(591)'
1515
}
1616

1717
lintOptions {
@@ -128,7 +128,7 @@ dependencies {
128128
implementation 'com.android.support:multidex:1.0.3'
129129

130130
// firebase
131-
compile 'com.google.firebase:firebase-messaging:11.4.0'
131+
implementation 'com.google.firebase:firebase-messaging:17.3.4'
132132

133133
implementation 'com.github.Str4tocaster:otr4j:custom-SNAPSHOT'
134134
implementation 'com.google.zxing:android-integration:3.3.0'
@@ -144,10 +144,10 @@ dependencies {
144144
implementation 'io.reactivex:rxjava:1.1.0'
145145

146146
// social
147-
implementation 'com.google.android.gms:play-services-safetynet:11.4.0'
147+
implementation 'com.google.android.gms:play-services-safetynet:16.0.0'
148148
implementation 'com.facebook.android:facebook-login:4.36.1'
149149
implementation 'com.twitter.sdk.android:twitter:3.0.0'
150-
implementation 'com.google.android.gms:play-services-auth:11.4.0'
150+
implementation 'com.google.android.gms:play-services-auth:15.0.0'
151151
implementation ('com.google.api-client:google-api-client-android:1.22.0') {
152152
exclude module: 'httpclient'
153153
}
@@ -178,7 +178,7 @@ dependencies {
178178

179179
// block canary
180180
debugImplementation 'com.github.markzhai:blockcanary-android:1.5.0'
181-
releaseCompile 'com.github.markzhai:blockcanary-no-op:1.5.0'
181+
releaseImplementation 'com.github.markzhai:blockcanary-no-op:1.5.0'
182182

183183
}
184184
apply plugin: 'com.google.gms.google-services'

xabber/emojicon/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="github.ankushsachdeva.emojicon">
33

4-
<uses-sdk android:targetSdkVersion="19"/>
5-
64
<application android:allowBackup="true"
75
android:label="@string/app_name"
86
android:icon="@drawable/ic_launcher">

xabber/src/main/AndroidManifest.xml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444

4545
<application
4646
android:name=".data.Application"
47-
android:allowBackup="true"
47+
android:allowBackup="false"
4848
android:icon="@mipmap/ic_launcher"
4949
android:label="@string/application_title_full"
5050
android:theme="@style/Theme"
51-
tools:replace="label, icon">
51+
tools:replace="label, icon, allowBackup">
5252
<activity
5353
android:name=".ui.activity.ContactListActivity"
5454
android:label="@string/application_title_full"
@@ -207,16 +207,6 @@
207207
android:name="android.support.PARENT_ACTIVITY"
208208
android:value="com.xabber.android.ui.activity.ContactListActivity" />
209209
</activity>
210-
<activity
211-
android:name=".ui.preferences.ChatContactSettings"
212-
android:label="@string/chat_settings"
213-
android:parentActivityName=".ui.activity.ChatActivity">
214-
215-
<!-- Parent activity meta-data to support 4.0 and lower -->
216-
<meta-data
217-
android:name="android.support.PARENT_ACTIVITY"
218-
android:value="com.xabber.android.ui.activity.ChatActivity" />
219-
</activity>
220210
<activity
221211
android:name=".ui.activity.ContactActivity"
222212
android:label="@string/contact_viewer"
@@ -443,6 +433,7 @@
443433
<action android:name="android.intent.action.QUICKBOOT_POWEROFF" />
444434
</intent-filter>
445435
</receiver>
436+
<receiver android:name=".receiver.NotificationReceiver" />
446437

447438
<activity android:name="de.duenndns.ssl.MemorizingActivity" />
448439
<activity android:name="com.soundcloud.android.crop.CropImageActivity" />
@@ -576,6 +567,13 @@
576567
android:name="android.support.PARENT_ACTIVITY"
577568
android:value="com.xabber.android.ui.activity.ChatActivity" />
578569
</activity>
570+
<activity android:name=".ui.preferences.CustomNotifySettings"
571+
android:label="@string/custom_notifications"
572+
android:parentActivityName=".ui.activity.ChatActivity">
573+
<meta-data
574+
android:name="android.support.PARENT_ACTIVITY"
575+
android:value="com.xabber.android.ui.activity.ChatActivity" />
576+
</activity>
579577
</application>
580578

581579
</manifest>

xabber/src/main/java/com/xabber/android/data/Application.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.xabber.android.data.message.chat.ChatManager;
5757
import com.xabber.android.data.message.phrase.PhraseManager;
5858
import com.xabber.android.data.notification.NotificationManager;
59+
import com.xabber.android.data.notification.custom_notification.CustomNotifyPrefsManager;
5960
import com.xabber.android.data.roster.GroupManager;
6061
import com.xabber.android.data.roster.PresenceManager;
6162
import com.xabber.android.data.roster.RosterManager;
@@ -368,6 +369,7 @@ private void addManagers() {
368369
addManager(GroupManager.getInstance());
369370
addManager(PhraseManager.getInstance());
370371
addManager(NotificationManager.getInstance());
372+
addManager(CustomNotifyPrefsManager.getInstance());
371373
addManager(ActivityManager.getInstance());
372374
addManager(CapabilitiesManager.getInstance());
373375
addManager(ChatStateManager.getInstance());

xabber/src/main/java/com/xabber/android/data/SettingsManager.java

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
public class SettingsManager implements OnInitializedListener,
5858
OnMigrationListener, OnSharedPreferenceChangeListener {
5959

60+
public static final String NOTIFICATION_PREFERENCES = "notification_preferences";
61+
6062
private static SettingsManager instance;
6163

6264
private SettingsManager() {
@@ -75,6 +77,11 @@ private static SharedPreferences getSharedPreferences() {
7577
.getInstance());
7678
}
7779

80+
private static SharedPreferences getNotificationSharedPreferences() {
81+
return Application.getInstance().getSharedPreferences(
82+
NOTIFICATION_PREFERENCES, Context.MODE_PRIVATE);
83+
}
84+
7885
private static int getInt(int key, int def) {
7986
String value = getString(key, def);
8087
try {
@@ -110,6 +117,16 @@ private static void setBoolean(int key, boolean value) {
110117
editor.commit();
111118
}
112119

120+
private static boolean getNotifBoolean(int key, boolean def) {
121+
return getNotificationSharedPreferences().getBoolean(
122+
Application.getInstance().getString(key), def);
123+
}
124+
125+
private static boolean getNotifBoolean(int key, int def) {
126+
return getNotifBoolean(key, Application.getInstance().getResources()
127+
.getBoolean(def));
128+
}
129+
113130
private static String getString(int key, String def) {
114131
return getSharedPreferences().getString(
115132
Application.getInstance().getString(key), def);
@@ -125,6 +142,21 @@ private static void setString(int key, String value) {
125142
editor.commit();
126143
}
127144

145+
private static String getNotifString(int key, String def) {
146+
return getNotificationSharedPreferences().getString(
147+
Application.getInstance().getString(key), def);
148+
}
149+
150+
private static String getNotifString(int key, int def) {
151+
return getNotifString(key, Application.getInstance().getString(def));
152+
}
153+
154+
private static void setNotifString(int key, String value) {
155+
Editor editor = getNotificationSharedPreferences().edit();
156+
editor.putString(Application.getInstance().getString(key), value);
157+
editor.apply();
158+
}
159+
128160
/**
129161
* @param key
130162
* @param defaultUri
@@ -133,11 +165,11 @@ private static void setString(int key, String value) {
133165
private static Uri getSound(int key, Uri defaultUri, int defaultResource) {
134166
String defaultValue = Application.getInstance().getString(
135167
defaultResource);
136-
String value = getString(key, defaultValue);
168+
String value = getNotifString(key, defaultValue);
137169
if (TextUtils.isEmpty(value))
138170
return null;
139171
if (defaultValue.equals(value)) {
140-
setString(key, defaultUri.toString());
172+
setNotifString(key, defaultUri.toString());
141173
return defaultUri;
142174
}
143175
return Uri.parse(value);
@@ -241,7 +273,7 @@ public static Uri eventsSoundMuc() {
241273
}
242274

243275
public static VibroMode eventsVibroChat() {
244-
String value = getString(R.string.events_vibro_chat_key, R.string.events_vibro_bydefault);
276+
String value = getNotifString(R.string.events_vibro_chat_key, R.string.events_vibro_bydefault);
245277
if (Application.getInstance().getString(R.string.events_vibro_disable).equals(value)) {
246278
return VibroMode.disabled;
247279
} else if (Application.getInstance().getString(R.string.events_vibro_bydefault).equals(value)) {
@@ -258,7 +290,7 @@ public static VibroMode eventsVibroChat() {
258290
}
259291

260292
public static VibroMode eventsVibroMuc() {
261-
String value = getString(R.string.events_vibro_muc_key, R.string.events_vibro_bydefault);
293+
String value = getNotifString(R.string.events_vibro_muc_key, R.string.events_vibro_bydefault);
262294
if (Application.getInstance().getString(R.string.events_vibro_disable).equals(value)) {
263295
return VibroMode.disabled;
264296
} else if (Application.getInstance().getString(R.string.events_vibro_bydefault).equals(value)) {
@@ -274,6 +306,7 @@ public static VibroMode eventsVibroMuc() {
274306
}
275307
}
276308

309+
@Deprecated
277310
public static boolean eventsSuppress100() {
278311
return getBoolean(R.string.chat_events_suppress_100_key,
279312
R.bool.chat_events_suppress_100_default);
@@ -285,12 +318,12 @@ public static boolean eventsSuppress100() {
285318
// }
286319

287320
public static boolean eventsLightning() {
288-
return getBoolean(R.string.events_lightning_key,
321+
return getNotifBoolean(R.string.events_lightning_key,
289322
R.bool.events_lightning_default);
290323
}
291324

292325
public static boolean eventsLightningForMuc() {
293-
return getBoolean(R.string.events_lightning_muc_key,
326+
return getNotifBoolean(R.string.events_lightning_muc_key,
294327
R.bool.events_lightning_default);
295328
}
296329

@@ -300,50 +333,53 @@ public static boolean eventsPersistent() {
300333
}
301334

302335
public static boolean eventsShowText() {
303-
return getBoolean(R.string.events_show_text_key,
336+
return getNotifBoolean(R.string.events_show_text_key,
304337
R.bool.events_show_text_default);
305338
}
306339

307340
public static boolean eventsShowTextOnMuc() {
308-
return getBoolean(R.string.events_show_text_muc_key,
341+
return getNotifBoolean(R.string.events_show_text_muc_key,
309342
R.bool.events_show_text_default);
310343
}
311344

312345
public static boolean eventsOnChat() {
313-
return getBoolean(R.string.events_on_chat_key,
346+
return getNotifBoolean(R.string.events_on_chat_key,
314347
R.bool.events_on_chat_default);
315348
}
316349

317350
public static boolean eventsOnMuc() {
318-
return getBoolean(R.string.events_on_muc_key,
351+
return getNotifBoolean(R.string.events_on_muc_key,
319352
R.bool.events_on_muc_default);
320353
}
321354

322-
public static boolean eventsInAppSounds() {
323-
return getBoolean(R.string.events_in_app_sounds_key,
324-
R.bool.events_in_app_sounds_default);
325-
}
326-
327-
public static boolean eventsInAppVibrate() {
328-
return getBoolean(R.string.events_in_app_vibrate_key,
329-
R.bool.events_in_app_vibrate_default);
330-
}
331-
332-
public static boolean eventsInAppPreview() {
333-
return getBoolean(R.string.events_in_app_preview_key,
334-
R.bool.events_in_app_preview_default);
335-
}
355+
// public static boolean eventsInAppSounds() {
356+
// return getBoolean(R.string.events_in_app_sounds_key,
357+
// R.bool.events_in_app_sounds_default);
358+
// }
359+
//
360+
// public static boolean eventsInAppVibrate() {
361+
// return getBoolean(R.string.events_in_app_vibrate_key,
362+
// R.bool.events_in_app_vibrate_default);
363+
// }
364+
//
365+
// public static boolean eventsInAppPreview() {
366+
// return getBoolean(R.string.events_in_app_preview_key,
367+
// R.bool.events_in_app_preview_default);
368+
// }
336369

370+
@Deprecated
337371
public static boolean eventsInChatSounds() {
338372
return getBoolean(R.string.events_in_chat_sounds_key,
339373
R.bool.events_in_chat_sounds_default);
340374
}
341375

376+
@Deprecated
342377
public static boolean eventsVisibleChat() {
343378
return getBoolean(R.string.events_visible_chat_key,
344379
R.bool.events_visible_chat_default);
345380
}
346381

382+
@Deprecated
347383
public static boolean eventsFirstOnly() {
348384
return getBoolean(R.string.events_first_only_key,
349385
R.bool.events_first_only_default);
@@ -432,7 +468,7 @@ public static boolean chatsStateNotification() {
432468
}
433469

434470
public static boolean chatsAttention() {
435-
return getBoolean(R.string.chats_attention_key,
471+
return getNotifBoolean(R.string.chats_attention_key,
436472
R.bool.chats_attention_default);
437473
}
438474

@@ -818,6 +854,10 @@ public static int getLastCrowdfundingPosition() {
818854
return getInteger(R.string.crowdfunding_last_position_key, 0);
819855
}
820856

857+
public static void resetPreferences(Context context, String preferencesName) {
858+
context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE).edit().clear().apply();
859+
}
860+
821861
@Override
822862
public void onInitialized() {
823863
incrementBootCount();

0 commit comments

Comments
 (0)