Skip to content

Commit

Permalink
Release into main (#10)
Browse files Browse the repository at this point in the history
* add nfc reader

* improve scanner

* add nfc listener

* Text update

* improve ui

* add ios compatibility

* update gitignore

* update version

* add missing dependency

* remove unnecessary files from git

* add missing dependency

* center scan widgets

* add missing file

* fix version

---------

Co-authored-by: Lorenz Cuno Klopfenstein <[email protected]>
  • Loading branch information
giandifra and LorenzCK authored May 13, 2024
1 parent ce198f5 commit 0255a8d
Show file tree
Hide file tree
Showing 29 changed files with 2,802 additions and 350 deletions.
1 change: 0 additions & 1 deletion .fvm/flutter_sdk

This file was deleted.

4 changes: 0 additions & 4 deletions .fvm/fvm_config.json

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ build/
**/android/key.properties
**/assets/map_point.json
**/pocket-keystore.jks

.fvm/
10 changes: 9 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand All @@ -31,7 +32,7 @@

<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:exported="true"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
Expand All @@ -53,6 +54,13 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/social.wom.pocket"/>
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Binary file modified assets/images/piggy-bank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"introDesc5": "You will be able to earn discounts on goods and service in exchange for your vouchers.",
"introDesc6": "Vouchers are stores on this device. If you need to uninstall the app or change device, remember to export your vouchers or you will lose them.",
"introDesc7": "For completing the tutorial, you got your first WOM",
"introAction7": "Riscatta subito",
"introDoneText": "OK",
"introSkipText": "Skip",
"introTitle1": "Welcome to",
Expand Down Expand Up @@ -230,6 +231,15 @@
"enableHomeTutorialDesc": "Go through the introduction tutorial on the app homepage.",
"languageSettingsTitle": "Application language",
"languageSettingsDesc": "Choose the language that will be used by the app’s interface.",
"exportYourWomTitle": "Export your WOM",
"exportYourWomDesc": "Create a backup of your wom and import it to another device"
"exportYourWomTitle": "Export your vouchers",
"exportYourWomDesc": "Create a backup of your WOM vouchers and import them to another device",
"scanStateEmpty": "None of the scanned QR Codes is recognized. The scanner is processing…",
"scanStateSingle": "One WOM QR Code found.",
"scanStateMultiple": "Multiple WOM QR Codes found. Focus on one.",
"scanContinueToScan": "Continue scan",
"scanning": "Scanning…",
"scanGetWom": "Redeem",
"scanPay": "Pay",
"scanImportMigration": "Import",
"scanExchangeImport": "Receive"
}
14 changes: 12 additions & 2 deletions assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"introDesc5": "Ottieni sconti su beni e servizi in cambio dei WOM raccolti",
"introDesc6": "I WOM sono conservati solo su questa applicazione, se devi disinstallarla o cambiare dispositivo ricordati di esportarli per non perderli",
"introDesc7": "Per aver completato il tutorial hai ottenuto i tuoi primi WOM",
"introAction7": "Riscatta subito",
"introDoneText": "OK",
"introSkipText": "Salta",
"introTitle1": "Ti diamo il benvenuto in",
Expand Down Expand Up @@ -137,7 +138,7 @@
"settings_pay_demo_desc": "Prova a pagare con i WOM",
"settings_info_title": "Info",
"settings_info_desc": "Visita il nostro sito",
"settings_show_intro_title": "Mostra il tutorial iniziale?",
"settings_show_intro_title": "Mostra il tutorial iniziale",
"settings_show_intro_desc": "Scopri cosa sono i WOM",
"no_sources": "Nessuna sorgente",
"missing_location_error": "Non riesco a rilevare la tua posizione",
Expand Down Expand Up @@ -231,5 +232,14 @@
"languageSettingsTitle": "Lingua dell’app",
"languageSettingsDesc": "Seleziona la lingua dell’applicazione.",
"exportYourWomTitle": "Esporta i tuoi WOM",
"exportYourWomDesc": "Crea un backup dei tuoi wom e importalo in un altro dispositivo"
"exportYourWomDesc": "Crea un backup dei tuoi wom e importalo in un altro dispositivo",
"scanStateEmpty": "Nessuno dei QR Code scansionati è supportato. Scansione in corso…",
"scanStateSingle": "Un QR Code WOM individuato.",
"scanStateMultiple": "Più QR Code WOM individuati. Fai zoom su uno di essi.",
"scanContinueToScan": "Continua scansione",
"scanning": "Scansione in corso…",
"scanGetWom": "Riscatta",
"scanPay": "Paga",
"scanImportMigration": "Importa",
"scanExchangeImport": "Ricevi"
}
24 changes: 12 additions & 12 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = "";
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -406,7 +406,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -529,7 +529,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = "";
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -539,7 +539,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -556,7 +556,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = wom;
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -566,7 +566,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -638,7 +638,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = "wom-dev";
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -649,7 +649,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -722,7 +722,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = wom;
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -732,7 +732,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -802,7 +802,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 82;
DEEP_PROTOCOL = wom;
DEVELOPMENT_TEAM = 5QA9U9924L;
ENABLE_BITCODE = NO;
Expand All @@ -812,7 +812,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = social.wom.pocket;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down
87 changes: 57 additions & 30 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'dart:io';

