Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
9908376
initial work for template app (not compiling)
shurwit Dec 23, 2022
2e5b730
save progress
shurwit Jan 3, 2023
7fe2b26
finish onboarding (needs some testing)
shurwit Jan 6, 2023
2ffaf93
save progress on settings
shurwit Jan 10, 2023
e61fa3b
setup initial panels
shurwit Jan 10, 2023
509be3a
fix style issues with dark theme
shurwit Jan 16, 2023
74e84da
Merge branch 'develop' into template-cleanup
shurwit Jan 19, 2023
570088e
fix runtime ui errors
shurwit Jan 23, 2023
ffb7622
fix some styling issues
shurwit Feb 22, 2023
012a5d9
update dependencies
shurwit Mar 9, 2023
9669305
add timezone database
bsdworkin Mar 21, 2023
ef722ec
add assets to pubspec
shurwit Mar 21, 2023
226b582
fix style issues
shurwit Mar 21, 2023
5c2af8c
add gen styles
shurwit Mar 23, 2023
c44aa81
add auto-update code refs to gen styles
shurwit Mar 23, 2023
07fa9f1
add instructions for gen styles tool to readme
shurwit Mar 23, 2023
8a5a79b
fixed scroll pager
bsdworkin Mar 29, 2023
43291cc
Merge remote-tracking branch 'origin/template-cleanup' into template-…
bsdworkin Mar 29, 2023
fcd45e4
handle plugin style asset merging
shurwit Mar 29, 2023
b241c55
Merge remote-tracking branch 'origin/template-cleanup' into template-…
shurwit Mar 29, 2023
2b31d9b
add generated styles
shurwit Mar 29, 2023
2a588b8
initial passkey credential manager implementation
shurwit Mar 31, 2023
9cc2f94
fix models, cleanup duplicate code
shurwit Apr 4, 2023
f7149fa
initial chart implementation (in progress)
shurwit Apr 11, 2023
8a1a6b3
progress on score chart
shurwit Apr 12, 2023
2640721
rework chart computation for fixed ranges, add high score chart
shurwit Apr 14, 2023
695fadd
cleanup remaining ui
shurwit Apr 15, 2023
168f0a4
rework trial board into widget
shurwit Apr 15, 2023
f242c6c
use flutter secure storage, fix onboarding and logout issues
shurwit Apr 18, 2023
11c2286
add scoring algorithm selection
shurwit Apr 25, 2023
53a2fcf
add encrypt utils
shurwit Apr 26, 2023
23591c8
fix encrypt utils
shurwit Apr 26, 2023
abc2ac5
Merge branch 'develop' into 264-passkey-authentication
shurwit Apr 28, 2023
e38dbc1
Merge branch '273-username-authentication' into template-cleanup
shurwit May 1, 2023
48cc96f
fix typos
shurwit May 1, 2023
0972f2a
Merge branch '273-username-authentication' into template-cleanup
shurwit May 2, 2023
07e605f
use plugin, begin implementation of passkey auth
shurwit May 4, 2023
440279a
Merge branch 'develop' into 264-passkey-authentication
shurwit May 4, 2023
624b309
add passkey auth type ui
shurwit May 5, 2023
8247aa6
fix styling and logging issues
shurwit May 9, 2023
a0df1cd
add passkey login flow (not working)
shurwit May 18, 2023
88f98ad
upgrade dependencies
shurwit May 22, 2023
e7e1888
upgrade dependencies for Flutter v3.10, fix errors
shurwit May 22, 2023
2000b76
Merge branch '285-upgrade-dependencies' into 264-passkey-authentication
shurwit May 24, 2023
a4ae1ac
upgrade flutter_html package to 3.0.0-beta.2
roberlander2 Jun 1, 2023
d135654
use gen styles, fix/remove app naming references
shurwit Jun 2, 2023
2c888e6
cleanup
shurwit Jun 2, 2023
940e959
cleanup
shurwit Jun 5, 2023
a267830
cleanup
shurwit Jun 6, 2023
37ee9b4
Merge branch 'develop' into 264-passkey-authentication
shurwit Jun 6, 2023
a415ca8
Merge branch 'develop' into template-cleanup
shurwit Jun 8, 2023
8c8e808
merge plugin develop
shurwit Jun 8, 2023
0b5aa78
fixes
shurwit Jun 9, 2023
e828897
Merge branch '264-passkey-authentication' into template-cleanup-passkeys
shurwit Jun 9, 2023
3ebbce8
change linked domain
shurwit Jun 9, 2023
932cbdd
[#291] Web app authentication support (#295)
roberlander2 Jun 9, 2023
c61faf0
Merge branch 'template-cleanup' into template-cleanup-passkeys
shurwit Jun 9, 2023
6c3eaf0
Handle IOS passkey login issues
akshadpai Jun 12, 2023
a3bb377
expose internal passkey auth errors in ui
shurwit Jun 16, 2023
04596a2
Merge remote-tracking branch 'origin/template-cleanup-passkeys' into …
shurwit Jun 16, 2023
6bb95c9
[#299] Web app passkey support (#300)
roberlander2 Jun 16, 2023
6e4202b
fix config loading issue on web
shurwit Jun 16, 2023
a0a12fd
fix refresh bug
roberlander2 Jun 20, 2023
89cf648
modify refreshToken to handle futures on web
roberlander2 Jun 20, 2023
d95f573
remove unnecessary android passkey implementation
roberlander2 Jun 21, 2023
6fedb65
fix profile styling and update domain links
shurwit Jun 23, 2023
3c99123
cleanup ui
shurwit Jun 23, 2023
0d6feb6
[#305] Anonymous account association (#306)
roberlander2 Jun 23, 2023
61ed1f2
[#309] Add timestamps to anonymous IDs (#310)
roberlander2 Jun 30, 2023
ef061b8
handle public accounts/follows
shurwit Jul 8, 2023
d789a9c
Merge branch 'develop' into template-cleanup-passkeys
shurwit Jul 11, 2023
d030920
Fix config init failed for web app
akshadpai Jul 11, 2023
1eefeea
Merge remote-tracking branch 'origin/template-cleanup-passkeys' into …
akshadpai Jul 11, 2023
5406010
fix more bugs running web app locally
roberlander2 Jul 12, 2023
164245c
restore assets.dart
roberlander2 Jul 27, 2023
43d9574
restore FlexContent.fromAssets
roberlander2 Jul 27, 2023
6545241
fix missing timezone asset
shurwit Jul 27, 2023
78345ee
update dependency, fix typos
shurwit Aug 10, 2023
4d3677a
fixed token refresh bug
roberlander2 Aug 31, 2023
1375ccd
Merge branch 'template-cleanup' of https://github.com/rokwire/app-flu…
roberlander2 Aug 31, 2023
2259142
add default style gen functionality
shurwit Aug 31, 2023
638dccf
Merge remote-tracking branch 'origin/template-cleanup' into template-…
shurwit Aug 31, 2023
74314a2
Merge branch 'template-cleanup' into template-cleanup-passkeys
shurwit Aug 31, 2023
3ba804f
Merge branch 'template-cleanup' into template-cleanup-passkeys
shurwit Aug 31, 2023
73e17ee
use gen styles
shurwit Sep 1, 2023
6b137d4
refactor image styles
shurwit Sep 1, 2023
685dc5a
fix image color issues
shurwit Sep 5, 2023
b358fe0
Merge branch 'template-cleanup' into template-cleanup-passkeys
shurwit Sep 5, 2023
2ce8049
fix material images
shurwit Sep 6, 2023
be39f86
Merge branch 'develop' into template-cleanup
shurwit Sep 12, 2023
5d120b9
fix merge issues
shurwit Sep 12, 2023
67ba2e8
Merge branch 'template-cleanup' into template-cleanup-passkeys
shurwit Sep 12, 2023
c078349
fix merge issues
shurwit Sep 12, 2023
502701a
[#379] Integrate auth refactor (#392)
roberlander2 Oct 7, 2023
88de2d9
expose convenience functions for config environment
shurwit Oct 11, 2023
2eeb77a
fix style gen bugs
shurwit Oct 12, 2023
442b360
add theme support to styles
shurwit Oct 12, 2023
a9689ff
handle oidc provider token
shurwit Oct 13, 2023
fe5090b
handle text style extensions in style generation
shurwit Oct 14, 2023
f17ca0d
update system theme on mode change
shurwit Oct 14, 2023
e6d4d58
[#96] Improve exception handling for passkeys (#397)
roberlander2 Oct 14, 2023
57451bc
Added StringUtils.invokeIfExists helper function [rokmetro/vogue-app#…
mihail-varbanov Oct 18, 2023
331b6a7
fix action message background color
shurwit Oct 19, 2023
09c689a
standardize styling
shurwit Oct 19, 2023
932bebe
progress on bookmark service integration
shurwit Oct 24, 2023
c028262
Release v1.21.0, resolves #103, resolves #110, resolves #108, resolve…
shurwit Nov 4, 2023
6c25384
Added Connectivity.checkOnline API [rokmetro/vogue-app/#139].
mihail-varbanov Nov 7, 2023
6306bb6
apply system proxy settings by default
shurwit Nov 10, 2023
5206e90
add font style support
shurwit Nov 11, 2023
68afa35
support setting default fetch policy for GraphQL client
shurwit Nov 16, 2023
46fd476
check access token expiration
shurwit Nov 17, 2023
0e68a9e
fix ui images to handle failed styles init
shurwit Nov 18, 2023
fd5455f
handle fallback service initialization
shurwit Nov 18, 2023
4d47dc9
handle additional fallback service inits
shurwit Nov 18, 2023
1cf6695
enable async notifications
shurwit Nov 18, 2023
0b0679a
add logout started notification
shurwit Nov 27, 2023
11cce94
[#404] Use CCT for Android OIDC login (#405)
roberlander2 Nov 30, 2023
1ca6ab9
refactor services init to be more performant
roberlander2 Dec 1, 2023
7a0706e
remove stopwatches
roberlander2 Dec 1, 2023
ae55a74
update changelog
roberlander2 Dec 4, 2023
dfe89a8
remove excess calls to serviceDependsOn, remove serviceDependsOn from…
roberlander2 Dec 5, 2023
fc19ec0
clear service dependencies on destroy services
roberlander2 Dec 5, 2023
1b4ca64
further improve auth and styles init
roberlander2 Dec 5, 2023
c9c739c
move isAnonymousAuthenticationSupported getter
roberlander2 Dec 6, 2023
9c06003
add parentheses for clarity"
roberlander2 Dec 6, 2023
505f219
disable graphql cache
shurwit Dec 6, 2023
deeddd5
Merge branch 'vogue' into 408-services-init-on-app-startup
mihail-varbanov Dec 6, 2023
3e209c2
Reset to initial [#408].
mihail-varbanov Dec 6, 2023
ec5952e
Build service initialization list using Breadth First Search (BFS) al…
mihail-varbanov Dec 6, 2023
e9d4482
Make skipped param of initServices API optional [#408].
mihail-varbanov Dec 6, 2023
4e372c7
combine some styles init async loads, call verifyInitialization from …
roberlander2 Dec 6, 2023
6e273fa
do not call Services._init if there are no dervice dependents
roberlander2 Dec 7, 2023
b53da93
remove stopwatch
roberlander2 Dec 7, 2023
6252f35
merge changes from 408-services-init-on-app-startup
roberlander2 Dec 7, 2023
5966fed
handle deeplinks
shurwit Dec 11, 2023
b157ebc
Merge branch 'vogue' into 408-services-init-on-app-startup-BFS
shurwit Dec 11, 2023
d1cab4b
fix typos, add back service debugDisplayName
shurwit Dec 11, 2023
eda8d8e
fix anonymous auth
shurwit Dec 12, 2023
7b234e3
disable location permission
shurwit Dec 13, 2023
d07c0d1
Merge branch 'vogue' into 408-services-init-on-app-startup-BFS
shurwit Dec 13, 2023
f016667
Do not try to retrieve device id for web.
dobromirdobrev Dec 19, 2023
9fef7a7
Do not try to apply http proxy settings for web.
dobromirdobrev Dec 19, 2023
529e8e8
fix ribbon button tap listener
shurwit Dec 29, 2023
891dcb7
clear oidc token on logout
shurwit Dec 29, 2023
1b35998
"Deregister" renamed to "unregister" [rokmetro/vogue-app#481].
mihail-varbanov Jan 4, 2024
e825b2f
Added ScrollPagerController.dispose [rokmetro/vogue-app#481].
mihail-varbanov Jan 4, 2024
545fa52
fix refresh bugs, make secure storage operations on login and logout …
roberlander2 Jan 5, 2024
e300e28
make app navigation service non-singleton
shurwit Jan 11, 2024
271ec5c
disable firebase messaging
shurwit Jan 17, 2024
2ca615c
check expiration in utc
shurwit Jan 22, 2024
d11c3b0
add client version header to auth requests
shurwit Jan 22, 2024
eac6012
remove testing return
shurwit Jan 22, 2024
d19ec08
not logged in without token
shurwit Jan 23, 2024
49399d3
await apply token
shurwit Jan 23, 2024
5e70c40
check connectivity when resuming from background
shurwit Feb 1, 2024
1943d6e
expose errors for oidc authentication
shurwit Feb 7, 2024
604b3b1
Added functionality to show or not show tap animation
manav2modi Feb 15, 2024
0d46899
remove dart:io dependency for web support
shurwit Feb 16, 2024
774c995
Merge remote-tracking branch 'origin/408-vogue' into 408-vogue
shurwit Feb 16, 2024
95a5e03
make oidc timeout configurable
shurwit Feb 16, 2024
1eb6919
notify login change on web init refresh
shurwit Feb 16, 2024
4dd18b5
improve logging for auth and network, extend default oidc timeout
shurwit Feb 22, 2024
e999ef2
add deeplink error logging
shurwit Feb 23, 2024
1bbe66e
fix async gap context use
shurwit Feb 23, 2024
2dd657a
add notifyLoginError notification to Auth service, check for oidcLogi…
roberlander2 Feb 23, 2024
49e413d
fix context usage in onboarding next
shurwit Feb 23, 2024
12e6a36
store service initialization state
shurwit Feb 26, 2024
e62ed74
replace uni_links with app_links
shurwit Feb 26, 2024
c39adda
fix app links stream listener
shurwit Feb 26, 2024
cf3adfb
improve refresh error notifications
shurwit Feb 27, 2024
6744409
add refresh lifecycle notifications
shurwit Feb 27, 2024
b290b94
remove access token decoding, improve privilege parsing and checks
shurwit Mar 1, 2024
2ed695d
update pubspec lock
shurwit Mar 1, 2024
72e0933
use updated recursive algorithm for Services.init, add initServiceFal…
roberlander2 Mar 4, 2024
009d5a9
prepare for merge
shurwit Mar 4, 2024
d25e69f
Merge remote-tracking branch 'origin/develop' into 408-vogue
shurwit Mar 5, 2024
4b5303a
fix merge issues
shurwit Mar 5, 2024
c7ed508
cleanup
shurwit Mar 5, 2024
7060216
fix styles reference
shurwit Mar 5, 2024
2052105
re-enable firebase messaging
shurwit Mar 5, 2024
36e5894
Merge branch 'develop' into 408-vogue
mihail-varbanov Mar 5, 2024
9d0fec2
Merge branch '408-vogue' into rokmetro-updates
mihail-varbanov Mar 5, 2024
25657f1
use published font awesome plugin
shurwit Mar 5, 2024
8fd89d1
Merge remote-tracking branch 'origin/408-vogue' into 408-vogue
shurwit Mar 5, 2024
fa02991
update pubspec lock
shurwit Mar 5, 2024
b5853ff
Await logout API call.
mihail-varbanov Mar 7, 2024
2cab5bb
Make Storage.encrypt/decrypt APIs public again.
mihail-varbanov Mar 7, 2024
0e0dd21
Added StringUtils.notEmptyString helper.
mihail-varbanov Mar 7, 2024
805d083
Added again email and phone getters in Auth2.
mihail-varbanov Mar 7, 2024
0cf0252
Added convinient status getters in Auth2OidcAuthenticateResult.
mihail-varbanov Mar 7, 2024
93b334e
Fixed various warnings.
mihail-varbanov Mar 7, 2024
2b5280f
Fixed build error.
mihail-varbanov Mar 7, 2024
798468f
Use AppColors and AppFontFamilies instead of Styles() members.
mihail-varbanov Mar 7, 2024
43a745d
Fixed unnecessary import warning.
mihail-varbanov Mar 7, 2024
e417c4c
Added missing entries to AppFontColors.
mihail-varbanov Mar 7, 2024
b64a8d2
Undo adding missing entries to AppFontColors.
mihail-varbanov Mar 7, 2024
da4e468
Removed unexisting references to AppColors entries.
mihail-varbanov Mar 7, 2024
e1ef859
remove assets service
shurwit Mar 7, 2024
cec5401
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 7, 2024
a8502a8
use font awesome override
shurwit Mar 7, 2024
dc73647
fix disabled tap animation
shurwit Mar 7, 2024
d2383c9
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 7, 2024
ed26c14
skip style.json comments in gen_styles
shurwit Mar 8, 2024
974e240
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 8, 2024
43b2c77
preserve formatting of styles.json when merging in gen_styles
shurwit Mar 8, 2024
22f13f8
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 8, 2024
c55134b
fix mixin classes, gen styles handle comments and merge blanks
shurwit Mar 8, 2024
fa1d737
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 8, 2024
bd9a5a8
fix style generation merging for missing sections
shurwit Mar 12, 2024
a08bbe4
Merge branch '408-vogue' into rokmetro-updates
shurwit Mar 12, 2024
b596e8f
Tuned services initialization, get rid of initServiceFallback [#408].
mihail-varbanov Mar 12, 2024
d85a5d0
Fixed _isInitialized initialization [#408].
mihail-varbanov Mar 14, 2024
76b2cba
Make sure not to run multiple instances of Services().init [#408].
mihail-varbanov Mar 14, 2024
a5a7da2
Merge pull request #439 from rokwire/408-vogue-initServiceFallback
mihail-varbanov Mar 15, 2024
093e69c
Merge branch '408-vogue' into rokmetro-updates
mihail-varbanov Mar 15, 2024
dd970f0
Fixed dart:ui import.
mihail-varbanov Mar 15, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
.dart_tool/
.packages
build/
temp.enc
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- The next version number should be the version from pubspec.yaml - 1.7.0 -->
### Changed
- Upgrade to Flutter 3.19.0 [#435](https://github.com/rokwire/app-flutter-plugin/issues/435).
- Init application services in parallel [#408](https://github.com/rokwire/app-flutter-plugin/issues/408).
- Integrate auth refactor [#379](https://github.com/rokwire/app-flutter-plugin/issues/379)
- Use CCT for Android OIDC login [#404](https://github.com/rokwire/app-flutter-plugin/issues/404)
- Improve services init on app startup [#408](https://github.com/rokwire/app-flutter-plugin/issues/408)
- Improve services failure processing [#408](https://github.com/rokwire/app-flutter-plugin/issues/408)

### Added
- Web app authentication support [#291](https://github.com/rokwire/app-flutter-plugin/issues/291)
- Web app passkey support [#299](https://github.com/rokwire/app-flutter-plugin/issues/299)
- Anonymous account association [#305](https://github.com/rokwire/app-flutter-plugin/issues/305)
- Add timestamps to anonymous IDs [#309](https://github.com/rokwire/app-flutter-plugin/issues/309)
- Web app authentication support [#291](https://github.com/rokwire/app-flutter-plugin/issues/291)
- Handle more identifiers using passkeys and linking [#330](https://github.com/rokwire/app-flutter-plugin/issues/330)
- Style code generation tools

### Fixed
- Improve exception handling for passkeys [#396](https://github.com/rokwire/app-flutter-plugin/issues/396)

## [1.6.3] - 2024-02-19
### Added
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,38 @@ git submodule add https://github.com/rokwire/services-flutter-pligin.git <plugin
rokwire_plugin:
path: <plugin-name>
```

## Tools
This plugin provides several tools that make it easier to use and manage the functionality it provides

### Generating Static Style Types
The `tools/gen_styles.dart` tool can be used to generate classes from the `styles.json` asset which
expose static references that can be easily accessed programmatically. To use this tool, navigate
to the root directory of your application and ensure that this plugin is cloned as a submodule in
the `plugin` directory. Ensure that `assets/styles.json` is valid and up to date with your desired
changes. To use the tool, run the following command:

```
dart plugin/tools/gen_styles.dart
```

If successful, you will see a new or updates `gen/styles.dart` file available with the generated classes.
You can then import this file and use the included references throughout the application.

This tool will also attempt to merge any new additions from `plugin/assets/styles.json` into `assets/styles.json`
Any existing entries in `assets/styles.json` will not be overridden. To run this tool without attempting
to merge plugin asset changes, or to run this tool within the plugin itself, provide the `-p` flag:

```
dart plugin/tools/gen_styles.dart -p
```

Note that this tool also includes a utility which can find and replace all existing references
in the codebase with the new static class members. To use this util after generating the classes,
provide the `-u` flag:

```
dart plugin/tools/gen_styles.dart -u
```


14 changes: 12 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ group 'edu.illinois.rokwire.rokwire_plugin'
version '1.0'

buildscript {
ext {
gradle_version = '7.0.0'
kotlin_version = '1.8.10'
}
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "com.android.tools.build:gradle:$gradle_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand All @@ -20,6 +25,7 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
Expand All @@ -30,7 +36,7 @@ android {
}

defaultConfig {
minSdkVersion 16
minSdkVersion 26
}
}

Expand All @@ -45,5 +51,9 @@ dependencies {
//AltBeacon - Android Beacon Library
implementation 'org.altbeacon:android-beacon-library:2.19.5-beta7'

//Passkeys
implementation "androidx.credentials:credentials:1.0.0-alpha03"
implementation "androidx.credentials:credentials-play-services-auth:1.0.0-alpha03"

//End Common Dependencies
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.UUID;

import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import io.flutter.embedding.engine.plugins.FlutterPlugin;
Expand Down Expand Up @@ -88,8 +89,8 @@ public static GeofenceMonitor getInstance() {
public void init() {
Context activityContext = RokwirePlugin.getInstance().getActivity();
if ((activityContext != null) &&
(ContextCompat.checkSelfPermission(activityContext, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) &&
(ContextCompat.checkSelfPermission(activityContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
(ContextCompat.checkSelfPermission(activityContext, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) &&
(ContextCompat.checkSelfPermission(activityContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
Log.d(TAG, "Location Permissions Granted.");
initGeofenceClient();
initBeaconManager();
Expand Down Expand Up @@ -352,6 +353,10 @@ private void startMonitorGeofenceRegions(List<Geofence> geofenceList) {
builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER);
builder.addGeofences(geofenceList);
GeofencingRequest geofencingRequest = builder.build();
Context context = RokwirePlugin.getInstance().getActivity();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
geofencingClient.addGeofences(geofencingRequest, getGeofencePendingIntent()).
addOnSuccessListener(addGeofencesSuccessListener).
addOnFailureListener(addGeofencesFailureListener);
Expand Down Expand Up @@ -381,15 +386,15 @@ private PendingIntent getGeofencePendingIntent() {

private void notifyCurrentGeofencesUpdated() {
//TBD
RokwirePlugin.getInstance().notifyGeoFence("onCurrentRegionsChanged", getCurrentIds());
RokwirePlugin.getInstance().notifyGeoFence("onCurrentRegionsChanged", getCurrentIds());
}

private void notifyRegionEnter(String regionId) {
RokwirePlugin.getInstance().notifyGeoFence("onEnterRegion", regionId);
RokwirePlugin.getInstance().notifyGeoFence("onEnterRegion", regionId);
}

private void notifyRegionExit(String regionId) {
RokwirePlugin.getInstance().notifyGeoFence("onExitRegion", regionId);
RokwirePlugin.getInstance().notifyGeoFence("onExitRegion", regionId);
}

//region Add Geofences Listeners
Expand Down Expand Up @@ -539,7 +544,7 @@ private void notifyBeacons(List<HashMap> beaconsList, String regionId) {
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("regionId", regionId);
parameters.put("beacons", beaconsList);
RokwirePlugin.getInstance().notifyGeoFence("onBeaconsInRegionChanged", parameters);
RokwirePlugin.getInstance().notifyGeoFence("onBeaconsInRegionChanged", parameters);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.credentials.exceptions.GetCredentialException;

import java.lang.ref.WeakReference;

Expand All @@ -25,6 +26,7 @@
import android.util.Log;

import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -93,7 +95,7 @@ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
// ActivityAware

@Override
public void onAttachedToActivity​(ActivityPluginBinding binding) {
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
_applyActivityBinding(binding);
}

Expand All @@ -103,7 +105,7 @@ public void onDetachedFromActivity() {
}

@Override
public void onReattachedToActivityForConfigChanges​(ActivityPluginBinding binding) {
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
_applyActivityBinding(binding);
}

Expand All @@ -130,45 +132,48 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
nextMethodComponents = call.method.substring(pos + 1);
}

if (firstMethodComponent.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
}
else if (firstMethodComponent.equals("createAndroidNotificationChannel")) {
result.success(createNotificationChannel(call));
}
else if (firstMethodComponent.equals("showNotification")) {
result.success(showNotification(call));
}
else if (firstMethodComponent.equals("getDeviceId")) {
result.success(getDeviceId(call.arguments));
}
else if (firstMethodComponent.equals("getEncryptionKey")) {
result.success(getEncryptionKey(call.arguments));
}
else if (firstMethodComponent.equals("dismissSafariVC")) {
result.success(null); // Safari VV not available in Android
}
else if (firstMethodComponent.equals("launchApp")) {
result.success(launchApp(call.arguments));
}
else if (firstMethodComponent.equals("launchAppSettings")) {
result.success(launchAppSettings(call.arguments));
}
else if (firstMethodComponent.equals("locationServices")) {
LocationServices.getInstance().handleMethodCall(nextMethodComponents, call.arguments, result);
}
else if (firstMethodComponent.equals("trackingServices")) {
result.success("allowed"); // tracking is allowed in Android by default
}
else if (firstMethodComponent.equals("geoFence")) {
GeofenceMonitor.getInstance().handleMethodCall(nextMethodComponents, call.arguments, result);
}
else {
result.notImplemented();
switch (firstMethodComponent) {
case "getPlatformVersion":
result.success("Android " + Build.VERSION.RELEASE);
break;
case "createAndroidNotificationChannel":
result.success(createNotificationChannel(call));
break;
case "showNotification":
result.success(showNotification(call));
break;
case "getDeviceId":
result.success(getDeviceId(call.arguments));
break;
case "getEncryptionKey":
result.success(getEncryptionKey(call.arguments));
break;
case "dismissSafariVC":
result.success(null); // Safari VV not available in Android
break;
case "launchApp":
result.success(launchApp(call.arguments));
break;
case "launchAppSettings":
result.success(launchAppSettings(call.arguments));
break;
case "locationServices":
assert nextMethodComponents != null;
LocationServices.getInstance().handleMethodCall(nextMethodComponents, call.arguments, result);
break;
case "trackingServices":
result.success("allowed"); // tracking is allowed in Android by default
break;
case "geoFence":
GeofenceMonitor.getInstance().handleMethodCall(nextMethodComponents, call.arguments, result);
break;
default:
result.notImplemented();
break;
}
}

public void notifyGeoFence(String event, Object arguments) {
public void notifyGeoFence(String event, Object arguments) {
Activity activity = getActivity();
if ((activity != null) && (_channel != null)) {
activity.runOnUiThread(() -> _channel.invokeMethod(String.format("geoFence.%s", event), arguments));
Expand All @@ -185,7 +190,7 @@ public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
// PluginRegistry.RequestPermissionsResultListener

@Override
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
public boolean onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == LocationServices.LOCATION_PERMISSION_REQUEST_CODE) {
return LocationServices.getInstance().onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Expand All @@ -212,7 +217,7 @@ private String getDeviceId(Object params) {
{
UUID uuid;
final String androidId = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);
uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
uuid = UUID.nameUUIDFromBytes(androidId.getBytes(StandardCharsets.UTF_8));
deviceId = uuid.toString();
}
catch (Exception e)
Expand All @@ -226,12 +231,11 @@ private boolean createNotificationChannel(MethodCall call) {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
Context appContext = (_flutterBinding != null) ? _flutterBinding.getApplicationContext() : null;
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) && (appContext != null)) {

if (appContext != null) {
try {
String id = call.hasArgument("id") ? call.argument("id") : "edu.illinois.rokwire.firebase_messaging.notification_channel";
String name = call.hasArgument("name") ? call.argument("name") : "Rokwire";
int importance = call.hasArgument("importance") ? call.argument("importance") : android.app.NotificationManager.IMPORTANCE_DEFAULT;
String id = call.hasArgument("id") ? call.argument("id") : "edu.illinois.rokwire.firebase_messaging.notification_channel";
String name = call.hasArgument("name") ? call.argument("name") : "Rokwire";
int importance = call.hasArgument("importance") ? call.argument("importance") : android.app.NotificationManager.IMPORTANCE_DEFAULT;

NotificationChannel channel = new NotificationChannel(id, name, importance);
String description = call.argument("description");
Expand Down Expand Up @@ -340,16 +344,14 @@ private Object getEncryptionKey(Object params) {
}
String base64KeyValue = Utils.AppSecureSharedPrefs.getString(getActivity(), identifier, null);
byte[] encryptionKey = Utils.Base64.decode(base64KeyValue);
if ((encryptionKey != null) && (encryptionKey.length == keySize)) {
return base64KeyValue;
} else {
if ((encryptionKey == null) || (encryptionKey.length != keySize)) {
byte[] keyBytes = new byte[keySize];
SecureRandom secRandom = new SecureRandom();
secRandom.nextBytes(keyBytes);
base64KeyValue = Utils.Base64.encode(keyBytes);
Utils.AppSecureSharedPrefs.saveString(getActivity(), identifier, base64KeyValue);
return base64KeyValue;
}
return base64KeyValue;
}

// Helpers
Expand Down
Loading