Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ PODS:
- DKImagePickerController/PhotoGallery
- Flutter
- Flutter (1.0.0)
- fluttertoast (0.0.2):
- Flutter
- Toast
- path_provider (0.0.1):
- Flutter
- "permission_handler (5.1.0+2)":
Expand All @@ -50,12 +53,14 @@ PODS:
- shared_preferences (0.0.1):
- Flutter
- SwiftyGif (5.4.0)
- Toast (4.0.0)

DEPENDENCIES:
- agent_dart (from `.symlinks/plugins/agent_dart/ios`)
- agora_rtc_engine (from `.symlinks/plugins/agora_rtc_engine/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
Expand All @@ -67,6 +72,7 @@ SPEC REPOS:
- DKPhotoGallery
- SDWebImage
- SwiftyGif
- Toast

EXTERNAL SOURCES:
agent_dart:
Expand All @@ -77,6 +83,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
:path: Flutter
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
permission_handler:
Expand All @@ -92,11 +100,13 @@ SPEC CHECKSUMS:
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196

PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa

Expand Down
33 changes: 18 additions & 15 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -360,9 +360,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.0.1;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.0.2;
DEVELOPMENT_TEAM = M95BRQPU3N;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -372,7 +372,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.partyboard.pabd;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "partyBoard-prod";
PROVISIONING_PROFILE_SPECIFIER = "";
STRIP_STYLE = "non-global";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -385,7 +386,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -442,7 +443,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -500,9 +501,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.0.1;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.0.2;
DEVELOPMENT_TEAM = M95BRQPU3N;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -512,7 +513,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.partyboard.pabd;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "partyBoard-prod";
PROVISIONING_PROFILE_SPECIFIER = "";
STRIP_STYLE = "non-global";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -530,9 +532,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.0.1;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.0.2;
DEVELOPMENT_TEAM = M95BRQPU3N;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -543,7 +545,8 @@
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.partyboard.pabd;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "partyBoard-prod";
PROVISIONING_PROFILE_SPECIFIER = "";
STRIP_STYLE = "non-global";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
83 changes: 42 additions & 41 deletions lib/codepage.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:typed_data';

import 'package:agent_dart/agent_dart.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:partyboard_client/ICP/agent_factory.dart';
import 'package:partyboard_client/ICP/nais.dart';
import 'package:partyboard_client/loginpage.dart';
Expand All @@ -15,7 +16,7 @@ final TextEditingController myController = TextEditingController();

class CodePage extends StatelessWidget {
CodePage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -53,21 +54,19 @@ class CodePage extends StatelessWidget {
height: 10,
),
Container(
child: GridView.count(
crossAxisCount: 4,
shrinkWrap: true,
children: new List<Widget>.generate(16, (index) {
return new GridTile(
child: new Card(
child: GridView.count(
crossAxisCount: 4,
shrinkWrap: true,
children: new List<Widget>.generate(16, (index) {
return new GridTile(
child: new Card(
color: Colors.blue.shade200,
child: new Center(
child: new Text('$index'),
)
),
);
}),
)
),
)),
);
}),
)),
],
),
ElevatedButton(
Expand All @@ -79,34 +78,7 @@ class CodePage extends StatelessWidget {
borderRadius: BorderRadius.circular(32.0)),
minimumSize: Size(150, 50), //////// HERE
),
onPressed: () async {
var popup = showProgress(context, "PartyBoard Citizen Apply");
Uint8List seed = myController.text.substring(0, 64).toU8a();
var _identity = Ed25519KeyIdentity.generate(seed);
popup.setValue(0.2);
popup.setDetailLabel('Progress ${(0.2 * 100).toInt()}%..');
var _nais = NaisAgentFactory.create(
canisterId: naisCanisterId,
url: replicaUrl,
idl: naisIdl,
identity: _identity,
).hook(Nais());
var lifeId = await _nais.applyCitizen(myController.text);

popup.setValue(0.6);
popup.setDetailLabel('Progress ${(0.6 * 100).toInt()}%..');
var pkStr = PemCodec(PemLabel.privateKey).encode(_identity.getKeyPair().secretKey);
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(lifePrefsKey, lifeId.toText());
prefs.setString(pkeyPrefsKey, pkStr);
popup.setValue(1.0);
popup.setDetailLabel('Progress ${(1.0 * 100).toInt()}%..');

Navigator.of(context).push(
MaterialPageRoute(
builder: (c) => Scaffold(body: LoginPage())),
);
},
onPressed: () => joinClicked(context),
child: Text(
'->',
style: TextStyle(fontSize: buttonFontSize),
Expand All @@ -118,4 +90,33 @@ class CodePage extends StatelessWidget {
),
);
}

void joinClicked(BuildContext context) async {
try {
var popup = showProgress(context, "PartyBoard Citizen Apply");
Uint8List seed = myController.text.substring(0, 64).toU8a();
var _identity = Ed25519KeyIdentity.generate(seed);
popup.setValue(0.2);
popup.setDetailLabel('Progress ${(0.2 * 100).toInt()}%..');
var _nais = NaisAgentFactory.create(
canisterId: naisCanisterId,
url: replicaUrl,
idl: naisIdl,
identity: _identity,
).hook(Nais());
var lifeId = await _nais.applyCitizen(myController.text);
popup.setValue(0.6);
popup.setDetailLabel('Progress ${(0.6 * 100).toInt()}%..');
var pkStr = PemCodec(PemLabel.privateKey)
.encode(_identity.getKeyPair().secretKey);
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(lifePrefsKey, lifeId.toText());
prefs.setString(pkeyPrefsKey, pkStr);
popup.setValue(1.0);
popup.setDetailLabel('Progress ${(1.0 * 100).toInt()}%..');
Navigator.of(context).push(
MaterialPageRoute(builder: (c) => Scaffold(body: LoginPage())),
);
} catch (e) {}
}
}
2 changes: 2 additions & 0 deletions lib/generated_plugin_registrant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
// ignore_for_file: lines_longer_than_80_chars

import 'package:file_picker/src/file_picker_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';

import 'package:flutter_web_plugins/flutter_web_plugins.dart';

// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
FilePickerWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
version: "8.0.8"
font_awesome_flutter:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies:
agora_rtc_engine: ^4.0.7
permission_handler: ^8.1.6
http: ^0.13.0
fluttertoast: ^8.0.8

dev_dependencies:
flutter_test:
Expand Down