diff --git a/android/jni/com/mapswithme/maps/MWMApplication.cpp b/android/jni/com/mapswithme/maps/MWMApplication.cpp index 4740a183d5..1d79d0963a 100644 --- a/android/jni/com/mapswithme/maps/MWMApplication.cpp +++ b/android/jni/com/mapswithme/maps/MWMApplication.cpp @@ -20,14 +20,16 @@ extern "C" jstring storagePath, jstring tmpPath, jstring extTmpPath, - jstring settingsPath) + jstring settingsPath, + jboolean isPro) { android::Platform::Instance().Initialize(env, apkPath, storagePath, tmpPath, extTmpPath, - settingsPath); + settingsPath, + isPro); if (!g_framework) g_framework = new android::Framework(); diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index dab59abbb5..25d4fe14ff 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -8,6 +8,9 @@ #include "../../../../../std/algorithm.hpp" #include "../../../../../std/cmath.hpp" + +// For the future: It's better to use virtual functions instead of this stuff. +/* class Platform::PlatformImpl { public: @@ -17,10 +20,12 @@ public: size_t m_preCachingDepth; }; +*/ int Platform::PreCachingDepth() const { - return m_impl->m_preCachingDepth; + //return m_impl->m_preCachingDepth; + return 3; } string Platform::UniqueClientId() const @@ -70,7 +75,7 @@ namespace android { Platform::~Platform() { - delete m_impl; + //delete m_impl; } void Platform::Initialize(JNIEnv * env, @@ -78,12 +83,12 @@ namespace android jstring storagePath, jstring tmpPath, jstring extTmpPath, - jstring settingsPath) + jstring settingsPath, + bool isPro) { - if (m_impl) - delete m_impl; - - m_impl = new PlatformImpl(); + //if (m_impl) + // delete m_impl; + //m_impl = new PlatformImpl(); m_resourcesDir = jni::ToNativeString(env, apkPath); m_writableDir = jni::ToNativeString(env, storagePath); @@ -94,6 +99,8 @@ namespace android // By default use external temporary folder m_tmpDir = m_externalTmpPath; + m_isPro = isPro; + LOG(LDEBUG, ("Apk path = ", m_resourcesDir)); LOG(LDEBUG, ("Writable path = ", m_writableDir)); LOG(LDEBUG, ("Local tmp path = ", m_localTmpPath)); diff --git a/android/jni/com/mapswithme/platform/Platform.hpp b/android/jni/com/mapswithme/platform/Platform.hpp index c2c3c3159c..d8096e122a 100644 --- a/android/jni/com/mapswithme/platform/Platform.hpp +++ b/android/jni/com/mapswithme/platform/Platform.hpp @@ -22,7 +22,8 @@ namespace android jstring storagePath, jstring tmpPath, jstring extTmpPath, - jstring settingsPath); + jstring settingsPath, + bool isPro); void OnExternalStorageStatusChanged(bool isAvailable); diff --git a/android/src/com/mapswithme/maps/MWMApplication.java b/android/src/com/mapswithme/maps/MWMApplication.java index b903edc89f..45a6fe47de 100644 --- a/android/src/com/mapswithme/maps/MWMApplication.java +++ b/android/src/com/mapswithme/maps/MWMApplication.java @@ -53,7 +53,8 @@ public class MWMApplication extends android.app.Application extStoragePath, getTmpPath(), extTmpPath, - getSettingsPath()); + getSettingsPath(), + mIsProVersion); } public LocationService getLocationService() @@ -117,5 +118,6 @@ public class MWMApplication extends android.app.Application String storagePath, String tmpPath, String extTmpPath, - String settingsPath); + String settingsPath, + boolean isPro); } diff --git a/iphone/Maps/Classes/SearchVC.mm b/iphone/Maps/Classes/SearchVC.mm index 78aebb5c68..80f4d4c77c 100644 --- a/iphone/Maps/Classes/SearchVC.mm +++ b/iphone/Maps/Classes/SearchVC.mm @@ -216,11 +216,7 @@ static void OnSearchResultCallback(search::Results const & res) - (BOOL)IsProVersion { - NSString * appID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; - // .travelguide corresponds to the Lite version without search - if ([appID rangeOfString:@"com.mapswithme.travelguide"].location != NSNotFound) - return FALSE; - return TRUE; + return GetPlatform().IsPro(); } - (void)viewWillAppear:(BOOL)animated diff --git a/platform/platform.cpp b/platform/platform.cpp index 2ba8d9386e..06e8ec7c03 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -38,12 +38,18 @@ string Platform::ResourcesMetaServerUrl() const string Platform::MetaServerUrl() const { - return "http://active.servers.url"; + if (m_isPro) + return "http://active.servers.url"; + else + return "http://active.servers.url"; } string Platform::DefaultUrlsJSON() const { - return "[\"http://1st.default.server/\",\"http://2nd.default.server/\",\"http://3rd.default.server/\"]"; + if (m_isPro) + return "[\"http://1st.default.server/\",\"http://2nd.default.server/\",\"http://3rd.default.server/\"]"; + else + return "[\"http://1st.default.server/\",\"http://2nd.default.server/\",\"http://3rd.default.server/\"]"; } void Platform::GetFontNames(FilesList & res) const diff --git a/platform/platform.hpp b/platform/platform.hpp index d14acc2595..ab9e8e98b6 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -26,6 +26,8 @@ protected: string m_tmpDir; /// Writable directory to store persistent application data string m_settingsDir; + /// Flag that it's a paid PRO version of app. + bool m_isPro; class PlatformImpl; /// Used only on those platforms where needed @@ -121,9 +123,13 @@ public: string UniqueClientId() const; + inline bool IsPro() const { return m_isPro; } + /// @return url for clients to download maps + //@{ string MetaServerUrl() const; string ResourcesMetaServerUrl() const; + //@} /// @return JSON-encoded list of urls if metaserver is unreachable string DefaultUrlsJSON() const; diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm index 3a377d9fe1..26edf42938 100644 --- a/platform/platform_ios.mm +++ b/platform/platform_ios.mm @@ -70,6 +70,10 @@ Platform::Platform() m_impl->m_scaleEtalonSize = 256 * 1.5 * [[UIScreen mainScreen] scale]; + NSString * appID = [[bundle infoDictionary] objectForKey:@"CFBundleIdentifier"]; + // .travelguide corresponds to the Lite version without search + m_isPro = ([appID rangeOfString:@"com.mapswithme.travelguide"].location == NSNotFound); + NSLog(@"Device: %@, SystemName: %@, SystemVersion: %@", device.model, device.systemName, device.systemVersion); [pool release]; diff --git a/platform/platform_qt.cpp b/platform/platform_qt.cpp index fdce4de879..ad93af0019 100644 --- a/platform/platform_qt.cpp +++ b/platform/platform_qt.cpp @@ -61,6 +61,15 @@ int Platform::VideoMemoryLimit() const /////////////////////////////////////////////////////////////////////////////// extern "C" Platform & GetPlatform() { - static Platform platform; + class PlatformQt : public Platform + { + public: + PlatformQt() + { + m_isPro = true; + } + }; + + static PlatformQt platform; return platform; }