Локаль можно задать на этапе сборки
This commit is contained in:
@@ -1,217 +0,0 @@
|
||||
{
|
||||
"auto_complete":
|
||||
{
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"e",
|
||||
"else"
|
||||
],
|
||||
[
|
||||
"pre",
|
||||
"previewing"
|
||||
],
|
||||
[
|
||||
"purc",
|
||||
"_purchase"
|
||||
]
|
||||
]
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
],
|
||||
"build_system": "",
|
||||
"build_system_choices":
|
||||
[
|
||||
],
|
||||
"build_varint": "",
|
||||
"command_palette":
|
||||
{
|
||||
"height": 359.0,
|
||||
"last_filter": "packa",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"packa",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"pac",
|
||||
"Install Package Control"
|
||||
]
|
||||
],
|
||||
"width": 485.0
|
||||
},
|
||||
"console":
|
||||
{
|
||||
"height": 0.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"distraction_free":
|
||||
{
|
||||
"menu_visible": true,
|
||||
"show_minimap": false,
|
||||
"show_open_files": false,
|
||||
"show_tabs": false,
|
||||
"side_bar_visible": false,
|
||||
"status_bar_visible": false
|
||||
},
|
||||
"file_history":
|
||||
[
|
||||
"/Users/kifio/FlutterProjects/checker/lib/consts.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/activate_token.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/registration.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/purchase_success.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/purchase.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/main.dart",
|
||||
"/Users/kifio/FlutterProjects/checker/lib/faq.dart",
|
||||
"/home/kifio/ShitCoding/checker/lib/main.dart",
|
||||
"/home/kifio/ShitCoding/checker/lib/base_state.dart",
|
||||
"/home/kifio/ShitCoding/checker/lib/splash.dart",
|
||||
"/home/kifio/ShitCoding/checker/lib/registration.dart",
|
||||
"/home/kifio/ShitCoding/checker/lib/activate_token.dart"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
"height": 23.0
|
||||
},
|
||||
"find_in_files":
|
||||
{
|
||||
"height": 93.0,
|
||||
"where_history":
|
||||
[
|
||||
""
|
||||
]
|
||||
},
|
||||
"find_state":
|
||||
{
|
||||
"case_sensitive": true,
|
||||
"find_history":
|
||||
[
|
||||
"intToken",
|
||||
"http://pos-api-autoclub.dinect.com/20130701/",
|
||||
"intUrl",
|
||||
"async",
|
||||
"common",
|
||||
" \treturn new Text('Покупка на сумму 1234.00 руб. проведена', style: new TextStyle(color: tokenActiveTextColor, decorationColor: const Color(0x8ae28aff)));\n",
|
||||
"getProgressIndicator",
|
||||
"direc",
|
||||
"_loading",
|
||||
"_merchantID",
|
||||
" \n",
|
||||
"getPaddingForTextField",
|
||||
"horiz",
|
||||
"horizontaMargin",
|
||||
"28.0",
|
||||
"merchantID"
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
"preserve_case": false,
|
||||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
"loading",
|
||||
"textFieldValue",
|
||||
"verticalMargin",
|
||||
"_merchantID"
|
||||
],
|
||||
"reverse": false,
|
||||
"show_context": true,
|
||||
"use_buffer2": true,
|
||||
"whole_word": false,
|
||||
"wrap": true
|
||||
},
|
||||
"groups":
|
||||
[
|
||||
{
|
||||
"sheets":
|
||||
[
|
||||
]
|
||||
}
|
||||
],
|
||||
"incremental_find":
|
||||
{
|
||||
"height": 23.0
|
||||
},
|
||||
"input":
|
||||
{
|
||||
"height": 33.0
|
||||
},
|
||||
"layout":
|
||||
{
|
||||
"cells":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
]
|
||||
],
|
||||
"cols":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"rows":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"menu_visible": true,
|
||||
"output.find_results":
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"pinned_build_system": "",
|
||||
"project": "AndroidManifest.sublime-project",
|
||||
"replace":
|
||||
{
|
||||
"height": 42.0
|
||||
},
|
||||
"save_all_on_build": true,
|
||||
"select_file":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"select_project":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"select_symbol":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"selected_group": 0,
|
||||
"settings":
|
||||
{
|
||||
},
|
||||
"show_minimap": true,
|
||||
"show_open_files": false,
|
||||
"show_tabs": true,
|
||||
"side_bar_visible": true,
|
||||
"side_bar_width": 241.0,
|
||||
"status_bar_visible": true,
|
||||
"template_settings":
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dinect.checker"
|
||||
android:versionCode="1"
|
||||
android:versionName="0.6">
|
||||
android:versionName="1.0.1">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
|
||||
@@ -38,7 +38,7 @@ import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.dinect.net.ApiClient;
|
||||
import com.dinect.checker.net.ApiClient;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class MainActivity extends FlutterActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
loadLocale(this);
|
||||
initLocale(this);
|
||||
mPreferences = getPreferences(Context.MODE_PRIVATE);
|
||||
|
||||
Log.d(TAG, "application prefs:");
|
||||
@@ -74,6 +74,9 @@ public class MainActivity extends FlutterActivity {
|
||||
Map merchantIDArguments = call.arguments();
|
||||
mPreferences.edit().putString(PREF_POS_MERCHANT_ID, (String) merchantIDArguments.get("merchantID")).apply();
|
||||
break;
|
||||
case "getLocale":
|
||||
result.success(BuildConfig.locale);
|
||||
break;
|
||||
case "getMerchantID":
|
||||
result.success(mPreferences.getString(PREF_POS_MERCHANT_ID, null));
|
||||
break;
|
||||
@@ -146,7 +149,7 @@ public class MainActivity extends FlutterActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadLocale(Context context) {
|
||||
public static void initLocale(Context context) {
|
||||
Resources res = context.getResources();
|
||||
Configuration configuration = new Configuration(res.getConfiguration());
|
||||
switch (BuildConfig.locale) {
|
||||
@@ -169,6 +172,10 @@ public class MainActivity extends FlutterActivity {
|
||||
|
||||
}
|
||||
|
||||
public void getLocale() {
|
||||
|
||||
}
|
||||
|
||||
public void handleItemClick() {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.dinect.net.ApiClient;
|
||||
import com.dinect.checker.net.ApiClient;
|
||||
|
||||
/**
|
||||
* Created by anonymous on 03.08.17.
|
||||
@@ -45,7 +45,7 @@ public final class NetworkThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
if (null != activity) {
|
||||
final Pair<String, String> response = client.findUser(card);
|
||||
final Pair<String, String> response = client.findUser(activity, card);
|
||||
Log.d(TAG, "network request done with result: " + response.first);
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.net.NetworkInfo;
|
||||
public class Utils {
|
||||
|
||||
private Utils() {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isOnline(Context context) {
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.dinect.net;
|
||||
package com.dinect.checker.net;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@@ -22,6 +23,7 @@ import android.util.Pair;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.lang.String;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -30,6 +32,8 @@ import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import com.dinect.checker.R;
|
||||
|
||||
/**
|
||||
* Created by anonymous
|
||||
*/
|
||||
@@ -41,8 +45,6 @@ public final class ApiClient {
|
||||
private static final int TIMEOUT_CONNECTION = 3;
|
||||
private static final int TIMEOUT_READ = 3;
|
||||
private static final int TIMEOUT_WRITE = 3;
|
||||
private static final String IDENTIFIER_NOT_FOUND = "Идентификатор {card} не найден.";
|
||||
|
||||
|
||||
public final String endpoint;
|
||||
public final String appToken;
|
||||
@@ -76,7 +78,7 @@ public final class ApiClient {
|
||||
* @param card card/foreigncarf number
|
||||
* @return (null, error) on fail or (card, user) info on success
|
||||
*/
|
||||
public Pair<String, String> findUser(final @NonNull String card) {
|
||||
public Pair<String, String> findUser(Context ctx, final @NonNull String card) {
|
||||
|
||||
final Request.Builder builder = new Request.Builder();
|
||||
final Request request;
|
||||
@@ -91,7 +93,7 @@ public final class ApiClient {
|
||||
try {
|
||||
final Response response = http.newCall(request).execute();
|
||||
final String body = response.body().string();
|
||||
final String NOT_FOUND_MESSAGE = IDENTIFIER_NOT_FOUND.replace("{card}", card);
|
||||
final String NOT_FOUND_MESSAGE = String.format(ctx.getString(R.string.identifier_not_found, card));
|
||||
switch (response.code()) {
|
||||
case 200:
|
||||
final JSONArray users = new JSONArray(body);
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.dinect.net;
|
||||
package com.dinect.checker.net;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
12
android/app/src/main/res/values-ru/strings.xml
Normal file
12
android/app/src/main/res/values-ru/strings.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">AutoBonus</string>
|
||||
<string name="scanner_title">Сканер карты</string>
|
||||
<string name="scan">Сканировать</string>
|
||||
<string name="faq">FAQ</string>
|
||||
<string name="logout">Выход</string>
|
||||
<string name="logout_title">Подтверждение</string>
|
||||
<string name="logout_text">Вы действительно хотите выйти и ввести другой номер магазина?</string>
|
||||
<string name="logout_yes">Да</string>
|
||||
<string name="logout_no">Нет</string>
|
||||
<string name="identifier_not_found">"Идентификатор %s не найден"</string>
|
||||
</resources>
|
||||
12
android/app/src/main/res/values-ua/strings.xml
Normal file
12
android/app/src/main/res/values-ua/strings.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">AutoBonus</string>
|
||||
<string name="scanner_title">Сканер карти</string>
|
||||
<string name="scan">Сканувати</string>
|
||||
<string name="faq">FAQ</string>
|
||||
<string name="logout">Вихід</string>
|
||||
<string name="logout_title">Підтвердження</string>
|
||||
<string name="logout_text">Ви дійсно хочете вийти і ввести інший номер магазину?</string>
|
||||
<string name="logout_yes">Так</string>
|
||||
<string name="logout_no">Ні</string>
|
||||
<string name="identifier_not_found">"Ідентифікатор %s не знайден"</string>
|
||||
</resources>
|
||||
@@ -1,11 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">AutoBonus</string>
|
||||
<string name="scanner_title">Сканнер карты</string>
|
||||
<string name="scan">Сканировать</string>
|
||||
<string name="scanner_title">Card Scanner</string>
|
||||
<string name="scan">Scan</string>
|
||||
<string name="faq">FAQ</string>
|
||||
<string name="logout">Выход</string>
|
||||
<string name="logout_title">Подтверждение</string>
|
||||
<string name="logout_text">Вы действительно хотите выйти и ввести другой номер магазина?</string>
|
||||
<string name="logout_yes">Да</string>
|
||||
<string name="logout_no">Нет</string>
|
||||
<string name="logout">Logout</string>
|
||||
<string name="logout_title">Сonfirmation</string>
|
||||
<string name="logout_text">Do you really want to log out and enter a different store number?</string>
|
||||
<string name="logout_yes">Yes</string>
|
||||
<string name="logout_no">No</string>
|
||||
<string name="identifier_not_found">"Identifier %s is not found"</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user