From 030d6ded0de6d4c0650f5c643c4c19ea7be640fe Mon Sep 17 00:00:00 2001 From: Grgur Grisogono Date: Wed, 30 Jan 2019 16:52:25 +0100 Subject: [PATCH] Squashed commit of the following: commit b3a92b27fdee33090e973daa5e85f2fe8e0a3fd3 Merge: 919b855 6df5efe Author: Grgur Grisogono Date: Wed Jan 30 16:40:20 2019 +0100 Merge branch 'master' into GI#94-ask-app-review # Conflicts: # ios/App/App.xcodeproj/project.pbxproj # ios/App/Podfile.lock # package-lock.json # package.json commit 919b855c7fcec73276845340f5020a1dadc19ede Merge: a9482dc 2a276ff Author: elninjagaiden Date: Wed Jan 23 11:28:31 2019 -0600 Merge branch 'master' into GI#94-ask-app-review commit a9482dc4b1565cfcfd467ab03795361253a1ffd4 Merge: 38708a4 44fdbbc Author: elninjagaiden Date: Wed Jan 23 11:14:20 2019 -0600 Merge branch 'master' into GI#94-ask-app-review commit 38708a4627f43a1d939371c748a7bdecef1b63a5 Author: elninjagaiden Date: Sun Oct 21 17:11:15 2018 -0600 Changes after feedback and changes requested by marketing team commit 0e7961e7453a20fea844b15bf524186ed8cd0c59 Author: elninjagaiden Date: Thu Oct 4 08:47:08 2018 -0600 Updating contact email and enabling feeback email on web environments commit f29fda6dd04d2ae840310f0fdf9a46645549c755 Author: elninjagaiden Date: Tue Oct 2 16:40:14 2018 -0600 Changes to use fullscreen modal on reviews and also support feedback via email commit d2531b72aac514ee4e08619572576cf493a9b67f Merge: c907e89 5af0dc7 Author: elninjagaiden Date: Tue Oct 2 12:52:21 2018 -0600 Merge branch 'master' into GI#94-ask-app-review commit c907e89cb6fbc717fa3de390abf80949df2159e8 Merge: d1e277f cd9212d Author: Grgur Grisogono Date: Mon Oct 1 14:31:44 2018 +0200 Merge branch 'master' into GI#94-ask-app-review commit d1e277f4a077e655db36812199f830c91ee91317 Author: elninjagaiden Date: Fri Sep 28 14:12:21 2018 -0400 Updating native platforms projects changes according cordova-plugin-market dependency commit 321497864a25db64c0a447151570dff86aea4f41 Author: elninjagaiden Date: Fri Sep 28 14:07:35 2018 -0400 Updating native platforms projects changes according cordova-plugin-market dependency commit 577a6b26904b9484a554cd0b27574b757603175f Author: elninjagaiden Date: Fri Sep 21 20:08:46 2018 -0600 Removing NativeStorage cordova dependency and changes after code review commit cd60846a227036a46436f122d4f9aa348d223d99 Author: elninjagaiden Date: Wed Sep 19 15:01:16 2018 -0600 Removing not needed dependencies commit f0b80121c9568207edb198cf179ee571a5116486 Author: elninjagaiden Date: Wed Sep 19 14:10:41 2018 -0600 Service to support app reviews on apps stores --- .env | 4 + android/app/src/main/res/xml/config.xml | 4 + .../com/xmartlabs/cordova/market/Market.java | 95 + ios/App/App.xcodeproj/project.pbxproj | 2 + ios/App/App/config.xml | 4 + ios/App/Podfile | 3 +- ios/App/Podfile.lock | 8 +- .../CordovaPlugins.podspec | 15 + .../CordovaPluginsResources.podspec | 11 + .../CordovaPluginsStatic.podspec | 15 + .../resources/.gitkeep | 1 + .../sources/.gitkeep | 1 + .../sources/CordovaPluginMarket/CDVMarket.h | 14 + .../sources/CordovaPluginMarket/CDVMarket.m | 35 + package-lock.json | 6 +- package.json | 1 + src/appService.js | 31 + src/components/Modal.vue | 26 +- src/components/ReviewAppModal.vue | 130 + src/helpers/index.js | 30 + src/images/Bee-Happy-Avatar@2x.svg | 161 + src/images/Bee-Not-Happy-Avatar@2x.svg | 155 + src/main.js | 21 +- src/mixins/hasModal.js | 4 +- src/mixins/reviewAppModal.js | 17 + src/reviewAppService.js | 108 + src/views/Acc.vue | 7 +- src/views/Pwd.vue | 5 +- src/views/tmpBreaches.json | 32 + yarn.lock | 8859 +++++++++++++++++ 30 files changed, 9789 insertions(+), 16 deletions(-) create mode 100644 android/capacitor-cordova-android-plugins/src/main/java/com/xmartlabs/cordova/market/Market.java create mode 100644 ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec create mode 100644 ios/capacitor-cordova-ios-plugins/CordovaPluginsResources.podspec create mode 100644 ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec create mode 100644 ios/capacitor-cordova-ios-plugins/resources/.gitkeep create mode 100644 ios/capacitor-cordova-ios-plugins/sources/.gitkeep create mode 100644 ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.h create mode 100644 ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.m create mode 100644 src/appService.js create mode 100644 src/components/ReviewAppModal.vue create mode 100644 src/images/Bee-Happy-Avatar@2x.svg create mode 100644 src/images/Bee-Not-Happy-Avatar@2x.svg create mode 100644 src/mixins/reviewAppModal.js create mode 100644 src/reviewAppService.js create mode 100644 src/views/tmpBreaches.json create mode 100644 yarn.lock diff --git a/.env b/.env index bdb06b9..b2ceee8 100644 --- a/.env +++ b/.env @@ -2,3 +2,7 @@ VUE_APP_NAME=BEEP VUE_APP_INITIAL_STATUSBAR_COLOR=#FFFFFF VUE_APP_UNSAFE_STATUSBAR_COLOR=#FF5C5D VUE_APP_SAFE_STATUSBAR_COLOR=#47BD8F +VUE_APP_STORE_REVIEWS_ENABLED=true +VUE_APP_IOS_APP_ID = 'id1434675665' +VUE_APP_SUPPORT_EMAIL = 'contact@moduscreate.com' +VUE_APP_SUPPORT_EMAIL_SUBJECT = 'Feedback: About beep' diff --git a/android/app/src/main/res/xml/config.xml b/android/app/src/main/res/xml/config.xml index c44ca0c..58afc07 100644 --- a/android/app/src/main/res/xml/config.xml +++ b/android/app/src/main/res/xml/config.xml @@ -1,4 +1,8 @@ + + + + \ No newline at end of file diff --git a/android/capacitor-cordova-android-plugins/src/main/java/com/xmartlabs/cordova/market/Market.java b/android/capacitor-cordova-android-plugins/src/main/java/com/xmartlabs/cordova/market/Market.java new file mode 100644 index 0000000..b36c05a --- /dev/null +++ b/android/capacitor-cordova-android-plugins/src/main/java/com/xmartlabs/cordova/market/Market.java @@ -0,0 +1,95 @@ +package com.xmartlabs.cordova.market; + +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaInterface; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import android.content.Context; +import android.content.ComponentName; +import android.content.Intent; +import android.net.Uri; +import android.util.Log; + +/** + * Interact with Google Play. + * + * @author Miguel Revetria + * @license Apache 2.0 + */ +public class Market extends CordovaPlugin +{ + /** + * Executes the request and returns PluginResult. + * + * @param action + * Action to perform. + * @param args + * Arguments to the action. + * @param callbackId + * JavaScript callback ID. + * @return A PluginResult object with a status and message. + */ + @Override + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { + try { + if (action.equals("open")) { + if (args.length() == 1) { + String appId = args.getString(0); + this.openGooglePlay(appId); + + callbackContext.success(); + return true; + } + }else if (action.equals("search")) { + if (args.length() == 1) { + String key = args.getString(0); + this.searchGooglePlay(key); + + callbackContext.success(); + return true; + } + } + } catch (JSONException e) { + Log.d("CordovaLog","Plugin Market: cannot parse args."); + e.printStackTrace(); + } catch (android.content.ActivityNotFoundException e) { + Log.d("CordovaLog","Plugin Market: cannot open Google Play activity."); + e.printStackTrace(); + } + + return false; + } + + /** + * Open the appId details on Google Play . + * + * @param appId + * Application Id on Google Play. + * E.g.: com.google.earth + */ + private void openGooglePlay(String appId) throws android.content.ActivityNotFoundException { + Context context = this.cordova.getActivity().getApplicationContext(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appId)); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } + + /** + * search the details on Google Play . + * + * @param searchKeyword + * Application Id on Google Play. + * E.g.: earth + */ + private void searchGooglePlay(String key) throws android.content.ActivityNotFoundException { + Context context = this.cordova.getActivity().getApplicationContext(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=" + key)); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } +} diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 7dd45bb..069df31 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -225,11 +225,13 @@ "${SRCROOT}/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh", "${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework", "${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework", + "${BUILT_PRODUCTS_DIR}/CordovaPlugins/CordovaPlugins.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CordovaPlugins.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/ios/App/App/config.xml b/ios/App/App/config.xml index c44ca0c..03f165f 100644 --- a/ios/App/App/config.xml +++ b/ios/App/App/config.xml @@ -1,4 +1,8 @@ + + + + \ No newline at end of file diff --git a/ios/App/Podfile b/ios/App/Podfile index 7676759..ada046f 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -7,6 +7,7 @@ target 'App' do # Automatic Capacitor Pod dependencies, do not delete pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' - + pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' + # Do not delete end diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index 2acef7f..c47b00a 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -2,21 +2,27 @@ PODS: - Capacitor (1.0.0-beta.10): - CapacitorCordova (= 1.0.0-beta.10) - CapacitorCordova (1.0.0-beta.10) + - CordovaPlugins (1.0.0-beta.11): + - CapacitorCordova DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" + - CordovaPlugins (from `../capacitor-cordova-ios-plugins`) EXTERNAL SOURCES: Capacitor: :path: "../../node_modules/@capacitor/ios" CapacitorCordova: :path: "../../node_modules/@capacitor/ios" + CordovaPlugins: + :path: "../capacitor-cordova-ios-plugins" SPEC CHECKSUMS: Capacitor: 9aa60986d00166b45b3216daf90f49f8df6593fa CapacitorCordova: aab520b872cabe0d9f30a03dc385c5dce8d2c82b + CordovaPlugins: 3890c45090aa3bd73fbd2bbd94db322ab18ec794 -PODFILE CHECKSUM: 144b255a8aae841ea14f3ee0bfb55be44afd1167 +PODFILE CHECKSUM: 1bb060a01b3dd72e2ee7a4a92775c43a5a308f02 COCOAPODS: 1.5.3 diff --git a/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec b/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec new file mode 100644 index 0000000..f9b472a --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec @@ -0,0 +1,15 @@ + + Pod::Spec.new do |s| + s.name = 'CordovaPlugins' + s.version = '1.0.0-beta.11' + s.summary = 'Autogenerated spec' + s.license = 'Unknown' + s.homepage = 'https://example.com' + s.authors = { 'Capacitor Generator' => 'hi@example.com' } + s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '1.0.0-beta.11' } + s.source_files = 'sources/**/*.{swift,h,m,c,cc,mm,cpp}' + s.ios.deployment_target = '11.0' + s.dependency 'CapacitorCordova' + s.swift_version = '4.0' + + end \ No newline at end of file diff --git a/ios/capacitor-cordova-ios-plugins/CordovaPluginsResources.podspec b/ios/capacitor-cordova-ios-plugins/CordovaPluginsResources.podspec new file mode 100644 index 0000000..9f0223e --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/CordovaPluginsResources.podspec @@ -0,0 +1,11 @@ +Pod::Spec.new do |s| + s.name = 'CordovaPluginsResources' + s.version = '0.0.105' + s.summary = 'Resources for Cordova plugins' + s.social_media_url = 'http://twitter.com/getcapacitor' + s.license = 'MIT' + s.homepage = 'https://capacitor.ionicframework.com/' + s.authors = { 'Ionic Team' => 'hi@ionicframework.com' } + s.source = { :git => 'https://github.com/ionic-team/capacitor.git', :tag => s.version.to_s } + s.resources = ['resources/*'] +end \ No newline at end of file diff --git a/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec b/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec new file mode 100644 index 0000000..213563e --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec @@ -0,0 +1,15 @@ + + Pod::Spec.new do |s| + s.name = 'CordovaPluginsStatic' + s.version = '1.0.0-beta.11' + s.summary = 'Autogenerated spec' + s.license = 'Unknown' + s.homepage = 'https://example.com' + s.authors = { 'Capacitor Generator' => 'hi@example.com' } + s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '1.0.0-beta.11' } + s.source_files = 'sourcesstatic/**/*.{swift,h,m,c,cc,mm,cpp}' + s.ios.deployment_target = '11.0' + s.dependency 'CapacitorCordova' + s.swift_version = '4.0' + s.static_framework = true + end \ No newline at end of file diff --git a/ios/capacitor-cordova-ios-plugins/resources/.gitkeep b/ios/capacitor-cordova-ios-plugins/resources/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/resources/.gitkeep @@ -0,0 +1 @@ + diff --git a/ios/capacitor-cordova-ios-plugins/sources/.gitkeep b/ios/capacitor-cordova-ios-plugins/sources/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/sources/.gitkeep @@ -0,0 +1 @@ + diff --git a/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.h b/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.h new file mode 100644 index 0000000..9e7efac --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.h @@ -0,0 +1,14 @@ +// +// CDVMarket.h +// +// Created by Miguel Revetria miguel@xmartlabs.com on 2014-03-17. +// License Apache 2.0 + +#import +#import + +@interface CDVMarket : CDVPlugin + +- (void)open:(CDVInvokedUrlCommand *)command; + +@end \ No newline at end of file diff --git a/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.m b/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.m new file mode 100644 index 0000000..fcc2c35 --- /dev/null +++ b/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginMarket/CDVMarket.m @@ -0,0 +1,35 @@ +// +// CDVMarket.h +// +// Created by Miguel Revetria miguel@xmartlabs.com on 2014-03-17. +// License Apache 2.0 + +#include "CDVMarket.h" + +@implementation CDVMarket + +- (void)pluginInitialize +{ +} + +- (void)open:(CDVInvokedUrlCommand *)command +{ + [self.commandDelegate runInBackground:^{ + NSArray *args = command.arguments; + NSString *appId = [args objectAtIndex:0]; + + CDVPluginResult *pluginResult; + if (appId) { + NSString *url = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/%@", appId]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid application id: null was found"]; + } + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +@end diff --git a/package-lock.json b/package-lock.json index 75a6217..965bafc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@modus/beep", - "version": "0.1.0", + "version": "1.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4064,6 +4064,10 @@ } } }, + "cordova-plugin-market": { + "version": "git+https://github.com/xmartlabs/cordova-plugin-market.git#44b058abf668c0f810389d96598579ef729853b4", + "from": "git+https://github.com/xmartlabs/cordova-plugin-market.git" + }, "core-js": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.3.tgz", diff --git a/package.json b/package.json index d1ff1fc..efe14a7 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@capacitor/cli": "1.0.0-beta.11", "@capacitor/core": "1.0.0-beta.11", "@capacitor/ios": "1.0.0-beta.11", + "cordova-plugin-market": "git+https://github.com/xmartlabs/cordova-plugin-market.git", "@ionic/core": "4.0.0-rc.3", "@modus/ionic-vue": "^1.2.2", "axios": "0.18.0", diff --git a/src/appService.js b/src/appService.js new file mode 100644 index 0000000..3d8b6dc --- /dev/null +++ b/src/appService.js @@ -0,0 +1,31 @@ +import { version as appVersion } from '../package.json' +import { Plugins } from '@capacitor/core' +const { Storage } = Plugins +const lastMajorAppVersionStorageKey = 'lastMajorAppVersion' + +export default { + currentMajorAppVersion: 0, + lastMajorAppVersion: 0, + isMajorUpdate: false, + async init() { + this.currentMajorAppVersion = this.getCurrentAppMajorVersion() + this.lastMajorAppVersion = await this.getLastAppMajorVersion() + this.isMajorUpdate = this.currentMajorAppVersion > this.lastMajorAppVersion + if (this.isMajorUpdate || this.currentMajorAppVersion === 0) { + Storage.set({ + key: lastMajorAppVersionStorageKey, + value: this.currentMajorAppVersion.toString(), + }) + } + }, + getCurrentAppMajorVersion() { + return parseInt(appVersion.split('.')[0]) + }, + async getLastAppMajorVersion() { + const lastMajorAppVersionData = await Storage.get({ key: lastMajorAppVersionStorageKey }) + if (lastMajorAppVersionData && lastMajorAppVersionData.value) { + return parseInt(lastMajorAppVersionData.value) + } + return 0 + }, +} diff --git a/src/components/Modal.vue b/src/components/Modal.vue index de4e20c..089060d 100644 --- a/src/components/Modal.vue +++ b/src/components/Modal.vue @@ -1,23 +1,23 @@