Skip to content

Commit

Permalink
Refactor: Improve code structure and add EULA
Browse files Browse the repository at this point in the history
- Renamed `screens/lessons` to `screens/lesson` for better clarity (single lesson display).
- Added correct text to the Facebook button in the buttons row.
- Applied `basicMarquee()` to ensure text scrolls when overflowing.
- Removed unused code, resources, and classes for better code clarity.
- Added End-User License Agreement (EULA).
  • Loading branch information
Mihai-Cristian Condrea committed Dec 6, 2024
1 parent e7ad933 commit a3ebd84
Show file tree
Hide file tree
Showing 65 changed files with 3,245 additions and 1,847 deletions.
75 changes: 75 additions & 0 deletions EULA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# End-User License Agreement (EULA)

This End-User License Agreement ("EULA") governs your use of any and all software applications
developed and distributed by D4rK. By installing,
copying, using, or redistributing the Software, you acknowledge that you have read, understood, and
agree to be bound by the terms of this EULA.

## License Grant

The Developer grants you a non-exclusive, revocable, worldwide, royalty-free license to use the
Software for personal, non-commercial purposes, subject to the limitations set forth in this EULA.
Unless otherwise expressly stated in writing by the Developer, you may not:

* Sublicense, distribute, or transfer the Software to any third party.
* Modify, adapt, translate, reverse engineer, decompile, or disassemble the Software.
* Remove, alter, or obscure any copyright, trademark, or other proprietary notices contained in the
Software.
* Use the Software in any way that violates any applicable laws or regulations.
* Use the Software to engage in any illegal, harmful, or offensive activity.
* Use the Software to infringe the intellectual property rights of any third party.

## Intellectual Property

The Software and all related intellectual property rights, including but not limited to copyrights,
trademarks, and trade secrets, are owned by the Developer. This EULA does not grant you any
ownership rights in the Software.

## Disclaimer of Warranties

THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE DEVELOPER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE DEVELOPER DOES NOT
WARRANT THAT THE SOFTWARE WILL BE ERROR-FREE, UNINTERRUPTED, OR FREE OF VIRUSES OR OTHER HARMFUL
COMPONENTS.

## Limitation of Liability

IN NO EVENT SHALL THE DEVELOPER BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR
EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO DAMAGES FOR LOSS OF PROFITS, DATA, OR USE, ARISING
OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF THE DEVELOPER HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.

## Term and Termination

This EULA is effective upon your acceptance and shall continue until terminated. Your rights under
this EULA will terminate automatically without notice from the Developer if you breach any term of
this EULA. Upon termination, you must cease all use of the Software and destroy all copies in your
possession.

## Governing Law

This EULA shall be governed by and construed in accordance with the laws of Romania. Any dispute
arising out of or in connection with this EULA shall be subject to the exclusive jurisdiction of the
competent courts of Bucharest, Romania.

## Contact Information

If you have any questions or concerns regarding this EULA, please contact the Developer
at d4rk7355608@gmail.com.

## Open Source Components

This Software may incorporate or utilize certain open-source components. These components are
governed by their respective licenses, which can be
found 'About' or 'Legal' section of the app. Your use of these components is
subject to the terms of their respective licenses.

## Changes to this EULA

The Developer reserves the right to modify this EULA at any time. Any changes will be effective upon
posting the revised EULA at https://github.com/D4rK7355608/com.d4rk.englishwithlidia.plus/EULA.md. Your
continued use of the Software after the effective date of any changes constitutes your acceptance of
the revised EULA.
34 changes: 19 additions & 15 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations += listOf(
"en" ,
"de" ,
"es" ,
"fr" ,
"hi" ,
"hu" ,
"in" ,
"it" ,
"ja" ,
"ro" ,
"ru" ,
"tr" ,
"sv" ,
"bg" ,
"pl" ,
"uk"
"bg-rBG" ,
"de-rDE" ,
"es-rGQ" ,
"fr-rFR" ,
"hi-rIN" ,
"hu-rHU" ,
"in-rID" ,
"it-rIT" ,
"ja-rJP" ,
"pl-rPL" ,
"pt-rBR" ,
"ro-rRO" ,
"ru-rRU" ,
"sv-rSE" ,
"th-rTH" ,
"tr-rTR" ,
"uk-rUA" ,
"zh-rTW" ,
)

