Commit 9ccf6b20 authored by armin's avatar armin
Browse files

Merge branch 'master' into 'production'

Master

See merge request !50
parents 3c827ab4 79af8c5e
Pipeline #142 passed with stage
in 2 minutes and 23 seconds
No preview for this file type
Subproject commit ae67df7f380b389b35f33640399da4e6b16a27c0
Subproject commit cde73995a5fa3fcd7a6b7f8baa14faaf74eb0287
No preview for this file type
......@@ -25,7 +25,7 @@ else:unix: PRE_TARGETDEPS += $$OUT_PWD/../engine/libengine.a
TARGET = fairchat
VER_MAJ = 1
VER_MIN = 1
VER_PAT = 5
VER_PAT = 6
VERSION = $$sprintf("%1.%2.%3",$$VER_MAJ,$$VER_MIN,$$VER_PAT)
DEFINES += VERSION=\\\"$$VERSION\\\"
......@@ -94,7 +94,7 @@ ios{
ios/src/shareheplersingelton.mm
LIBS += -framework UserNotifications
LIBS += -framework UserNotifications -framework Photos
RESOURCES += ios.qrc
......
No preview for this file type
......@@ -92,7 +92,7 @@
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>2017.11.24.0153</string>
<string>2018.02.17.1908</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
......@@ -116,7 +116,7 @@
<string>remote-notification</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<false/>
<key>UILaunchStoryboardName</key>
<string>Launch</string>
<key>UISupportedInterfaceOrientations</key>
......
......@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Photos/Photos.h>
#include <QtGui>
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QString>
......@@ -15,6 +16,7 @@
#include "ios/IosGalleryPicker.h"
@interface IosGalleryPickerDelegate : NSObject<UIImagePickerControllerDelegate,UINavigationControllerDelegate>{
IosGalleryPicker *mIosPicker;
}
......@@ -35,20 +37,33 @@
{
UIImage *orig = [info valueForKey:UIImagePickerControllerOriginalImage];
NSData *imgData = UIImagePNGRepresentation(orig);
NSURL *refURL = [info valueForKey:UIImagePickerControllerReferenceURL];
PHFetchResult *result = [PHAsset fetchAssetsWithALAssetURLs:@[refURL] options:nil];
NSString *filename = [[result firstObject] filename];
QString qFilename = QString::fromNSString(filename);
QStringList fileParts = qFilename.split(".");
QString fileExt = fileParts[fileParts.length()-1];
NSData *imgData = nil;
if(!fileExt.compare("png",Qt::CaseInsensitive)){
imgData = UIImagePNGRepresentation(orig);
}else{
imgData = UIImageJPEGRepresentation(orig, 1.0);
}
QByteArray qImgData = QByteArray::fromNSData(imgData);
QMimeDatabase mimeDb;
QMimeType mimeType = mimeDb.mimeTypeForData(qImgData);
QString path = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation );
path += "/picker."+mimeType.preferredSuffix();
path += "/"+QString::fromNSString(filename);
QFile destFile(path);
destFile.open(QFile::WriteOnly);
destFile.write(qImgData);
mIosPicker->receiveFile(path);
[picker dismissViewControllerAnimated:YES completion:NULL];
[picker release];
if(destFile.write(qImgData)>0){
mIosPicker->receiveFile(path);
[picker dismissViewControllerAnimated:YES completion:NULL];
[picker release];
}
}
@end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment