This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Irineu333/release/v1.0.2
Release/v1.0.2 feat: added Neo Utils apps divulgation fix: correcting BottomSheet expanded bug feat: create config help feat: enabled firebase persistence feat: added force update
- Loading branch information
Showing
29 changed files
with
487 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
package com.neo.fbrules | ||
|
||
import android.app.Application | ||
import com.google.firebase.FirebaseApp | ||
import com.google.firebase.database.FirebaseDatabase | ||
import com.google.firebase.ktx.Firebase | ||
import com.neo.fbrules.util.environment | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class App : Application() { | ||
override fun onCreate() { | ||
|
||
FirebaseDatabase | ||
.getInstance() | ||
.setPersistenceEnabled(true) | ||
|
||
environment = getString(R.string.environment) | ||
|
||
super.onCreate() | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/neo/fbrules/core/NeoUtilsAppsManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.neo.fbrules.core | ||
|
||
import com.google.firebase.crashlytics.ktx.crashlytics | ||
import com.google.firebase.database.DataSnapshot | ||
import com.google.firebase.database.DatabaseError | ||
import com.google.firebase.database.ValueEventListener | ||
import com.google.firebase.ktx.Firebase | ||
import com.neo.fbrules.main.presenter.model.NeoUtilsApp | ||
import com.neo.fbrules.util.firebaseEnvironment | ||
|
||
|
||
class NeoUtilsAppsManager( | ||
private val appsListener: AppsListener | ||
) : ValueEventListener { | ||
|
||
private val fbNeoUtilsAppsManager = | ||
firebaseEnvironment.child("neo_utils_apps") | ||
|
||
init { | ||
fbNeoUtilsAppsManager.addValueEventListener(this) | ||
} | ||
|
||
interface AppsListener { | ||
fun change(apps: List<NeoUtilsApp>) | ||
} | ||
|
||
override fun onDataChange(snapshot: DataSnapshot) { | ||
|
||
val neoUtilsApp = mutableListOf<NeoUtilsApp>() | ||
|
||
for (child in snapshot.children) { | ||
|
||
runCatching { | ||
val name = child.child("name").value as String | ||
val packageName = child.child("package").value as String | ||
val url = child.child("url").value as String | ||
val iconUrl = child.child("icon").value as String | ||
|
||
neoUtilsApp.add( | ||
NeoUtilsApp( | ||
name = name, | ||
packageName = packageName, | ||
url = url, | ||
iconUrl = iconUrl | ||
) | ||
) | ||
}.onFailure { | ||
Firebase.crashlytics.recordException(it) | ||
} | ||
} | ||
|
||
appsListener.change(neoUtilsApp) | ||
|
||
} | ||
|
||
override fun onCancelled(error: DatabaseError) = Unit | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.