Skip to content

Commit 3024805

Browse files
Merge branch 'bugfix-13236' into release-6.6.4
2 parents 7098c56 + ba5dcbc commit 3024805

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

docs/dictionary/command/mobilePickPhoto.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<doc> <legacy_id></legacy_id> <name>mobilePickPhoto</name> <type>command</type> <syntax> <example>mobilePickPhoto <i>source</i> [, <i>maxwidth</i> [, <i>maxheight</i>] ] </example> </syntax> <synonyms> <synonym>iphonePickPhoto</synonym> </synonyms> <summary>Displays the iPhone or Android native photo picker.</summary> <examples><example>mobilePickPhoto &quot;library&quot;</example><example>mobilePickPhoto &quot;front camera&quot;, 250, 250</example> </examples> <history> <introduced version="4.5.2">Added.</introduced> <deprecated version=""></deprecated> <removed version=""></removed> <changed version="4.6.1">4.6.1</changed> </history> <objects> </objects> <platforms> <ios/> <android/> </platforms> <classes> <mobile/> </classes> <security> </security> <classification> </classification> <references> </references> <description> <overview>Use the <b>mobilePickPhoto</b> command to allow the user to select an image.</overview> <parameters> <parameter> <name>source</name> <description>The source for the image. One of:</description> <options title=""> <option> <item>library</item> <description/> </option> <option> <item>album</item> <description/> </option> <option> <item>camera</item> <description/> </option> <option> <item>rear camera</item> <description>iOS only</description> </option> <option> <item>front camera</item> <description>iOS only</description> </option> </options> </parameter> <parameter> <name>maxwidth</name> <description>The maximum allowed width of the image.</description> </parameter> <parameter> <name>maxheight</name> <description>The maximum allowed height of the image.</description> </parameter> </parameters> <value></value> <comments>The <b>mobilePickPhoto</b> displays the iPhone or Android native photo picker, allowing the user to select a photo from the device&apos;s photo library, take a photo using the device cameras or select a photo from the device&apos;s recent camera roll.<p></p><p>When running on an iPhone or Android, the photo-picker is displayed using the standard iOS fullscreen overlay view. When running on an iPad, the photo-picker is displayed using a standard iOS pop-over. In this case, the pop-over is positioned relative to the rect of the target at the time the <b>mobilePickPhoto</b> command was called.</p><p></p><p>If the <i>source</i> type is not available on the target device, the command returns with result source not available. If the user cancels the pick, the command returns with result cancel. Otherwise a new image object is created on the current card of the default stack containing the chosen image.</p><p></p><p>The <i>maxwidth</i> and <i>maxheight</i> parameters are only available on iOS devices and constrain the maximum size of an image. The chosen image is scaled down proportionally to fit within the size specified. If either size specified is 0, then the parameter is ignored.</p><p></p><p></p><p></p><note>The image object is cloned from the <keyword tag="templateImage">templateImage</keyword>, so you can use this to configure settings before calling the picker.</note><p></p><p></p><p></p><note>Android: <b>mobilePickPhoto</b> requires &apos;Camera&apos; and &apos;External Storage&apos; permissions. Set these in the standalone application settings pane. Not setting this permission will result in a &quot;could not create temporary image file&quot; error.</note></comments> </description></doc>
1+
<doc> <legacy_id></legacy_id> <name>mobilePickPhoto</name> <type>command</type> <syntax> <example>mobilePickPhoto <i>source</i> [, <i>maxwidth</i> [, <i>maxheight</i>] ] </example> </syntax> <synonyms> <synonym>iphonePickPhoto</synonym> </synonyms> <summary>Displays the iPhone or Android native photo picker.</summary> <examples><example>mobilePickPhoto &quot;library&quot;</example><example>mobilePickPhoto &quot;front camera&quot;, 250, 250</example> </examples> <history> <introduced version="4.5.2">Added.</introduced> <deprecated version=""></deprecated> <removed version=""></removed> <changed version="4.6.1">4.6.1</changed> </history> <objects> </objects> <platforms> <ios/> <android/> </platforms> <classes> <mobile/> </classes> <security> </security> <classification> </classification> <references> </references> <description> <overview>Use the <b>mobilePickPhoto</b> command to allow the user to select an image.</overview> <parameters> <parameter> <name>source</name> <description>The source for the image. One of:</description> <options title=""> <option> <item>library</item> <description/> </option> <option> <item>album</item> <description/> </option> <option> <item>camera</item> <description/> </option> <option> <item>rear camera</item> <description>iOS only</description> </option> <option> <item>front camera</item> <description>iOS only</description> </option> </options> </parameter> <parameter> <name>maxwidth</name> <description>The maximum allowed width of the image.</description> </parameter> <parameter> <name>maxheight</name> <description>The maximum allowed height of the image.</description> </parameter> </parameters> <value></value> <comments>The <b>mobilePickPhoto</b> displays the iPhone or Android native photo picker, allowing the user to select a photo from the device&apos;s photo library, take a photo using the device cameras or select a photo from the device&apos;s recent camera roll.<p></p><p>When running on an iPhone or Android, the photo-picker is displayed using the standard iOS fullscreen overlay view. The same happens when running on an iPad and the supported orientations for the app contain any of landscape right, landscape left, portrait upside down. On the contrary, when running on an iPad and the supported orientations for the app contain only portrait, then the photo-picker is displayed using a standard iOS pop-over. In this case, the pop-over is positioned relative to the rect of the target at the time the <b>mobilePickPhoto</b> command was called.</p><p></p><p>If the <i>source</i> type is not available on the target device, the command returns with result source not available. If the user cancels the pick, the command returns with result cancel. Otherwise a new image object is created on the current card of the default stack containing the chosen image.</p><p></p><p>The <i>maxwidth</i> and <i>maxheight</i> parameters are only available on iOS devices and constrain the maximum size of an image. The chosen image is scaled down proportionally to fit within the size specified. If either size specified is 0, then the parameter is ignored.</p><p></p><p></p><p></p><note>The image object is cloned from the <keyword tag="templateImage">templateImage</keyword>, so you can use this to configure settings before calling the picker.</note><p></p><p></p><p></p><note>Android: <b>mobilePickPhoto</b> requires &apos;Camera&apos; and &apos;External Storage&apos; permissions. Set these in the standalone application settings pane. Not setting this permission will result in a &quot;could not create temporary image file&quot; error.</note></comments> </description></doc>

