-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Currently, geoff is only available on git. To install, add this to your pubspec.yaml under dependancies:
geoff:
git: https://github.com/Kibibibit/geoff.gitThen, as this package depends on flutter_appauth (Can be found here), you need to update some of the build files.
You will need to add the following to your android/app/build.gradle under defaultConfig:
...
android {
...
defaultConfig {
...
manifestPlaceholders += [
'appAuthRedirectScheme': '<your_custom_scheme>'
]
}
}<your_custom_scheme> must be in all lowercase. Also notice the use of +=, this is required by newer versions of the flutter SDK.
If your app is target API 30 or above (i.e. Android 11 or newer), make sure to add the following to your AndroidManifest.xml file a level underneath the <manifest> element
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.APP_BROWSER" />
<data android:scheme="https" />
</intent>
</queries>Instructions taken from here
You will need to update your Info.plist to include the following:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>your_custom_scheme</string>
</array>
</dict>
</array>your_custom_scheme must be in all lowercase
Instructions taken from here
If using keycloak, your client must have your_custom_scheme added to its valid redirect urls
Some of the libraries in geoff need some initialisation code to be run at the start of the app.
void main() {
runApp(const MyApp());
}
...
class _MyAppState extends State<MyApp> {
@override
void initState() {
...
DeviceOrientation.onOrientationChange = ((orientation) {
//What happens when the device changes orientation?
});
//Call this so that the device actually reacts to to orientation changes
DeviceOrientation.initOrientation();
//Set the keycloak realm of your project
AppAuthHelper.setRealm('$yourRealm');
//Set the client id of your project
AppAuthHelper.setClientId('$yourClientId');
//Set the redirect url of your project. Make sure this matches the scheme you used in your build files
//e.g. "my.geoff.app.appauth://oauth/login_success/";
AppAuthHelper.setRedirectUrl('$yourRedirectUrl');
//The url of your keycloak server
AppAuthHelper.setAuthServerUrl('$yourAuthServerUrl');
//Set this to false if you don't want ansii colours in the log output. This defaults to true
Log.setColors($trueOrFalse);
...
}
...Models - Currently Empty