Skip to content

Commit 10d0506

Browse files
committed
Conscrypt settings not applied fix
1 parent b712129 commit 10d0506

7 files changed

Lines changed: 45 additions & 17 deletions

File tree

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/settings/GeneralSettingsPresenter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.liskovsoft.smartyoutubetv2.common.prefs.AppPrefs;
2424
import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData;
2525
import com.liskovsoft.smartyoutubetv2.common.prefs.MainUIData;
26+
import com.liskovsoft.smartyoutubetv2.common.prefs.NetworkData;
2627
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerData;
2728
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerTweaksData;
2829
import com.liskovsoft.smartyoutubetv2.common.prefs.SearchData;
@@ -45,6 +46,7 @@ public class GeneralSettingsPresenter extends BasePresenter<Void> {
4546
private final PlayerTweaksData mPlayerTweaksData;
4647
private final MainUIData mMainUIData;
4748
private final MediaServiceData mMediaServiceData;
49+
private final NetworkData mNetworkData;
4850
private final SidebarService mSidebarService;
4951
private boolean mRestartApp;
5052
private final Runnable mOnFinish = () -> {
@@ -61,6 +63,7 @@ private GeneralSettingsPresenter(Context context) {
6163
mPlayerTweaksData = PlayerTweaksData.instance(context);
6264
mMainUIData = MainUIData.instance(context);
6365
mMediaServiceData = MediaServiceData.instance();
66+
mNetworkData = NetworkData.instance(context);
6467
mSidebarService = SidebarService.instance(context);
6568
}
6669

@@ -658,10 +661,10 @@ private void appendConscrypt(AppDialogPresenter settingsPresenter, List<OptionIt
658661
options.add(UiOptionItem.from(getContext().getString(R.string.enable_conscrypt),
659662
getContext().getString(R.string.enable_conscrypt_desc),
660663
option -> {
661-
mGeneralData.setConscryptEnabled(option.isSelected());
664+
mNetworkData.setConscryptEnabled(option.isSelected());
662665
mRestartApp = true;
663666
},
664-
mGeneralData.isConscryptEnabled()));
667+
mNetworkData.isConscryptEnabled()));
665668
}
666669

