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

fix: build issue while applying full story plugin when disabled #366

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
223fc43
fix: Ensure cookies authentication prior to webview loading (#312)
HamzaIsrar12 May 6, 2024
498f0ef
fix: crash when restoring the app after a long period of inactivity
dixidroid Apr 15, 2024
ae777dd
Merge pull request #290 from touchapp/fix/crash_when_restore
volodymyr-chekyrta May 15, 2024
4d78460
feat: Course home. Moved certificate access.
volodymyr-chekyrta May 14, 2024
f7d4d5f
Merge pull request #321 from raccoongang/feature/course_home_certificate
volodymyr-chekyrta May 20, 2024
a712170
chore: enhance app theme capability for prod edX theme/branding (#262)
farhan-arshad-dev May 23, 2024
0d093ea
feat: [FC-0047] Calendar main screen and dialogs (#322)
PavloNetrebchuk May 29, 2024
c2684f9
feat: [FC-0047] Improved Dashboard Level Navigation (#308)
PavloNetrebchuk May 30, 2024
3df3c05
fix: update config parsing structure (#319)
omerhabib26 May 31, 2024
3e95560
feat: delete old videos Directory (#326)
omerhabib26 May 31, 2024
22ee176
fix: Accessibility issue on courseDashboard (#327)
omerhabib26 Jun 6, 2024
1bc1d4c
feat: [FC-0047] Course progress and collapsing sections (#323)
PavloNetrebchuk Jun 6, 2024
09b422a
fix: enable Programs view for new dashboard navigation (#328)
omerhabib26 Jun 7, 2024
7d623ce
fix: Filter block IDs before download, minor refactoring (#333)
PavloNetrebchuk Jun 7, 2024
651db4c
fix: Update feature flag name (#334)
PavloNetrebchuk Jun 7, 2024
21bd1a1
fix: sourceSets dir fallback (#335)
volodymyr-chekyrta Jun 8, 2024
07f6dca
fix: Crash on opening a course from DashboardListFragment (#336)
omerhabib26 Jun 8, 2024
d845e5e
feat: added the external router for deep links (#320)
dixidroid Jun 10, 2024
5c887eb
fix: UI Issues on Auth Screens (#332)
HamzaIsrar12 Jun 11, 2024
efd3998
feat: Add Branch deep links to local calendar events (#249)
HamzaIsrar12 Jun 12, 2024
065d583
feat: atlas push pull scripts: FC-55 (#317)
Amr-Nash Jun 12, 2024
dbd02e3
fix: English plurals error in transifex should be `one` and `other` (…
OmarIthawi Jun 15, 2024
05c3544
fix: secondary courses view all button behavior (#345)
volodymyr-chekyrta Jun 19, 2024
7ff0ff4
chore: validate plurals in strings.xml | FC-55 (#348)
OmarIthawi Jun 21, 2024
948277a
feat: [FC-0047] FCM (#344)
volodymyr-chekyrta Jun 25, 2024
5abf44d
fix: update keyboard visibility and imeAction (#350)
omerhabib26 Jul 8, 2024
ba305a0
fix: show only one screen with all downloadable content (#352)
dixidroid Jul 8, 2024
02a83ed
fix: Video Subtitles on Native and Youtube Player (#349)
HamzaIsrar12 Jul 8, 2024
9f0740f
feat: Handle Branch Deeplinks from Braze Push Notification (#353)
HamzaIsrar12 Jul 9, 2024
6efdd76
feat: Fullstory Analytics SDK Implementation (#347)
HamzaIsrar12 Jul 9, 2024
29d307d
chore: add colors and resource for edx theme/branding
farhan-arshad-dev Mar 15, 2024
3720f85
chore: Add missing success colors for authentication screens
HamzaIsrar12 Jun 7, 2024
830dbe7
fix: Add missing color for 2u/develop branch
farhan-arshad-dev Jul 9, 2024
1d7a091
Merge pull request #5 from farhan-arshad-dev/2U/missing_colors
farhan-arshad-dev Jul 10, 2024
8b5722f
feat: Payments and upgrade execution for the course (#1)
farhan-arshad-dev Jul 10, 2024
0ef101f
fix: Update course dates prefix on course cards
omerhabib26 Jul 12, 2024
1f427dc
refactor: Improve customAppColors usage according to usage
omerhabib26 Jun 28, 2024
d923deb
feat: Update color scheme according to edxApp
omerhabib26 Jul 11, 2024
8c0b033
Merge pull request #8 from omerhabib26/omer/LEARNER-10062
omerhabib26 Jul 17, 2024
44e39d8
Merge pull request #6 from edx/2U/edx_theme
HamzaIsrar12 Jul 17, 2024
8c29d1a
feat: App Level WebView/No Internet Error Handling (#10)
farhan-arshad-dev Jul 18, 2024
b206ef2
fix: Minor UI & Feature Set Changes (#7)
HamzaIsrar12 Jul 18, 2024
0569556
fix: disable full story plugin when disabled
farhan-arshad-dev Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions .github/workflows/validate-english-strings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Validate English strings.xml

on:
pull_request: { }
push:
branches: [ main, develop ]

jobs:
translation_strings:
name: Validate strings.xml
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install translations requirements
run: make translation_requirements

- name: Validate English plurals in strings.xml
run: make validate_english_plurals

- name: Test extract strings
run: |
make extract_translations
# Ensure the file is extracted
test -f i18n/src/main/res/values/strings.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ local.properties
/.idea/
*.log
/config_settings.yaml
.venv/
i18n/
**/values-*/strings.xml
2 changes: 1 addition & 1 deletion Documentation/ConfigurationManagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ android:
- **PRE_LOGIN_EXPERIENCE_ENABLED:** Enables the pre login courses discovery experience.
- **WHATS_NEW_ENABLED:** Enables the "What's New" feature to present the latest changes to the user.
- **SOCIAL_AUTH_ENABLED:** Enables SSO buttons on the SignIn and SignUp screens.
- **COURSE_NESTED_LIST_ENABLED:** Enables an alternative visual representation for the course structure.
- **COURSE_DROPDOWN_NAVIGATION_ENABLED:** Enables an alternative navigation through units.
- **COURSE_UNIT_PROGRESS_ENABLED:** Enables the display of the unit progress within the courseware.

## Future Support
Expand Down
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
clean_translations_temp_directory:
rm -rf i18n/

translation_requirements:
pip3 install -r i18n_scripts/requirements.txt

pull_translations: clean_translations_temp_directory
atlas pull $(ATLAS_OPTIONS) translations/openedx-app-android/i18n:i18n
python3 i18n_scripts/translation.py --split --replace-underscore

extract_translations: clean_translations_temp_directory
python3 i18n_scripts/translation.py --combine

validate_english_plurals:
@if git grep 'quantity' -- '**/res/values/strings.xml' | grep -E 'quantity=.(zero|two|few|many)'; then \
echo ""; \
echo ""; \
echo "Error: Found invalid plurals in the files listed above."; \
echo " Please only use 'one' and 'other' in English strings.xml files,"; \
echo " otherwise Transifex fails to parse them."; \
echo ""; \
exit 1; \
else \
echo "strings.xml files are valid."; \
fi
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,47 @@ Modern vision of the mobile application for the Open edX platform from Raccoon G

6. Click the **Run** button.

## Translations

### Getting Translations for the App
Translations aren't included in the source code of this repository as of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html). Therefore, they need to be pulled before testing or publishing to App Store.

Before retrieving the translations for the app, we need to install the requirements listed in the requirements.txt file located in the i18n_scripts directory. This can be done easily by running the following make command:
```bash
make translation_requirements
```

Then, to get the latest translations for all languages use the following command:
```bash
make pull_translations
```
This command runs [`atlas pull`](https://github.com/openedx/openedx-atlas) to download the latest translations files from the [openedx/openedx-translations](https://github.com/openedx/openedx-translations) repository. These files contain the latest translations for all languages. In the [openedx/openedx-translations](https://github.com/openedx/openedx-translations) repository each language's translations are saved as a single file e.g. `i18n/src/main/res/values-uk/strings.xml` ([example](https://github.com/openedx/openedx-translations/blob/04ccea36b8e6a9889646dfb5a5acb99686fa9ae0/translations/openedx-app-android/i18n/src/main/res/values-uk/strings.xml)). After these are pulled, each language's translation file is split into the App's modules e.g. `auth/src/main/res/values-uk/strings.xml`.

After this command is run the application can load the translations by changing the device (or the emulator) language in the settings.

### Using Custom Translations

By default, the command `make pull_translations` runs [`atlas pull`](https://github.com/openedx/openedx-atlas) with no arguments which pulls translations from the [openedx-translations repository](https://github.com/openedx/openedx-translations).

You can use custom translations on your fork of the openedx-translations repository by setting the following configuration parameters:

- `--revision` (default: `"main"`): Branch or git tag to pull translations from.
- `--repository` (default: `"openedx/openedx-translations"`): GitHub repository slug. There's a feature request to [support GitLab and other providers](https://github.com/openedx/openedx-atlas/issues/20).

Arguments can be passed via the `ATLAS_OPTIONS` environment variable as shown below:
``` bash
make ATLAS_OPTIONS='--repository=<your-github-org>/<repository-name> --revision=<branch-name>' pull_translations
```
Additional arguments can be passed to `atlas pull`. Refer to the [atlas documentations ](https://github.com/openedx/openedx-atlas) for more information.

### How to Translate the App

Translations are managed in the [open-edx/openedx-translations](https://app.transifex.com/open-edx/openedx-translations/dashboard/) Transifex project.

To translate the app join the [Transifex project](https://app.transifex.com/open-edx/openedx-translations/dashboard/) and add your translations `openedx-app-android` resource: https://app.transifex.com/open-edx/openedx-translations/openedx-app-android/ (the link will start working after the [pull request #317](https://github.com/openedx/openedx-app-android/pull/317) is merged)

Once the resource is both 100% translated and reviewed the [Transifex integration](https://github.com/apps/transifex-integration) will automatically push it to the [openedx-translations](https://github.com/openedx/openedx-translations) repository and developers can use the translations in their app.

## API
This project targets on the latest Open edX release and rely on the relevant mobile APIs.

Expand Down
38 changes: 26 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
def config = configHelper.fetchConfig()
def appId = config.getOrDefault("APPLICATION_ID", "org.openedx.app")
def platformName = config.getOrDefault("PLATFORM_NAME", "OpenEdx").toLowerCase()
def themeDirectory = config.getOrDefault("THEME_DIRECTORY", "openedx")
def firebaseConfig = config.get('FIREBASE')
def firebaseEnabled = firebaseConfig?.getOrDefault('ENABLED', false)
def fullstoryConfig = config.get("FULLSTORY")
def fullstoryEnabled = fullstoryConfig?.getOrDefault('ENABLED', false)

apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'

if (fullstoryEnabled) {
apply plugin: 'fullstory'
}

if (firebaseEnabled) {
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
Expand All @@ -25,6 +32,18 @@ if (firebaseEnabled) {
preBuild.dependsOn(removeGoogleServicesJson)
}

if (fullstoryEnabled) {
def fullstoryOrgId = fullstoryConfig?.get("ORG_ID")

fullstory {
org fullstoryOrgId
composeEnabled true
composeSelectorVersion 4
enabledVariants 'debug|release'
logcatLevel 'error'
}
}

android {
compileSdk 34

Expand Down Expand Up @@ -63,13 +82,13 @@ android {

sourceSets {
prod {
res.srcDirs = ["src/$platformName/res"]
res.srcDirs = ["src/$themeDirectory/res"]
}
develop {
res.srcDirs = ["src/$platformName/res"]
res.srcDirs = ["src/$themeDirectory/res"]
}
stage {
res.srcDirs = ["src/$platformName/res"]
res.srcDirs = ["src/$themeDirectory/res"]
}
}

Expand Down Expand Up @@ -130,6 +149,9 @@ dependencies {

implementation 'androidx.core:core-splashscreen:1.0.1'

api platform("com.google.firebase:firebase-bom:$firebase_version")
api "com.google.firebase:firebase-messaging"

// Segment Library
implementation "com.segment.analytics.kotlin:android:1.14.2"
// Segment's Firebase integration
Expand All @@ -138,14 +160,6 @@ dependencies {
implementation "com.braze:braze-segment-kotlin:1.4.2"
implementation "com.braze:android-sdk-ui:30.2.0"

// Firebase Cloud Messaging Integration for Braze
implementation 'com.google.firebase:firebase-messaging-ktx:23.4.1'

// Branch SDK Integration
implementation 'io.branch.sdk.android:library:5.9.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation "com.android.installreferrer:installreferrer:2.2"

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
Expand Down
24 changes: 24 additions & 0 deletions app/src/edx/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="552.88"
android:viewportHeight="310.72">
<group
android:scaleX="0.5"
android:scaleY="0.2810013"
android:translateX="138.22"
android:translateY="111.703636">
<path
android:fillColor="#02262B"
android:pathData="M353.43,50.96l10.65,-50.96l-312.78,0l-51.3,245.01l261.52,0l-14.4,65.71l250.51,0l55.25,-259.76z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M106.6,213.73c-7.09,0 -13.79,-1.16 -20.09,-3.49c-6.3,-2.32 -11.8,-5.75 -16.49,-10.28c-4.69,-4.53 -8.39,-10.1 -11.11,-16.72c-2.72,-6.62 -4.08,-14.22 -4.08,-22.81c0,-11.74 1.63,-22.44 4.9,-32.09c3.27,-9.65 7.82,-17.92 13.65,-24.82c5.83,-6.89 12.82,-12.23 20.98,-16.01c8.15,-3.78 17.08,-5.67 26.77,-5.67c6.54,0 12.74,1.14 18.62,3.43c5.87,2.29 11.01,5.61 15.42,9.99c4.41,4.37 7.92,9.75 10.52,16.13c2.6,6.38 3.9,13.71 3.9,21.98c0,1.26 -0.04,2.74 -0.12,4.43c-0.08,1.7 -0.2,3.43 -0.36,5.2c-0.16,1.77 -0.32,3.51 -0.47,5.2c-0.16,1.69 -0.35,3.13 -0.59,4.31H76.22c-0.08,1.11 -0.14,2.17 -0.18,3.19c-0.04,1.03 -0.06,2.09 -0.06,3.19c0,6.54 0.95,12.11 2.84,16.72c1.89,4.61 4.35,8.37 7.39,11.29c3.03,2.92 6.44,5.02 10.22,6.32c3.78,1.3 7.6,1.95 11.46,1.95c8.43,0 15.21,-1.46 20.33,-4.37c5.12,-2.91 9.02,-6.85 11.7,-11.82h21.63c-1.34,4.89 -3.55,9.46 -6.62,13.71c-3.07,4.25 -6.95,7.94 -11.64,11.05c-4.69,3.11 -10.13,5.56 -16.31,7.33C120.8,212.84 114,213.73 106.6,213.73zM148.08,136.08c0.08,-0.39 0.14,-1.12 0.18,-2.19c0.04,-1.06 0.06,-2.11 0.06,-3.13c0,-4.18 -0.61,-8.14 -1.83,-11.88c-1.22,-3.74 -3.05,-7.03 -5.5,-9.87c-2.44,-2.84 -5.48,-5.08 -9.1,-6.74c-3.63,-1.65 -7.84,-2.48 -12.65,-2.48c-4.89,0 -9.46,0.87 -13.71,2.6c-4.26,1.73 -8.12,4.2 -11.58,7.39c-3.47,3.19 -6.46,7.01 -8.98,11.46c-2.52,4.45 -4.53,9.4 -6.03,14.83H148.08z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M227.58,213.73c-6.38,0 -12.37,-1.2 -17.97,-3.61c-5.6,-2.4 -10.5,-5.85 -14.71,-10.34c-4.22,-4.49 -7.55,-9.93 -9.99,-16.31c-2.44,-6.38 -3.66,-13.51 -3.66,-21.39c0,-7.64 0.77,-14.95 2.3,-21.92s3.72,-13.43 6.56,-19.38c2.84,-5.95 6.24,-11.33 10.22,-16.13c3.98,-4.81 8.39,-8.9 13.24,-12.29c4.85,-3.39 10.08,-5.99 15.72,-7.8c5.63,-1.81 11.52,-2.72 17.67,-2.72c4.57,0 8.92,0.63 13.06,1.89c4.14,1.26 7.88,3.01 11.23,5.26c3.35,2.25 6.22,4.96 8.63,8.15c2.4,3.19 4.16,6.68 5.26,10.46h1.89l15.72,-74.11h20.68l-37.82,178h-19.62l3.66,-17.37h-1.89c-4.65,6.07 -10.48,10.85 -17.49,14.36C243.26,211.97 235.69,213.73 227.58,213.73zM234.08,195.41c6.62,0 12.74,-1.55 18.38,-4.67c5.63,-3.11 10.54,-7.37 14.71,-12.76c4.18,-5.4 7.45,-11.74 9.81,-19.03c2.36,-7.29 3.55,-15.15 3.55,-23.58c0,-5.44 -0.75,-10.32 -2.25,-14.66c-1.5,-4.33 -3.63,-8.02 -6.38,-11.05c-2.76,-3.03 -6.11,-5.38 -10.05,-7.03c-3.94,-1.66 -8.39,-2.48 -13.36,-2.48c-6.54,0 -12.61,1.46 -18.2,4.37c-5.6,2.92 -10.44,6.97 -14.54,12.17c-4.1,5.2 -7.33,11.41 -9.69,18.61s-3.55,15.11 -3.55,23.7c0,5.36 0.77,10.28 2.31,14.77c1.54,4.49 3.68,8.33 6.44,11.52c2.76,3.19 6.07,5.67 9.93,7.45C225.05,194.52 229.35,195.41 234.08,195.41z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M508.94,84.45l-46.13,0l-50.32,62.3l-2.48,0l-26.61,-62.3l-46.66,0l40,90.49l-86.35,102.29l45.51,0l55.42,-65.71l3.74,0l29.94,65.71l45.79,0l-44.28,-97.76z" />
</group>
</vector>
5 changes: 5 additions & 0 deletions app/src/edx/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/edx/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Binary file added app/src/edx/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/edx/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/edx/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/edx/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/edx/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

<queries>
<intent>
Expand Down Expand Up @@ -39,7 +41,8 @@
android:exported="true"
android:fitsSystemWindows="true"
android:theme="@style/Theme.App.Starting"
android:windowSoftInputMode="adjustPan">
android:windowSoftInputMode="adjustPan"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down Expand Up @@ -102,9 +105,9 @@
android:foregroundServiceType="dataSync"
tools:node="merge" />

<!-- Braze init -->
<!-- FirebaseMessaging init -->
<service
android:name="com.braze.push.BrazeFirebaseMessagingService"
android:name=".system.push.OpenEdXFirebaseMessagingService"
android:enabled="${fcmEnabled}"
android:exported="false">
<intent-filter>
Expand Down
15 changes: 14 additions & 1 deletion app/src/main/java/org/openedx/app/AnalyticsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package org.openedx.app
import android.content.Context
import org.openedx.app.analytics.Analytics
import org.openedx.app.analytics.FirebaseAnalytics
import org.openedx.app.analytics.FullstoryAnalytics
import org.openedx.app.analytics.SegmentAnalytics
import org.openedx.auth.presentation.AuthAnalytics
import org.openedx.core.config.Config
import org.openedx.core.presentation.CoreAnalytics
import org.openedx.core.presentation.IAPAnalytics
import org.openedx.core.presentation.dialog.appreview.AppReviewAnalytics
import org.openedx.course.presentation.CourseAnalytics
import org.openedx.dashboard.presentation.DashboardAnalytics
Expand All @@ -20,7 +22,7 @@ class AnalyticsManager(
config: Config,
) : AppAnalytics, AppReviewAnalytics, AuthAnalytics, CoreAnalytics, CourseAnalytics,
DashboardAnalytics, DiscoveryAnalytics, DiscussionAnalytics, ProfileAnalytics,
WhatsNewAnalytics {
WhatsNewAnalytics, IAPAnalytics {

private val services: ArrayList<Analytics> = arrayListOf()

Expand All @@ -29,10 +31,15 @@ class AnalyticsManager(
if (config.getFirebaseConfig().enabled) {
addAnalyticsTracker(FirebaseAnalytics(context = context))
}

val segmentConfig = config.getSegmentConfig()
if (segmentConfig.enabled && segmentConfig.segmentWriteKey.isNotBlank()) {
addAnalyticsTracker(SegmentAnalytics(context = context, config = config))
}

if (config.getFullstoryConfig().isEnabled) {
addAnalyticsTracker(FullstoryAnalytics())
}
}

private fun addAnalyticsTracker(analytic: Analytics) {
Expand All @@ -45,6 +52,12 @@ class AnalyticsManager(
}
}

override fun logScreenEvent(screenName: String, params: Map<String, Any?>) {
services.forEach { analytics ->
analytics.logScreenEvent(screenName, params)
}
}

override fun logEvent(event: String, params: Map<String, Any?>) {
services.forEach { analytics ->
analytics.logEvent(event, params)
Expand Down
Loading
Loading