local network test

merge-requests/140/head
mirza.shafique 3 years ago
parent 6b56d40349
commit 5f525f16a0

@ -44,7 +44,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.cloudSolutions.mohemmtest"
applicationId "hmg.cloudSolutions.mohem"
minSdkVersion 21
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()

@ -9,9 +9,9 @@
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="Mohemm"
android:allowBackup="false"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round">
<activity

@ -4,7 +4,7 @@ class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";
@ -44,7 +44,6 @@ class ApiConsts {
static int tabletMinLength = 500;
}
class SharedPrefsConsts {
static String isRememberMe = "remember_me";
static String username = "username";

@ -26,6 +26,7 @@ import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart';
import 'package:safe_device/safe_device.dart';
import 'package:wifi_iot/wifi_iot.dart';
class LoginScreen extends StatefulWidget {
LoginScreen({Key? key}) : super(key: key);
@ -160,8 +161,8 @@ class _LoginScreenState extends State<LoginScreen> {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (!kReleaseMode) {
// username.text = "15444"; // Maha User
// username.text = "15153"; // Tamer User
// password.text = "Abcd@1234";
username.text = "15153"; // Tamer User
password.text = "Abcd@12345";
// username.text = "206535"; // Hashim User
// password.text = "Namira786";
@ -224,6 +225,14 @@ class _LoginScreenState extends State<LoginScreen> {
Navigator.pushNamed(context, AppRoutes.forgotPassword);
}),
),
20.height,
DefaultButton(
"Connect HMG Network",
() async {
SystemChannels.textInput.invokeMethod('TextInput.hide');
connectWithHmgNetwork();
},
),
],
),
)
@ -239,4 +248,30 @@ class _LoginScreenState extends State<LoginScreen> {
),
);
}
void connectWithHmgNetwork() async {
try {
bool isConnected = await WiFiForIoTPlugin.connect("MOHEMM-CONNECT", password: "0987654321", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
if (isConnected) {
await WiFiForIoTPlugin.forceWifiUsage(true);
// if (Platform.isIOS) {
// await closeWifiRequest();
// await Future.delayed(Duration(seconds: 6));
// } else {
// await WiFiForIoTPlugin.forceWifiUsage(true);
// }
}
} catch (e) {
print("----------------o----");
print(e);
}
}
Future<bool> closeWifiRequest() async {
if (Platform.isAndroid) {
await WiFiForIoTPlugin.forceWifiUsage(false);
}
return await WiFiForIoTPlugin.disconnect();
}
}

Loading…
Cancel
Save