Commit 5b1be9f5 authored by Nastuzzi Samy's avatar Nastuzzi Samy

API update

Add rights required to change API info
Edit API text
Fix bug when API not reconized
parent 4ab2377e
......@@ -82,6 +82,7 @@ public class APIActivity extends BaseActivity implements ZXingScannerView.Result
alertDialogBuilder
.setTitle(R.string.getting_informations_from)
.setView(popupView)
.setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
......@@ -91,16 +92,32 @@ public class APIActivity extends BaseActivity implements ZXingScannerView.Result
Map<String, String> apiInfo = config.getApi(inputApi.getText().toString());
if (apiInfo == null) {
Log.e(LOG_TAG, getString(R.string.api_not_recognized));
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.e(LOG_TAG, getString(R.string.api_not_recognized));
dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.api_not_recognized));
dialog.infoDialog(APIActivity.this, getString(R.string.badge_read), getString(R.string.api_not_recognized));
}
});
} else
handleAPI(buttonTag.isChecked() ? inputInfo.getText().toString().toUpperCase() : inputInfo.getText().toString(), apiInfo, null, null, buttonTag.isChecked());
}
}).start();
}
})
.setCancelable(true);
.setNeutralButton(R.string.api_assign, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new Thread(new Runnable() {
@Override
public void run() {
Map<String, String> apiInfo = config.getApi(inputApi.getText().toString());
}
}).start();
}
})
.setNegativeButton(R.string.cancel, null);
dialog.createDialog(alertDialogBuilder, inputInfo);
......
......@@ -100,7 +100,7 @@ public abstract class BaseActivity extends InternetActivity {
protected void hasRights(final String title, final String[] rightList, final Runnable runnablePos) { hasRights(title, rightList, false, runnablePos);}
protected void hasRights(final String title, final String[] rightList, final boolean needToBeSuper, final Runnable runnablePos) {
hasRights(title, rightList, false, runnablePos, new Runnable() {
hasRights(title, rightList, needToBeSuper, runnablePos, new Runnable() {
@Override
public void run() {
dialog.errorDialog(BaseActivity.this, title, nemopaySession.forbidden(rightList, needToBeSuper));
......
......@@ -204,7 +204,7 @@ public class FoundationsOptionsActivity extends BaseActivity {
}
protected void keyEditDialog() {
hasRights(getString(R.string.key_registration), new String[]{}, new Runnable(){
hasRights(getString(R.string.key_registration), new String[]{}, true, new Runnable(){
@Override
public void run() {
final View keyView = getLayoutInflater().inflate(R.layout.dialog_key_set, null);
......
......@@ -4,11 +4,11 @@
<item>Mode annulation</item>
<item>Modifier les articles, catégories/claviers de caisse</item>
<item>Modifier les points de vente</item>
<item>Lire un QR Code</item>
<item>Communiquer avec une API</item>
<item>Gestion des cartes/cotisations</item>
<item>Modifier la clé Nemopay</item>
<item>Modifier la clé Ginger</item>
<item>Modifier une clé API</item>
<item>Modifier une API</item>
<item>Rechercher une mise à jour</item>
<item>Crédits</item>
</string-array>
......
......@@ -123,6 +123,7 @@
<string name="api_no_data">L\'API n\'a envoyé aucune information</string>
<string name="api_execution">Exécution de la commande API</string>
<string name="api_pay_caution">Attention, la commande \"%s\" fera payer la personne des articles affichés</string>
<string name="api_assign">Assigner cette API</string>
<string name="key">Clé d\'application</string>
<string name="key_registration">Enregistrement d\'une clé</string>
<string name="key_explication">Pour pouvoir fonctionner, l\'application a besoin d\'être enregistrée sous un nom précis et daté (date automatiquement ajoutée si non détectée). Ceci permettra par la suite de donner des droits à cet appareil</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment