diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 072310d..58c6230 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -405,7 +405,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.14; + MARKETING_VERSION = 1.1.16; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -548,7 +548,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.14; + MARKETING_VERSION = 1.1.16; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -583,7 +583,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.14; + MARKETING_VERSION = 1.1.16; PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/main.dart b/lib/main.dart index dcb545c..6f085c7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -134,8 +134,10 @@ Future main() async { }, ); } + final WorkoutTreeRepository menuTreeRepository = WorkoutTreeRepository(); WidgetsFlutterBinding.ensureInitialized(); + FlutterUxcam.startWithKey("wvdstyoml4tiwfd"); print(" -- FireBase init.."); await FirebaseApi().initializeFlutterFire(); @@ -195,10 +197,8 @@ Future initThirdParty() async { Smartlook.setEventTrackingMode(EventTrackingMode.FULL_TRACKING); */ PushNotificationsManager().init(); - - FlutterUxcam.startWithKey("wvdstyoml4tiwfd"); - FlutterUxcam.optIntoSchematicRecordings(); } + FlutterUxcam.optIntoSchematicRecordings(); } class WorkoutTestApp extends StatelessWidget { diff --git a/lib/service/api.dart b/lib/service/api.dart index 6a98b3d..242ac64 100644 --- a/lib/service/api.dart +++ b/lib/service/api.dart @@ -1,31 +1,12 @@ import 'dart:convert'; import 'dart:io'; -import 'package:aitrainer_app/model/result.dart'; import 'package:aitrainer_app/service/logging.dart'; import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/not_found_exception.dart'; import 'package:flutter/services.dart'; -import 'package:http/http.dart' as http; import 'package:aitrainer_app/model/cache.dart'; class APIClient with Common, Logging { - Future sendRequestToServer(dynamic model, String reqType, bool isTokenHeader, String token) async { - HttpClient client = new HttpClient(); - client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true); - HttpClientRequest request = await client.postUrl(Uri.parse(Cache().getBaseUrl() + reqType)); - request.headers.set('Content-Type', 'application/json'); - if (isTokenHeader) { - request.headers.set('Authorization', 'Bearer $token'); - } - request.add(utf8.encode(jsonEncode(model))); - HttpClientResponse result = await request.close(); - if (result.statusCode == 200) { - return jsonDecode(await result.transform(utf8.decoder).join()); - } else { - return null; - } - } - dynamic authenticateUser(String email, String password) async { var url = Cache().getBaseUrl() + "authenticate"; @@ -112,93 +93,4 @@ class APIClient with Common, Logging { throw Exception("Network Error, please try again later"); } } - - Future get0(String endPoint, String param) async { - final url = Cache().getBaseUrl() + endPoint + param; - - trace("-------- API get " + url); - String authToken = Cache().getAuthToken(); - if (authToken.length == 0) { - var responseJson = await this.authenticateUser(Cache.username, Cache.password); - authToken = responseJson['token']; - Cache().authToken = authToken; - } - var uri = Uri.parse(url); - final response = await http.get(uri, headers: {'Content-Type': 'application/json', 'Authorization': "Bearer " + authToken}); - trace(" ------------get response code: " + response.statusCode.toString()); - if (response.statusCode == 200) { - return utf8.decode(response.bodyBytes); - } else if (response.statusCode == 404) { - throw NotFoundException(message: "Not Found"); - } else { - throw Exception("Network Error, please try again later"); - } - } - - Future post0(String endPoint, String body) async { - final url = Cache().getBaseUrl() + endPoint; - trace(" ------------ http/post body $body - url: $url "); - String authToken = Cache().getAuthToken(); - if (authToken.length == 0) { - var responseJson = await this.authenticateUser(Cache.username, Cache.password); - authToken = responseJson['token']; - } - var uri = Uri.parse(url); - final response = await http.post( - uri, - headers: {'Content-Type': 'application/json; charset=UTF-8', 'Authorization': "Bearer " + authToken}, - body: body, - ); - trace(" ------------post response code: " + response.statusCode.toString()); - final String decodedResponse = utf8convert(response.body); - trace(" ------------ response: $decodedResponse"); - return decodedResponse; - } - - dynamic authenticateUser0(String email, String password) async { - var url = Cache().getBaseUrl() + "authenticate"; - - try { - final body = '{"username":"$email", "password":"$password"}'; - trace("authentication with $email"); - var uri = Uri.parse(url); - final response = await http.post(uri, headers: {'Authorization': '1', 'Content-Type': 'application/json'}, body: body); - final responseCode = response.statusCode; - if (responseCode != 200) { - trace("authentication response: $responseCode"); - throw Exception("Network error, try again later!"); - /* return { - "error": "Authentication error, total failure", - }; */ - } - - final responseJson = json.decode(response.body); - return responseJson; - } catch (exception) { - print(exception.toString()); - throw Exception("Network error, try again later!"); - } - } - - Future fetch(var authToken, var endPoint) async { - var url = Cache().getBaseUrl() + endPoint; - - try { - var uri = Uri.parse(url); - final response = await http.get( - uri, - headers: {'Authorization': authToken}, - ); - - final responseJson = json.decode(response.body); - return responseJson; - } catch (exception) { - log(exception.toString()); - if (exception.toString().contains('SocketException')) { - return 'NetworkError'; - } else { - return null; - } - } - } } diff --git a/pubspec.lock b/pubspec.lock index c1ee976..8c89e48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -603,7 +603,7 @@ packages: source: hosted version: "0.15.0" http: - dependency: "direct dev" + dependency: transitive description: name: http url: "https://pub.dartlang.org" diff --git a/pubspec.yaml b/pubspec.yaml index 2ed78bd..4142804 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.14+75 +version: 1.1.17+77 environment: sdk: ">=2.12.0 <3.0.0" @@ -94,8 +94,6 @@ dev_dependencies: build_runner: - - http: ^0.13.3 intl: ^0.17.0 shared_preferences: ^2.0.5