Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most Recent Webxdc apps but make it a widget #2418

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

zeitschlag
Copy link
Collaborator

@zeitschlag zeitschlag commented Nov 27, 2024

This PR adds a Widget to Deltachat. The widget shows the most recent Webxdc-apps on the Homescreen so that users can open them right away from the Homescreen. It comes in two flavours/sizes:

  • small. Shows up to 4 apps.
  • medium. Shows up to 8 apps.

They look like this:

2406_1

When users tap on an icon, the selected app opens right away in the right chat. The list gets updated every 15 minutes.

When adding them to the Homescreen, users see this:

2406_add

The icons for this placeholder come from various Webxdc-app-repos.

Also: This PR makes CI use Xcode 16. And closes #2406
Sidenote: Widgets are more fun on an actual device than in the Simulator.
Sidenote: Widget is not localized yet.

@zeitschlag zeitschlag force-pushed the 2406-most-recent-webxdcs-widget branch from 8f46a71 to 4c96285 Compare November 28, 2024 11:33
@r10s
Copy link
Member

r10s commented Dec 4, 2024

wow! that already looks great!

also nice, that the appicon can be changed to a widget by just long-tapping, did not know about that, is that new in iOS 18? a bit confusing might be that the app icon is lost by that, but the user can undo the same way or re-add that as usual, this is also OS part, there is probably not much we can do about that.

i know, this is a draft, however, some random comments: i think, there are only few steps needed to have "something" that can be shipped:

  • having a method to somehow "add" a webxdc so that it is always shown. we may revive the old "Add To Home Screen" option inside a webxdc for that. once tapped, it will get its place atop of the list, maybe including some hints how to add the widget (or can we trigger that from the app even?

  • explicitly added ones may come from any accounts, meaning that each webxdc in the starer-widget may belong to a different account

"removing" is not needed for the start, the list is anyways filled with the recent ones, when more webxdc are added than can be shown, the last are not shown. that's fine to start with

also, it seems fine to fill the recents from the "current" account (i think, this is what happens currently). also fine is to have only one widget, things otherwise gets confusing and also more complicated implementation-wise

@zeitschlag zeitschlag force-pushed the 2406-most-recent-webxdcs-widget branch from 65f64bc to 29360bd Compare December 5, 2024 13:46
@zeitschlag zeitschlag changed the title [WIP] Most Recent WebXDC apps but make it a widget [WIP] Most Recent Webxdc apps but make it a widget Dec 5, 2024
@zeitschlag zeitschlag marked this pull request as ready for review December 5, 2024 14:27
@zeitschlag zeitschlag requested a review from r10s December 5, 2024 14:27
@zeitschlag zeitschlag changed the title [WIP] Most Recent Webxdc apps but make it a widget Most Recent Webxdc apps but make it a widget Dec 5, 2024
@zeitschlag zeitschlag self-assigned this Dec 5, 2024
@r10s r10s added wait-for-merge-window potentially dangerous or otherwise unfitting PR waiting for better merge timing enhancement actually in development, user visible enhancement labels Dec 5, 2024
@zeitschlag zeitschlag force-pushed the 2406-most-recent-webxdcs-widget branch 3 times, most recently from 6ba0d55 to da5599a Compare December 13, 2024 10:02
@zeitschlag zeitschlag force-pushed the 2406-most-recent-webxdcs-widget branch from fab2718 to bcb38e0 Compare December 16, 2024 11:08
Comment on lines 42 to 52
for accountId in dcAccounts.getAll() {
let dcContext = dcAccounts.get(id: accountId)
if dcContext.isOpen() == false {
do {
let secret = try KeychainManager.getAccountSecret(accountID: accountId)
_ = dcContext.open(passphrase: secret)
} catch {
debugPrint("Couldn't open \(error.localizedDescription)")
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed, encrypted accounts are deprecated at #2011, also in the newer DcNotificationService we do not care for encrypted accounts

Suggested change
for accountId in dcAccounts.getAll() {
let dcContext = dcAccounts.get(id: accountId)
if dcContext.isOpen() == false {
do {
let secret = try KeychainManager.getAccountSecret(accountID: accountId)
_ = dcContext.open(passphrase: secret)
} catch {
debugPrint("Couldn't open \(error.localizedDescription)")
}
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's good to know, thank you!
I basically just copied this from AppDelegate.continueDidFinishLaunchingWithOptions. Should we remove it there as well?

scripts/untranslated.xml Outdated Show resolved Hide resolved
DcWebxdcWidget/DcWebxdcWidget.swift Outdated Show resolved Hide resolved
DcWebxdcWidget/DcWebxdcWidget.swift Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement actually in development, user visible enhancement wait-for-merge-window potentially dangerous or otherwise unfitting PR waiting for better merge timing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show Webxdc-apps in Widget
2 participants