667670
private void enableChildMode(boolean enable) {

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs/GeneralData.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public class GeneralData implements ProfileChangeListener {
8686
private int mLocalDriveBackupFreqDays;
8787
private List<Video> mOldPinnedItems;
8888
private boolean mIsRemapSToSpeedToggleEnabled;
89-
private boolean mIsConscryptEnabled;
9089
private final Runnable mPersistStateInt = this::persistStateInt;
9190

9291
private GeneralData(Context context) {
@@ -576,15 +575,6 @@ public void setChannelUpDownAction(int action) {
576575
persistState();
577576
}
578577

579-
public boolean isConscryptEnabled() {
580-
return mIsConscryptEnabled;
581-
}
582-
583-
public void setConscryptEnabled(boolean enable) {
584-
mIsConscryptEnabled = enable;
585-
persistState();
586-
}
587-
588578
/**
589579
* Fixed ConcurrentModificationException after onProfileChanged()<br/>
590580
* Happened inside cleanupPinnedItems()
@@ -670,7 +660,6 @@ private synchronized void restoreState() {
670660
mLocalDriveBackupFreqDays = Helpers.parseInt(split, 70, 1);
671661
//mIsRemapFastForwardToSpeedToggleEnabled = Helpers.parseBoolean(split, 71, false);
672662
mIsRemapSToSpeedToggleEnabled = Helpers.parseBoolean(split, 72, true);
673-
mIsConscryptEnabled = Helpers.parseBoolean(split, 73, false);
674663
}
675664

676665
public void persistNow() {
@@ -696,7 +685,7 @@ private void persistStateInt() {
696685
mIsHideWatchedFromNotificationsEnabled, mChangelog, mPlayerExitShortcut, null, mIsFullscreenModeEnabled, null,
697686
mIsRememberPinnedPositionEnabled, mSelectedItems, mIsFirstUseTooltipEnabled, mIsDeviceSpecificBackupEnabled, null,
698687
null, mSearchExitShortcut, mGDriveBackupFreqDays, mLocalDriveBackupFreqDays, null,
699-
mIsRemapSToSpeedToggleEnabled, mIsConscryptEnabled));
688+
mIsRemapSToSpeedToggleEnabled));
700689
}
701690

702691
@Override
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.liskovsoft.smartyoutubetv2.common.prefs;
2+
3+
import android.content.Context;
4+
5+
import com.liskovsoft.smartyoutubetv2.common.prefs.common.DataSaverBase;
6+
7+
public class NetworkData extends DataSaverBase {
8+
private static NetworkData sInstance;
9+
10+
private NetworkData(Context context) {
11+
super(context);
12+
}
13+
14+
public static NetworkData instance(Context context) {
15+
if (sInstance == null) {
16+
sInstance = new NetworkData(context);
17+
}
18+
19+
return sInstance;
20+
}
21+
22+
public boolean isConscryptEnabled() {
23+
return getBoolean(0, false);
24+
}
25+
26+
public void setConscryptEnabled(boolean enable) {
27+
setBoolean(0, enable);
28+
}
29+
}

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs/common/DataSaverBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ private void restoreState() {
9292
}
9393
}
9494

95+
public void persistNow() {
96+
Utils.post(mPersistStateInt);
97+
}
98+
9599
private void persistState() {
96100
onDataChange();
97101
Utils.postDelayed(mPersistStateInt, 10_000);

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/utils/Utils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData;
8989
import com.liskovsoft.smartyoutubetv2.common.prefs.HiddenPrefs;
9090
import com.liskovsoft.smartyoutubetv2.common.prefs.MainUIData;
91+
import com.liskovsoft.smartyoutubetv2.common.prefs.NetworkData;
9192
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerData;
9293
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerTweaksData;
9394
import com.liskovsoft.smartyoutubetv2.common.prefs.RemoteControlData;
@@ -1302,5 +1303,6 @@ private static void persistData(Context context) {
13021303
MediaServiceData mediaServiceData = MediaServiceData.instance();
13031304
mediaServiceData.persistNow();
13041305
BlockedChannelData.instance(context).persistNow();
1306+
NetworkData.instance(context).persistNow();
13051307
}
13061308
}

smarttubetv/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ android {
5757
applicationId "app.smarttube"
5858
minSdkVersion project.properties.minSdkVersion
5959
targetSdkVersion project.properties.targetSdkVersion
60-
versionCode 2376
61-
versionName "31.86"
60+
versionCode 2377
61+
versionName "31.87"
6262
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
6363
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
6464

smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/main/MainApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager;
1818
import com.liskovsoft.smartyoutubetv2.common.app.views.WebBrowserView;
1919
import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData;
20+
import com.liskovsoft.smartyoutubetv2.common.prefs.NetworkData;
2021
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerData;
2122
import com.liskovsoft.smartyoutubetv2.common.prefs.PlayerTweaksData;
2223
import com.liskovsoft.smartyoutubetv2.tv.ui.adddevice.AddDeviceActivity;
@@ -58,7 +59,7 @@ public void onCreate() {
5859
//if (Build.VERSION.SDK_INT < 29 && Conscrypt.isAvailable()) {
5960
// Security.insertProviderAt(Conscrypt.newProvider(), 1);
6061
//}
61-
if (GeneralData.instance(getApplicationContext()).isConscryptEnabled() && Conscrypt.isAvailable()) {
62+
if (NetworkData.instance(getApplicationContext()).isConscryptEnabled() && Conscrypt.isAvailable()) {
6263
Security.insertProviderAt(Conscrypt.newProvider(), 1);
6364
}
6465

0 commit comments

Comments
 (0)