Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95814aa2 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'pwa-support' into 'master'

Improved PWA support

See merge request e/apps/BlissLauncher!45
parents 682f1e74 44bf8496
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@
    <uses-permission android:name="lineageos.permission.READ_WEATHER" />
    <!-- LineageOS specific permissions END -->

    <uses-permission android:name="foundation.e.pwaplayer.provider.READ_WRITE"/>

    <application
        android:name=".BlissLauncher"
        android:hardwareAccelerated="true"
+14 −3
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.os.UserManager;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.DragEvent;
import android.view.Gravity;
@@ -1981,8 +1982,12 @@ public class LauncherActivity extends AppCompatActivity implements
                        .setTitle(launcherItem.title)
                        .setMessage(R.string.uninstall_shortcut_dialog)
                        .setPositiveButton(R.string.ok, (dialog1, which) -> {
                            DeepShortcutManager.getInstance(this).unpinShortcut(ShortcutKey.fromItem((ShortcutItem) launcherItem));
                            removeShortcutView((ShortcutItem) launcherItem, blissFrameLayout);
                            ShortcutItem shortcut = (ShortcutItem) launcherItem;
                            DeepShortcutManager.getInstance(this).unpinShortcut(ShortcutKey.fromItem(shortcut));
                            if (DeepShortcutManager.getInstance(this).wasLastCallSuccess()) {
                                deleteShortcutFromProvider(shortcut.id);
                                removeShortcutView(shortcut, blissFrameLayout);
                            }
                        })
                        .setNegativeButton(R.string.cancel, null)
                        .setIcon(launcherItem.icon)
@@ -2000,6 +2005,12 @@ public class LauncherActivity extends AppCompatActivity implements
        blissFrameLayout.addView(imageView, layoutParams);
    }

    private void deleteShortcutFromProvider(String id) {
        ContentResolver resolver = getContentResolver();
        int count = resolver.delete(Uri.parse("content://foundation.e.pwaplayer.provider/pwa"), null, new String[]{id});
        Log.d("LauncherActivity", "Items deleted from pwa provider: " + count);
    }

    private void removeShortcutView(ShortcutItem shortcutItem, BlissFrameLayout blissFrameLayout) {
        DatabaseManager.getManager(this).removeLauncherItem(shortcutItem.id);
        if (mFolderWindowContainer.getVisibility() == View.VISIBLE) {