docs/notes/bugfix-13236.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# mobilePickPhoto camera view is rotated on iPad when in landscape or in portraitUpsideDown

engine/src/mbliphonecamera.mm

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,22 @@ - (NSData *)takeImageData
148148
// 19/10/2010 IM - fix crash in iOS4.0
149149
// UIPopoverController only available on iPad but NSClassFromString returns non-nil in iOS4 phone/pod
150150
// AL-2013-10-04 [[ Bug 11255 ]] Uninitialised variable can cause crash in iPhonePickPhoto
151-
id t_popover = nil;
152-
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
153-
t_popover = NSClassFromString(@"UIPopoverController");
151+
id t_popover = nil;
152+
uint32_t t_orientations;
153+
t_orientations = [[MCIPhoneApplication sharedApplication] allowedOrientations];
154+
bool t_allowed_landscape = false;
155+
bool t_allowed_portrait_upside_down = false;
156+
157+
if ((t_orientations & (1 << UIInterfaceOrientationLandscapeLeft)) != 0 || (t_orientations & (1 << UIInterfaceOrientationLandscapeRight)) != 0)
158+
t_allowed_landscape = true;
159+
160+
if ((t_orientations & (1 << UIInterfaceOrientationPortraitUpsideDown)) != 0)
161+
t_allowed_portrait_upside_down = true;
162+
163+
// PM-2014-10-13: [[ Bug 13236 ]] If we are on iPad and the supported orientations contain any of LandscapeLeft, LandscapeRight, PortraitUpsideDown,
164+
// then the photo-picker is displayed using the standard iOS fullscreen overlay view (as it is the case with iphone)
165+
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && !t_allowed_landscape && !t_allowed_portrait_upside_down)
166+
t_popover = NSClassFromString(@"UIPopoverController");
154167

155168
if (t_popover != nil)
156169
{

0 commit comments

Comments
 (0)