add invitation

This commit is contained in:
Sai Naw Wun
2020-09-12 03:34:52 +06:30
parent 96a095e2e9
commit aa8a6765de
20 changed files with 526 additions and 197 deletions

View File

@@ -1,14 +1,11 @@
import 'dart:async';
import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:device_info/device_info.dart';
import 'package:dio/dio.dart';
import 'package:fcs/fcs/common/domain/entities/auth_result.dart';
import 'package:fcs/fcs/common/domain/entities/auth_status.dart';
import 'package:fcs/fcs/common/domain/entities/setting.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/helpers/network_connectivity.dart';
import 'package:fcs/fcs/common/helpers/shared_pref.dart';
import 'package:fcs/fcs/common/pages/model/base_model.dart';
import 'package:fcs/fcs/common/services/services.dart';
import 'package:flutter/foundation.dart';
@@ -22,12 +19,11 @@ class MainModel extends ChangeNotifier {
User user;
PackageInfo packageInfo;
Setting setting = Setting(
terms:
'[{"insert":"* Minimum shipping weight is 1lbs.\n* Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on pecifications.Please contact us for pricing.\n* Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.\n* Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.\n* Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.\n*Payments made in Myanmar will incur 2% tranfer fee\n"}]');
Setting setting;
bool isLoaded = false;
bool isOnline = false;
bool isFirstLaunch = false;
MainModel() {
NetworkConnectivity.instance.statusStream.listen((data) {
@@ -39,23 +35,22 @@ class MainModel extends ChangeNotifier {
notifyListeners();
});
Services.instance.authService.onAuthStatus().listen((event) {
this.user=event;
this.user = event;
notifyListeners();
print("main event-->$event");
});
}
bool faqEditable(){
return this.user != null && false;
}
bool termEditable(){
return this.user != null && false;
}
bool contactEditable(){
bool faqEditable() {
return this.user != null && false;
}
bool termEditable() {
return this.user != null && false;
}
bool contactEditable() {
return this.user != null && false;
}
bool isLogin() {
return this.user != null;
@@ -69,13 +64,15 @@ class MainModel extends ChangeNotifier {
return this.user != null && this.user.hasSysAdmin();
}
bool isAdmin() {
return this.user != null && this.user.hasAdmin();
}
init() async {
await _loadSetting();
this.isFirstLaunch = await SharedPref.isFirstLaunch();
this.isFirstLaunch = this.isFirstLaunch ?? true;
_loadUser();
this.packageInfo = await PackageInfo.fromPlatform();
}
@@ -126,7 +123,6 @@ class MainModel extends ChangeNotifier {
}
bool isSupport() {
return true;
if (packageInfo == null || setting == null) return false;
return int.parse(packageInfo.buildNumber) >= setting.supportBuildNum;
}