Skip to content

Commit

Permalink
stable version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemragab committed Dec 17, 2021
1 parent 9bb7adc commit 4cf0275
Show file tree
Hide file tree
Showing 47 changed files with 1,035 additions and 388 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@
* group chat page which can update group name and upgrade users to admin if i the group creator and update group image
* kick users from group
* admin downgrade and upgrade system if iam admin
* admins can add users only
* admins can add users only

## 0.9.1
* full localization support

## 1.0.0
* first stable version
Binary file modified example/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed example/assets/v.gif
Binary file not shown.
68 changes: 62 additions & 6 deletions example/lib/controllers/home_controller.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
import 'package:example/generated/l10n.dart';
import 'package:example/utils/load_more_type.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
import 'package:textless/textless.dart';
import 'package:v_chat_sdk/v_chat_sdk.dart';
import '../models/user.dart';
import '../utils/custom_alert.dart';
import '../utils/custom_dio.dart';

class HomeController {
BuildContext context;
class HomeController extends ChangeNotifier {
int currentIndex = 0;

HomeController(this.context);
final usersList = <User>[];
LoadMoreStatus loadingStatus = LoadMoreStatus.loaded;
final scrollController = ScrollController();
String searchText = "";

Future<List<User>> getUsers() async {
void init(BuildContext context) {
scrollController.addListener(_scrollListener);

/// here user will be online this must be init one user authenticated
if (GetStorage().hasData("myModel")) {
/// this mean my user has auth so i will bind chat controller to make him online else will throw exception
VChatController.instance.bindChatControllers(
context: context,
email: GetStorage().read("myModel")['email'],
);
}
}

Future getUsers(BuildContext context) async {
try {
final res = (await CustomDio()
.send(reqMethod: "get", path: "user", query: {"lastId": "first"}))
.data['data'] as List;
return res.map((e) => User.fromMap(e)).toList();
final users = res.map((e) => User.fromMap(e)).toList();
usersList.clear();
usersList.addAll(users);
notifyListeners();
} catch (err) {
CustomAlert.showError(context: context, err: err.toString());
rethrow;
}
}

void startChat(String email) async {
void startChat(String email, BuildContext context) async {
try {
final res =
await CustomAlert.chatAlert(context: context, peerEmail: email);
Expand All @@ -39,4 +62,37 @@ class HomeController {
rethrow;
}
}

void _scrollListener() async {
if (scrollController.offset >=
scrollController.position.maxScrollExtent / 2 &&
!scrollController.position.outOfRange &&
loadingStatus != LoadMoreStatus.loading &&
loadingStatus != LoadMoreStatus.completed) {
loadingStatus = LoadMoreStatus.loading;
loadMore();
}
}

void onTabTapped(int index) {
currentIndex = index;
notifyListeners();
}

Future<void> loadMore() async {
final loadedRooms = await loadMoreApi(usersList.last.id);
loadingStatus = LoadMoreStatus.loaded;
if (loadedRooms.isEmpty) {
loadingStatus = LoadMoreStatus.completed;
}
usersList.addAll(loadedRooms);
notifyListeners();
}

Future<List<User>> loadMoreApi(String lastId) async {
final roomsMaps = (await CustomDio()
.send(reqMethod: "get", path: "user", query: {"lastId": lastId}))
.data['data'] as List;
return roomsMaps.map((e) => User.fromMap(e)).toList();
}
}
53 changes: 52 additions & 1 deletion example/lib/generated/intl/messages_ar_EG.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,86 @@ class MessageLookup extends MessageLookupByLibrary {

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("عن"),
"allChatNotifications":
MessageLookupByLibrary.simpleMessage("كل اشعارات المحادثه"),
"ar": MessageLookupByLibrary.simpleMessage("عربي"),
"areYouHaveQuestion":
MessageLookupByLibrary.simpleMessage("هل لديك اساله ؟"),
"buyTheBackendCode":
MessageLookupByLibrary.simpleMessage("قم بشراء نسخه"),
"cancel": MessageLookupByLibrary.simpleMessage("الغاء"),
"changeLanguage": MessageLookupByLibrary.simpleMessage("تغيسر اللغه"),
"changeTheme": MessageLookupByLibrary.simpleMessage("تغير الثيم"),
"chats": MessageLookupByLibrary.simpleMessage("الدردشات"),
"chooseGroupImage":
MessageLookupByLibrary.simpleMessage("اختار صوره للجروب"),
"chooseImage": MessageLookupByLibrary.simpleMessage("اختار صوره"),
"chooseMembers": MessageLookupByLibrary.simpleMessage("اختار الاعضاء"),
"codePrivateAndGroupChatWithVChatItsVery":
MessageLookupByLibrary.simpleMessage(
"اناء محادثه خاصه وجروب دردشه في دقائق"),
"contactMeOnWhatsapp":
MessageLookupByLibrary.simpleMessage("تواصل معي"),
"contactUsAndReportIssuesOrNewFeatures":
MessageLookupByLibrary.simpleMessage(
"Contact Us And Report issues or new features"),
"createGroup": MessageLookupByLibrary.simpleMessage("انشاء جروب دردشه"),
"dark": MessageLookupByLibrary.simpleMessage("اسود "),
"email": MessageLookupByLibrary.simpleMessage("البريد"),
"en": MessageLookupByLibrary.simpleMessage("انجليزي"),
"enterTheName": MessageLookupByLibrary.simpleMessage("ادخل الاسم"),
"error": MessageLookupByLibrary.simpleMessage("خطا"),
"groupName": MessageLookupByLibrary.simpleMessage("اسم الجروب شات"),
"home": MessageLookupByLibrary.simpleMessage("الرئيسيه"),
"imageHasBeenSelected":
MessageLookupByLibrary.simpleMessage("تم اختيار الصوره"),
"imageHasBeenSetSuccessfully":
MessageLookupByLibrary.simpleMessage("تم اختيار الصوره"),
"imageSizeMustBeLessThan20Mb": MessageLookupByLibrary.simpleMessage(
"يجب ان تكون الصوره اقل من 20 ميجا"),
"iosTestflightAndPublicFlutterUi": MessageLookupByLibrary.simpleMessage(
"ios testflight and public flutter ui"),
"light": MessageLookupByLibrary.simpleMessage("ابيض "),
"loading": MessageLookupByLibrary.simpleMessage("جاري التحميل ..."),
"logOut": MessageLookupByLibrary.simpleMessage("تسجيل خروج"),
"login": MessageLookupByLibrary.simpleMessage("تسجيل دخول"),
"members": MessageLookupByLibrary.simpleMessage("الاعضاء"),
"message": MessageLookupByLibrary.simpleMessage("رساله"),
"myGreatRooms": MessageLookupByLibrary.simpleMessage("كل المحادثات"),
"name": MessageLookupByLibrary.simpleMessage("الاسم"),
"newName": MessageLookupByLibrary.simpleMessage("الاسم الجديد"),
"off": MessageLookupByLibrary.simpleMessage("ايقاف"),
"offline": MessageLookupByLibrary.simpleMessage("قافل"),
"ok": MessageLookupByLibrary.simpleMessage("تم"),
"on": MessageLookupByLibrary.simpleMessage("تشغيل"),
"ourFullDocumentation":
MessageLookupByLibrary.simpleMessage("اطلع علي كيفيه التشغيل"),
"password": MessageLookupByLibrary.simpleMessage("كلمه المرور"),
"register": MessageLookupByLibrary.simpleMessage("تسجيل حساب"),
"removeYourSelfFromTheListYourNameIs":
MessageLookupByLibrary.simpleMessage(
"برجاء حذف اسمك من اللسته اسمك هوه"),
"selectAtLestOneUser":
MessageLookupByLibrary.simpleMessage("اختار علي الاقل شخص"),
"settings": MessageLookupByLibrary.simpleMessage("الاعدادات"),
"splashScreen": MessageLookupByLibrary.simpleMessage("splash screen"),
"success": MessageLookupByLibrary.simpleMessage("نجت العمليه"),
"test": MessageLookupByLibrary.simpleMessage("تست"),
"thisDataFromMyServerNotVchat":
MessageLookupByLibrary.simpleMessage("هذه الداتا من سيرفر خارجي"),
"title": MessageLookupByLibrary.simpleMessage("العنوان"),
"update": MessageLookupByLibrary.simpleMessage("تحديث"),
"updateProfile": MessageLookupByLibrary.simpleMessage("تحديث الحساب")
"updateImage": MessageLookupByLibrary.simpleMessage("تحديث الصوره"),
"updateName": MessageLookupByLibrary.simpleMessage("تحديث الاسم"),
"updateProfile": MessageLookupByLibrary.simpleMessage("تحديث الحساب"),
"userName": MessageLookupByLibrary.simpleMessage("اسم المستخدم"),
"usersHasBeenAddedSuccessfully":
MessageLookupByLibrary.simpleMessage("تم اضافه العضو بنجاح"),
"vChatUsers": MessageLookupByLibrary.simpleMessage("الاعضاء"),
"yourImageHasBeenUpdated":
MessageLookupByLibrary.simpleMessage("تم تحديث الصوره"),
"yourNameHasBeenUpdated":
MessageLookupByLibrary.simpleMessage("تم تحديث الاسم ")
};
}
53 changes: 52 additions & 1 deletion example/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,87 @@ class MessageLookup extends MessageLookupByLibrary {

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("About"),
"allChatNotifications":
MessageLookupByLibrary.simpleMessage("All Chat notifications"),
"ar": MessageLookupByLibrary.simpleMessage("ar"),
"areYouHaveQuestion":
MessageLookupByLibrary.simpleMessage("Are you have question ?"),
"buyTheBackendCode":
MessageLookupByLibrary.simpleMessage("Buy the backend code"),
"cancel": MessageLookupByLibrary.simpleMessage("cancel"),
"changeLanguage":
MessageLookupByLibrary.simpleMessage("Change language"),
"changeTheme": MessageLookupByLibrary.simpleMessage("Change Theme"),
"chats": MessageLookupByLibrary.simpleMessage("Chats"),
"chooseGroupImage":
MessageLookupByLibrary.simpleMessage("Choose group image"),
"chooseImage": MessageLookupByLibrary.simpleMessage("choose image"),
"chooseMembers": MessageLookupByLibrary.simpleMessage("choose members"),
"codePrivateAndGroupChatWithVChatItsVery":
MessageLookupByLibrary.simpleMessage(
"Code private and Group Chat with v chat its very easy !"),
"contactMeOnWhatsapp":
MessageLookupByLibrary.simpleMessage("Contact me on whatsapp"),
"contactUsAndReportIssuesOrNewFeatures":
MessageLookupByLibrary.simpleMessage(
"Contact Us And Report issues or new features"),
"createGroup": MessageLookupByLibrary.simpleMessage("Create Group !"),
"dark": MessageLookupByLibrary.simpleMessage("dark"),
"email": MessageLookupByLibrary.simpleMessage("Email"),
"en": MessageLookupByLibrary.simpleMessage("en"),
"enterTheName": MessageLookupByLibrary.simpleMessage("Enter the name"),
"error": MessageLookupByLibrary.simpleMessage("Error"),
"groupName": MessageLookupByLibrary.simpleMessage("Group Name"),
"home": MessageLookupByLibrary.simpleMessage("Home"),
"imageHasBeenSelected":
MessageLookupByLibrary.simpleMessage("image has been selected"),
"imageHasBeenSetSuccessfully": MessageLookupByLibrary.simpleMessage(
"image has been set successfully"),
"imageSizeMustBeLessThan20Mb": MessageLookupByLibrary.simpleMessage(
"image size must be less than 20 Mb"),
"iosTestflightAndPublicFlutterUi": MessageLookupByLibrary.simpleMessage(
"ios testflight and public flutter ui"),
"light": MessageLookupByLibrary.simpleMessage("light"),
"loading": MessageLookupByLibrary.simpleMessage("Loading ..."),
"logOut": MessageLookupByLibrary.simpleMessage("Log out"),
"login": MessageLookupByLibrary.simpleMessage("login"),
"members": MessageLookupByLibrary.simpleMessage("Members"),
"message": MessageLookupByLibrary.simpleMessage("Message"),
"myGreatRooms": MessageLookupByLibrary.simpleMessage("My great rooms"),
"name": MessageLookupByLibrary.simpleMessage("Name"),
"newName": MessageLookupByLibrary.simpleMessage("new name"),
"off": MessageLookupByLibrary.simpleMessage("Off"),
"offline": MessageLookupByLibrary.simpleMessage("offline"),
"ok": MessageLookupByLibrary.simpleMessage("Ok"),
"on": MessageLookupByLibrary.simpleMessage("On"),
"ourFullDocumentation":
MessageLookupByLibrary.simpleMessage("Our Full Documentation"),
"password": MessageLookupByLibrary.simpleMessage("Password"),
"register": MessageLookupByLibrary.simpleMessage("Register"),
"removeYourSelfFromTheListYourNameIs":
MessageLookupByLibrary.simpleMessage(
"Remove your self from the list your name is"),
"selectAtLestOneUser":
MessageLookupByLibrary.simpleMessage("select at lest one user"),
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
"splashScreen": MessageLookupByLibrary.simpleMessage("splash screen"),
"success": MessageLookupByLibrary.simpleMessage("success"),
"test": MessageLookupByLibrary.simpleMessage("test"),
"thisDataFromMyServerNotVchat": MessageLookupByLibrary.simpleMessage(
"This data from my server not vchat"),
"title": MessageLookupByLibrary.simpleMessage("Title"),
"update": MessageLookupByLibrary.simpleMessage("Update"),
"updateProfile": MessageLookupByLibrary.simpleMessage("Update profile")
"updateImage": MessageLookupByLibrary.simpleMessage("update image"),
"updateName": MessageLookupByLibrary.simpleMessage("update name"),
"updateProfile": MessageLookupByLibrary.simpleMessage("Update profile"),
"userName": MessageLookupByLibrary.simpleMessage("User name"),
"usersHasBeenAddedSuccessfully": MessageLookupByLibrary.simpleMessage(
"Users has been added successfully"),
"vChatUsers": MessageLookupByLibrary.simpleMessage("v chat users"),
"yourImageHasBeenUpdated": MessageLookupByLibrary.simpleMessage(
"your image has been updated !"),
"yourNameHasBeenUpdated":
MessageLookupByLibrary.simpleMessage("your name has been updated !")
};
}
Loading

0 comments on commit 4cf0275

Please sign in to comment.