Skip to content

Commit 5f407a3

Browse files
authored
Implement Messages feature (#61)
* Implement Messages feature - Provided NStackMessageWidget for the user to get and show messages from NStack - The user can use either the default dialog provided by the SDK or override the dialog and implement the UI as per the requirements. * Update version of the Kotlin Gradle plugin. * Remove unused import * Absorb review changes * Absorb review changes * Absorb review changes
1 parent 6a1eb95 commit 5f407a3

File tree

12 files changed

+589
-30
lines changed

12 files changed

+589
-30
lines changed

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.10'
2+
ext.kotlin_version = '1.9.22'
33
repositories {
44
google()
55
mavenCentral()
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

example/ios/Podfile.lock

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ PODS:
77
- shared_preferences_foundation (0.0.1):
88
- Flutter
99
- FlutterMacOS
10+
- url_launcher_ios (0.0.1):
11+
- Flutter
1012

1113
DEPENDENCIES:
1214
- Flutter (from `Flutter`)
1315
- nstack (from `.symlinks/plugins/nstack/ios`)
1416
- package_info (from `.symlinks/plugins/package_info/ios`)
1517
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
18+
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
1619

1720
EXTERNAL SOURCES:
1821
Flutter:
@@ -23,13 +26,16 @@ EXTERNAL SOURCES:
2326
:path: ".symlinks/plugins/package_info/ios"
2427
shared_preferences_foundation:
2528
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
29+
url_launcher_ios:
30+
:path: ".symlinks/plugins/url_launcher_ios/ios"
2631

2732
SPEC CHECKSUMS:
2833
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
2934
nstack: a7ebf31d8c387ec76d4bfe5eb494d3ac81756d92
3035
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
3136
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
37+
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
3238

3339
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
3440

35-
COCOAPODS: 1.12.1
41+
COCOAPODS: 1.14.3

example/lib/main.dart

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,40 @@ class MainScreen extends StatelessWidget {
3232
final localizationAsset = localization.assets;
3333
final activeLanguage = localization.activeLanguage;
3434

35-
return Scaffold(
36-
appBar: AppBar(
37-
title: Text(localizationAsset.test.testDollarSign),
38-
),
39-
body: Center(
40-
child: MaterialButton(
41-
onPressed: () {
42-
final locale = activeLanguage.locale == 'en-EN'
43-
? const Locale('de-DE')
44-
: const Locale('en-EN');
45-
localization.changeLocalization(locale);
46-
},
47-
child: Text(
48-
'Selected locale: ${activeLanguage.name}',
35+
// Message option for receiving the Message response, will not show the default dialog.
36+
// void onMessage(Message message) {
37+
// if (kDebugMode) {
38+
// print(message.message);
39+
// }
40+
// }
41+
42+
// final customNstackHandlerConfiguration =
43+
// CustomNstackHandlerConfiguration(onMessage: onMessage);
44+
45+
// Message option for showing default dialog.
46+
final defaultHandlerConfiguration = DefaultNstackHandlerConfiguration(
47+
okButtonTitle: localizationAsset.test.okButtonTitle,
48+
openUrlButtonTitle: localizationAsset.test.openUrlButtonTitle,
49+
dialogTitle: localizationAsset.test.dialogTitle,
50+
);
51+
52+
return NStackMessageWidget(
53+
handlerConfiguration: defaultHandlerConfiguration,
54+
child: Scaffold(
55+
appBar: AppBar(
56+
title: Text(localizationAsset.test.testDollarSign),
57+
),
58+
body: Center(
59+
child: MaterialButton(
60+
onPressed: () {
61+
final locale = activeLanguage.locale == 'en-EN'
62+
? const Locale('de-AT')
63+
: const Locale('en-EN');
64+
localization.changeLocalization(locale);
65+
},
66+
child: Text(
67+
'Selected locale: ${activeLanguage.name}',
68+
),
4969
),
5070
),
5171
),

0 commit comments

Comments
 (0)