fixed some incorrect URLs and request setups
This commit is contained in:
parent
21641f514a
commit
e7debbdd39
7 changed files with 32 additions and 13 deletions
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import 'package:fluffychat/pangea/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/controllers/base_controller.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
|
|
@ -308,7 +309,10 @@ class SubscriptionController extends BaseController {
|
|||
}
|
||||
|
||||
Future<String> getPaymentLink(String duration, {bool isPromo = false}) async {
|
||||
final Requests req = Requests();
|
||||
final Requests req = Requests(
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: _pangeaController.userController.accessToken,
|
||||
);
|
||||
final String reqUrl = Uri.encodeFull(
|
||||
"${PApiUrls.paymentLink}?pangea_user_id=${_pangeaController.matrixState.client.userID}&duration=$duration&redeem=$isPromo",
|
||||
);
|
||||
|
|
@ -323,7 +327,6 @@ class SubscriptionController extends BaseController {
|
|||
return paymentLink;
|
||||
}
|
||||
|
||||
|
||||
Future<void> redeemPromoCode(BuildContext context) async {
|
||||
final List<String>? promoCode = await showTextInputDialog(
|
||||
useRootNavigator: false,
|
||||
|
|
|
|||
|
|
@ -52,14 +52,14 @@ class PApiUrls {
|
|||
|
||||
static String itFeedback = "${PApiUrls.choreoEndpoint}/translation/feedback";
|
||||
|
||||
static String firstStep = "/it_initialstep";
|
||||
static String subseqStep = "/it_step";
|
||||
static String firstStep = "${PApiUrls.choreoEndpoint}/it_initialstep";
|
||||
static String subseqStep = "${PApiUrls.choreoEndpoint}/it_step";
|
||||
|
||||
static String textToSpeech = "${PApiUrls.choreoEndpoint}/text_to_speech";
|
||||
static String speechToText = "${PApiUrls.choreoEndpoint}/speech_to_text";
|
||||
|
||||
static String messageActivityGeneration =
|
||||
"${Environment.choreoApi}/practice/message";
|
||||
"${PApiUrls.choreoEndpoint}/practice/message";
|
||||
|
||||
///-------------------------------- revenue cat --------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
|
|
@ -44,9 +45,12 @@ class GenerateImageRequest {
|
|||
|
||||
class ImageRepo {
|
||||
static Future<GenerateImageeResponse> fetchImage(
|
||||
GenerateImageRequest request) async {
|
||||
final Requests req =
|
||||
Requests(baseUrl: Environment.choreoApi); // Set your API base URL
|
||||
GenerateImageRequest request,
|
||||
) async {
|
||||
final Requests req = Requests(
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
); // Set your API base URL
|
||||
final requestBody = request.toJson();
|
||||
|
||||
try {
|
||||
|
|
@ -58,7 +62,8 @@ class ImageRepo {
|
|||
if (res.statusCode == 200) {
|
||||
final decodedBody = jsonDecode(utf8.decode(res.bodyBytes));
|
||||
return GenerateImageeResponse.fromJson(
|
||||
decodedBody); // Convert response to ImageModel
|
||||
decodedBody,
|
||||
); // Convert response to ImageModel
|
||||
} else {
|
||||
throw Exception('Failed to load image');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import '../models/custom_input_translation_model.dart';
|
||||
import '../models/it_response_model.dart';
|
||||
import '../models/system_choice_translation_model.dart';
|
||||
|
|
@ -14,8 +15,8 @@ class ITRepo {
|
|||
CustomInputRequestModel initalText,
|
||||
) async {
|
||||
final Requests req = Requests(
|
||||
baseUrl: Environment.choreoApi,
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
);
|
||||
final Response res =
|
||||
await req.post(url: PApiUrls.firstStep, body: initalText.toJson());
|
||||
|
|
@ -29,8 +30,8 @@ class ITRepo {
|
|||
SystemChoiceRequestModel subseqText,
|
||||
) async {
|
||||
final Requests req = Requests(
|
||||
baseUrl: Environment.choreoApi,
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
);
|
||||
|
||||
final Response res =
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:fluffychat/pangea/network/urls.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
|
|
@ -11,7 +13,10 @@ import '../network/requests.dart';
|
|||
|
||||
class LanguageRepo {
|
||||
static Future<List<LanguageModel>> fetchLanguages() async {
|
||||
final Requests req = Requests();
|
||||
final Requests req = Requests(
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
);
|
||||
final Response res = await req.get(url: PApiUrls.getLanguages);
|
||||
|
||||
final decodedBody =
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:fluffychat/pangea/controllers/subscription_controller.dart';
|
|||
import 'package:fluffychat/pangea/network/requests.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/utils/subscription_app_id.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
|
@ -17,6 +18,7 @@ class SubscriptionRepo {
|
|||
try {
|
||||
final Requests req = Requests(
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
);
|
||||
final http.Response res = await req.get(
|
||||
url: PApiUrls.rcAppsChoreo,
|
||||
|
|
@ -38,6 +40,7 @@ class SubscriptionRepo {
|
|||
try {
|
||||
final Requests req = Requests(
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
accessToken: MatrixState.pangeaController.userController.accessToken,
|
||||
);
|
||||
final http.Response res = await req.get(
|
||||
url: PApiUrls.rcProductsChoreo,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
|
|
@ -20,6 +21,7 @@ class PUserRepo {
|
|||
}) async {
|
||||
final Requests req = Requests(
|
||||
accessToken: accessToken,
|
||||
choreoApiKey: Environment.choreoApiKey,
|
||||
);
|
||||
final Map<String, dynamic> body = {};
|
||||
// if (interests != null) body[ModelKey.userInterests] = interests.toString();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue