fixed bugs in ios version

This commit is contained in:
Semyon Babushkin
2017-12-22 20:43:04 +03:00
parent cd9a831571
commit 8f09940822
21 changed files with 161 additions and 43 deletions

View File

@@ -12,6 +12,8 @@ packages
pubspec.lock
.flutter-plugins
ios/Flutter
android/gradle
android/gradlew
android/gradlew.bat

Binary file not shown.

View File

@@ -5,14 +5,22 @@
#ifndef FLUTTER_FLUTTER_H_
#define FLUTTER_FLUTTER_H_
/**
BREAKING CHANGES:
November 29, 2017: Added a BREAKING CHANGES section.
*/
#include "FlutterAppDelegate.h"
#include "FlutterBinaryMessenger.h"
#include "FlutterChannels.h"
#include "FlutterCodecs.h"
#include "FlutterDartProject.h"
#include "FlutterHeadlessDartRunner.h"
#include "FlutterMacros.h"
#include "FlutterNavigationController.h"
#include "FlutterPlugin.h"
#include "FlutterTexture.h"
#include "FlutterViewController.h"
#endif // FLUTTER_FLUTTER_H_

View File

@@ -34,6 +34,12 @@ FLUTTER_EXPORT
// Defaults to window's rootViewController.
- (NSObject<FlutterBinaryMessenger>*)binaryMessenger;
// Can be overriden by subclasses to provide a custom FlutterTextureRegistry,
// typically a FlutterViewController, for plugin interop.
//
// Defaults to window's rootViewController.
- (NSObject<FlutterTextureRegistry>*)textures;
@end
#endif // FLUTTER_FLUTTERDARTPROJECT_H_

View File

@@ -291,6 +291,10 @@ FLUTTER_EXPORT
Invoked when the last listener is deregistered from the Stream associated to
this channel on the Flutter side.
The channel implementation may call this method with `nil` arguments
to separate a pair of two consecutive set up requests. Such request pairs
may occur during Flutter hot restart.
- Parameter arguments: Arguments for the stream.
- Returns: A FlutterError instance, if teardown fails.
*/

View File

@@ -99,7 +99,7 @@ FLUTTER_EXPORT
On the Dart side, these values are represented as follows:
- `nil` or `NSNull`: `null`
- `nil` or `NSNull`: null
- `NSNumber`: `bool`, `int`, or `double`, depending on the contained value.
- `FlutterStandardBigInteger`: `int`
- `NSString`: `String`

View File

@@ -0,0 +1,34 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FLUTTERHEADLESSDARTRUNNER_H_
#define FLUTTER_FLUTTERHEADLESSDARTRUNNER_H_
#import <Foundation/Foundation.h>
#include "FlutterDartProject.h"
#include "FlutterMacros.h"
/**
The FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer,
and no native drawing surface. It is appropriate for use in running Dart
code e.g. in the background from a plugin.
*/
FLUTTER_EXPORT
@interface FlutterHeadlessDartRunner : NSObject
/**
Runs a Dart function on an Isolate that is not the main application's Isolate.
The first call will create a new Isolate. Subsequent calls will reuse that
Isolate. The Isolate is destroyed when the FlutterHeadlessDartRunner is
destroyed.
- Parameter entrypoint: The name of a top-level function from the same Dart
library that contains the app's main() function.
*/
- (void)runWithEntrypoint:(NSString*)entrypoint;
@end
#endif // FLUTTER_FLUTTERHEADLESSDARTRUNNER_H_

View File

@@ -20,4 +20,21 @@
#define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#endif // defined(NS_ASSUME_NONNULL_BEGIN)
/**
Indicates that the API has been deprecated for the specifed reason. Code that
uses the deprecated API will continue to work as before. However, the API will
soon become unavailable and users are encouraged to immediately take the
appropriate action mentioned in the deprecation message and the BREAKING
CHANGES section present in the Flutter.h umbrella header.
*/
#define FLUTTER_DEPRECATED(msg) __attribute__((__deprecated__(msg)))
/**
Indicates that the previously deprecated API is now unavailable. Code that
uses the API will not work and the declaration of the API is only a stub meant
to display the given message detailing the actions for the user to take
immediately.
*/
#define FLUTTER_UNAVAILABLE(msg) __attribute__((__unavailable__(msg)))
#endif // FLUTTER_FLUTTERMACROS_H_

View File

@@ -10,6 +10,7 @@
#include "FlutterBinaryMessenger.h"
#include "FlutterChannels.h"
#include "FlutterCodecs.h"
#include "FlutterTexture.h"
NS_ASSUME_NONNULL_BEGIN
@protocol FlutterPluginRegistrar;
@@ -142,6 +143,14 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (NSObject<FlutterBinaryMessenger>*)messenger;
/**
Returns a `FlutterTextureRegistry` for registering textures
provided by the plugin.
- Returns: The texture registry.
*/
- (NSObject<FlutterTextureRegistry>*)textures;
/**
Publishes a value for external use of the plugin.

View File

@@ -0,0 +1,29 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FLUTTERTEXTURE_H_
#define FLUTTER_FLUTTERTEXTURE_H_
#import <CoreMedia/CoreMedia.h>
#import <Foundation/Foundation.h>
#include "FlutterMacros.h"
NS_ASSUME_NONNULL_BEGIN
FLUTTER_EXPORT
@protocol FlutterTexture<NSObject>
- (CVPixelBufferRef)copyPixelBuffer;
@end
FLUTTER_EXPORT
@protocol FlutterTextureRegistry<NSObject>
- (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture;
- (void)textureFrameAvailable:(int64_t)textureId;
- (void)unregisterTexture:(int64_t)textureId;
@end
NS_ASSUME_NONNULL_END
#endif // FLUTTER_FLUTTERTEXTURE_H_

View File

@@ -11,9 +11,10 @@
#include "FlutterBinaryMessenger.h"
#include "FlutterDartProject.h"
#include "FlutterMacros.h"
#include "FlutterTexture.h"
FLUTTER_EXPORT
@interface FlutterViewController : UIViewController<FlutterBinaryMessenger>
@interface FlutterViewController : UIViewController<FlutterBinaryMessenger, FlutterTextureRegistry>
- (instancetype)initWithProject:(FlutterDartProject*)project
nibName:(NSString*)nibNameOrNil

View File

@@ -1,9 +1,9 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/ntrlab/flutter
FLUTTER_APPLICATION_PATH=/Users/ntrlab/semyon/apps/dinect
FLUTTER_TARGET=lib/main.dart
FLUTTER_ROOT=/Users/supermyon/Documents/flutter
FLUTTER_APPLICATION_PATH=/Users/supermyon/Documents/Apps/checker
FLUTTER_TARGET=/Users/supermyon/Documents/Apps/checker/lib/main.dart
FLUTTER_BUILD_MODE=debug
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/ntrlab/flutter/bin/cache/artifacts/engine/ios
FLUTTER_FRAMEWORK_DIR=/Users/supermyon/Documents/flutter/bin/cache/artifacts/engine/ios
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"

Binary file not shown.

View File

@@ -1,8 +1,8 @@
PODS:
- Flutter (1.0.0)
- FMDB (2.6.2):
- FMDB/standard (= 2.6.2)
- FMDB/standard (2.6.2)
- FMDB (2.7.2):
- FMDB/standard (= 2.7.2)
- FMDB/standard (2.7.2)
- image_picker (0.0.1):
- Flutter
- path_provider (0.0.1):
@@ -12,28 +12,28 @@ PODS:
- FMDB
DEPENDENCIES:
- Flutter (from `/Users/ntrlab/flutter/bin/cache/artifacts/engine/ios`)
- image_picker (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.3/ios`)
- path_provider (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios`)
- sqflite (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.4/ios`)
- Flutter (from `/Users/supermyon/Documents/flutter/bin/cache/artifacts/engine/ios`)
- image_picker (from `/Users/supermyon/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios`)
- path_provider (from `/Users/supermyon/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`)
- sqflite (from `/Users/supermyon/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.4/ios`)
EXTERNAL SOURCES:
Flutter:
:path: /Users/ntrlab/flutter/bin/cache/artifacts/engine/ios
:path: /Users/supermyon/Documents/flutter/bin/cache/artifacts/engine/ios
image_picker:
:path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.3/ios
:path: /Users/supermyon/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios
path_provider:
:path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios
:path: /Users/supermyon/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios
sqflite:
:path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.4/ios
:path: /Users/supermyon/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.4/ios
SPEC CHECKSUMS:
Flutter: d674e78c937094a75ac71dd77e921e840bea3dbf
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa
image_picker: a211f28b95a560433c00f5cd3773f4710a20404d
path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
sqflite: 8e2d9fe1e7cdc95d4d537fc7eb2d23c8dc428e3c
PODFILE CHECKSUM: 351e02e34b831289961ec3558a535cbd2c4965d2
COCOAPODS: 1.2.1
COCOAPODS: 1.3.1

View File

@@ -370,7 +370,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
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";
showEnvVarsInLog = 0;
};
ACE861291F9F745B006FEF38 /* Run Script */ = {
@@ -408,7 +408,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../../../flutter/bin/cache/artifacts/engine/ios-release/Flutter.framework",
"${PODS_ROOT}/../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "0"
version = "2.0">
</Bucket>

View File

@@ -92,6 +92,9 @@
ScannerViewController *modalViewController = [ScannerViewController new];
modalViewController.platformChannel = weekPlatformChannel;
[controller presentViewController:modalViewController animated:YES completion:nil];
// [weekPlatformChannel invokeMethod:(@"findUserAndPurchase") arguments: @[@"79039441628", @"phone"]];
} else if ([@"isOnline" isEqualToString:call.method]) {
result(@YES);
} else if ([@"getSupportPhone" isEqualToString:call.method]) {

View File

@@ -81,6 +81,7 @@ extension ZBarSymbolSet: Sequence {
self.addChildViewController(readerViewController)
self.view.addSubview(readerViewController.view)
readerViewController.didMove(toParentViewController: self)
readerViewController.view.addSubview(topView)
topView.addSubview(textField)
@@ -120,11 +121,14 @@ extension ZBarSymbolSet: Sequence {
}
func sendResult(_ str: String) {
platformChannel?.invokeMethod("findUserAndPurchase", arguments: [str, buttonState.searchType], result: { (result: Any?) in
platformChannel?.invokeMethod("findUser", arguments: [str, buttonState.searchType], result: { (result: Any?) in
if result is FlutterError {
self.showErrorAlert(str)
} else {
self.presentingViewController?.dismiss(animated: false, completion: { self.dismiss(animated: true) })
self.dismiss(animated: true) {
self.platformChannel?.invokeMethod("purchase", arguments: [result, str])
}
}
print("result: \(result.debugDescription )")
})
@@ -139,6 +143,9 @@ extension ZBarSymbolSet: Sequence {
)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.default,handler: nil))
// if let appDelegate = UIApplication.shared.delegate as? FlutterAppDelegate {
// appDelegate.window.rootViewController?.present(alertController, animated: true, completion: nil)
// }
self.present(alertController, animated: true, completion: nil)
}
@@ -157,7 +164,7 @@ extension ZBarSymbolSet: Sequence {
readerViewController.view.frame = view.bounds
topView.frame = CGRect(x: 0, y: 0, width: readerViewController.view.frame.size.width, height: 40)
textField.frame = CGRect(x: settingButton.frame.maxX + 8, y: 5, width: readerViewController.view.frame.size.width - 50, height: 30)
textField.frame = CGRect(x: settingButton.frame.maxX + 8 + 20 + 5, y: 5, width: readerViewController.view.frame.size.width - 50, height: 30)
settingButton.frame = CGRect(x: 8, y: 10, width: 20, height: 20)
}

View File

@@ -101,7 +101,7 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
if (call.method == 'logout') {
forceLogout(token, context);
} else if (call.method == 'findUserAndPurchase') {
} else if (call.method == 'findUser') {
var userResponse;
String cardPhone = call.arguments[0];
@@ -129,25 +129,10 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
print(error);
}
print(users.length);
if (users.length > 0) {
String userString = '${users[0]['first_name']} ${users[0]['last_name']}';
print(userString);
print(cardPhone);
// pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), cardPhone));
var route = new MaterialPageRoute<Null>(
builder: (BuildContext context) =>
new PurchaseScreen(helper, app, JSON.encode(users[0]), cardPhone)
);
while (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
}
Navigator.of(context).pushReplacement(route);
return users[0];
} else {
startScanner(context, app, helper);
throw new FlutterError("Users not found");
}
@@ -157,8 +142,16 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} else if (call.method == 'settings') {
pushRoute(context, new SettingsScreen(helper, app, true));
} else {
String userString = call.arguments[0];
String userString;
if (call.arguments[0] is String) {
userString = call.arguments[0];
} else {
userString = JSON.encode(call.arguments[0]);
}
print(userString);
String card = call.arguments[1];
print('$userString, $card');
var route = new MaterialPageRoute<Null>(