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
Future<Category> _fetchCategoriesPreview() async { | |
http.Response response = | |
await http.get(Uri.encodeFull(UtilsURL.CATEGORIES_PREVIEW), headers: { | |
"Authorization": 'Token 9dcc473d8e65ccdd6440e03f0622642b11acbbbd', | |
"Accept": "application/json", | |
"Content-Type": "text/html; charset=utf-8" | |
}); | |
if (response.statusCode == 200) { | |
return Category.fromJson(json.decode(response.body)); | |
} else { |
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
Future<Map<String, dynamic>> _fetchCategoriesPreview() async { | |
http.Response response = | |
await http.get(Uri.encodeFull(UtilsURL.CATEGORIES_PREVIEW), headers: { | |
"Authorization": 'Token 9dcc473d8e65ccdd6440e03f0622642b11acbbbd', | |
"Accept": "application/json" | |
}); | |
if (response.statusCode == 200) { | |
// return json.decode(response.body); | |
return json.decode(response.body[3]); | |
} else { |
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
private static String addMask(final String textoAFormatar, final String mask){ | |
String formatado = ""; | |
int i = 0; | |
// vamos iterar a mascara, para descobrir quais caracteres vamos adicionar e quando... | |
for (char m : mask.toCharArray()) { | |
if (m != '#') { // se não for um #, vamos colocar o caracter informado na máscara | |
formatado += m; | |
continue; | |
} | |
// Senão colocamos o valor que será formatado |
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
private void checkAppVersion() { | |
DatabaseReference database = FirebaseUtils.getDatabase().getReference().child(Utils.APP_CONFIG); | |
database.addListenerForSingleValueEvent(new ValueEventListener() { | |
@Override | |
public void onDataChange(@NonNull DataSnapshot dataSnapshot) { | |
String appVersion = dataSnapshot.child(Utils.VERSION).getValue(String.class).substring(0, 3); | |
String currentVersion = String.valueOf(BuildConfig.VERSION_NAME).substring(0, 3); | |
if (!appVersion.equals(currentVersion)) { | |
new AwesomeSuccessDialog(MainActivity.this) | |
.setTitle(R.string.new_update) |