diff options
author | Mark Kuo <starryalley@gmail.com> | 2019-09-24 17:29:02 +1000 |
---|---|---|
committer | Mark Kuo <starryalley@gmail.com> | 2019-09-25 12:35:45 +1000 |
commit | bba9d9123c0acebe4339900b351d3d409269677e (patch) | |
tree | 00df26a67f9f9335ae2106f28ba406fc8b60f595 /platform/iphone/ios.mm | |
parent | dd3e17588eab8fe0c41fa11f4d33c3fbe5f6dc94 (diff) |
ios: support get_model_name
Diffstat (limited to 'platform/iphone/ios.mm')
-rw-r--r-- | platform/iphone/ios.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm index 686422ceb2..6e986df493 100644 --- a/platform/iphone/ios.mm +++ b/platform/iphone/ios.mm @@ -29,6 +29,7 @@ /*************************************************************************/ #include "ios.h" +#include <sys/sysctl.h> #import <UIKit/UIKit.h> @@ -42,6 +43,21 @@ void iOS::alert(const char *p_alert, const char *p_title) { [alert show]; } +String iOS::get_model() const { + // [[UIDevice currentDevice] model] only returns "iPad" or "iPhone". + size_t size; + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *model = (char *)malloc(size); + if (model == NULL) { + return ""; + } + sysctlbyname("hw.machine", model, &size, NULL, 0); + NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding]; + free(model); + const char *str = [platform UTF8String]; + return String(str != NULL ? str : ""); +} + String iOS::get_rate_url(int p_app_id) const { String templ = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID"; String templ_iOS7 = "itms-apps://itunes.apple.com/app/idAPP_ID"; |