import 'package:dart_wom_connector/dart_wom_connector.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
Expand All @@ -10,8 +13,12 @@ import 'package:wom_pocket/src/application/app_state.dart';
import 'package:wom_pocket/src/migration/application/import_notifier.dart';
import 'package:wom_pocket/src/migration/ui/import_screen.dart';
import 'package:wom_pocket/src/models/deep_link_model.dart';
import 'package:wom_pocket/src/models/totem_data.dart';
import 'package:wom_pocket/src/my_logger.dart';
import 'package:wom_pocket/src/nfc/application/nfc_notifier.dart';
import 'package:wom_pocket/src/nfc/utils.dart';
import 'package:wom_pocket/src/screens/home/home_screen.dart';
import 'package:wom_pocket/src/screens/home/widgets/totem_dialog.dart';
import 'package:wom_pocket/src/screens/pin/pin_screen.dart';

import 'package:wom_pocket/src/screens/intro/intro.dart';
Expand All @@ -25,7 +32,6 @@ bool fakeModeVar = false;
String? fakeData;

class App extends ConsumerWidget {

App({Key? key}) : super(key: key);

@override
Expand Down Expand Up @@ -93,48 +99,69 @@ class GateWidget extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(appNotifierProvider);
ref.listen<AsyncValue<DeepLinkModel?>>(
ref.listen<AsyncValue<String?>>(
deepLinkNotifierProvider,
(previous, next) {
logger.i("APP BLOC LISTENER ----> state is: $next");
if (next is AsyncData) {
final data = next.value;
if (data != null) {
// _pinBloc = PinBloc(state.value);
// _pinBloc = PinBloc(state.deepLinkModel);
// var blocProviderPin = BlocProvider(
// create: (context) => _pinBloc,
// child: PinScreen(),
// );
if (data.type == TransactionType.MIGRATION_IMPORT) {
Navigator.push(
context,
MaterialPageRoute<bool>(
builder: (context) => ProviderScope(
overrides: [
deeplinkProvider.overrideWithValue(data),
importNotifierProvider
],
child: ImportScreen(),
if (data == null) return;
final totemData = validateTotemQrCodeWithRegex(data);
if (totemData != null) {
launchTotemDialog(context, totemData);
} else {
try {
logger.i("AppNotifier uri : $data");
final deepLink = DeepLinkModel.fromUri(Uri.parse(data));

if (deepLink.type == TransactionType.MIGRATION_IMPORT) {
Navigator.push(
context,
MaterialPageRoute<bool>(
builder: (context) => ProviderScope(
overrides: [
deeplinkProvider.overrideWithValue(deepLink),
importNotifierProvider
],
child: ImportScreen(),
),
),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute<bool>(
builder: (context) => ProviderScope(
overrides: [deeplinkProvider.overrideWithValue(data)],
child: PinScreen(),
);
} else {
Navigator.push(
context,
MaterialPageRoute<bool>(
builder: (context) => ProviderScope(
overrides: [deeplinkProvider.overrideWithValue(deepLink)],
child: PinScreen(),
),
),
),
);
);
}
} on PlatformException catch (ex, st) {
logger.e('AppRepository: error getting deep link',
error: ex, stackTrace: st);
} on FormatException catch (ex, st) {
logger.e('Error getting deep link', error: ex, stackTrace: st);
} catch (ex, st) {
logger.e('Error getting deep link', error: ex, stackTrace: st);
}
}
}
},
);

if (Platform.isAndroid) {
ref.listen<AsyncValue<TotemData?>>(nfcBackgroundNotifierProvider,
(previous, next) async {
print('getNfcIntentProvider new intent');
final currentState = next;
if (currentState is AsyncData && currentState.value != null) {
await launchTotemDialog(context, currentState.requireValue!);
ref.read(nfcBackgroundNotifierProvider.notifier).unlock();
}
});
}
logger.i("APP BLOC BUILDER ----> state is: $state");

if (state is AsyncData) {
Expand Down
2 changes: 1 addition & 1 deletion lib/main_dev.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Future<void> main() async {
noBoxingByDefault: true,
printEmojis: false,
),
filter: ReleaseFilter(),
// filter: ReleaseFilter(),
output: DevOutput(),
);
logger.i('DEV VERSION');
Expand Down
Loading

0 comments on commit 0255a8d

Please sign in to comment.