5
5
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_BCC_SELF ;
6
6
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_MVBOX_MOVE ;
7
7
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_ONLY_FETCH_MVBOX ;
8
+ import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_SELF_REPORTING ;
8
9
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_SENTBOX_WATCH ;
9
10
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_SHOW_EMAILS ;
10
11
import static org .thoughtcrime .securesms .connect .DcHelper .CONFIG_WEBXDC_REALTIME_ENABLED ;
20
21
import android .view .View ;
21
22
import android .webkit .WebView ;
22
23
import android .widget .EditText ;
24
+ import android .widget .TextView ;
23
25
import android .widget .Toast ;
24
26
25
27
import androidx .annotation .NonNull ;
39
41
import org .thoughtcrime .securesms .connect .DcEventCenter ;
40
42
import org .thoughtcrime .securesms .connect .DcHelper ;
41
43
import org .thoughtcrime .securesms .proxy .ProxySettingsActivity ;
44
+ import org .thoughtcrime .securesms .util .IntentUtils ;
42
45
import org .thoughtcrime .securesms .util .Prefs ;
43
46
import org .thoughtcrime .securesms .util .ScreenLockUtil ;
44
47
import org .thoughtcrime .securesms .util .StreamUtil ;
@@ -59,6 +62,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
59
62
60
63
private ListPreference showEmails ;
61
64
CheckBoxPreference sentboxWatchCheckbox ;
65
+ CheckBoxPreference selfReportingCheckbox ;
62
66
CheckBoxPreference bccSelfCheckbox ;
63
67
CheckBoxPreference mvboxMoveCheckbox ;
64
68
CheckBoxPreference onlyFetchMvboxCheckbox ;
@@ -212,22 +216,21 @@ public void onCreate(Bundle paramBundle) {
212
216
});
213
217
}
214
218
215
- Preference selfReporting = this .findPreference ("pref_self_reporting" );
216
- if (selfReporting != null ) {
217
- selfReporting .setOnPreferenceClickListener (((preference ) -> {
218
- try {
219
- int chatId = getRpc (requireActivity ()).draftSelfReport (dcContext .getAccountId ());
220
-
221
- Intent intent = new Intent (requireActivity (), ConversationActivity .class );
222
- intent .putExtra (ConversationActivity .CHAT_ID_EXTRA , chatId );
223
- intent .setFlags (Intent .FLAG_ACTIVITY_CLEAR_TOP );
224
- requireActivity ().startActivity (intent );
225
- } catch (RpcException e ) {
226
- Log .e (TAG , "Error calling rpc.draftSelfReport()" , e );
227
- }
219
+ selfReportingCheckbox = this .findPreference ("pref_self_reporting" );
220
+ if (selfReportingCheckbox != null ) {
221
+ selfReportingCheckbox .setOnPreferenceChangeListener ((preference , newValue ) -> {
222
+ boolean enabled = (Boolean ) newValue ;
223
+ dcContext .setConfigInt (CONFIG_SELF_REPORTING , enabled ? 1 : 0 );
228
224
225
+ if (enabled ) {
226
+ new AlertDialog .Builder (getActivity ())
227
+ .setMessage (R .string .send_stats_thanks )
228
+ .setPositiveButton (android .R .string .ok , null )
229
+ .setNegativeButton (R .string .more_info_desktop , (_d , _w ) -> IntentUtils .showInBrowser (getContext (), "TODO[blog post]" ))
230
+ .show ();
231
+ }
229
232
return true ;
230
- })) ;
233
+ });
231
234
}
232
235
233
236
Preference proxySettings = this .findPreference ("proxy_settings_button" );
@@ -274,6 +277,7 @@ public void onResume() {
274
277
updateListSummary (showEmails , value );
275
278
276
279
sentboxWatchCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_SENTBOX_WATCH ));
280
+ selfReportingCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_SELF_REPORTING ));
277
281
bccSelfCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_BCC_SELF ));
278
282
mvboxMoveCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_MVBOX_MOVE ));
279
283
onlyFetchMvboxCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_ONLY_FETCH_MVBOX ));
0 commit comments