vectorDrawables {
useSupportLibrary = true
}
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</activity>

<activity
android:name=".ui.screens.lessons.LessonActivity"
android:name=".ui.screens.lesson.LessonActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,80 +7,86 @@ import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.d4rk.englishwithlidia.plus.BuildConfig
import com.d4rk.englishwithlidia.plus.constants.datastore.DataStoreNamesConstants
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map

val Context.dataStore by preferencesDataStore("settings")
val Context.dataStore by preferencesDataStore(name = DataStoreNamesConstants.DATA_STORE_SETTINGS)

class DataStore(context: Context) {
class DataStore(context : Context) {
private val dataStore = context.dataStore

companion object {
@Volatile
private var instance: DataStore? = null
private var instance : DataStore? = null

fun getInstance(context: Context): DataStore {
return instance ?: synchronized(this) {
fun getInstance(context : Context) : DataStore {
return instance ?: synchronized(lock = this) {
instance ?: DataStore(context).also { instance = it }
}
}
}

// Last used app notifications
private val lastUsedKey = longPreferencesKey("last_used")
val lastUsed: Flow<Long> = dataStore.data.map { preferences ->
private val lastUsedKey =
longPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_LAST_USED)
val lastUsed : Flow<Long> = dataStore.data.map { preferences ->
preferences[lastUsedKey] ?: 0
}

suspend fun saveLastUsed(timestamp: Long) {
suspend fun saveLastUsed(timestamp : Long) {
dataStore.edit { preferences ->
preferences[lastUsedKey] = timestamp
}
}

// Startup
private val startupKey = booleanPreferencesKey("value")
val startup: Flow<Boolean> = dataStore.data.map { preferences ->
preferences[startupKey] ?: true
private val startupKey =
booleanPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_STARTUP)
val startup : Flow<Boolean> = dataStore.data.map { preferences ->
preferences[startupKey] != false
}

suspend fun saveStartup(isFirstTime: Boolean) {
suspend fun saveStartup(isFirstTime : Boolean) {
dataStore.edit { preferences ->
preferences[startupKey] = isFirstTime
}
}

// Display
val themeModeState = mutableStateOf("follow_system")
private val themeModeKey = stringPreferencesKey("theme_mode")
val themeMode: Flow<String> = dataStore.data.map { preferences ->
val themeModeState = mutableStateOf(value = "follow_system")
private val themeModeKey =
stringPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_THEME_MODE)
val themeMode : Flow<String> = dataStore.data.map { preferences ->
preferences[themeModeKey] ?: "follow_system"
}

suspend fun saveThemeMode(mode: String) {
suspend fun saveThemeMode(mode : String) {
dataStore.edit { preferences ->
preferences[themeModeKey] = mode
}
}

private val amoledModeKey = booleanPreferencesKey("amoled_mode")
val amoledMode: Flow<Boolean> = dataStore.data.map { preferences ->
preferences[amoledModeKey] ?: false
private val amoledModeKey =
booleanPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_AMOLED_MODE)
val amoledMode : Flow<Boolean> = dataStore.data.map { preferences ->
preferences[amoledModeKey] == true
}

suspend fun saveAmoledMode(isChecked: Boolean) {
suspend fun saveAmoledMode(isChecked : Boolean) {
dataStore.edit { preferences ->
preferences[amoledModeKey] = isChecked
}
}

private val dynamicColorsKey = booleanPreferencesKey("dynamic_colors")
val dynamicColors: Flow<Boolean> = dataStore.data.map { preferences ->
preferences[dynamicColorsKey] ?: true
private val dynamicColorsKey =
booleanPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_DYNAMIC_COLORS)
val dynamicColors : Flow<Boolean> = dataStore.data.map { preferences ->
preferences[dynamicColorsKey] != false
}

suspend fun saveDynamicColors(isChecked: Boolean) {
suspend fun saveDynamicColors(isChecked : Boolean) {
dataStore.edit { preferences ->
preferences[dynamicColorsKey] = isChecked
}
Expand All @@ -98,37 +104,39 @@ class DataStore(context: Context) {
}
}

private val languageKey = stringPreferencesKey("language")
private val languageKey =
stringPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_LANGUAGE)

fun getLanguage(): Flow<String> = dataStore.data.map { preferences ->
fun getLanguage() : Flow<String> = dataStore.data.map { preferences ->
preferences[languageKey] ?: "en"
}

suspend fun saveLanguage(language: String) {
suspend fun saveLanguage(language : String) {
dataStore.edit { preferences ->
preferences[languageKey] = language
}
}

// Usage and Diagnostics
private val usageAndDiagnosticsKey = booleanPreferencesKey("usage_and_diagnostics")
val usageAndDiagnostics: Flow<Boolean> = dataStore.data.map { preferences ->
preferences[usageAndDiagnosticsKey] ?: true
private val usageAndDiagnosticsKey =
booleanPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_USAGE_AND_DIAGNOSTICS)
val usageAndDiagnostics : Flow<Boolean> = dataStore.data.map { preferences ->
preferences[usageAndDiagnosticsKey] ?: ! BuildConfig.DEBUG
}

suspend fun saveUsageAndDiagnostics(isChecked: Boolean) {
suspend fun saveUsageAndDiagnostics(isChecked : Boolean) {
dataStore.edit { preferences ->
preferences[usageAndDiagnosticsKey] = isChecked
}
}

// Ads
private val adsKey = booleanPreferencesKey("ads")
val ads: Flow<Boolean> = dataStore.data.map { preferences ->
preferences[adsKey] ?: true
private val adsKey = booleanPreferencesKey(name = DataStoreNamesConstants.DATA_STORE_ADS)
val ads : Flow<Boolean> = dataStore.data.map { preferences ->
preferences[adsKey] ?: ! BuildConfig.DEBUG
}

suspend fun saveAds(isChecked: Boolean) {
suspend fun saveAds(isChecked : Boolean) {
dataStore.edit { preferences ->
preferences[adsKey] = isChecked
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.d4rk.englishwithlidia.plus.R
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
Expand All @@ -30,6 +32,7 @@ class AppUpdateNotificationsManager(private val context: Context) {
* This function checks the availability of app updates using the AppUpdateManager and sends
* a notification with a deep link to the Play Store if a flexible update is available.
*/
@RequiresApi(Build.VERSION_CODES.O)
fun checkAndSendUpdateNotification() {
val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.d4rk.englishwithlidia.plus.notifications.workers
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.work.Worker
import androidx.work.WorkerParameters
Expand Down Expand Up @@ -36,6 +38,7 @@ class AppUsageNotificationWorker(context: Context, workerParams: WorkerParameter
*
* @return The result of the worker operation, indicating success or failure.
*/
@RequiresApi(Build.VERSION_CODES.O)
override fun doWork(): Result {
val currentTimestamp = System.currentTimeMillis()
val notificationThreshold = 3 * 24 * 60 * 60 * 1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.waitForUpOrCancellation
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.pager.PagerState
import androidx.compose.material3.DrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -84,23 +83,6 @@ fun Modifier.hapticDrawerSwipe(drawerState : DrawerState) : Modifier = composed
return@composed this
}

fun Modifier.hapticPagerSwipe(pagerState : PagerState) : Modifier = composed {
val haptic : HapticFeedback = LocalHapticFeedback.current
var hasVibrated : Boolean by remember { mutableStateOf(value = false) }

LaunchedEffect(pagerState.isScrollInProgress) {
if (pagerState.isScrollInProgress && ! hasVibrated) {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
hasVibrated = true
}
else if (! pagerState.isScrollInProgress) {
hasVibrated = false
}
}

return@composed this
}

fun Modifier.animateVisibility(
visible : Boolean = true ,
index : Int = 0 ,
Expand Down
Loading

0 comments on commit a3ebd84

Please sign in to comment.