Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from Irineu333/release/v1.0.4
Browse files Browse the repository at this point in the history
Release/v1.0.4

feat : added github repository link
feat : title span art
feat : improving highlighting
feat : added visual editor #5
  • Loading branch information
Irineu333 committed Jan 22, 2022
2 parents e50d5fc + ef51dab commit 56a215f
Show file tree
Hide file tree
Showing 104 changed files with 2,964 additions and 281 deletions.
14 changes: 8 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'dagger.hilt.android.plugin'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-parcelize'
}

android {
Expand All @@ -27,8 +28,8 @@ android {
applicationId "com.neo.fbrules"
minSdk 21
targetSdk 31
versionCode 4
versionName "1.0.3"
versionCode 5
versionName "1.0.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -41,6 +42,7 @@ android {
}
debug {
versionNameSuffix '-dev'
applicationIdSuffix '.dev'
signingConfig signingConfigs.debug
}
}
Expand Down Expand Up @@ -87,9 +89,9 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

//view
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

//utils
implementation 'com.google.code.gson:gson:2.8.9'
Expand All @@ -100,7 +102,7 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'

//async
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'

//hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
Expand Down
77 changes: 77 additions & 0 deletions app/src/debug/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"project_info": {
"project_number": "883298988094",
"firebase_url": "https://fbrules333-default-rtdb.firebaseio.com",
"project_id": "fbrules333",
"storage_bucket": "fbrules333.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:883298988094:android:d708344cb9fa3f75a5216f",
"android_client_info": {
"package_name": "com.neo.fbrules"
}
},
"oauth_client": [
{
"client_id": "883298988094-vnrglb8tc2hbuh5an8en66iveskah0p1.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.neo.fbrules",
"certificate_hash": "f4c55227b596437058d76090992f70e66b460181"
}
},
{
"client_id": "883298988094-n81d26v04dbo34d02n7h31pfitln31lf.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyA9nHPhOFQwI2nEMb0JgTC_QSjnnJHq5js"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "883298988094-n81d26v04dbo34d02n7h31pfitln31lf.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:883298988094:android:c466a916f8935269a5216f",
"android_client_info": {
"package_name": "com.neo.fbrules.dev"
}
},
"oauth_client": [
{
"client_id": "883298988094-n81d26v04dbo34d02n7h31pfitln31lf.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyA9nHPhOFQwI2nEMb0JgTC_QSjnnJHq5js"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "883298988094-n81d26v04dbo34d02n7h31pfitln31lf.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
20 changes: 0 additions & 20 deletions app/src/debug/res/drawable/ic_launcher_foreground.xml

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/debug/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="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified app/src/debug/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/debug/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/debug/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/debug/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/debug/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/debug/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified app/src/debug/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:name=".App"
android:theme="@style/Theme.NeoFirebase">
Expand Down
Binary file modified app/src/main/ic_launcher-playstore.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/java/com/neo/fbrules/core/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.neo.fbrules.core

import androidx.annotation.StringRes
import com.neo.fbrules.R

object Constants {
const val FIREBASE_RULES = ".settings/rules.json"

enum class ERROR(val message: String) {
CREDENTIAL_NOT_FOUND("Credenciais de acesso não configuradas"),
UNKNOWN_ERROR("Erro não especificado"),
enum class ERROR(@StringRes val message: Int) {
CREDENTIAL_NOT_FOUND(R.string.credentials_not_found),
UNKNOWN_ERROR(R.string.unknown_error),
}
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/neo/fbrules/core/Expression.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.neo.fbrules.core

import java.util.regex.Pattern

object Expression {
val variableInProperty: Pattern = Pattern.compile("((?<=/)|^)\\$\\w+(?=/?)$")
val variableInCondition: Pattern = Pattern.compile("\\$\\w+(?=/?)$")
}
54 changes: 54 additions & 0 deletions app/src/main/java/com/neo/fbrules/core/HandlerError.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.neo.fbrules.core

import android.content.Context
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import com.neo.fbrules.R
import com.neo.fbrules.util.showAlertDialog


fun Fragment.handlerError(type: ERROR, throwable: Throwable? = null) =
requireContext().handlerError(type, throwable)

fun Context.handlerError(type: ERROR, throwable: Throwable? = null) {

@StringRes
val errorMessage = when (type) {

ERROR.INVALID_RULES -> {
R.string.text_visualRules_invalidRulesError
}

ERROR.UNRECOGNIZED_RULES -> {
R.string.text_visualRules_unrecognizedRuleError
}

ERROR.INVALID_JSON -> {
R.string.text_visualRules_invalidRulesError_invalidJsonError
}
}

showAlertDialog(this, "Error", getString(errorMessage)) {
if (throwable != null) {
negativeButton("log") {
showAlertDialog(
this@handlerError,
"Error",
getString(errorMessage) + "\n\n" + throwable.message
)
}
}
}

if (throwable != null) {
Firebase.crashlytics.recordException(throwable)
}
}

enum class ERROR {
UNRECOGNIZED_RULES,
INVALID_RULES,
INVALID_JSON
}
9 changes: 7 additions & 2 deletions app/src/main/java/com/neo/fbrules/core/Result.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.neo.fbrules.core

import android.content.Context
import androidx.annotation.StringRes
import com.neo.fbrules.R

Expand All @@ -10,8 +11,12 @@ sealed class Result<out R> {
data class Error(
val type: Constants.ERROR = Constants.ERROR.UNKNOWN_ERROR,
val title: String = type.name,
val message: String = type.message
) : Result<Nothing>()
val message: String? = null
) : Result<Nothing>() {
fun getSafeMessage(context: Context): String {
return message ?: context.getString(R.string.unknown_error)
}
}
}

class Message(
Expand Down
65 changes: 65 additions & 0 deletions app/src/main/java/com/neo/fbrules/core/constants/Highlighting.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.neo.fbrules.core.constants

import android.content.Context
import com.neo.fbrules.R
import com.neo.fbrules.util.getCompatColor
import com.neo.fbrules.util.requestColor
import com.neo.highlight.util.scheme.ColorScheme
import java.util.regex.Pattern

class Highlighting(context: Context) {

val propertySyntax = listOf(
ColorScheme(
Pattern.compile("(\\.read|\\.write)"),
context.theme.requestColor(R.attr.colorAccent)
)
)

val conditionSyntax = listOf(
ColorScheme(
Pattern.compile("(?<=auth\\.)uid|auth"),
context.theme.requestColor(R.attr.colorAccent)
),
ColorScheme(
Pattern.compile("===|==|!="),
context.theme.requestColor(R.attr.colorPrimary)
),
ColorScheme(
Pattern.compile("(true|false|null)"),
context.requestColor(R.color.syntax_literal)
),
ColorScheme(
Pattern.compile("(\"[^\"]*\")|('[^']*')"),
context.requestColor(R.color.syntax_string)
)
)

val completeSyntax = listOf(
ColorScheme(
Pattern.compile("(?<!\\w)(true|false|null)(?!\\w)"),
context.getCompatColor(R.color.syntax_literal)
),
ColorScheme(
Pattern.compile("\"[^\"]*\""),
context.getCompatColor(R.color.syntax_string)
),
propertySyntax[0],
ColorScheme(
Pattern.compile("(?<=auth\\.)uid|auth"),
context.theme.requestColor(R.attr.colorAccent)
),
ColorScheme(
Pattern.compile("===|==|!="),
context.theme.requestColor(R.attr.colorPrimary)
),
ColorScheme(
Pattern.compile("\\$\\w+"),
context.requestColor(R.color.syntax_variable)
),
ColorScheme(
Pattern.compile("[/]{2}.*"),
context.getCompatColor(R.color.syntax_comment)
)
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
package com.neo.fbrules.main.domain.model

import com.neo.fbrules.main.data.model.DataCredential

data class DomainCredential(
var privateKey: String,
var databaseKey: String
)

fun DomainCredential.toData(): DataCredential {
return DataCredential(
privateKey = privateKey,
databaseKey = databaseKey
)
}

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/java/com/neo/fbrules/main/domain/model/parse.kt

This file was deleted.

Loading

0 comments on commit 56a215f

Please sign in to comment.