diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser
index bf16f3e0..c07369ca 100644
Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ
diff --git a/app/build.gradle b/app/build.gradle
index c1b1977c..e7390518 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,12 @@ android {
applicationId "ai.carol.deeplinking"
minSdkVersion 16
targetSdkVersion 28
- versionCode 2
- versionName "1.0.1"
+ versionCode 3
+ versionName "1.0.2"
+
+ def scheme = "deeplinking";
+ manifestPlaceholders = [scheme: "${scheme}"]
+ buildConfigField("String", "SCHEME", "\"${scheme}\"")
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -29,6 +33,7 @@ android {
}
ext {
+ scheme = "deeplinking"
androidVersion = "28.0.0"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 62a38bde..d5d9597b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/src/main/java/ai/carol/deeplinking/activity/EditActivity.java b/app/src/main/java/ai/carol/deeplinking/activity/EditActivity.java
index 972f5a3b..92dcc2d2 100644
--- a/app/src/main/java/ai/carol/deeplinking/activity/EditActivity.java
+++ b/app/src/main/java/ai/carol/deeplinking/activity/EditActivity.java
@@ -50,6 +50,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mEdtAppName.setText(DatabaseHelper.fetchAppName(context));
mEdtAppIdentifier.setText(DatabaseHelper.fetchAppIdentifier(context));
+ mEdtAppScheme.setEnabled(false);
+ mEdtAppName.setEnabled(false);
+ mEdtAppIdentifier.setEnabled(false);
+
mBtnSave.setOnClickListener((view) -> save());
}
diff --git a/app/src/main/java/ai/carol/deeplinking/activity/MainActivity.java b/app/src/main/java/ai/carol/deeplinking/activity/MainActivity.java
index 0ce56607..ac669a1b 100644
--- a/app/src/main/java/ai/carol/deeplinking/activity/MainActivity.java
+++ b/app/src/main/java/ai/carol/deeplinking/activity/MainActivity.java
@@ -13,6 +13,7 @@
import java.util.Locale;
import ai.carol.deeplinking.R;
+import ai.carol.deeplinking.helper.AlertHelper;
import ai.carol.deeplinking.helper.ConverterHelper;
import ai.carol.deeplinking.helper.DatabaseHelper;
import ai.carol.deeplinking.model.ClockInObject;
@@ -76,11 +77,20 @@ private void startEditActivity() {
}
private void startSendDataActivity() {
+ final String tenant = getString(mTxtTenant);
+ final String email = getString(mTxtEmail);
+ final String password = getString(mTxtPassword);
+
+ if (tenant.isEmpty() || email.isEmpty() || password.isEmpty()) {
+ AlertHelper.showFillFieldsAlert(this);
+ return;
+ }
+
final Intent sendDataIntent = new Intent(getBaseContext(), SendDataActivity.class);
- sendDataIntent.putExtra(SendDataActivity.TENANT_EXTRA, getString(mTxtTenant));
- sendDataIntent.putExtra(SendDataActivity.EMAIL_EXTRA, getString(mTxtEmail));
- sendDataIntent.putExtra(SendDataActivity.PASSWORD_EXTRA, getString(mTxtPassword));
+ sendDataIntent.putExtra(SendDataActivity.TENANT_EXTRA, tenant);
+ sendDataIntent.putExtra(SendDataActivity.EMAIL_EXTRA, email);
+ sendDataIntent.putExtra(SendDataActivity.PASSWORD_EXTRA, password);
sendDataIntent.putExtra(SendDataActivity.APP_SCHEME_EXTRA, getString(mTxtAppScheme));
sendDataIntent.putExtra(SendDataActivity.APP_NAME_EXTRA, getString(mTxtAppName));
sendDataIntent.putExtra(SendDataActivity.APP_IDENTIFIER_EXTRA, getString(mTxtAppIdentifier));
diff --git a/app/src/main/java/ai/carol/deeplinking/helper/AlertHelper.java b/app/src/main/java/ai/carol/deeplinking/helper/AlertHelper.java
index c1e85c2f..6b29d2f4 100644
--- a/app/src/main/java/ai/carol/deeplinking/helper/AlertHelper.java
+++ b/app/src/main/java/ai/carol/deeplinking/helper/AlertHelper.java
@@ -8,6 +8,7 @@
import android.support.annotation.NonNull;
import ai.carol.deeplinking.R;
+import ai.carol.deeplinking.activity.EditActivity;
public final class AlertHelper {
@@ -28,6 +29,15 @@ public static void showPlayStoreAlert(@NonNull final Activity activity) {
.show();
}
+ public static void showFillFieldsAlert(@NonNull final Activity activity) {
+ new AlertDialog.Builder(activity)
+ .setTitle(R.string.app_name)
+ .setMessage(R.string.fill_all_fields)
+ .setCancelable(false)
+ .setPositiveButton(R.string.yes_right_away, (dialog, which) -> openEditActivity(activity))
+ .show();
+ }
+
//endregion
//region - Private
@@ -42,6 +52,11 @@ private static void openPlayStorePage(@NonNull final Activity activity) {
}
}
+ private static void openEditActivity(@NonNull final Activity activity) {
+ final Intent editIntent = new Intent(activity, EditActivity.class);
+ activity.startActivity(editIntent);
+ }
+
//endregion
}
diff --git a/app/src/main/java/ai/carol/deeplinking/helper/DatabaseHelper.java b/app/src/main/java/ai/carol/deeplinking/helper/DatabaseHelper.java
index 3e4ce890..5754bae8 100644
--- a/app/src/main/java/ai/carol/deeplinking/helper/DatabaseHelper.java
+++ b/app/src/main/java/ai/carol/deeplinking/helper/DatabaseHelper.java
@@ -4,6 +4,9 @@
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
+import ai.carol.deeplinking.BuildConfig;
+import ai.carol.deeplinking.R;
+
public final class DatabaseHelper {
private static final String DB_NAME = "ai.carol.deeplinking.database";
@@ -22,21 +25,21 @@ public static void saveAppIdentifier(@NonNull final Context context, final Strin
save(context, APP_IDENTIFIER_KEY, appIdentifier);
}
public static String fetchAppIdentifier(@NonNull final Context context) {
- return fetch(context, APP_IDENTIFIER_KEY);
+ return fetch(context, APP_IDENTIFIER_KEY, getAppIdentifierDefault());
}
public static void saveAppName(@NonNull final Context context, final String appName) {
save(context, APP_NAME_KEY, appName);
}
public static String fetchAppName(@NonNull final Context context) {
- return fetch(context, APP_NAME_KEY);
+ return fetch(context, APP_NAME_KEY, getAppNameDefault(context));
}
public static void saveAppScheme(@NonNull final Context context, final String appScheme) {
save(context, APP_SCHEME_KEY, appScheme);
}
public static String fetchAppScheme(@NonNull final Context context) {
- return fetch(context, APP_SCHEME_KEY);
+ return fetch(context, APP_SCHEME_KEY, getAppSchemeDefault(context));
}
public static void saveClockIns(@NonNull final Context context, final String clockIns) {
@@ -67,7 +70,7 @@ public static String fetchTenant(@NonNull final Context context) {
return fetch(context, TENANT_KEY);
}
- //region - Private
+ //region - Private Helper
private static void save(@NonNull final Context context, @NonNull final String key, final String value) {
final SharedPreferences preferences = getPreferences(context);
@@ -78,8 +81,11 @@ private static void save(@NonNull final Context context, @NonNull final String k
}
private static String fetch(@NonNull final Context context, @NonNull final String key) {
+ return fetch(context, key, null);
+ }
+
+ private static String fetch(@NonNull final Context context, @NonNull final String key, final String defaultValue) {
final SharedPreferences preferences = getPreferences(context);
- final String defaultValue = null;
return preferences.getString(key, defaultValue);
}
@@ -89,4 +95,20 @@ private static SharedPreferences getPreferences(@NonNull final Context context)
//endregion
+ //region - Private Default
+
+ private static String getAppIdentifierDefault() {
+ return BuildConfig.APPLICATION_ID;
+ }
+
+ private static String getAppNameDefault(final @NonNull Context context) {
+ return context.getString(R.string.app_name);
+ }
+
+ private static String getAppSchemeDefault(final @NonNull Context context) {
+ return BuildConfig.SCHEME;
+ }
+
+ //endregion
+
}
diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml
index e8a8f222..3fcccd9b 100644
--- a/app/src/main/res/values-pt/strings.xml
+++ b/app/src/main/res/values-pt/strings.xml
@@ -7,6 +7,7 @@
Dados a serem enviados
Editar dados a serem enviados
E-mail:\u0020
+ Preencha todos os campos para continuar.
Logar no Clock-In
Senha:\u0020
Limpar
@@ -14,5 +15,6 @@
Salvar
Tenant:\u0020
Sim, instalar
+ Sim, é pra já!
Deseja instalar o app Clock-In?
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 30fb6d11..fcd3d4ae 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,6 +7,7 @@
Data to Send
Edit Data to Send
Email:\u0020
+ Fill all the fields to continue.
Login into Clock-In
Password:\u0020
Reset
@@ -14,5 +15,6 @@
Save
Tenant:\u0020
Yes, install
+ Yes, right away!
Do you want to install the Clock-In app?