Skip to content

Commit

Permalink
Remove add player via contact (#154)
Browse files Browse the repository at this point in the history
* Remove add player via contact

* fix lint

* fix lint

* remove ios permission

* remove permission description

---------

Co-authored-by: sidhdhi canopas <[email protected]>
  • Loading branch information
cp-mayank and cp-sidhdhi-p authored Dec 17, 2024
1 parent b9f4dba commit 8c286e3
Show file tree
Hide file tree
Showing 31 changed files with 91 additions and 1,604 deletions.
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions data/lib/extensions/list_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extension ListExtension<E> on List<E> {
///Update the element at any position; it will return the same list if the element is not found.
// Update the element at any position; it will return the same list if the element is not found.
List<E> updateWhere({
required bool Function(E element) where,
required E Function(E oldElement) updated,
Expand All @@ -17,10 +17,10 @@ extension ListExtension<E> on List<E> {
return newList;
}

/// This converts a list into a list of lists, using the specified size.
/// For example:
/// List<int> numbers = List.generate(100, (index) => index + 1);
/// List<List<int>> result = numbers.chunked(5);
// This converts a list into a list of lists, using the specified size.
// For example:
// List<int> numbers = List.generate(100, (index) => index + 1);
// List<List<int>> result = numbers.chunked(5);
List<List<E>> chunked(int size) {
return List.generate((length / size).ceil(), (index) {
final int start = index * size;
Expand Down
38 changes: 0 additions & 38 deletions data/lib/service/user/user_service.dart
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:http/http.dart' as http;
import '../../errors/app_error.dart';
import '../../extensions/list_extensions.dart';
import '../../api/network/client.dart';
import '../device/device_service.dart';
import '../../utils/constant/firestore_constant.dart';
import '../../utils/dummy_deactivated_account.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../api/user/user_models.dart';
import '../../storage/app_preferences.dart';
import 'user_endpoint.dart';

final userServiceProvider = Provider((ref) {
final service = UserService(
ref.read(currentUserPod),
FirebaseFirestore.instance,
ref.read(httpProvider),
ref.read(deviceServiceProvider),
);

Expand All @@ -28,13 +24,11 @@ class UserService {
UserModel? _currentUser;

final FirebaseFirestore firestore;
final http.Client client;
final DeviceService deviceService;

UserService(
this._currentUser,
this.firestore,
this.client,
this.deviceService,
);

Expand Down Expand Up @@ -104,20 +98,6 @@ class UserService {
}
}

Future<UserModel?> getUserByPhoneNumber(String number) async {
try {
final snapshot =
await _userRef.where(FireStoreConst.phone, isEqualTo: number).get();
if (snapshot.docs.isNotEmpty) {
return snapshot.docs.first.data();
} else {
return null;
}
} catch (error, stack) {
throw AppError.fromError(error, stack);
}
}

Future<List<UserModel>> getUsersByIds(List<String> ids) async {
final List<UserModel> users = [];
try {
Expand Down Expand Up @@ -175,24 +155,6 @@ class UserService {
}
}

Future<UserModel> createNewUser(
String phoneNumber,
String displayName,
) async {
try {
final response = await client.req(
CreateUserEndpoint(
name: displayName,
phone: phoneNumber,
),
);

return UserModel.fromJson(response.data);
} catch (error, stack) {
throw AppError.fromError(error, stack);
}
}

Future<void> updateUser(UserModel user) async {
try {
final userRef = _userRef.doc(user.id);
Expand Down
2 changes: 2 additions & 0 deletions khelo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
2 changes: 0 additions & 2 deletions khelo/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

<application
android:label="Khelo"
Expand Down
13 changes: 0 additions & 13 deletions khelo/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@
"add_team_enter_team_name_placeholder_text": "Enter team name",
"add_team_team_initial_placeholder_text": "Team initials (e.g. IND, AUS, PBKS)",
"add_team_player_role_title": "Playing role",
"add_team_player_add_via_contact_title": "Add via Contact",
"add_team_players_text": "Players",
"add_team_already_added": "Team already added",
"add_team_add_hint_text": "Added user will be shown here, tap on '+' button to add team member.",
Expand Down Expand Up @@ -348,18 +347,6 @@
}
},

"contact_selection_contact_title": "Contact",
"contact_selection_empty_contact": "No Contacts Found",
"contact_selection_empty_contact_description": "We didn't find any contacts, will be shown here as soon as we get it.",
"contact_selection_access_permission": "Allow contact access",
"contact_selection_access_permission_description": "Allow contact access to add member via contacts.",
"contact_selection_allow_title": "Allow",

"confirm_number_confirm_phone_title": "Confirm phone number",
"confirm_number_confirm_title": "Confirm",
"confirm_number_name_title": "Name",
"confirm_number_add_user_manually_title": "Add user manually",

"team_list_add_members_title": "Add Members",
"team_list_all_teams_title": "All teams",
"team_list_created_by_me_title": "Created by me",
Expand Down
2 changes: 0 additions & 2 deletions khelo/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ post_install do |installer|
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',

## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=1',
]

end
Expand Down
44 changes: 19 additions & 25 deletions khelo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ PODS:
- Firebase/Storage (= 11.2.0)
- firebase_core
- Flutter
- FirebaseAppCheckInterop (11.3.0)
- FirebaseAppCheckInterop (11.6.0)
- FirebaseAuth (11.2.0):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseAuthInterop (~> 11.0)
Expand All @@ -1210,14 +1210,14 @@ PODS:
- GoogleUtilities/Environment (~> 8.0)
- GTMSessionFetcher/Core (~> 3.4)
- RecaptchaInterop (~> 100.0)
- FirebaseAuthInterop (11.3.0)
- FirebaseAuthInterop (11.6.0)
- FirebaseCore (11.2.0):
- FirebaseCoreInternal (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.3.0):
- FirebaseCoreExtension (11.4.1):
- FirebaseCore (~> 11.0)
- FirebaseCoreInternal (11.3.0):
- FirebaseCoreInternal (11.6.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.2.0):
- FirebaseCore (~> 11.0)
Expand Down Expand Up @@ -1256,7 +1256,7 @@ PODS:
- FirebaseMessagingInterop (~> 11.0)
- FirebaseSharedSwift (~> 11.0)
- GTMSessionFetcher/Core (~> 3.4)
- FirebaseInstallations (11.3.0):
- FirebaseInstallations (11.4.0):
- FirebaseCore (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
Expand All @@ -1270,8 +1270,8 @@ PODS:
- GoogleUtilities/Reachability (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- FirebaseMessagingInterop (11.3.0)
- FirebaseRemoteConfigInterop (11.3.0)
- FirebaseMessagingInterop (11.6.0)
- FirebaseRemoteConfigInterop (11.6.0)
- FirebaseSessions (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCoreExtension (~> 11.0)
Expand All @@ -1281,7 +1281,7 @@ PODS:
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (11.3.0)
- FirebaseSharedSwift (11.6.0)
- FirebaseStorage (11.2.0):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseAuthInterop (~> 11.0)
Expand All @@ -1290,8 +1290,6 @@ PODS:
- GoogleUtilities/Environment (~> 8.0)
- GTMSessionFetcher/Core (~> 3.4)
- Flutter (1.0.0)
- flutter_contacts (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_timezone (0.0.1):
Expand Down Expand Up @@ -1422,7 +1420,7 @@ PODS:
- TOCropViewController (~> 2.7.4)
- image_picker_ios (0.0.1):
- Flutter
- leveldb-library (1.22.5)
- leveldb-library (1.22.6)
- MTBBarcodeScanner (5.0.11)
- nanopb (3.30910.0):
- nanopb/decode (= 3.30910.0)
Expand Down Expand Up @@ -1466,7 +1464,6 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `Flutter`)
- flutter_contacts (from `.symlinks/plugins/flutter_contacts/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
Expand Down Expand Up @@ -1536,8 +1533,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_storage/ios"
Flutter:
:path: Flutter
flutter_contacts:
:path: ".symlinks/plugins/flutter_contacts/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_timezone:
Expand Down Expand Up @@ -1577,25 +1572,24 @@ SPEC CHECKSUMS:
firebase_crashlytics: 37d104d457b51760b48504a93a12b3bf70995d77
firebase_messaging: 15d114e1a41fc31e4fbabcd48d765a19eec94a38
firebase_storage: 61d62709bb4eda114cf68172f0dfde7ec23779ad
FirebaseAppCheckInterop: 7789a8adfb09e905ce02a76540b94b059029ea81
FirebaseAppCheckInterop: 347aa09a805219a31249b58fc956888e9fcb314b
FirebaseAuth: 2a198b8cdbbbd457f08d74df7040feb0a0e7777a
FirebaseAuthInterop: c453b7ba7c49b88b2f519bb8d2e29edf7ada4a2a
FirebaseAuthInterop: a919d415797d23b7bfe195a04f322b86c65020ef
FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da
FirebaseCoreExtension: 30bb063476ef66cd46925243d64ad8b2c8ac3264
FirebaseCoreInternal: ac26d09a70c730e497936430af4e60fb0c68ec4e
FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e
FirebaseCoreInternal: d98ab91e2d80a56d7b246856a8885443b302c0c2
FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac
FirebaseFirestore: 62708adbc1dfcd6d165a7c0a202067b441912dc9
FirebaseFirestoreInternal: ad9b9ee2d3d430c8f31333a69b3b6737a7206232
FirebaseFunctions: 8ff3cb87f2c18fd564dddd4e5086a899392e1d07
FirebaseInstallations: 58cf94dabf1e2bb2fa87725a9be5c2249171cda0
FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414
FirebaseMessaging: c9ec7b90c399c7a6100297e9d16f8a27fc7f7152
FirebaseMessagingInterop: 41f840551051fa9e5516b2f572c659e03a79e00d
FirebaseRemoteConfigInterop: c3a5c31b3c22079f41ba1dc645df889d9ce38cb9
FirebaseMessagingInterop: d768073b71144b7bceadfec019d3dc49c743d53e
FirebaseRemoteConfigInterop: e75e348953352a000331eb77caf01e424248e176
FirebaseSessions: 655ff17f3cc1a635cbdc2d69b953878001f9e25b
FirebaseSharedSwift: d39c2ad64a11a8d936ce25a42b00df47078bb59c
FirebaseSharedSwift: a4e5dfca3e210633bb3a3dfb94176c019211948b
FirebaseStorage: 9353f926690b2329957860abfcbc8b4074fe45e8
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_contacts: edb1c5ce76aa433e20e6cb14c615f4c0b66e0983
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
Expand All @@ -1606,7 +1600,7 @@ SPEC CHECKSUMS:
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28
leveldb-library: cc8b8f8e013647a295ad3f8cd2ddf49a6f19be19
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
Expand All @@ -1623,6 +1617,6 @@ SPEC CHECKSUMS:
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 263bbdc4af357de40d8d908cfc1d29ff7d1f184b
PODFILE CHECKSUM: 080c4d0c0f64eaecad20947df573da50713d7bd0

COCOAPODS: 1.15.2
2 changes: 0 additions & 2 deletions khelo/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
<string>Capture a new profile image using your device's camera for a personalized and up-to-date appearance.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Select a profile image from your device's gallery to showcase your preferred photo in moments of your choice.</string>
<key>NSContactsUsageDescription</key>
<string>Sync and select contacts from your device to easily add team members and enhance collaboration.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down
10 changes: 0 additions & 10 deletions khelo/lib/ui/app_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import 'package:khelo/ui/flow/settings/edit_profile/edit_profile_screen.dart';
import 'package:khelo/ui/flow/sign_in/phone_verification/phone_verification_screen.dart';
import 'package:khelo/ui/flow/team/add_team/add_team_screen.dart';
import 'package:khelo/ui/flow/team/add_team_member/add_team_member_screen.dart';
import 'package:khelo/ui/flow/team/add_team_member/contact_selection/contact_selection_screen.dart';
import 'package:khelo/ui/flow/team/detail/make_admin/make_team_admin_screen.dart';
import 'package:khelo/ui/flow/team/detail/team_detail_screen.dart';
import 'package:khelo/ui/flow/team/scanner/scanner_screen.dart';
Expand Down Expand Up @@ -60,7 +59,6 @@ class AppRoute {
static const pathMatchDetailTab = '/match-detail-tab';
static const pathSearchHome = "/search-home";
static const pathViewAll = "/view-all";
static const pathContactSelection = "/contact-selection";
static const pathAddTournament = "/add-tournament";
static const pathTeamSelection = "/team-selection";
static const pathMatchSelection = "/match-selection";
Expand Down Expand Up @@ -341,10 +339,6 @@ class AppRoute {
builder: (_) => QrCodeView(id: id, description: description),
);

static AppRoute contactSelection({required List<String> memberIds}) =>
AppRoute(pathContactSelection,
builder: (_) => ContactSelectionScreen(memberIds: memberIds));

static final routes = [
GoRoute(
path: main.path,
Expand Down Expand Up @@ -437,10 +431,6 @@ class AppRoute {
path: pathUserDetail,
builder: (context, state) => state.widget(context),
),
GoRoute(
path: pathContactSelection,
builder: (context, state) => state.widget(context),
),
GoRoute(
path: pathScannerScreen,
builder: (context, state) => state.widget(context),
Expand Down
13 changes: 8 additions & 5 deletions khelo/lib/ui/flow/home/components/tournament_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class _TournamentItemState extends State<TournamentItem> {
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
dominant.withOpacity(0),
dominant.withOpacity(0.5),
dominant.withValues(alpha: 0),
dominant.withValues(alpha: 0.5),
dominant,
],
),
Expand Down Expand Up @@ -217,14 +217,17 @@ class _TournamentItemState extends State<TournamentItem> {
if (dominant == context.colorScheme.primary) {
return (
context.colorScheme.onPrimary,
context.colorScheme.onPrimary.withOpacity(0.8)
context.colorScheme.onPrimary.withValues(alpha: 0.8)
);
}

if (dominant.computeLuminance() < 0.5) {
return (Colors.white, Colors.white.withOpacity(0.8));
return (Colors.white, Colors.white.withValues(alpha: 0.8));
} else {
return (Colors.black.withOpacity(0.87), Colors.black.withOpacity(0.6));
return (
Colors.black.withValues(alpha: 0.87),
Colors.black.withValues(alpha: 0.6)
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class TeamSelectionView extends StatelessWidget {
: context.colorScheme.alert),
color: validSquad
? context.colorScheme.containerHigh
: context.colorScheme.alert.withOpacity(0.2),
: context.colorScheme.alert.withValues(alpha: 0.2),
shape: BoxShape.circle,
image: (team != null && team.profile_img_url != null)
? DecorationImage(
Expand Down
Loading

0 comments on commit 8c286e3

Please sign in to comment.