Skip to content

Commit

Permalink
Update 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sheikhhaziq committed Dec 30, 2022
1 parent aab1948 commit 0b919a3
Show file tree
Hide file tree
Showing 31 changed files with 1,745 additions and 657 deletions.
Binary file added assets/images/playlist.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 added assets/images/song.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 47 additions & 6 deletions lib/data/home1.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,50 @@
import 'dart:convert';

import 'package:http/http.dart';
import 'package:shared_preferences/shared_preferences.dart';

class HomeApi {
static String hostAddress = "https://vibeapi-sheikh-haziq.vercel.app/";

static setCountry() async {
final response = await get(Uri.parse('http://ip-api.com/json'));
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
String country = data['countryCode'];
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('country', country);
}
}

static Future<List> getHome() async {
final response = await get(Uri.parse('${hostAddress}home'));
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
final response = await get(Uri.parse('${hostAddress}home?lang=$lang'));
if (response.statusCode == 200) {
List data = jsonDecode(response.body);
return data;
}
return [];
}

static Future<Map> getCharts() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
String country = prefs.getString('country') ?? "IN";
final response = await get(
Uri.parse('${hostAddress}charts?lang=$lang&country=$country'));
if (response.statusCode == 200) {
Map data = jsonDecode(response.body)['trending'];
return data;
}
return {};
}

