2021-05-13 20:16:41 +02:00
|
|
|
|
|
|
|
|
|
using Android.App;
|
|
|
|
|
using Android.Content.PM;
|
|
|
|
|
using Android.OS;
|
|
|
|
|
using Android.Content;
|
|
|
|
|
using Java.Interop;
|
2021-12-08 17:57:30 +01:00
|
|
|
|
using Plugin.Permissions;
|
2022-01-04 18:54:03 +01:00
|
|
|
|
using Xamarin.Forms.Platform.Android.AppLinks;
|
|
|
|
|
using Firebase;
|
2021-05-13 20:16:41 +02:00
|
|
|
|
|
|
|
|
|
namespace TINK.Droid
|
|
|
|
|
{
|
|
|
|
|
[Activity (Label = "Sharee", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
2021-12-08 20:03:50 +01:00
|
|
|
|
|
|
|
|
|
[IntentFilter(new[] { Intent.ActionView },
|
|
|
|
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
|
|
|
|
DataScheme = "https",
|
|
|
|
|
DataHost = "sharee.bike",
|
|
|
|
|
DataPathPrefix = "/sharee",
|
|
|
|
|
AutoVerify = true)]
|
|
|
|
|
|
|
|
|
|
[IntentFilter(new[] { Intent.ActionView },
|
|
|
|
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
|
|
|
|
DataScheme = "http",
|
|
|
|
|
DataHost = "sharee.bike",
|
|
|
|
|
DataPathPrefix = "/sharee",
|
|
|
|
|
AutoVerify = true)]
|
|
|
|
|
|
|
|
|
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
2021-05-13 20:16:41 +02:00
|
|
|
|
{
|
|
|
|
|
protected override void OnCreate (Bundle bundle)
|
|
|
|
|
{
|
|
|
|
|
TabLayoutResource = Resource.Layout.Tabbar;
|
|
|
|
|
ToolbarResource = Resource.Layout.Toolbar;
|
|
|
|
|
|
|
|
|
|
base.OnCreate (bundle);
|
|
|
|
|
|
|
|
|
|
global::Xamarin.Forms.Forms.Init (this, bundle);
|
|
|
|
|
|
2022-01-04 18:54:03 +01:00
|
|
|
|
FirebaseApp.InitializeApp(this);
|
|
|
|
|
AndroidAppLinks.Init(this);
|
|
|
|
|
|
2021-11-07 19:42:59 +01:00
|
|
|
|
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
|
|
|
|
Xamarin.Essentials.Platform.Init(this, bundle);
|
|
|
|
|
|
2021-05-13 20:16:41 +02:00
|
|
|
|
// Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/
|
|
|
|
|
Xamarin.FormsGoogleMaps.Init(this, bundle);
|
|
|
|
|
|
|
|
|
|
// Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings.
|
|
|
|
|
Xamarin.FormsGoogleMapsBindings.Init();
|
|
|
|
|
|
|
|
|
|
// Get version name of app.
|
|
|
|
|
Context context = ApplicationContext;
|
|
|
|
|
new Model.Device.AppInfo(context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName);
|
|
|
|
|
|
|
|
|
|
Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => {
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(e.View.AutomationId))
|
|
|
|
|
{
|
|
|
|
|
e.NativeView.ContentDescription = e.View.AutomationId;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LoadApplication(new App());
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-07 19:42:59 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles opening the dialog to request for permissions.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
|
|
|
|
|
{
|
|
|
|
|
if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Essentials.Permissions))
|
|
|
|
|
{
|
|
|
|
|
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
2022-01-04 18:54:03 +01:00
|
|
|
|
}
|
2021-12-08 17:57:30 +01:00
|
|
|
|
else if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Plugin.Permissions))
|
|
|
|
|
{
|
|
|
|
|
// Bug in 3.0.244 and earlier versions of sharee.bike app: Call of PermissionsImplementation.Current.OnRequestedPermission result was missing.
|
|
|
|
|
// see https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/136 for further details.
|
|
|
|
|
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
|
|
|
}
|
2021-11-07 19:42:59 +01:00
|
|
|
|
|
|
|
|
|
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-13 20:16:41 +02:00
|
|
|
|
[Export("TapStation")]
|
|
|
|
|
public void TapStation(string stationNr)
|
|
|
|
|
{
|
|
|
|
|
BackdoorMethodHelpers.DoTapPage(stationNr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|