Skip to content

Latest commit

 

History

History

application

Xayn Discovery App

Xayn Discovery is your news assistant that discovers an endless stream of news, articles and other content for you. Ad-free, loaded with privacy features and highly personalised.

Component overview ⚙️

The app is structured mainly to three components

➡️ domain

A package where models and abstract repository classes live.

A package where use cases, repository implementation, and services live.

A package where screens and widgets implementation live. The screens and widgets use managers that utilize the infrastructure code.

Migrations 💾

Migrations are responsible for changing already persisted data so that it is up to date with the current Entities. When migration is required, follow the steps below.

  1. Create a new migration class that extends BaseDbMigration and override the Future<int> runMigration(int fromVersion) method with custom migration code. See Migration_0_To_1.dart as an example.

  2. When the database structure changes, make sure to create new mappers and data classes with corresponding migration version. Is is important to not update the code inside old classes. Example:

class AppStatusV2 extends DbEntity with _$AppStatusV2 {
}

class AppStatusMapperV2 extends BaseDbEntityMapper<AppStatusV2> {
}
  1. Run the database snapshot script (details in the section below).

  2. Write tests to verify the newly added migrations.

Database snapshots

To create DB snapshot you need to create/edit a script located in application/bin/create_snapshot.dart and then run it:

cd application
dart bin/create_snapshot.dart test/db_snapshots X

where X is the new app db version.

Dependencies 📦

Analytics platform integrations

Dependency Description
Mixpanel Mixpanel platform helps in building analytics dashboards to better understand user behavior. You can check a list of events we send to Mixpanel here.
AppsFlyer A marketing analytics tool that helps in understanding how well marketing campaigns achieve their targets.

Xayn dependencies

Dependency Description
xayn_design Provides Xayn-styled shared design elements like icons, colors, styles, and themes.
xayn_architecture Provides the underlying of usecases and helpers that allow for cleaner functional code.
xayn_swipe_it Provides a performant, animated swipe widget with left and right customizable options that you can swipe or fling horizontally.
xayn_card_view Provides a performant solution to scroll cards in Xayn's discovery feed.
xayn_readability Provides the reader mode widget, which renders html content as pure Flutter widgets.

Other third party dependencies

Dependency Description
Instabug 1. A crash reporter tool that report crashes in the background so we build a more rebust app on the long run.
2. In-app feedback feature from the settings screen.

For a more comprehensive list, check pubspec.yaml.

Analytics 📈

The analytics implementation can be found as part of the infrastructure/service/analytics. The platforms used are mentioned briefly here.

Events

An event is data sent to the analytics platforms when the user triggers an action.

Bookmarking/Saving an article

Event Description Properties
bookmarkDeleted triggers when a bookmark is deleted from bookmarks screen
bookmarkMoved triggers when a bookmark is moved to another collection bool toDefaultCollection: is moved to default collection ("Read later")
collectionCreatedEvent triggers when a new collection is created -
collectionDeleted triggers when a collection is deleted enum deleteCollectionContext: [moveBookmarks (when all bookmarks are moved), deleteBookmarks (when all bookmarks are deleted), empty (the collection was empty)]
collectionRenamed triggers when a collection is renamed -
documentBookmarked triggers when an article is bookmarked or unbookmarked bool isBookmarked: is true when bookmarked, false when not.
Document document: the article.

Discovery screen/Swiping cards

Event Description Properties
documentFeedbackChanged triggers when a like/dislike are clicked enum context: [implicit, explicit]
Document document: the article.
documentIndexChanged triggers when a card is swiped enum direction: [start, up, down]
Document nextDocument: the article.
documentShared triggers when a card is shared Document nextDocument: the article.
documentTimeSpent triggers when a card is clicked or swiped Duration duration: the duration of time spent on the card.
enum viewMode: [reader, story]
Document document: the article.
documentViewModeChanged triggers when a card is clicked to open reader mode and when you return to the cards feed enum viewMode: [reader, story]
Document document: the article.
nextFeedBatchRequestFailed triggers when the engine fails to get new cards NextFeedBatchRequestFailed nextFeedBatchRequestFailed: error details.
restoreFeedFailed triggers when restore feed exception occures RestoreFeedFailed restoreFeedFailed: error object

Card in reader mode

Event Description Properties
readerModeBackgroundColorChanged triggers when reader mode background color is changed enum lightBackgroundColor: [white, beige]
enum darkBackgroundColor: [dark, trueBlack]
readerModeFontSizeChanged triggers when reader mode font size is changed String fontSize: a number
readerModeFontStyleChanged triggers when reader mode font style is changed enum fontStyle: [sans, serif]
readerModeSettingsMenuDisplayed triggers when reader mode menu is displayed bool isVisible

Subscription

Event Description Properties
subscriptionAction triggers when user taps on a button or link on the subscription window. enum **
action**: [subscribe, unsubscribe, cancel, restore, promoCode,]
Object? **
arguments**
af_purchase triggers when user subscribes. String **
af_price**: price
String af_currency: currency
String **
af_content_id**: id of what is subscribed to
openSubscriptionWindow triggers when subsciption window is open. enum **
currentView**: [personalArea, settings, feed,]
Object? **
arguments**

Generic

Event Description Properties
bottomSheetDismissed triggers when a bottom menu is dismissed enum bottomSheetView: [saveToCollection, moveMultipleBookmarksToCollection, createCollection, renameCollection, confirmDeletingCollection,]
engineExceptionRaised triggers when an engine exception is raised String reason: reason of failure.
String? message
String? stackTrace
engineInitFailed triggers when an engine init exception occures Object error
openScreen triggers when switching screens. String screen: name of the screen
Object? arguments: arguments sent to the screen
openExternalUrl triggers when an external url is opened String url: url opened
enum currentView: [story, reader, settings]

User property

A user property is data tied to a user. It helps in creating user groups to visualize a user group behavior.

Parameter Description
lastSeenDate The last date/time the user opened the app
numberOfSelectedCountries Number of countries a user selected
numberOfBookmarks Number of bookmarks a user has
numberOfCollections Number of collections a user has
numberOfTotalSessions Number of total sessions a user has opened the app