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 ;
@@ -211,22 +215,21 @@ public void onCreate(Bundle paramBundle) {
211
215
});
212
216
}
213
217
214
- Preference selfReporting = this .findPreference ("pref_self_reporting" );
215
- if (selfReporting != null ) {
216
- selfReporting .setOnPreferenceClickListener (((preference ) -> {
217
- try {
218
- int chatId = getRpc (requireActivity ()).draftSelfReport (dcContext .getAccountId ());
219
-
220
- Intent intent = new Intent (requireActivity (), ConversationActivity .class );
221
- intent .putExtra (ConversationActivity .CHAT_ID_EXTRA , chatId );
222
- intent .setFlags (Intent .FLAG_ACTIVITY_CLEAR_TOP );
223
- requireActivity ().startActivity (intent );
224
- } catch (RpcException e ) {
225
- Log .e (TAG , "Error calling rpc.draftSelfReport()" , e );
226
- }
218
+ selfReportingCheckbox = this .findPreference ("pref_self_reporting" );
219
+ if (selfReportingCheckbox != null ) {
220
+ selfReportingCheckbox .setOnPreferenceChangeListener ((preference , newValue ) -> {
221
+ boolean enabled = (Boolean ) newValue ;
222
+ dcContext .setConfigInt (CONFIG_SELF_REPORTING , enabled ? 1 : 0 );
227
223
224
+ if (enabled ) {
225
+ new AlertDialog .Builder (getActivity ())
226
+ .setMessage (R .string .send_stats_thanks )
227
+ .setPositiveButton (android .R .string .ok , null )
228
+ .setNegativeButton (R .string .more_info_desktop , (_d , _w ) -> IntentUtils .showInBrowser (getContext (), "TODO[blog post]" ))
229
+ .show ();
230
+ }
228
231
return true ;
229
- })) ;
232
+ });
230
233
}
231
234
232
235
Preference proxySettings = this .findPreference ("proxy_settings_button" );
@@ -273,6 +276,7 @@ public void onResume() {
273
276
updateListSummary (showEmails , value );
274
277
275
278
sentboxWatchCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_SENTBOX_WATCH ));
279
+ selfReportingCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_SELF_REPORTING ));
276
280
bccSelfCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_BCC_SELF ));
277
281
mvboxMoveCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_MVBOX_MOVE ));
278
282
onlyFetchMvboxCheckbox .setChecked (0 !=dcContext .getConfigInt (CONFIG_ONLY_FETCH_MVBOX ));
0 commit comments