fix issue
This commit is contained in:
parent
6ec0b04bbd
commit
00fee40128
|
@ -63,7 +63,6 @@ public class MainApplication extends MultiDexApplication {
|
|||
|
||||
|
||||
private static MainApplication app;
|
||||
public static int notificationsSyncJob = -1;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -71,15 +70,22 @@ public class MainApplication extends MultiDexApplication {
|
|||
app = this;
|
||||
//System.setProperty("java.net.preferIPv4Stack" , "true");
|
||||
JobManager.create(this).addJobCreator(new ApplicationJob());
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
|
||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
||||
if( Helper.getNotificationIcon(getApplicationContext()) == Helper.NOTIF_NONE) {
|
||||
notificationsSyncJob = NotificationsSyncJob.schedule(false);
|
||||
NotificationsSyncJob.schedule(false);
|
||||
}
|
||||
|
||||
ApplicationJob.cancelAllJob(BackupStatusesSyncJob.BACKUP_SYNC);
|
||||
BackupStatusesSyncJob.schedule(false);
|
||||
ApplicationJob.cancelAllJob(BackupNotificationsSyncJob.BACKUP_NOTIFICATIONS_SYNC);
|
||||
BackupNotificationsSyncJob.schedule(false);
|
||||
|
||||
|
||||
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
||||
StrictMode.setVmPolicy(builder.build());
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
|
||||
try {
|
||||
List<Locale> SUPPORTED_LOCALES = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -696,11 +696,7 @@ public class API {
|
|||
editor.putString(Helper.SET_ONION_SCHEME + domain, "http");
|
||||
scheme = "http";
|
||||
editor.apply();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
} catch (IOException | NoSuchAlgorithmException | KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
@ -771,9 +767,7 @@ public class API {
|
|||
} catch (IOException e) {
|
||||
instanceNodeInfo.setConnectionError(true);
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
try {
|
||||
|
@ -785,22 +779,15 @@ public class API {
|
|||
} catch (IOException e1) {
|
||||
instanceNodeInfo.setConnectionError(true);
|
||||
e1.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (KeyManagementException e1) {
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | JSONException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (HttpsConnection.HttpsConnectionException e1) {
|
||||
instanceNodeInfo.setName("GNU");
|
||||
instanceNodeInfo.setVersion("unknown");
|
||||
instanceNodeInfo.setOpenRegistrations(true);
|
||||
e1.printStackTrace();
|
||||
} catch (JSONException e1) {
|
||||
|
||||
e1.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return instanceNodeInfo;
|
||||
}
|
||||
|
@ -1011,7 +998,10 @@ public class API {
|
|||
}
|
||||
String response = new HttpsConnection(context, this.instance).get(getAbsoluteUrl("/accounts/verify_credentials"), 10, null, prefKeyOauthTokenT);
|
||||
account = parseAccountResponse(context, new JSONObject(response));
|
||||
account.setSocial(getNodeInfo(instance).getName().toUpperCase());
|
||||
InstanceNodeInfo nodeinfo = getNodeInfo(instance);
|
||||
if( nodeinfo != null && nodeinfo.getName() != null) {
|
||||
account.setSocial(getNodeInfo(instance).getName().toUpperCase());
|
||||
}
|
||||
if (account != null && account.getSocial() != null && account.getSocial().equals("PLEROMA")) {
|
||||
isPleromaAdmin(account.getAcct());
|
||||
}
|
||||
|
@ -1044,26 +1034,14 @@ public class API {
|
|||
if (account.getSocial().equals("PLEROMA")) {
|
||||
isPleromaAdmin(account.getAcct());
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (KeyManagementException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (JSONException e1) {
|
||||
} catch (IOException | NoSuchAlgorithmException | KeyManagementException | JSONException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (HttpsConnection.HttpsConnectionException e1) {
|
||||
e1.printStackTrace();
|
||||
setError(e.getStatusCode(), e);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return account;
|
||||
|
|
|
@ -566,7 +566,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
Toasty.info(context, context.getString(R.string.toast_toot_saved_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
//For conversation
|
||||
if (context instanceof ShowConversationActivity) {
|
||||
if (context instanceof ShowConversationActivity && apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
|
||||
((ShowConversationActivity) context).addStatuses(apiResponse.getStatuses().get(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -1290,9 +1290,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||
editor.apply();
|
||||
context.sendBroadcast(new Intent(context, StopDelayedNotificationReceiver.class));
|
||||
if( MainApplication.notificationsSyncJob != -1){
|
||||
ApplicationJob.cancelJob(MainApplication.notificationsSyncJob);
|
||||
}
|
||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
||||
break;
|
||||
case Helper.NOTIF_DELAYED:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
|
@ -1300,9 +1298,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||
context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class));
|
||||
editor.apply();
|
||||
if( MainApplication.notificationsSyncJob != -1){
|
||||
ApplicationJob.cancelJob(MainApplication.notificationsSyncJob);
|
||||
}
|
||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
||||
break;
|
||||
case Helper.NOTIF_NONE:
|
||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||
|
@ -1310,7 +1306,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
live_notif_per_account.setVisibility(View.GONE);
|
||||
context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class));
|
||||
context.sendBroadcast(new Intent(context, StopDelayedNotificationReceiver.class));
|
||||
MainApplication.notificationsSyncJob = NotificationsSyncJob.schedule(false);
|
||||
NotificationsSyncJob.schedule(false);
|
||||
editor.apply();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import app.fedilab.android.sqlite.Sqlite;
|
|||
|
||||
public class BackupNotificationsSyncJob extends Job {
|
||||
|
||||
static final String BACKUP_NOTIFICATIONS_SYNC = "job_backup_notification";
|
||||
public static final String BACKUP_NOTIFICATIONS_SYNC = "job_backup_notification";
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
||||
|
|
|
@ -73,7 +73,7 @@ import static app.fedilab.android.helper.Helper.notify_user;
|
|||
|
||||
public class BackupStatusesSyncJob extends Job {
|
||||
|
||||
static final String BACKUP_SYNC = "job_backup";
|
||||
public static final String BACKUP_SYNC = "job_backup";
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
||||
|
|
|
@ -73,7 +73,7 @@ import static app.fedilab.android.helper.Helper.notify_user;
|
|||
|
||||
public class NotificationsSyncJob extends Job {
|
||||
|
||||
static final String NOTIFICATION_REFRESH = "job_notification";
|
||||
public static final String NOTIFICATION_REFRESH = "job_notification";
|
||||
|
||||
static {
|
||||
Helper.installProvider();
|
||||
|
|
|
@ -161,7 +161,9 @@ public class AccountDAO {
|
|||
values.put(Sqlite.COL_HEADER_STATIC, account.getHeader_static());
|
||||
values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(account.getCreated_at()));
|
||||
values.put(Sqlite.COL_EMOJIS, Helper.emojisToStringStorage(account.getEmojis()));
|
||||
values.put(Sqlite.COL_SOCIAL, account.getSocial());
|
||||
if( account.getSocial() != null ) {
|
||||
values.put(Sqlite.COL_SOCIAL, account.getSocial());
|
||||
}
|
||||
if (account.getClient_id() != null && account.getClient_secret() != null && account.getRefresh_token() != null) {
|
||||
values.put(Sqlite.COL_CLIENT_ID, account.getClient_id());
|
||||
values.put(Sqlite.COL_CLIENT_SECRET, account.getClient_secret());
|
||||
|
|
Loading…
Reference in New Issue