diff --git a/GoogleService-Info.plist b/GoogleService-Info.plist index 0294531d87bf5a998a21e3b2e63a60a9849d4b1a..13167e087da59a32d561a1a681d62f487d2b55cb 100644 --- a/GoogleService-Info.plist +++ b/GoogleService-Info.plist @@ -7,9 +7,9 @@ <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key> <string>ca-app-pub-3940256099942544/4411468910</string> <key>CLIENT_ID</key> - <string>1006878207346-dkva1hprctic3027kn62n7d4tjv42au8.apps.googleusercontent.com</string> + <string>1006878207346-9v61fspphkk57q334mq6td4p9i55dipv.apps.googleusercontent.com</string> <key>REVERSED_CLIENT_ID</key> - <string>com.googleusercontent.apps.1006878207346-dkva1hprctic3027kn62n7d4tjv42au8</string> + <string>com.googleusercontent.apps.1006878207346-9v61fspphkk57q334mq6td4p9i55dipv</string> <key>API_KEY</key> <string>AIzaSyBtDoADGTSBPirvlHEeQTz2APlMfwq3aJA</string> <key>GCM_SENDER_ID</key> @@ -17,7 +17,7 @@ <key>PLIST_VERSION</key> <string>1</string> <key>BUNDLE_ID</key> - <string>com.jeremyguiselin.betskills</string> + <string>com.dimago.betskills</string> <key>PROJECT_ID</key> <string>betskills-145919</string> <key>STORAGE_BUCKET</key> @@ -27,13 +27,13 @@ <key>IS_ANALYTICS_ENABLED</key> <false/> <key>IS_APPINVITE_ENABLED</key> - <false/> + <true/> <key>IS_GCM_ENABLED</key> <true/> <key>IS_SIGNIN_ENABLED</key> <true/> <key>GOOGLE_APP_ID</key> - <string>1:1006878207346:ios:2de78a74bfdf1959</string> + <string>1:1006878207346:ios:9d4e0a7669d0f086</string> <key>DATABASE_URL</key> <string>https://betskills-145919.firebaseio.com</string> </dict> diff --git a/config.xml b/config.xml index ebd217afa28169d911f57e3cabc8ca6d15d934ed..2f610c9ba6e3df84c6dad5ceb961e2096445c1fb 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<widget id="com.jeremyguiselin.betskills" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget id="com.dimago.betskills" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Betskills</name> <description> Betskills app to see predictions of football and tennis games. @@ -12,7 +12,8 @@ <preference name="webviewbounce" value="false"/> <preference name="UIWebViewBounce" value="false"/> <preference name="DisallowOverscroll" value="true"/> - <preference name="SplashScreenDelay" value="3000"/> + <preference name="SplashScreenDelay" value="5000"/> + <preference name="ShowSplashScreenSpinner" value="false" /> <preference name="android-minSdkVersion" value="16"/> <preference name="BackupWebStorage" value="none"/> <preference name="SplashScreen" value="screen"/> @@ -39,8 +40,6 @@ <variable name="APP_NAME" value="Betskills"/> </plugin> <platform name="ios"> - <preference name="FadeSplashScreen" value="false"/> - <preference name="FadeSplashScreenDuration" value="1000"/> <preference name="iosPersistentFileLocation" value="Library"/> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640"/> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750"/> @@ -100,4 +99,4 @@ <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> </platform> <icon src="resources/android/icon/drawable-xhdpi-icon.png"/> -</widget> \ No newline at end of file +</widget> diff --git a/google-services.json b/google-services.json index b554f0bdf43d80629c53f52e9d090cc1342819ca..c891abd6c608d4995b1f3aa0edaefb7c49635438 100644 --- a/google-services.json +++ b/google-services.json @@ -36,6 +36,37 @@ "status": 2 } } + }, + { + "client_info": { + "mobilesdk_app_id": "1:1006878207346:android:9d4e0a7669d0f086", + "android_client_info": { + "package_name": "com.dimago.betskills" + } + }, + "oauth_client": [ + { + "client_id": "1006878207346-bv3pqbnac3v9rcu4gheef5fgagg03k41.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAN5KmJEXNd4uKu3TCfhd47bFkYcBvZmRI" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } } ], "configuration_version": "1" diff --git a/scss/pack.scss b/scss/pack.scss index bcae264a174d0d1fdcb1dec888e8b995e2ee0baa..c1436cecc06bd806f8af142d08eb1359f153ff97 100644 --- a/scss/pack.scss +++ b/scss/pack.scss @@ -36,6 +36,15 @@ align-items: center; flex-direction: column; + .whiteChevron { + position: absolute; + right: 0; + + img { + height: 30px; + } + } + .title { color: $whiteColor; font-family: "OspDin"; diff --git a/scss/prediction.scss b/scss/prediction.scss index 085b00a308534e61bb686b64b4260f3c1bfaef3d..52011b3cd49cb7af6a51615d8eb1ddd592f50f9a 100644 --- a/scss/prediction.scss +++ b/scss/prediction.scss @@ -71,8 +71,8 @@ text-align: center; img { - width: 70%; height: auto; + max-height: 65px; } .name { diff --git a/www/img/white-chevron.png b/www/img/white-chevron.png new file mode 100644 index 0000000000000000000000000000000000000000..82fc1cee2b9a8670c4351f7dea4ab10447c79fac Binary files /dev/null and b/www/img/white-chevron.png differ diff --git a/www/js/app.js b/www/js/app.js index 3395d7429d2a76025322a762e16e7be8c0e399a9..274b9ca495a22055859dc32e5a595c1e04143854 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -24,7 +24,10 @@ "unlock": "Unlock", "predictions": "Predictions", "games": "Game(s)", - "currency": "£" + "currency": "£", + "purchase_payment_error": "An error occured during the payment, please try again.", + "purchase_internal_error": "An internal error occured, please contact the team to solve this issue.", + "purchase_ok": "Congratulations, your payment has been successfully made. You have now access to the selected elements." }, "fr": { "info_title_1": "Comment resté connecté ?", @@ -48,14 +51,17 @@ "unlock": "Dévérouiller", "predictions": "Prédictions", "games": "Match(s)", - "currency": "€" + "currency": "€", + "purchase_payment_error": "Une erreur est survenue lors du paiement, veuillez réessayer.", + "purchase_internal_error": "Une erreur interne est survenue, veuillez contacter l'équipe Betskills pour résoudre le problème.", + "purchase_ok": "Félicitations, votre transaction a été réalisée avec succès. Vous avez désormais accès aux éléments que vous venez d'acheter." } }; /** * @ngInject */ - function setupRun($ionicPlatform, NotificationService) { + function setupRun($ionicPlatform, NotificationService, constantConfig) { $ionicPlatform.ready(function () { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard @@ -71,6 +77,9 @@ ionic.Platform.ready(function () { NotificationService.registerDevice(); + ionic.Platform.ready(function () { + constantConfig.uuid = window.cordova ? ionic.Platform.device().uuid : '7f4a6a40e5c87157'; + }); }); } diff --git a/www/js/modules/notification/service.js b/www/js/modules/notification/service.js index ff61f3b1d12ab7b95446d6a4fcec236f447e703e..3f3b94cd6377dcbd05991e46b9743f11bd9972ba 100644 --- a/www/js/modules/notification/service.js +++ b/www/js/modules/notification/service.js @@ -16,7 +16,7 @@ registerDevice: function () { var locale = window.navigator.language.split('-')[0]; - if (locale !== 'fr' && locale !== 'en' ) { + if (locale !== 'fr') { locale = 'en'; } @@ -26,6 +26,9 @@ var device = ionic.Platform.device(); deviceData = device; var tokenAlreadyCreated = false; + if (ionic.Platform.isIOS()) { + window.FirebasePlugin.grantPermission(); + } window.FirebasePlugin.getToken(function (token) { deviceData = Object.assign(device, {'locale': locale, 'token': token}); tokenAlreadyCreated = true; diff --git a/www/js/modules/purchase/service.js b/www/js/modules/purchase/service.js index 9900cbfe47c349fe7f29ecf2e852e326cd0d125a..5fee12d561ec4e4aad3f49022cd4c9692c89122e 100644 --- a/www/js/modules/purchase/service.js +++ b/www/js/modules/purchase/service.js @@ -10,27 +10,9 @@ * * @ngInject */ - function PurchaseService($http, $state, ToastService, constantConfig, purchaseConfig) { + function PurchaseService($http, $state, ToastService, constantConfig) { return { - getProducts: function (sport) { - if (window.cordova) { - var products = []; - inAppPurchase - .getProducts(purchaseConfig[sport]) - .then(function (storeProducts) { - products = storeProducts; - }) - .catch(function (err) { - ToastService.show(err, 'long', 'bottom'); - }); - - return products; - } else { - return purchaseConfig['mock'][sport]; - } - }, - buyContent : function (uuid, purchaseId, leagues) { var self = this; var transactionData = {}; diff --git a/www/js/modules/toast/service.js b/www/js/modules/toast/service.js index 52b57cf5a2f8790ff15de3dd57db2c72f286f825..0f5f626bde7fa26823cb4d39614a8b642e9ef53f 100644 --- a/www/js/modules/toast/service.js +++ b/www/js/modules/toast/service.js @@ -19,13 +19,9 @@ show : function (message, duration, location) { if (window.cordova) { - $cordovaToast.show($translate(message), duration, location).then(function(success) { - // success - }, function (error) { - console.log(error); - }); + $cordovaToast.show(message, duration, location); } else { - console.log($translate(message)) + console.log($translate(message)); } } }; diff --git a/www/js/pages/football/controller.js b/www/js/pages/football/controller.js index 1d24d13486b2e9be13b6184f5e28569ed4728406..a050343bdf83c7ac3657fad03338e989abe178f4 100644 --- a/www/js/pages/football/controller.js +++ b/www/js/pages/football/controller.js @@ -22,6 +22,7 @@ $ionicLoading, PurchaseService, constantConfig, + purchaseConfig, ToastService ) { @@ -30,9 +31,7 @@ **/ var deregistrationCallbackList = []; - var products = PurchaseService.getProducts('football'); var self = this; - var uuid = window.cordova ? ionic.Platform.device().uuid : '7f4a6a40e5c87157'; /** End Controller variables @@ -56,6 +55,10 @@ Scope functions **/ + $scope.isUndefined = function (value) { + return typeof value === 'undefined' || value === null; + }; + $scope.isBought = function (league) { return league.device_status === 'unlock'; }; @@ -76,18 +79,18 @@ if ($scope.selected.indexOf(league) !== -1) { $scope.selected.splice($scope.selected.indexOf(league), 1); $scope.predictionsNumber -= league.predictions_number; - $scope.price = self.findPrice($scope.selected.length); } else { $scope.selected.push(league); $scope.predictionsNumber += league.predictions_number; } + $scope.price = self.findPrice($scope.selected.length); } }; $scope.buyContent = function () { var pack = self.findPack($scope.selected.length); - PurchaseService.buyContent(uuid, pack, $scope.selected); + PurchaseService.buyContent(self.uuid, pack, $scope.selected); }; $scope.getPredictionClass = function (prediction, value) { @@ -179,7 +182,7 @@ if (packToGet !== '') { var price = ''; - products.forEach(function (el) { + this.products.forEach(function (el) { if (el.productId === packToGet) { price = el.price; } @@ -236,18 +239,23 @@ deregistrationCallbackList = null; }); - - $scope.$on("$ionicView.beforeEnter", function(event, data){ + ionic.Platform.ready(function () { + self.uuid = window.cordova ? ionic.Platform.device().uuid : '7f4a6a40e5c87157'; $ionicLoading.show({ template: '<ion-spinner icon="ripple" class="spinner-assertive"></ion-spinner>', animation: 'fade-in', - showBackdrop: true, + showBackdrop: true }); var freePredictionsPromise = $http.get(constantConfig.apiUrl + 'predictions/football/free'); - var leaguesPromise = $http.get(constantConfig.apiUrl + uuid + '/leagues/football'); + var leaguesPromise = $http.get(constantConfig.apiUrl + self.uuid + '/leagues/football'); + var promises = [freePredictionsPromise, leaguesPromise]; + if (window.cordova) { + var storePromise = inAppPurchase.getProducts(purchaseConfig['tennis']); + promises.push(storePromise); + } - $q.all([freePredictionsPromise, leaguesPromise]).then(function (data) { + $q.all(promises).then(function (data) { var freePredictions = []; data[0]['data'].forEach(function (prediction) { self.parseScore(prediction); @@ -255,11 +263,18 @@ }); $scope.freePredictions = freePredictions; $scope.leagues = data[1]['data']; + if (window.cordova) { + self.products = data[2]; + } else { + self.products = []; + } }).finally(function () { $ionicLoading.hide(); }); }); + + /** End Scope event **/ diff --git a/www/js/pages/tennis/controller.js b/www/js/pages/tennis/controller.js index ab9c6b4c8c0b6576719dac214fa791e0ab4af188..4f59b4c6d05ac05b2045087bac7d87bbe2d40ead 100644 --- a/www/js/pages/tennis/controller.js +++ b/www/js/pages/tennis/controller.js @@ -7,10 +7,10 @@ /** * @ngdoc controller - * @name ChoiceController + * @name Tennis Controller * * @description - * Controller for the choice of sport page. + * Controller for the tennis index page. * * @ngInject */ @@ -21,7 +21,8 @@ $q, $ionicLoading, PurchaseService, - constantConfig + constantConfig, + purchaseConfig ) { /** @@ -29,9 +30,7 @@ **/ var deregistrationCallbackList = []; - var products = PurchaseService.getProducts('tennis'); var self = this; - var uuid = window.cordova ? ionic.Platform.device().uuid : '7f4a6a40e5c87157'; /** End Controller variables @@ -55,6 +54,10 @@ Scope functions **/ + $scope.isUndefined = function (value) { + return typeof value === 'undefined' || value === null; + }; + $scope.isBought = function (league) { return league.device_status === 'unlock'; }; @@ -107,7 +110,7 @@ } if (selectedPack !== '') { - PurchaseService.buyContent(uuid, selectedPack, $scope.selected); + PurchaseService.buyContent(constantConfig.uuid, selectedPack, $scope.selected); } }; @@ -176,7 +179,7 @@ if (packToGet !== '') { var price = ''; - products.forEach(function (el) { + self.products.forEach(function (el) { if (el.productId === packToGet) { price = el.price; } @@ -216,9 +219,14 @@ }); var freePredictionsPromise = $http.get(constantConfig.apiUrl + 'predictions/tennis/free'); - var leaguesPromise = $http.get(constantConfig.apiUrl + uuid + '/leagues/tennis'); + var leaguesPromise = $http.get(constantConfig.apiUrl + constantConfig.uuid + '/leagues/tennis'); + var promises = [freePredictionsPromise, leaguesPromise]; + if (window.cordova) { + var storePromise = inAppPurchase.getProducts(purchaseConfig['tennis']); + promises.push(storePromise); + } - $q.all([freePredictionsPromise, leaguesPromise]).then(function (data) { + $q.all(promises).then(function (data) { var freePredictions = []; data[0]['data'].forEach(function (prediction) { self.parseScore(prediction); @@ -226,6 +234,11 @@ }); $scope.freePredictions = freePredictions; $scope.leagues = data[1]['data']; + if (window.cordova) { + self.products = data[2]; + } else { + self.products = []; + } }).finally(function () { $ionicLoading.hide(); }); diff --git a/www/partials/prediction.html b/www/partials/prediction.html index dec563a608876e05cdf7143c082e13038c8fd64d..057dd9ad3c7af3dc05b8521c5e1f374900c5dfe9 100644 --- a/www/partials/prediction.html +++ b/www/partials/prediction.html @@ -36,7 +36,7 @@ <div class="name">{{freePrediction.second_team.name}}</div> </div> </div> -<div class="score-container" ng-hide="freePrediction.score === null"> +<div class="score-container" ng-hide="isUndefined(freePrediction.score)"> <div class="tick"></div> <div ng-if="freePrediction.league.sport === 'football'" ng-include="'partials/score/football.html'" class="score football-score"></div> <div ng-if="freePrediction.league.sport === 'tennis'" ng-include="'partials/score/tennis.html'" class="score tennis-score"></div> diff --git a/www/partials/sport-index.html b/www/partials/sport-index.html index f7cec7e4e648aae1e342d3aa5eefa125b084db1f..adbe9f9eb9479aac74a401bcb6304d816849c3e9 100644 --- a/www/partials/sport-index.html +++ b/www/partials/sport-index.html @@ -19,6 +19,9 @@ - {{parseDate(league.max_date)}} </div> + <div class="whiteChevron" ng-class="!isBought(league) ? 'locked' : ''"> + <img src="img/white-chevron.png" /> + </div> </div> </a> </ion-item>