Compare commits

...

2 Commits

Author SHA1 Message Date
Sikander Saleem a68faf6e98 version 1.1.2 released on stores. 2 years ago
Sikander Saleem e9a3aaaceb welcome video api added. 2 years ago

@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {
}
android {
compileSdkVersion 33
compileSdk 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -48,8 +48,8 @@ android {
applicationId "com.cloudsolutions.tangheem"
minSdkVersion 19
targetSdkVersion 33
versionCode 3
versionName "1.1.1"
versionCode 4
versionName "1.1.2"
multiDexEnabled true
}

@ -6,8 +6,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.google.gms:google-services:4.3.13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

@ -1,5 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
android.jetifier.blacklist=bcprov-jdk15on
android.jetifier.ignorelist=bcprov-jdk15on

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

@ -1,5 +1,5 @@
sdk.dir=/Users/sikandersaleem/Library/Android/sdk
flutter.sdk=/Users/sikandersaleem/sdks/flutter
flutter.buildMode=release
flutter.versionName=1.1.0
flutter.versionCode=2
flutter.versionName=1.1.2
flutter.versionCode=4

@ -36,6 +36,12 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'

@ -364,7 +364,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = GWPV7QNN58;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -381,7 +381,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tangheem.tangheemalquran;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -506,7 +506,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = GWPV7QNN58;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -523,7 +523,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tangheem.tangheemalquran;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = GWPV7QNN58;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -557,7 +557,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tangheem.tangheemalquran;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

@ -77,11 +77,7 @@ class ApiClient {
print("Url:$url");
print("body:${jsonEncode(jsonObject)}");
}
var response = await postJsonForResponse(url, jsonObject, token: token,
queryParameters: queryParameters,
headers: _headers,
retryTimes: retryTimes,
isPutRequest: isPutRequest);
var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isPutRequest: isPutRequest);
try {
var jsonData = jsonDecode(response.body);
return factoryConstructor(jsonData);
@ -102,11 +98,7 @@ class ApiClient {
}
}
return await _postForResponse(url, requestBody, token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes,
isPutRequest: isPutRequest);
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isPutRequest: isPutRequest);
}
Future<Response> _postForResponse(String url, requestBody, {String token, Map<String, dynamic> queryParameters, Map<String, String> headers, int retryTimes = 0, bool isPutRequest = false}) async {
@ -135,11 +127,7 @@ class ApiClient {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
isPutRequest: isPutRequest);
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1, isPutRequest: isPutRequest);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -147,11 +135,7 @@ class ApiClient {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
isPutRequest: isPutRequest);
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1, isPutRequest: isPutRequest);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -161,11 +145,7 @@ class ApiClient {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
isPutRequest: isPutRequest);
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1, isPutRequest: isPutRequest);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -175,8 +155,7 @@ class ApiClient {
bool _certificateCheck(X509Certificate cert, String host, int port) => true;
Future<T> _withClient<T>(Future<T> Function(Client) fn) async {
var httpClient = HttpClient()
..badCertificateCallback = _certificateCheck;
var httpClient = HttpClient()..badCertificateCallback = _certificateCheck;
var client = IOClient(httpClient);
try {
return await fn(client);
@ -185,12 +164,92 @@ class ApiClient {
}
}
Future<Response> _post(url, {Map<String, String> headers, body, Encoding encoding, bool isPutRequest = false}) =>
_withClient((client) {
Future<Response> _post(url, {Map<String, String> headers, body, Encoding encoding, bool isPutRequest = false}) => _withClient((client) {
if (isPutRequest) {
return client.put(url, headers: headers, body: body, encoding: encoding);
} else {
return client.post(url, headers: headers, body: body, encoding: encoding);
}
});
Future<U> getJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, {String token, Map<String, dynamic> queryParameters, Map<String, String> headers, int retryTimes = 0}) async {
var _headers = {'Accept': 'application/json'};
if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers);
}
if (!kReleaseMode) {
print("Url:$url");
}
var response = await getJsonForResponse(url, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes);
try {
var jsonData = jsonDecode(response.body);
return factoryConstructor(jsonData);
} catch (ex) {
throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
}
}
Future<Response> getJsonForResponse<T>(String url, {String token, Map<String, dynamic> queryParameters, Map<String, String> headers, int retryTimes = 0}) async {
headers = {'Content-Type': 'application/json'};
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
}
Future<Response> _getForResponse(String url, {String token, Map<String, dynamic> queryParameters, Map<String, String> headers, int retryTimes = 0}) async {
try {
var _headers = <String, String>{};
if (token != null) {
_headers['Authorization'] = 'Bearer $token';
}
if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers);
}
if (queryParameters != null) {
var queryString = new Uri(queryParameters: queryParameters).query;
url = url + '?' + queryString;
}
var response = await _get(
Uri.parse(url),
headers: _headers,
).timeout(Duration(minutes: 2));
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
} else {
throw _throwAPIException(response);
}
} on SocketException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on HttpException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on TimeoutException catch (e) {
throw APIException(APIException.TIMEOUT, arguments: e);
} on ClientException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
}
}
Future<Response> _get(url, {Map<String, String> headers}) => _withClient((client) {
return client.get(url, headers: headers);
});
}

