Skip to content

Commit 01e02e0

Browse files
authored
Merge pull request #2 from youngmonkeys/dev
update ssl
2 parents bcead70 + b69ab2b commit 01e02e0

File tree

14 files changed

+137
-15
lines changed

14 files changed

+137
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Podfile.lock
12
# Miscellaneous
23
*.class
34
*.log

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
flutter client for [ezyfox server](https://github.com/youngmonkeys/ezyfox-server)
44

5+
# Architecture
6+
7+
<img src="https://raw.githubusercontent.com/youngmonkeys/ezyfox-server-flutter-client/master/images/flutter-sdk.png" />
8+
59
# Prepare
610

711
1. Download and install [JDK 8](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html)
@@ -24,16 +28,16 @@ [email protected]:youngmonkeys/ezyfox-server-flutter-client.git
2428
git submodule update --remote --recursive
2529
```
2630

27-
### 3. Import source code:
31+
### 3. Import source code
2832

2933
- To IntelliJ IDE: for all
3034
- To Xcode: for iOS
3135
- To Android studio: for Android
3236

33-
### 4. You can run:
37+
### 4. You can run
3438

3539
- [main.dart](https://github.com/youngmonkeys/ezyfox-server-flutter-client/blob/master/lib/main.dart) on Intellij
36-
- Build and Run on Xcode for iOS
40+
- Build and Run on Xcode for iOS, don't for get run `pod install`
3741
- Build and run on Android Studio for Android
3842

3943
### 5. Where need I click?

images/flutter-sdk.png

239 KB
Loading

ios/Flutter/Debug.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#include "Generated.xcconfig"
2+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"

ios/Flutter/Release.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#include "Generated.xcconfig"
2+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"

ios/Podfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Uncomment the next line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
target 'Runner' do
5+
# Comment the next line if you don't want to use dynamic frameworks
6+
use_frameworks!
7+
8+
# Pods for Runner
9+
10+
pod 'OpenSSL-Universal'
11+
12+
end

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 51;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -13,6 +13,7 @@
1313
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1414
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1515
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16+
D44C6451496F39C9524E09C3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30425E68A0587C2952C7A950 /* Pods_Runner.framework */; };
1617
F17E4714269A6C4F00668CED /* EzyNativeDataSerializer.mm in Sources */ = {isa = PBXBuildFile; fileRef = F17E4657269A6C4E00668CED /* EzyNativeDataSerializer.mm */; };
1718
F17E4715269A6C4F00668CED /* EzyClientConfigSerializer.mm in Sources */ = {isa = PBXBuildFile; fileRef = F17E4658269A6C4E00668CED /* EzyClientConfigSerializer.mm */; };
1819
F17E4716269A6C4F00668CED /* EzyNativeDataDeserializer.mm in Sources */ = {isa = PBXBuildFile; fileRef = F17E465B269A6C4E00668CED /* EzyNativeDataDeserializer.mm */; };
@@ -109,9 +110,12 @@
109110
/* End PBXCopyFilesBuildPhase section */
110111

111112
/* Begin PBXFileReference section */
113+
03332054315A3AE09980408C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
112114
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
113115
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
116+
30425E68A0587C2952C7A950 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
114117
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
118+
6B2CC68C51353B6B50C55957 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
115119
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
116120
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
117121
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -122,6 +126,7 @@
122126
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
123127
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
124128
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
129+
B461B3840AFCB3A8BABC2A51 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
125130
F17E4657269A6C4E00668CED /* EzyNativeDataSerializer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EzyNativeDataSerializer.mm; sourceTree = "<group>"; };
126131
F17E4658269A6C4E00668CED /* EzyClientConfigSerializer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EzyClientConfigSerializer.mm; sourceTree = "<group>"; };
127132
F17E4659269A6C4E00668CED /* EzyNativeDataDeserializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EzyNativeDataDeserializer.h; sourceTree = "<group>"; };
@@ -291,12 +296,23 @@
291296
isa = PBXFrameworksBuildPhase;
292297
buildActionMask = 2147483647;
293298
files = (
299+
D44C6451496F39C9524E09C3 /* Pods_Runner.framework in Frameworks */,
294300
);
295301
runOnlyForDeploymentPostprocessing = 0;
296302
};
297303
/* End PBXFrameworksBuildPhase section */
298304

299305
/* Begin PBXGroup section */
306+
2EE83825BB93B668DB4A8852 /* Pods */ = {
307+
isa = PBXGroup;
308+
children = (
309+
B461B3840AFCB3A8BABC2A51 /* Pods-Runner.debug.xcconfig */,
310+
6B2CC68C51353B6B50C55957 /* Pods-Runner.release.xcconfig */,
311+
03332054315A3AE09980408C /* Pods-Runner.profile.xcconfig */,
312+
);
313+
path = Pods;
314+
sourceTree = "<group>";
315+
};
300316
9740EEB11CF90186004384FC /* Flutter */ = {
301317
isa = PBXGroup;
302318
children = (
@@ -315,6 +331,7 @@
315331
97C146F01CF9000F007C117D /* Runner */,
316332
97C146EF1CF9000F007C117D /* Products */,
317333
F17E46512699D40000668CED /* Frameworks */,
334+
2EE83825BB93B668DB4A8852 /* Pods */,
318335
);
319336
sourceTree = "<group>";
320337
};
@@ -345,6 +362,7 @@
345362
F17E46512699D40000668CED /* Frameworks */ = {
346363
isa = PBXGroup;
347364
children = (
365+
30425E68A0587C2952C7A950 /* Pods_Runner.framework */,
348366
);
349367
name = Frameworks;
350368
sourceTree = "<group>";
@@ -765,12 +783,14 @@
765783
isa = PBXNativeTarget;
766784
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
767785
buildPhases = (
786+
EC309B84265F1B993387303B /* [CP] Check Pods Manifest.lock */,
768787
9740EEB61CF901F6004384FC /* Run Script */,
769788
97C146EA1CF9000F007C117D /* Sources */,
770789
97C146EB1CF9000F007C117D /* Frameworks */,
771790
97C146EC1CF9000F007C117D /* Resources */,
772791
9705A1C41CF9048500538489 /* Embed Frameworks */,
773792
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
793+
25531C6403BEB076D77D440D /* [CP] Embed Pods Frameworks */,
774794
);
775795
buildRules = (
776796
);
@@ -845,6 +865,23 @@
845865
/* End PBXResourcesBuildPhase section */
846866

847867
/* Begin PBXShellScriptBuildPhase section */
868+
25531C6403BEB076D77D440D /* [CP] Embed Pods Frameworks */ = {
869+
isa = PBXShellScriptBuildPhase;
870+
buildActionMask = 2147483647;
871+
files = (
872+
);
873+
inputFileListPaths = (
874+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
875+
);
876+
name = "[CP] Embed Pods Frameworks";
877+
outputFileListPaths = (
878+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
879+
);
880+
runOnlyForDeploymentPostprocessing = 0;
881+
shellPath = /bin/sh;
882+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
883+
showEnvVarsInLog = 0;
884+
};
848885
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
849886
isa = PBXShellScriptBuildPhase;
850887
buildActionMask = 2147483647;
@@ -873,6 +910,28 @@
873910
shellPath = /bin/sh;
874911
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
875912
};
913+
EC309B84265F1B993387303B /* [CP] Check Pods Manifest.lock */ = {
914+
isa = PBXShellScriptBuildPhase;
915+
buildActionMask = 2147483647;
916+
files = (
917+
);
918+
inputFileListPaths = (
919+
);
920+
inputPaths = (
921+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
922+
"${PODS_ROOT}/Manifest.lock",
923+
);
924+
name = "[CP] Check Pods Manifest.lock";
925+
outputFileListPaths = (
926+
);
927+
outputPaths = (
928+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
929+
);
930+
runOnlyForDeploymentPostprocessing = 0;
931+
shellPath = /bin/sh;
932+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
933+
showEnvVarsInLog = 0;
934+
};
876935
/* End PBXShellScriptBuildPhase section */
877936

878937
/* Begin PBXSourcesBuildPhase section */
@@ -1091,6 +1150,7 @@
10911150
GCC_OPTIMIZATION_LEVEL = 0;
10921151
GCC_PREPROCESSOR_DEFINITIONS = (
10931152
"DEBUG=1",
1153+
"EZY_SSL_ENABLE=1",
10941154
"$(inherited)",
10951155
);
10961156
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/client/proxy/EzyMethodProxy.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,10 @@ - (NSObject *)invoke:(NSDictionary *)params {
301301
EzyClient* client = getClient(params);
302302
NSString* cmd = [request objectForKey:@"command"];
303303
NSArray* data = [request objectForKey:@"data"];
304+
NSNumber* encrypted = [request objectForKey:@"encrypted"];
304305
EzyArray* array = (EzyArray*)[EzyNativeSerializers fromReadableArray:data];
305306
EzyCommand command = sNativeCommandIds[[cmd UTF8String]];
306-
client->send(command, array);
307+
client->send(command, array, [encrypted boolValue]);
307308
return [NSNumber numberWithBool:TRUE];
308309
}
309310

@@ -348,10 +349,10 @@ @implementation EzyGenerateKeyPairMethod
348349

349350
- (NSObject *)invoke:(NSDictionary *)params {
350351
EzyKeyPairProxy* keyPair = [[EzyRSAProxy getInstance] generateKeyPair];
351-
NSData* publicKey = [[keyPair publicKey] dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
352+
NSString* publicKey = [keyPair publicKey];
352353
NSData* privateKey = [[keyPair privateKey] dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
353354
NSDictionary* answer = [NSMutableDictionary dictionary];
354-
[answer setValue:[FlutterStandardTypedData typedDataWithBytes:publicKey] forKey:@"publicKey"];
355+
[answer setValue:publicKey forKey:@"publicKey"];
355356
[answer setValue:[FlutterStandardTypedData typedDataWithBytes:privateKey] forKey:@"privateKey"];
356357
return answer;
357358
}

ios/client/serializer/EzyNativeDataDeserializer.mm

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,42 @@ - (void)deserializeToArray:(EzyArray*)output value:(NSObject*)value {
7373
NSData* realData = [data data];
7474
output->addByteArray(std::string((char*)[realData bytes], [realData length]));
7575
}
76+
else if(dataType == FlutterStandardDataTypeInt32) {
77+
EzyArray *array = new EzyArray();
78+
NSData* realData = [data data];
79+
int32_t* int32Array = (int32_t*)[realData bytes];
80+
for(int i = 0 ; i < [realData length] ; ++i) {
81+
array->addInt(int32Array[i]);
82+
}
83+
output->addArray(array);
84+
}
85+
else if(dataType == FlutterStandardDataTypeInt64) {
86+
EzyArray *array = new EzyArray();
87+
NSData* realData = [data data];
88+
int64_t* int64Array = (int64_t*)[realData bytes];
89+
for(int i = 0 ; i < [realData length] ; ++i) {
90+
array->addInt(int64Array[i]);
91+
}
92+
output->addArray(array);
93+
}
94+
else if(dataType == FlutterStandardDataTypeFloat32) {
95+
EzyArray *array = new EzyArray();
96+
NSData* realData = [data data];
97+
float* floatArray = (float*)[realData bytes];
98+
for(int i = 0 ; i < [realData length] ; ++i) {
99+
array->addFloat(floatArray[i]);
100+
}
101+
output->addArray(array);
102+
}
103+
else {
104+
EzyArray *array = new EzyArray();
105+
NSData* realData = [data data];
106+
double* doubleArray = (double*)[realData bytes];
107+
for(int i = 0 ; i < [realData length] ; ++i) {
108+
array->addDouble(doubleArray[i]);
109+
}
110+
output->addArray(array);
111+
}
76112
}
77113
else {
78114
@throw [NSException exceptionWithName:@"NSInvalidArgumentException"

0 commit comments

Comments
 (0)