From 5f026bc45b1a5406a97954cd43131676176199c9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 1 Mar 2021 14:10:56 +0100 Subject: [PATCH] copy release notes --- app/src/fdroidcommon/AndroidManifest.xml | 103 ++++++++++++++++++ app/src/playstore/AndroidManifest.xml | 37 +++++++ .../android/services/UnifiedPushService.java | 55 +--------- 3 files changed, 142 insertions(+), 53 deletions(-) create mode 100644 app/src/fdroidcommon/AndroidManifest.xml create mode 100644 app/src/playstore/AndroidManifest.xml diff --git a/app/src/fdroidcommon/AndroidManifest.xml b/app/src/fdroidcommon/AndroidManifest.xml new file mode 100644 index 000000000..397a7c259 --- /dev/null +++ b/app/src/fdroidcommon/AndroidManifest.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/playstore/AndroidManifest.xml b/app/src/playstore/AndroidManifest.xml new file mode 100644 index 000000000..68246105c --- /dev/null +++ b/app/src/playstore/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/playstore/java/app/fedilab/android/services/UnifiedPushService.java b/app/src/playstore/java/app/fedilab/android/services/UnifiedPushService.java index cf63316d5..07e27658a 100644 --- a/app/src/playstore/java/app/fedilab/android/services/UnifiedPushService.java +++ b/app/src/playstore/java/app/fedilab/android/services/UnifiedPushService.java @@ -13,16 +13,13 @@ package app.fedilab.android.services; * * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see . */ + import android.content.Context; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; -import android.util.Log; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.unifiedpush.android.connector.MessagingReceiver; -import org.unifiedpush.android.connector.MessagingReceiverHandler; - import app.fedilab.android.client.API; import app.fedilab.android.client.APIResponse; @@ -37,55 +34,7 @@ import app.fedilab.android.sqlite.Sqlite; import static android.content.Context.MODE_PRIVATE; -class handler implements MessagingReceiverHandler { +class handler { - @Override - public void onMessage(@Nullable Context context, @NotNull String s, @NotNull String slug) { - new Thread(() -> { - SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - String[] slugArray = slug.split("@"); - Account account = new AccountDAO(context, db).getUniqAccountUsernameInstance(slugArray[0], slugArray[1]); - APIResponse apiResponse; - if (account.getSocial().compareTo("FRIENDICA") != 0 && account.getSocial().compareTo("GNU") != 0) { - API api = new API(context, account.getInstance(), account.getToken()); - apiResponse = api.getNotificationsSince(DisplayNotificationsFragment.Type.ALL, null, false); - } else { - GNUAPI gnuApi = new GNUAPI(context, account.getInstance(), account.getToken()); - apiResponse = gnuApi.getNotificationsSince(DisplayNotificationsFragment.Type.ALL, null); - } - NotificationsHelper.onRetrieveNotifications(context, apiResponse, account); - }).start(); - } - - @Override - public void onNewEndpoint(@Nullable Context context, @NotNull String endpoint, @NotNull String slug) { - final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(Helper.SERVER_ENDPOINT, endpoint); - editor.apply(); - new PushNotifications() - .registerPushNotifications(context, endpoint, slug); - } - - @Override - public void onRegistrationFailed(@Nullable Context context, @NotNull String s) { - - } - - @Override - public void onRegistrationRefused(@Nullable Context context, @NotNull String s) { - - } - - @Override - public void onUnregistered(@Nullable Context context, @NotNull String s) { - - } -} - -public class UnifiedPushService extends MessagingReceiver { - public UnifiedPushService() { - super(new handler()); - } }