static Future<Map> getSearch(query) async {
final response = await get(Uri.parse('$hostAddress/search?query=$query'));
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
final response =
await get(Uri.parse('$hostAddress/search?query=$query&lang=$lang'));
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
return data;
Expand All @@ -23,7 +53,10 @@ class HomeApi {
}

static Future<Map> getPlaylist(id) async {
final response = await get(Uri.parse('$hostAddress/playlist?id=$id'));
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
final response =
await get(Uri.parse('$hostAddress/playlist?id=$id&lang=$lang'));
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
return data;
Expand All @@ -32,8 +65,10 @@ class HomeApi {
}

static Future<List> getWatchPlaylist(String videoId, int limit) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
String url =
"$hostAddress/searchwatchplaylist?videoId=$videoId&limit=$limit";
"$hostAddress/searchwatchplaylist?videoId=$videoId&limit=$limit&lang=$lang";
final response = await get(Uri.parse(url));
if (response.statusCode == 200) {
Map data = jsonDecode(response.body);
Expand All @@ -45,7 +80,10 @@ class HomeApi {
}

static Future<List> getSongs(query) async {
final response = await get(Uri.parse('$hostAddress/songs?query=$query'));
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
final response =
await get(Uri.parse('$hostAddress/songs?query=$query&lang=$lang'));
if (response.statusCode == 200) {
List data = jsonDecode(response.body);
return data;
Expand All @@ -54,7 +92,10 @@ class HomeApi {
}

static Future<List> getArtists(query) async {
final response = await get(Uri.parse('$hostAddress/artists?query=$query'));
SharedPreferences prefs = await SharedPreferences.getInstance();
String lang = prefs.getString('locale') ?? "en";
final response =
await get(Uri.parse('$hostAddress/artists?query=$query&lang=$lang'));
if (response.statusCode == 200) {
List data = jsonDecode(response.body);
return data;
Expand Down
75 changes: 75 additions & 0 deletions lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';

import 'messages_en.dart' as messages_en;
import 'messages_fr.dart' as messages_fr;
import 'messages_hi.dart' as messages_hi;
import 'messages_ru.dart' as messages_ru;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'fr': () => new SynchronousFuture(null),
'hi': () => new SynchronousFuture(null),
'ru': () => new SynchronousFuture(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'fr':
return messages_fr.messages;
case 'hi':
return messages_hi.messages;
case 'ru':
return messages_ru.messages;
default:
return null;
}
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new SynchronousFuture(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
}

bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}

MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale =
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
38 changes: 38 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"Dark_Theme": MessageLookupByLibrary.simpleMessage("Dark Theme"),
"EnterAName": MessageLookupByLibrary.simpleMessage("Enter a name"),
"Home": MessageLookupByLibrary.simpleMessage("Home"),
"Language": MessageLookupByLibrary.simpleMessage("Language"),
"Play_All": MessageLookupByLibrary.simpleMessage("Play All"),
"Playlists": MessageLookupByLibrary.simpleMessage("Playlists"),
"Search": MessageLookupByLibrary.simpleMessage("Search"),
"Settings": MessageLookupByLibrary.simpleMessage("Settings"),
"Songs": MessageLookupByLibrary.simpleMessage("Songs"),
"Tracks": MessageLookupByLibrary.simpleMessage("Tracks"),
"addToQueue": MessageLookupByLibrary.simpleMessage("Add to Queue"),
"quickPicks": MessageLookupByLibrary.simpleMessage("Quick picks")
};
}
39 changes: 39 additions & 0 deletions lib/generated/intl/messages_fr.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a fr locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'fr';

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"Dark_Theme": MessageLookupByLibrary.simpleMessage("Thème sombre"),
"EnterAName": MessageLookupByLibrary.simpleMessage("Entrez un nom"),
"Home": MessageLookupByLibrary.simpleMessage("Domicile"),
"Language": MessageLookupByLibrary.simpleMessage("Langue"),
"Play_All": MessageLookupByLibrary.simpleMessage("Jouer à tous"),
"Playlists": MessageLookupByLibrary.simpleMessage("Listes de lecture"),
"Search": MessageLookupByLibrary.simpleMessage("Chercher"),
"Settings": MessageLookupByLibrary.simpleMessage("Réglages"),
"Songs": MessageLookupByLibrary.simpleMessage("Chansons"),
"Tracks": MessageLookupByLibrary.simpleMessage("Des pistes"),
"addToQueue":
MessageLookupByLibrary.simpleMessage("Ajouter à la liste"),
"quickPicks": MessageLookupByLibrary.simpleMessage("Sélections rapides")
};
}
38 changes: 38 additions & 0 deletions lib/generated/intl/messages_hi.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a hi locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'hi';

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"Dark_Theme": MessageLookupByLibrary.simpleMessage("डार्क थीम"),
"EnterAName": MessageLookupByLibrary.simpleMessage("नाम डालें"),
"Home": MessageLookupByLibrary.simpleMessage("होम पेज"),
"Language": MessageLookupByLibrary.simpleMessage("भाषा"),
"Play_All": MessageLookupByLibrary.simpleMessage("सभी को बजाएं"),
"Playlists": MessageLookupByLibrary.simpleMessage("प्लेलिस्ट"),
"Search": MessageLookupByLibrary.simpleMessage("खोज"),
"Settings": MessageLookupByLibrary.simpleMessage("समायोजन"),
"Songs": MessageLookupByLibrary.simpleMessage("गीत"),
"Tracks": MessageLookupByLibrary.simpleMessage("पटरियों"),
"addToQueue": MessageLookupByLibrary.simpleMessage("क़तार में जोड़ें"),
"quickPicks": MessageLookupByLibrary.simpleMessage("जल्दी चुनाव")
};
}
39 changes: 39 additions & 0 deletions lib/generated/intl/messages_ru.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a ru locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'ru';

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"Dark_Theme": MessageLookupByLibrary.simpleMessage("Темная тема"),
"EnterAName": MessageLookupByLibrary.simpleMessage("Введите имя"),
"Home": MessageLookupByLibrary.simpleMessage("Дом"),
"Language": MessageLookupByLibrary.simpleMessage("Язык"),
"Play_All": MessageLookupByLibrary.simpleMessage("Играть все"),
"Playlists": MessageLookupByLibrary.simpleMessage("Плейлисты"),
"Search": MessageLookupByLibrary.simpleMessage("Поиск"),
"Settings": MessageLookupByLibrary.simpleMessage("Настройки"),
"Songs": MessageLookupByLibrary.simpleMessage("Песни"),
"Tracks": MessageLookupByLibrary.simpleMessage("Треки"),
"addToQueue":
MessageLookupByLibrary.simpleMessage("Добавить в очередь"),
"quickPicks": MessageLookupByLibrary.simpleMessage("Быстрый выбор")
};
}
Loading

0 comments on commit 0b919a3

Please sign in to comment.