unifiedpush: fix registration flow
This commit is contained in:
parent
0b08d05397
commit
ae860c1948
|
@ -181,7 +181,7 @@ dependencies {
|
|||
implementation 'com.huangyz0918:androidwm-light:0.1.2'
|
||||
|
||||
|
||||
implementation 'com.github.UnifiedPush:android-connector:1.1.0'
|
||||
implementation 'com.github.UnifiedPush:android-connector:1.2.0'
|
||||
implementation "com.madgag.spongycastle:bctls-jdk15on:1.58.0.0"
|
||||
|
||||
|
||||
|
@ -195,7 +195,7 @@ dependencies {
|
|||
playstoreImplementation 'org.framagit.tom79:country-picker-android:1.2.0'
|
||||
playstoreImplementation 'com.vanniktech:emoji-one:0.6.0'
|
||||
playstoreImplementation 'ja.burhanrashid52:photoeditor:0.4.0'
|
||||
playstoreImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.0.0'
|
||||
playstoreImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.1.0'
|
||||
|
||||
//Fdroid
|
||||
fdroidApi 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
|
||||
|
|
|
@ -908,7 +908,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
|
||||
|
||||
|
||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_PUSH_NOTIFICATIONS, true);
|
||||
final SwitchCompat switchCompatNotify = rootView.findViewById(R.id.set_notify);
|
||||
switchCompatNotify.setChecked(notify);
|
||||
final LinearLayout notification_container = rootView.findViewById(R.id.notification_container);
|
||||
|
@ -920,7 +920,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
switchCompatNotify.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
// Save the state here
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIFY, isChecked);
|
||||
editor.putBoolean(Helper.SET_PUSH_NOTIFICATIONS, isChecked);
|
||||
editor.apply();
|
||||
if (isChecked) {
|
||||
notification_container.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -2458,7 +2458,7 @@ public class BaseHelper {
|
|||
*/
|
||||
public static boolean canNotify(Context context) {
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean notify = sharedpreferences.getBoolean(SET_NOTIFY, true);
|
||||
boolean notify = sharedpreferences.getBoolean(SET_PUSH_NOTIFICATIONS, true);
|
||||
if (!notify)
|
||||
return false;
|
||||
boolean enable_time_slot = sharedpreferences.getBoolean(SET_ENABLE_TIME_SLOT, true);
|
||||
|
|
|
@ -46,7 +46,15 @@ public class PushHelper {
|
|||
}).start();
|
||||
break;
|
||||
case NOTIF_NONE:
|
||||
new Registration().unregisterApp(context);
|
||||
new Thread(() -> {
|
||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
List<Account> accounts = new AccountDAO(context, db).getPushNotificationAccounts();
|
||||
((Activity) context).runOnUiThread(() -> {
|
||||
for (Account account : accounts) {
|
||||
new Registration().unregisterApp(context, account.getUsername() + "@" + account.getInstance());
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +77,6 @@ public class PushHelper {
|
|||
if (distributors.size() == 1 || !registration.getDistributor(context).isEmpty()) {
|
||||
if (distributors.size() == 1) {
|
||||
registration.saveDistributor(context, distributors.get(0));
|
||||
} else {
|
||||
registration.saveDistributor(context, registration.getDistributor(context));
|
||||
}
|
||||
registration.registerApp(context, slug);
|
||||
return;
|
||||
|
|
|
@ -1122,6 +1122,7 @@
|
|||
<string name="set_hide_status_bar_indication">For hiding the remaining notification in the status bar, tap on the eye icon button then uncheck: \"Display in status bar\"</string>
|
||||
<string name="set_push_notifications">Use a push notifications system for getting notifications in real time.</string>
|
||||
<string name="no_live_notif">No live notifications</string>
|
||||
<string name="live_notif">Live notifications</string>
|
||||
<string name="no_live_indication">Notifications will be fetched every 15 minutes.</string>
|
||||
<string name="action_add_notes">Add notes</string>
|
||||
<string name="note_for_account">Notes for the account</string>
|
||||
|
|
Loading…
Reference in New Issue