Skip to content

Architecture

Mehrdad Pajuhaan edited this page Oct 23, 2026 · 1 revision

Architecture

The app is a native Android shell around your shop's Progressive Web App (PWA). Store pages render in a WebView; native code handles navigation, login, QR codes and notifications, and the two sides talk through a small JavaScript bridge. This page explains each part and where it lives in the code.

Overview

┌──────────────────────── MainActivity ────────────────────────┐
│ TopToolbar (shop title + icon, menu)                         │
│ ┌───────────────────────── WebView ─────────────────────────┐ │
│ │  https://selldone.com/@{shop_name}?native=true  (PWA)     │ │
│ │     ▲ GoToPath / SetToken / NativeLogout                  │ │
│ │     ▼ Android.passShop / Android.passUser                 │ │
│ └───────────────────────────────────────────────────────────┘ │
│ Bottom navigation: Store · Basket · Profile/Login            │
└──────────────────────────────────────────────────────────────┘

WebView

MainActivity loads:

String pwa_url = "https://selldone.com/@" + shop_name;
webView.loadUrl(pwa_url + "?native=true");

?native=true loads the native mode of the storefront (no title, no footer). JavaScript, DOM storage, database storage, app cache and geolocation are enabled. Console messages from the page are logged under the Webview tag.

JavaScript bridge

PWA → Android

The activity registers WebAppInterface as window.Android:

Method Called by the PWA when Effect
Android.passShop(json) Shop data is loaded Parsed into ShopDataPack; sets the toolbar title and shop icon, hides the loading view.
Android.passUser(json) User data changes (or null on logout) Parsed into User; enables the basket, switches Login ↔ Profile and loads the avatar.

Android → PWA

Call Purpose
GoToPath(name, params?, query?) Navigate the PWA to a named page (built by ShopRoute.GoToPath).
SetToken(token) Pass the access token after login.
NativeLogout() Log the user out.

Page names used by the app include ShopPage, BasketPage (param type), HistoryOrdersPhysical and UserFavoritesPage. ShopRoute also lists ProductPage, ComparisonPage, MyOrdersPage, UserProfilePage, UserAddressesPage, UserReturnRequests, UserGiftCardsPage, Blogs, ShopFAQ, ShopContactUs and others.

Login flow

  1. RequestLogin() opens http://selldone.com/@{shop}/login?app=selldone://{shop_name}.callback in the browser.
  2. After sign-in, the browser opens selldone://{shop_name}.callback?token=.... The manifest's intent filter (scheme selldone, host ${shopName}.callback) routes it to MainActivity (launchMode="singleTask").
  3. onNewIntent reads the token query parameter and calls SetToken(token) in the PWA.

This is why manifestPlaceholders.shopName must match shop_name — see Configuration.

Notifications

selldone.fcm.FirebaseMessagingServiceSamin handles Firebase Cloud Messaging. When a message's data contains basket, it is parsed into OrderUpdateMessage to notify the customer about the order. Firebase configuration is not included in the repository — see Build from Source.

Images and URLs

api/ShopHelperMethods.java builds:

  • product images: https://selldone.com/cdn-shop-images-1/{file_name}?size=...
  • shop icons: https://selldone.com/xapi/shops/{shop_id}/icon?size=...
  • user avatars: https://selldone.com/users/{user_id}/profile/avatar/{size}

Images are loaded with Picasso.

Source layout

Path (app/src/main/java/selldone/) Contents
AppController.java Application subclass (singleton access).
activities/MainActivity.java WebView, toolbar, bottom navigation, login, JS interface, QR code.
routes/ShopRoute.java Named PWA routes and GoToPath helper.
api/ShopHelperMethods.java Image/icon/avatar URL helpers.
fcm/FirebaseMessagingServiceSamin.java Push notification handling.
messages/OrderUpdateMessage.java Order update notification payload.
models/ Shop, ShopInfo, ShopDataPack, User, Basket, BasketItem, Product, Badge, LocationObject, Model.
helpers/ COLOR, FormatHelper, BitmapHelper, CircleTransform, QRCodeHelper.
ui/fragments/ BackFragment, QRCodeFragment, ShopAdminFragment, ShopInfoFragment.
ui/topbar/, ui/gesture/, ui/interfaces/ Toolbar, swipe gestures, callbacks.

Main libraries (from app/build.gradle): AndroidX AppCompat/RecyclerView/ConstraintLayout, Material Components, Volley, Gson, Picasso, Lottie, RxJava 2, ZXing / ZBar (QR codes), Firebase Messaging, Chrome Custom Tabs, input-mask.

Related

Clone this wiki locally