Implementato Firebase e Fabric
This commit is contained in:
parent
4ba935ec88
commit
79d7f11eb5
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -1,6 +1,18 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.fabric.tools:gradle:1.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.firebase.firebase-perf'
|
||||
apply plugin: 'io.fabric'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
@ -37,6 +49,9 @@ dependencies {
|
||||
})
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
implementation 'com.google.firebase:firebase-crash:16.2.1'
|
||||
implementation 'com.google.firebase:firebase-perf:16.2.2'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha01'
|
||||
@ -86,11 +101,11 @@ dependencies {
|
||||
//AppUpdate
|
||||
implementation 'com.github.javiersantos:AppUpdater:2.7'
|
||||
|
||||
|
||||
//Barcode
|
||||
implementation project(':pointmobilescannerlibrary')
|
||||
implementation project(path: ':barcode_base_library')
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
|
||||
55
app/google-services.json
Normal file
55
app/google-services.json
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "963231271247",
|
||||
"firebase_url": "https://wmsfirebaseproject-64854.firebaseio.com",
|
||||
"project_id": "wmsfirebaseproject-64854",
|
||||
"storage_bucket": "wmsfirebaseproject-64854.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:963231271247:android:6d73ab369f33c450",
|
||||
"android_client_info": {
|
||||
"package_name": "it.integry.integrywmsnative"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "963231271247-b50hgcd89u9ksfc7189mri044kq8aq1p.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "it.integry.integrywmsnative",
|
||||
"certificate_hash": "864b69dcc40196befa65638a868cec1c61245fa6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "963231271247-6jof105pci1g0g7m2e7kjbtrtk2443g4.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAV0HnnjE-ZVKhkCQOAyNRzlByk1wng9_4"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "963231271247-6jof105pci1g0g7m2e7kjbtrtk2443g4.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@ -52,6 +52,9 @@
|
||||
android:label="@string/activity_contenuto_bancale_title"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
<meta-data
|
||||
android:name="io.fabric.ApiKey"
|
||||
android:value="26f0d16c00d20fe74582627c831f26e30646a187" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -53,7 +53,7 @@ public class MainActivity extends AppCompatActivity
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ExceptionsHandler.init(this);
|
||||
//ExceptionsHandler.init(this);
|
||||
|
||||
PermissionsHelper.askPermissions(this);
|
||||
|
||||
|
||||
@ -6,9 +6,11 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import it.integry.integrywmsnative.core.REST.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.ExceptionsHandler;
|
||||
@ -31,6 +33,9 @@ public class MainApplication extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if(!BuildConfig.DEBUG) {
|
||||
Fabric.with(this, new Crashlytics());
|
||||
}
|
||||
Stash.init(this);
|
||||
|
||||
SettingsManager.init(this);
|
||||
|
||||
@ -43,7 +43,8 @@ public class RESTBuilder {
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
return retrofit.create(service);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.core.REST.model;
|
||||
|
||||
public class SlackMessageDTO {
|
||||
}
|
||||
@ -19,7 +19,6 @@ public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
private final static String TAG = ExceptionsHandler.class.getSimpleName();
|
||||
|
||||
private final Activity context;
|
||||
//private final Thread.UncaughtExceptionHandler rootHandler;
|
||||
|
||||
public static void init(Activity context) {
|
||||
new ExceptionsHandler(context);
|
||||
@ -28,10 +27,11 @@ public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
private ExceptionsHandler(Activity context) {
|
||||
this.context = context;
|
||||
|
||||
if (!BuildConfig.DEBUG) {
|
||||
//rootHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
//if (!BuildConfig.DEBUG) {
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -14,7 +11,6 @@ import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import okhttp3.internal.Util;
|
||||
|
||||
public class UtilityLogger {
|
||||
|
||||
|
||||
@ -210,16 +210,12 @@ public class VersamentoMerceViewModel {
|
||||
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, ProgressDialog progressDialog) {
|
||||
|
||||
if(shouldAskLivello) {
|
||||
DialogAskLivelloPosizione.make(mContext, livello -> {
|
||||
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, newPosizione -> {
|
||||
|
||||
if(livello == null) {
|
||||
if(newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);
|
||||
} else {
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += livello;
|
||||
mtbDepoPosizione.setPosizione(newPosizione);
|
||||
|
||||
updatePosizione(mtbDepoPosizione, false, progressDialog);
|
||||
updatePosizione(newPosizione, false, progressDialog);
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
|
||||
@ -1,45 +1,133 @@
|
||||
package it.integry.integrywmsnative.view.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.text.InputType;
|
||||
import android.widget.EditText;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
|
||||
public class DialogAskLivelloPosizione {
|
||||
|
||||
|
||||
public static void make(Context context, RunnableArgs<Integer> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
final EditText livelloEditText = new EditText(context);
|
||||
livelloEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
private Context mContext;
|
||||
private MtbDepoPosizione mtbDepoPosizione;
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||
.setTitle("Livello")
|
||||
.setMessage("In che livello vuoi posizionare?")
|
||||
.setView(livelloEditText)
|
||||
.setPositiveButton("OK", (dialog1, which) -> {
|
||||
String livello = String.valueOf(livelloEditText.getText());
|
||||
if(UtilityString.isNullOrEmpty(livello)) {
|
||||
UtilityToast.showToast("Inserisci un LIVELLO valido");
|
||||
onComplete.run(null);
|
||||
} else {
|
||||
try{
|
||||
Integer livelloInt = Integer.parseInt(livello);
|
||||
onComplete.run(livelloInt);
|
||||
} catch (NumberFormatException nfe) {
|
||||
UtilityToast.showToast("Inserisci un LIVELLO valido");
|
||||
onComplete.run(null);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton("Annulla", null)
|
||||
.create();
|
||||
dialog.show();
|
||||
private Dialog mAlert;
|
||||
|
||||
private RunnableArgs<MtbDepoPosizione> onComplete;
|
||||
private RunnableArgs<Exception> onFailed;
|
||||
|
||||
private TextInputLayout livelloTextInputLayout;
|
||||
|
||||
public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
new DialogAskLivelloPosizione(context, mtbDepoPosizione, onComplete, onFailed).mAlert.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mContext = context;
|
||||
this.mtbDepoPosizione = mtbDepoPosizione;
|
||||
this.onComplete = onComplete;
|
||||
this.onFailed = onFailed;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
View currentView = inflater.inflate(R.layout.dialog_ask_position_of_lu__page2, null, false);
|
||||
|
||||
mAlert = new Dialog(mContext);
|
||||
mAlert.setContentView(currentView);
|
||||
mAlert.setCanceledOnTouchOutside(false);
|
||||
|
||||
mAlert.setOnShowListener(dialog -> {
|
||||
|
||||
currentView.findViewById(R.id.button_confirm).setOnClickListener(v -> {
|
||||
String levelNumber = ((TextView)currentView.findViewById(R.id.level_number)).getText().toString();
|
||||
onLevelConfirm(levelNumber);
|
||||
});
|
||||
|
||||
currentView.findViewById(R.id.button_abort).setOnClickListener(v -> {
|
||||
onLevelAbort();
|
||||
});
|
||||
|
||||
livelloTextInputLayout = currentView.findViewById(R.id.level_number_layout);
|
||||
|
||||
livelloTextInputLayout.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if(livelloTextInputLayout.getEditText().getText() != null) {
|
||||
validateLevel(livelloTextInputLayout.getEditText().getText().toString());
|
||||
} else resetLevelError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onLevelConfirm(String levelString) {
|
||||
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += levelString;
|
||||
|
||||
MtbDepoPosizione foundPosizione = UtilityPosizione.getFromCache(newPosizione);
|
||||
|
||||
if(foundPosizione != null) {
|
||||
resetLevelError();
|
||||
|
||||
onComplete.run(foundPosizione);
|
||||
mAlert.dismiss();
|
||||
|
||||
|
||||
} else {
|
||||
setLevelError(mContext.getResources().getString(R.string.not_valid));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateLevel(String levelString) {
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += levelString;
|
||||
|
||||
if(UtilityPosizione.getFromCache(newPosizione) != null) {
|
||||
resetLevelError();
|
||||
} else setLevelError(mContext.getResources().getString(R.string.not_valid));
|
||||
}
|
||||
|
||||
private void setLevelError(String message){
|
||||
livelloTextInputLayout.setErrorEnabled(true);
|
||||
livelloTextInputLayout.setError(message);
|
||||
}
|
||||
|
||||
private void resetLevelError() {
|
||||
livelloTextInputLayout.setError(null);
|
||||
}
|
||||
|
||||
|
||||
private void onLevelAbort() {
|
||||
onComplete.run(null);
|
||||
mAlert.dismiss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
buildscript {
|
||||
ext{
|
||||
kotlin_version = '1.3.10'
|
||||
kotlin_version = '1.3.11'
|
||||
gradle_version = '3.2.1'
|
||||
}
|
||||
|
||||
@ -15,8 +15,10 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:3.2.1"
|
||||
classpath "com.android.tools.build:gradle:$gradle_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
classpath 'com.google.firebase:firebase-plugins:1.1.5'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user