@ -14,6 +14,7 @@ import 'package:tangheem/models/navigation_model.dart';
import 'package:tangheem/models/quick_links_model.dart';
import 'package:tangheem/models/surah_model.dart';
import 'package:tangheem/models/tangheem_type_model.dart';
import 'package:tangheem/models/welcome_video_model.dart';
import 'api_client.dart';
@ -175,4 +176,9 @@ class TangheemUserApiClient {
var postParams = {"contentTypeId": contentId};
return await ApiClient().postJsonForObject((json) => ContentInfoModel.fromJson(json), url, postParams);
}
Future<String> getWelcomeVideo() async {
String url = "${ApiConsts.tangheemUsers}WelcomeVideoUrl_Get";
return await ApiClient().getJsonForObject((json) => WelcomeVideoModel.fromJson(json).welcomeVideoUrl, url);
}
}

@ -0,0 +1,28 @@
class WelcomeVideoModel {
int totalItemsCount;
int statusCode;
String message;
String welcomeVideoUrl;
WelcomeVideoModel({this.totalItemsCount, this.statusCode, this.message, this.welcomeVideoUrl});
WelcomeVideoModel.fromJson(Map<String, dynamic> json) {
totalItemsCount = json['totalItemsCount'];
statusCode = json['statusCode'];
message = json['message'];
if (json['data'] != null) {
welcomeVideoUrl = json['data']['welcomevideoUrl'];
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['totalItemsCount'] = this.totalItemsCount;
data['statusCode'] = this.statusCode;
data['message'] = this.message;
if (this.welcomeVideoUrl != null) {
data['data']['welcomevideoUrl'] = this.welcomeVideoUrl;
}
return data;
}
}

@ -28,6 +28,7 @@ import 'package:tangheem/ui/screens/pdf_viewer_screen.dart';
import 'package:tangheem/ui/screens/quran_screen.dart';
import 'package:tangheem/widgets/video_player_widget.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
class CommonHomeParent extends StatefulWidget {
CommonHomeParent({Key key}) : super(key: key);
@ -84,13 +85,26 @@ class _CommonHomeParentState extends State<CommonHomeParent> {
builder: (BuildContext context) => GeneralDialog(),
);
}
showWelcomeVideoDialog();
getWelcomeVideo();
// showWelcomeVideoDialog();
});
}
void showWelcomeVideoDialog() async {
void getWelcomeVideo() async {
Utils.showLoading(context);
try {
String link = await TangheemUserApiClient().getWelcomeVideo();
Utils.hideLoading(context);
link = YoutubePlayer.convertUrlToId(link);
showWelcomeVideoDialog(link);
} catch (ex) {
if (mounted) Utils.handleException(ex, null);
Utils.hideLoading(context);
}
}
void showWelcomeVideoDialog(String permLink) async {
prefs = await SharedPreferences.getInstance();
String permLink = "-PqP0BCiTlE";
String link = prefs.getString(GlobalConsts.welcomeVideoUrl) ?? permLink;
if (permLink == link) {
await prefs.setString(GlobalConsts.welcomeVideoUrl, permLink);
@ -112,7 +126,6 @@ class _CommonHomeParentState extends State<CommonHomeParent> {
@override
Widget build(BuildContext context) {
bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
return Scaffold(
backgroundColor: Color(0xffF4F4F4),
resizeToAvoidBottomInset: true,

@ -21,7 +21,7 @@ class VideoPlayerWidget extends StatefulWidget {
}
class _VideoPlayerWidgetState extends State<VideoPlayerWidget> {
bool doNotShowAgain = false;
bool doNotShowAgain = true;
YoutubePlayerController _controller;
@override

@ -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.1+3
version: 1.1.2+4
environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save