Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adbc97f829 | |||
| c43057ed6d | |||
| b8709935a9 | |||
| 2742f827aa | |||
| 49c25e54a1 | |||
| 2f1b37f3f5 | |||
| 92b6a79a78 | |||
| c893a38192 | |||
| 8755cb1137 | |||
| 65dbe0d69f | |||
| 1fa7df4aa2 | |||
| 2fce9e7e19 | |||
| 4bf95cbe8b | |||
| 94bee732aa | |||
| dcc2320332 | |||
| daf62f222c | |||
| 1e70f84622 | |||
| d199b482ad | |||
| d584c6c3af | |||
| 9bab2a7798 | |||
| 76a6a763c6 | |||
| 2ba9dfd57a | |||
| 6221969d6b | |||
| b1176ca5ba | |||
| b9403a5be0 | |||
| cc97123908 | |||
| f9304a52e2 | |||
| 58825427d0 | |||
| 878c62f2cb | |||
| 6b746cd1d0 | |||
| 9483c6b834 | |||
| bb6b08cf1a | |||
| fe15ea221f | |||
| 33ac4c6fcf | |||
| d3bcbd28ef | |||
| 77ecf4ca12 | |||
| 3c8064dfd2 | |||
| 879e40f4de | |||
| cc9665a7ec | |||
| eb749a7b37 | |||
| 356f75d0c5 | |||
| 6b68afad9b |
@@ -1,10 +1,42 @@
|
|||||||
################################################################################
|
*.iml
|
||||||
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
|
.gradle
|
||||||
################################################################################
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
|
|
||||||
/.vs
|
|
||||||
/Mear/Mear/bin/Debug/netstandard2.0
|
# Log/OS Files
|
||||||
/Mear/Mear/obj
|
*.log
|
||||||
/Mear/Mear.Android/bin/Debug
|
|
||||||
/Mear/Mear.Android/obj
|
# Android Studio generated files and folders
|
||||||
/Mear/Mear.iOS/obj
|
captures/
|
||||||
|
.cxx/
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
output-metadata.json
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
.idea/
|
||||||
|
misc.xml
|
||||||
|
deploymentTargetDropDown.xml
|
||||||
|
render.experimental.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
google-services.json
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# Contributing
|
|
||||||
|
|
||||||
When contributing to this repository, please first discuss the change you wish to make via issue,
|
|
||||||
email, or any other method with the owners of this repository before making a change.
|
|
||||||
|
|
||||||
Please note the project has a code of conduct, please follow it in all your interactions with the project.
|
|
||||||
|
|
||||||
## Code of Conduct
|
|
||||||
|
|
||||||
### Pledge
|
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, I as
|
|
||||||
aintainers pledge to making participation in this project and
|
|
||||||
this community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity and
|
|
||||||
orientation.
|
|
||||||
|
|
||||||
### Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
|
||||||
include:
|
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
|
||||||
* Being respectful of differing viewpoints and experiences
|
|
||||||
* Gracefully accepting constructive criticism
|
|
||||||
* Focusing on what is best for the community
|
|
||||||
* Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
||||||
advances
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or electronic
|
|
||||||
address, without explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
### Maintainers Responsibilities
|
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable
|
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
|
||||||
response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or
|
|
||||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
||||||
permanently any contributor for other behaviors that they deem inappropriate,
|
|
||||||
threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## How You Can Contribute
|
|
||||||
|
|
||||||
The project is always looking for people to help in anyway they can. The following would be greatly appreciated:
|
|
||||||
|
|
||||||
* Developers
|
|
||||||
* Graphic Designers
|
|
||||||
* Documenters
|
|
||||||
|
|
||||||
### Graphic Designers
|
|
||||||
|
|
||||||
If you have anything that you produced and would to show case it, create a new issue giving a descriptive title and description regarding the resources you wish you present. Once someone responds and gives feedback fork the master branch of the project include the resources in the corresponding directories and make a pull request. The directories on where to places the resources will be included in the issue. After the pull request has been reviewed it will be included into the main branch and you will be credited
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
||||||
available at [http://contributor-covenant.org/version/1/4][version]
|
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2019 Kun Deng
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 16
|
|
||||||
VisualStudioVersion = 16.0.28803.452
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mear.Android", "Mear\Mear.Android\Mear.Android.csproj", "{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mear.iOS", "Mear\Mear.iOS\Mear.iOS.csproj", "{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mear", "Mear\Mear\Mear.csproj", "{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Debug|iPhone = Debug|iPhone
|
|
||||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
Release|iPhone = Release|iPhone
|
|
||||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhone.Build.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhone.ActiveCfg = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhone.Build.0 = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhone.Deploy.0 = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
|
||||||
{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhone.Build.0 = Debug|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhone.Deploy.0 = Debug|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|Any CPU.ActiveCfg = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|Any CPU.Build.0 = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|Any CPU.Deploy.0 = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhone.ActiveCfg = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhone.Build.0 = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhone.Deploy.0 = Release|iPhone
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
|
||||||
{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhone.Build.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhone.Deploy.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhone.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhone.Build.0 = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhone.Deploy.0 = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
|
||||||
{3A4FB936-3738-4D2B-A116-B9CABEEADDE0}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {A18B4812-7C12-43E8-A83E-3FF614C450C0}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
Any raw assets you want to be deployed with your application can be placed in
|
|
||||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
|
||||||
|
|
||||||
These files will be deployed with you package and will be accessible using Android's
|
|
||||||
AssetManager, like this:
|
|
||||||
|
|
||||||
public class ReadAsset : Activity
|
|
||||||
{
|
|
||||||
protected override void OnCreate (Bundle bundle)
|
|
||||||
{
|
|
||||||
base.OnCreate (bundle);
|
|
||||||
|
|
||||||
InputStream input = Assets.Open ("my_asset.txt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Additionally, some Android functions will automatically load asset files:
|
|
||||||
|
|
||||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Android.App;
|
|
||||||
using Android.Content.PM;
|
|
||||||
using Android.Runtime;
|
|
||||||
using Android.Views;
|
|
||||||
using Android.Widget;
|
|
||||||
using Android.OS;
|
|
||||||
|
|
||||||
using MediaManager;
|
|
||||||
using Rg.Plugins.Popup;
|
|
||||||
using Rg.Plugins.Popup.Pages;
|
|
||||||
|
|
||||||
namespace Mear.Droid
|
|
||||||
{
|
|
||||||
[Activity(Label = "Mear", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
|
||||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
||||||
{
|
|
||||||
protected override void OnCreate(Bundle savedInstanceState)
|
|
||||||
{
|
|
||||||
TabLayoutResource = Resource.Layout.Tabbar;
|
|
||||||
ToolbarResource = Resource.Layout.Toolbar;
|
|
||||||
|
|
||||||
Popup.Init(this, savedInstanceState);
|
|
||||||
|
|
||||||
base.OnCreate(savedInstanceState);
|
|
||||||
|
|
||||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
|
||||||
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
|
||||||
LoadApplication(new App());
|
|
||||||
|
|
||||||
CrossMediaManager.Current.Init(this);
|
|
||||||
}
|
|
||||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
|
|
||||||
{
|
|
||||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
|
|
||||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
}
|
|
||||||
public override void OnBackPressed()
|
|
||||||
{
|
|
||||||
if (Popup.SendBackPressed(base.OnBackPressed))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{FF6A18DF-D1DF-4D8C-A412-961A3FFF02AE}</ProjectGuid>
|
|
||||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<RootNamespace>Mear.Droid</RootNamespace>
|
|
||||||
<AssemblyName>Mear.Android</AssemblyName>
|
|
||||||
<AndroidApplication>True</AndroidApplication>
|
|
||||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
|
||||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
|
||||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
|
||||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
|
||||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
|
||||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
|
||||||
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
|
|
||||||
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
|
|
||||||
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>portable</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AndroidLinkMode>None</AndroidLinkMode>
|
|
||||||
<AotAssemblies>false</AotAssemblies>
|
|
||||||
<EnableLLVM>false</EnableLLVM>
|
|
||||||
<BundleAssemblies>false</BundleAssemblies>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
|
||||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Mono.Android" />
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Numerics" />
|
|
||||||
<Reference Include="System.Numerics.Vectors" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Plugin.MediaManager">
|
|
||||||
<Version>0.6.7</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="RestSharp">
|
|
||||||
<Version>106.6.9</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="sqlite-net-pcl">
|
|
||||||
<Version>1.5.231</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="UXDivers.GorillaPlayer.SDK">
|
|
||||||
<Version>1.5.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.1" />
|
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="MainActivity.cs" />
|
|
||||||
<Compile Include="Resources\Resource.designer.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\AboutResources.txt" />
|
|
||||||
<None Include="Assets\AboutAssets.txt" />
|
|
||||||
<None Include="Properties\AndroidManifest.xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\layout\Tabbar.axml" />
|
|
||||||
<AndroidResource Include="Resources\layout\Toolbar.axml" />
|
|
||||||
<AndroidResource Include="Resources\values\styles.xml" />
|
|
||||||
<AndroidResource Include="Resources\values\colors.xml" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
|
|
||||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Resources\drawable-hdpi\" />
|
|
||||||
<Folder Include="Resources\drawable-xhdpi\" />
|
|
||||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
|
||||||
<Folder Include="Resources\drawable-xxxhdpi\" />
|
|
||||||
<Folder Include="Resources\drawable\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Mear\Mear.csproj">
|
|
||||||
<Project>{A65E7D12-24D6-4C9C-BCFE-B33E77ABDB06}</Project>
|
|
||||||
<Name>Mear</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<SelectedDevice>Motorola Moto E %284%29 Plus</SelectedDevice>
|
|
||||||
<AndroidDesignerPreferredTheme>Theme.DeviceDefault.Light.NoActionBar.Fullscreen</AndroidDesignerPreferredTheme>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.Mear" android:installLocation="auto">
|
|
||||||
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" />
|
|
||||||
<application android:label="Mear.Android"></application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Android.App;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Mear.Android")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Mear.Android")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
|
|
||||||
// Add some common permissions, these can be removed if not needed
|
|
||||||
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
|
||||||
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
|
||||||
in your application as resource files. Various Android APIs are designed to
|
|
||||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
|
||||||
directly.
|
|
||||||
|
|
||||||
For example, a sample Android app that contains a user interface layout (main.xml),
|
|
||||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
|
||||||
would keep its resources in the "Resources" directory of the application:
|
|
||||||
|
|
||||||
Resources/
|
|
||||||
drawable-hdpi/
|
|
||||||
icon.png
|
|
||||||
|
|
||||||
drawable-ldpi/
|
|
||||||
icon.png
|
|
||||||
|
|
||||||
drawable-mdpi/
|
|
||||||
icon.png
|
|
||||||
|
|
||||||
layout/
|
|
||||||
main.xml
|
|
||||||
|
|
||||||
values/
|
|
||||||
strings.xml
|
|
||||||
|
|
||||||
In order to get the build system to recognize Android resources, set the build action to
|
|
||||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
|
||||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
|
||||||
the build system will package the resources for distribution and generate a class called
|
|
||||||
"Resource" that contains the tokens for each one of the resources included. For example,
|
|
||||||
for the above Resources layout, this is what the Resource class would expose:
|
|
||||||
|
|
||||||
public class Resource {
|
|
||||||
public class drawable {
|
|
||||||
public const int icon = 0x123;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class layout {
|
|
||||||
public const int main = 0x456;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class strings {
|
|
||||||
public const int first_string = 0xabc;
|
|
||||||
public const int second_string = 0xbcd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
|
||||||
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
|
||||||
string in the dictionary file values/strings.xml.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/sliding_tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
|
||||||
app:tabIndicatorColor="@android:color/white"
|
|
||||||
app:tabGravity="fill"
|
|
||||||
app:tabMode="fixed" />
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<android.support.v7.widget.Toolbar
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
|
||||||
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/launcher_background" />
|
|
||||||
<foreground android:drawable="@mipmap/launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/launcher_background" />
|
|
||||||
<foreground android:drawable="@mipmap/launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 51 KiB |
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="launcher_background">#000000</color>
|
|
||||||
<color name="colorPrimary">#360485</color>
|
|
||||||
<color name="colorPrimaryDark">#000000</color>
|
|
||||||
<color name="colorAccent">#bbaa11</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<style name="MainTheme" parent="MainTheme.Base">
|
|
||||||
</style>
|
|
||||||
<!-- Base theme applied no matter what API -->
|
|
||||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
||||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
|
||||||
<item name="windowNoTitle">true</item>
|
|
||||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
|
||||||
<item name="windowActionBar">false</item>
|
|
||||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
|
||||||
<!-- colorPrimary is used for the default action bar background -->
|
|
||||||
<!--
|
|
||||||
<item name="colorPrimary">#2196F3</item>
|
|
||||||
-->
|
|
||||||
<item name="colorPrimary">#333333</item>
|
|
||||||
<!-- colorPrimaryDark is used for the status bar -->
|
|
||||||
<item name="colorPrimaryDark">#000000</item>
|
|
||||||
<!-- colorAccent is used as the default value for colorControlActivated
|
|
||||||
which is used to tint widgets -->
|
|
||||||
<item name="colorAccent">#9955fa</item>
|
|
||||||
<!-- You can also set colorControlNormal, colorControlActivated
|
|
||||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
|
||||||
<item name="windowActionModeOverlay">true</item>
|
|
||||||
|
|
||||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
|
||||||
<item name="colorAccent">#9955fc</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using Foundation;
|
|
||||||
using UIKit;
|
|
||||||
|
|
||||||
namespace Mear.iOS
|
|
||||||
{
|
|
||||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
|
||||||
// User Interface of the application, as well as listening (and optionally responding) to
|
|
||||||
// application events from iOS.
|
|
||||||
[Register("AppDelegate")]
|
|
||||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// This method is invoked when the application has loaded and is ready to run. In this
|
|
||||||
// method you should instantiate the window, load the UI into it and then make the window
|
|
||||||
// visible.
|
|
||||||
//
|
|
||||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
|
||||||
//
|
|
||||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
|
||||||
{
|
|
||||||
Rg.Plugins.Popup.Popup.Init();
|
|
||||||
|
|
||||||
global::Xamarin.Forms.Forms.Init();
|
|
||||||
LoadApplication(new App());
|
|
||||||
|
|
||||||
return base.FinishedLaunching(app, options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
{
|
|
||||||
"images": [
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "20x20",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon40.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "3x",
|
|
||||||
"size": "20x20",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon60.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "29x29",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon58.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "3x",
|
|
||||||
"size": "29x29",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon87.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "40x40",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon80.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "3x",
|
|
||||||
"size": "40x40",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon120.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "60x60",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon120.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "3x",
|
|
||||||
"size": "60x60",
|
|
||||||
"idiom": "iphone",
|
|
||||||
"filename": "Icon180.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "1x",
|
|
||||||
"size": "20x20",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon20.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "20x20",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon40.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "1x",
|
|
||||||
"size": "29x29",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon29.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "29x29",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon58.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "1x",
|
|
||||||
"size": "40x40",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon40.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "40x40",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon80.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "1x",
|
|
||||||
"size": "76x76",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon76.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "76x76",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon152.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "2x",
|
|
||||||
"size": "83.5x83.5",
|
|
||||||
"idiom": "ipad",
|
|
||||||
"filename": "Icon167.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scale": "1x",
|
|
||||||
"size": "1024x1024",
|
|
||||||
"idiom": "ios-marketing",
|
|
||||||
"filename": "Icon1024.png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {},
|
|
||||||
"info": {
|
|
||||||
"version": 1,
|
|
||||||
"author": "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 845 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>1</integer>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
|
||||||
<array>
|
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
||||||
</array>
|
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
||||||
<array>
|
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
||||||
</array>
|
|
||||||
<key>MinimumOSVersion</key>
|
|
||||||
<string>8.0</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>Mear</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.companyname.Mear</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>UILaunchStoryboardName</key>
|
|
||||||
<string>LaunchScreen</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>Mear</string>
|
|
||||||
<key>XSAppIconAssets</key>
|
|
||||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using Foundation;
|
|
||||||
using UIKit;
|
|
||||||
|
|
||||||
namespace Mear.iOS
|
|
||||||
{
|
|
||||||
public class Application
|
|
||||||
{
|
|
||||||
// This is the main entry point of the application.
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
|
||||||
// you can specify it here.
|
|
||||||
UIApplication.Main(args, null, "AppDelegate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{A76BE057-EE1A-4B2B-997C-4D0953DB1E37}</ProjectGuid>
|
|
||||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RootNamespace>Mear.iOS</RootNamespace>
|
|
||||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
|
||||||
<AssemblyName>Mear.iOS</AssemblyName>
|
|
||||||
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
|
|
||||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
|
||||||
<DefineConstants>DEBUG</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>x86_64</MtouchArch>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
<MtouchDebug>true</MtouchDebug>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
<MtouchArch>x86_64</MtouchArch>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
|
||||||
<DefineConstants>DEBUG</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>ARM64</MtouchArch>
|
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
|
||||||
<MtouchDebug>true</MtouchDebug>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<MtouchArch>ARM64</MtouchArch>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Main.cs" />
|
|
||||||
<Compile Include="AppDelegate.cs" />
|
|
||||||
<None Include="Entitlements.plist" />
|
|
||||||
<None Include="Info.plist" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</ImageAsset>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="Xamarin.iOS" />
|
|
||||||
<Reference Include="System.Numerics" />
|
|
||||||
<Reference Include="System.Numerics.Vectors" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="RestSharp">
|
|
||||||
<Version>106.6.9</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="sqlite-net-pcl">
|
|
||||||
<Version>1.5.231</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="UXDivers.GorillaPlayer.SDK">
|
|
||||||
<Version>1.5.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Mear\Mear.csproj">
|
|
||||||
<Project>{A65E7D12-24D6-4C9C-BCFE-B33E77ABDB06}</Project>
|
|
||||||
<Name>Mear</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Mear.iOS")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Mear.iOS")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
|
Before Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h">
|
|
||||||
<dependencies>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--View Controller-->
|
|
||||||
<scene sceneID="gAE-YM-kbH">
|
|
||||||
<objects>
|
|
||||||
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
|
|
||||||
<layoutGuides>
|
|
||||||
<viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
|
|
||||||
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
|
|
||||||
</layoutGuides>
|
|
||||||
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
|
||||||
<rect key="frame" x="270" y="270" width="60" height="60"/>
|
|
||||||
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/>
|
|
||||||
</imageView>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
|
|
||||||
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="349" y="339"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
<resources>
|
|
||||||
<image name="Icon-60.png" width="180" height="180"/>
|
|
||||||
</resources>
|
|
||||||
</document>
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="Mear.App">
|
|
||||||
<Application.Resources>
|
|
||||||
<Color x:Key="NavigationPageColor">#101010</Color>
|
|
||||||
<Color x:Key="NavigationBarColor">#9955fa</Color>
|
|
||||||
<Color x:Key="BarTextColor">#ffffff</Color>
|
|
||||||
<Color x:Key="NavigationPageBackgroundColor">#ffffff</Color>
|
|
||||||
|
|
||||||
<Color x:Key="TabbedBarTextColor">#ffffff</Color>
|
|
||||||
<Color x:Key="TabbedUnselectedColor">#000000</Color>
|
|
||||||
<Color x:Key="TabbedSelectedColor">#333333</Color>
|
|
||||||
|
|
||||||
<Color x:Key="ButtonColor">#360485</Color>
|
|
||||||
<Color x:Key="ButtonTextColor">#ffffff</Color>
|
|
||||||
<Color x:Key="ButtonBorderColor">#9555fa</Color>
|
|
||||||
|
|
||||||
<Color x:Key="LabelTextColor">#ffffff</Color>
|
|
||||||
<Color x:Key="LabelBackgroundColor">#333333</Color>
|
|
||||||
|
|
||||||
<Color x:Key="EntryTextColor">#ffffff</Color>
|
|
||||||
<Color x:Key="EntryPlaceholderTextColor">#a300ff</Color>
|
|
||||||
<Color x:Key="EntryBackgroundColor">#111111</Color>
|
|
||||||
|
|
||||||
<Color x:Key="SwitchBackgroundColor">#101010</Color>
|
|
||||||
<Color x:Key="SwitchActiveColor">#915dfa</Color>
|
|
||||||
|
|
||||||
<Color x:Key="SearchBarBackgroundColor">#222222</Color>
|
|
||||||
<Color x:Key="SearchBarCancelButtonColor">#9955fa</Color>
|
|
||||||
<Color x:Key="SearchBarPlaceholderTextColor">#eeffff</Color>
|
|
||||||
<Color x:Key="SearchBarTextColor">#ffffff</Color>
|
|
||||||
|
|
||||||
<Style TargetType="NavigationPage">
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageBackgroundColor}" />
|
|
||||||
<Setter Property="BarBackgroundColor" Value="{DynamicResource NavigationBarColor}" />
|
|
||||||
<Setter Property="BarTextColor" Value="{DynamicResource BarTextColor}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style TargetType="StackLayout">
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageColor}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style TargetType="Button">
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonColor}" />
|
|
||||||
<Setter Property="TextColor" Value="{DynamicResource ButtonTextColor}" />
|
|
||||||
<Setter Property="BorderColor" Value="{DynamicResource ButtonBorderColor}" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="Label">
|
|
||||||
<Setter Property="TextColor" Value="{DynamicResource LabelTextColor}" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="Entry">
|
|
||||||
<Setter Property="TextColor" Value="{DynamicResource EntryTextColor}" />
|
|
||||||
<Setter Property="PlaceholderColor" Value="{DynamicResource EntryPlaceholderTextColor}" />
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource EntryBackgroundColor}" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="SearchBar">
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource SearchBarBackgroundColor}" />
|
|
||||||
<Setter Property="CancelButtonColor" Value="{DynamicResource SearchBarCancelButtonColor}" />
|
|
||||||
<Setter Property="PlaceholderColor" Value="{DynamicResource SearchBarPlaceholderTextColor}" />
|
|
||||||
<Setter Property="TextColor" Value="{DynamicResource SearchBarTextColor}" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="Switch">
|
|
||||||
<Setter Property="OnColor" Value="{DynamicResource SwitchActiveColor}" />
|
|
||||||
<Setter Property="BackgroundColor" Value="{DynamicResource SwitchBackgroundColor}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
</Application.Resources>
|
|
||||||
</Application>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Xamarin.Forms.Xaml;
|
|
||||||
|
|
||||||
using Mear.Views;
|
|
||||||
|
|
||||||
namespace Mear
|
|
||||||
{
|
|
||||||
public partial class App : Application
|
|
||||||
{
|
|
||||||
public App()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
MainPage = new Landing();
|
|
||||||
MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnStart()
|
|
||||||
{
|
|
||||||
// Handle when your app starts
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnSleep()
|
|
||||||
{
|
|
||||||
// Handle when your app sleeps
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnResume()
|
|
||||||
{
|
|
||||||
// Handle when your app resumes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
using Xamarin.Forms.Xaml;
|
|
||||||
|
|
||||||
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mear.Constants.API
|
|
||||||
{
|
|
||||||
public class API
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private static string _apiUrl = @"https://www..com/";
|
|
||||||
private static string _apiVersion = "";
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public static string ApiUrl
|
|
||||||
{
|
|
||||||
get => _apiUrl;
|
|
||||||
}
|
|
||||||
public static string APIVersion
|
|
||||||
{
|
|
||||||
get => _apiVersion;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mear.Constants.App
|
|
||||||
{
|
|
||||||
public class Info
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private static string _appName = "Mear";
|
|
||||||
private static string _appVersion = "Dev Pre-release";
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public static string AppName
|
|
||||||
{
|
|
||||||
get => _appName;
|
|
||||||
}
|
|
||||||
public static string AppVersion
|
|
||||||
{
|
|
||||||
get => _appVersion;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mear.Constants
|
|
||||||
{
|
|
||||||
public enum PlayControls
|
|
||||||
{
|
|
||||||
PLAYOFFLINE = 1,
|
|
||||||
PAUSE,
|
|
||||||
RESUME,
|
|
||||||
STREAM,
|
|
||||||
PREVIOUS,
|
|
||||||
NEXT,
|
|
||||||
REPEAT,
|
|
||||||
SHUFFLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:local="clr-namespace:Mear"
|
|
||||||
x:Class="Mear.MainPage">
|
|
||||||
|
|
||||||
<StackLayout>
|
|
||||||
<!-- Place new controls here -->
|
|
||||||
<Label Text="Welcome to Xamarin.Forms!"
|
|
||||||
HorizontalOptions="Center"
|
|
||||||
VerticalOptions="CenterAndExpand" />
|
|
||||||
</StackLayout>
|
|
||||||
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Mear
|
|
||||||
{
|
|
||||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
|
||||||
// by visiting https://aka.ms/xamarinforms-previewer
|
|
||||||
[DesignTimeVisible(true)]
|
|
||||||
public partial class MainPage : ContentPage
|
|
||||||
{
|
|
||||||
public MainPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Managers
|
|
||||||
{
|
|
||||||
public class LoginManager
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private User _user;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public LoginManager(User user)
|
|
||||||
{
|
|
||||||
_user = user;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public bool Authenticate()
|
|
||||||
{
|
|
||||||
var loginRes = Login();
|
|
||||||
|
|
||||||
if (loginRes.Expiration > 0 && loginRes != null)
|
|
||||||
{
|
|
||||||
DBUserRepository.DeleteUser();
|
|
||||||
|
|
||||||
SaveToDatabase(loginRes);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LoginResult Login()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/login";
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.POST);
|
|
||||||
var userJson = JsonConvert.SerializeObject(_user);
|
|
||||||
|
|
||||||
request.AddParameter("application/json; charset=utf-8", userJson, ParameterType.RequestBody);
|
|
||||||
request.RequestFormat = DataFormat.Json;
|
|
||||||
|
|
||||||
var response = client.Execute(request);
|
|
||||||
|
|
||||||
var loginResult = JsonConvert.DeserializeObject<LoginResult>(response.Content);
|
|
||||||
|
|
||||||
return loginResult;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void SaveToDatabase(LoginResult loginRes)
|
|
||||||
{
|
|
||||||
DBTokenRepository tokRepo = new DBTokenRepository();
|
|
||||||
tokRepo.SaveToken(new Token
|
|
||||||
{
|
|
||||||
AccessToken = loginRes.Token,
|
|
||||||
UserId = loginRes.UserId
|
|
||||||
});
|
|
||||||
|
|
||||||
DBUserRepository.SaveUser(_user);
|
|
||||||
var usr = DBUserRepository.RetrieveUser();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
|
|
||||||
namespace Mear.Managers
|
|
||||||
{
|
|
||||||
public class RegisterManager
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private User _user;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public RegisterManager(User user)
|
|
||||||
{
|
|
||||||
_user = user;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public RegisterResult RegisterUser()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/register";
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.POST);
|
|
||||||
var userJson = JsonConvert.SerializeObject(_user);
|
|
||||||
request.AddParameter("application/json; charset=utf-8", userJson, ParameterType.RequestBody);
|
|
||||||
request.RequestFormat = DataFormat.Json;
|
|
||||||
|
|
||||||
var response = client.Execute(request);
|
|
||||||
|
|
||||||
var registerResult = JsonConvert.DeserializeObject<RegisterResult>(response.Content);
|
|
||||||
|
|
||||||
return registerResult;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Managers
|
|
||||||
{
|
|
||||||
public class SongManager
|
|
||||||
{
|
|
||||||
#region Methods
|
|
||||||
public async Task StreamSong()
|
|
||||||
{
|
|
||||||
var url = $"https://www.soaricarus.com/api/v1/song/stream/{Playback.MearPlayer.OnSong.Id}";
|
|
||||||
var streamReq = (HttpWebRequest)WebRequest.Create(url);
|
|
||||||
var tokRepo = new DBTokenRepository();
|
|
||||||
var token = tokRepo.RetrieveToken();
|
|
||||||
streamReq.Headers.Add(HttpRequestHeader.Authorization, $"Bearer {token.AccessToken}");
|
|
||||||
streamReq.KeepAlive = true;
|
|
||||||
streamReq.ContentType = "application/octet-stream";
|
|
||||||
streamReq.AddRange(0, long.MaxValue);
|
|
||||||
streamReq.Method = WebRequestMethods.Http.Get;
|
|
||||||
|
|
||||||
using (var songStream = ((HttpWebResponse)streamReq.GetResponse()).GetResponseStream())
|
|
||||||
{
|
|
||||||
using (var songTemp = new FileStream(Playback.MearPlayer.OnSong.SongPath, FileMode.CreateNew, FileAccess.ReadWrite,
|
|
||||||
FileShare.Read, bufferSize: 4096, useAsync: true))
|
|
||||||
{
|
|
||||||
await songStream.CopyToAsync(songTemp);
|
|
||||||
await Task.Delay(500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not use
|
|
||||||
public bool DownloadStream(ref Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//using (var writer = File.OpenWrite(song.SongPath))
|
|
||||||
using (var writer = new FileStream(song.SongPath, FileMode.Create, FileAccess.Write,
|
|
||||||
FileShare.ReadWrite, bufferSize: 4096, useAsync: true))
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/song/stream/{song.Id}";
|
|
||||||
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
var tokRepo = new DBTokenRepository();
|
|
||||||
var token = tokRepo.RetrieveToken();
|
|
||||||
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
request.AddHeader("Content-type", "application/octet-stream");
|
|
||||||
request.AddHeader("Connection", "Keep-Alive");
|
|
||||||
request.ResponseWriter = (responseStream) =>
|
|
||||||
responseStream.CopyTo(writer);
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
//responseStream.CopyToAsync(writer);
|
|
||||||
|
|
||||||
client.DownloadData(request);
|
|
||||||
//var response = client.Execute(request);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Managers
|
|
||||||
{
|
|
||||||
public class ThemeManager
|
|
||||||
{
|
|
||||||
#region Methods
|
|
||||||
public void InitTheme()
|
|
||||||
{
|
|
||||||
var settingsRepo = new DBSettingsRepository();
|
|
||||||
if (settingsRepo.IsDarkThemeOn())
|
|
||||||
{
|
|
||||||
ApplyDarkTheme();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ApplyLightTheme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void ChangeTheme(bool? isDarkTheme = null)
|
|
||||||
{
|
|
||||||
var settingsRepo = new DBSettingsRepository();
|
|
||||||
if (isDarkTheme == null)
|
|
||||||
{
|
|
||||||
settingsRepo.UpdateDarkTheme();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
settingsRepo.UpdateDarkTheme(isDarkTheme.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settingsRepo.IsDarkThemeOn())
|
|
||||||
{
|
|
||||||
ApplyDarkTheme();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ApplyLightTheme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyDarkTheme()
|
|
||||||
{
|
|
||||||
App.Current.Resources["NavigationPageColor"] = Color.FromHex("#101010");
|
|
||||||
App.Current.Resources["BarTextColor"] = Color.FromHex("#ffffff");
|
|
||||||
App.Current.Resources["ButtonColor"] = Color.FromHex("#360485");
|
|
||||||
App.Current.Resources["ButtonTextColor"] = Color.FromHex("#ffffff");
|
|
||||||
App.Current.Resources["ButtonBorderColor"] = Color.FromHex("#9955fa");
|
|
||||||
App.Current.Resources["LabelTextColor"] = Color.FromHex("#ffffff");
|
|
||||||
App.Current.Resources["LabelBackgroundColor"] = Color.FromHex("#333333");
|
|
||||||
App.Current.Resources["EntryTextColor"] = Color.FromHex("#ffffff");
|
|
||||||
App.Current.Resources["EntryPlaceholderTextColor"] = Color.FromHex("#a300ff");
|
|
||||||
App.Current.Resources["EntryBackgroundColor"] = Color.FromHex("#111111");
|
|
||||||
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#101010");
|
|
||||||
App.Current.Resources["SwitchActiveColor"] = Color.FromHex("#915dfa");
|
|
||||||
App.Current.Resources["SearchBarBackgroundColor"] = Color.FromHex("#222222");
|
|
||||||
App.Current.Resources["SearchBarCancelButtonColor"] = Color.FromHex("#9955fa");
|
|
||||||
App.Current.Resources["SearchBarPlaceholderTextColor"] = Color.FromHex("eeffff");
|
|
||||||
App.Current.Resources["SearchBarTextColor"] = Color.FromHex("#ffffff");
|
|
||||||
}
|
|
||||||
private void ApplyLightTheme()
|
|
||||||
{
|
|
||||||
App.Current.Resources["NavigationPageColor"] = Color.FromHex("#eeffff");
|
|
||||||
App.Current.Resources["BarTextColor"] = Color.FromHex("#000000");
|
|
||||||
App.Current.Resources["ButtonColor"] = Color.FromHex("#9955fa");
|
|
||||||
App.Current.Resources["ButtonTextColor"] = Color.FromHex("#000000");
|
|
||||||
App.Current.Resources["ButtonBorderColor"] = Color.FromHex("#360485");
|
|
||||||
App.Current.Resources["LabelTextColor"] = Color.FromHex("#000000");
|
|
||||||
App.Current.Resources["LabelBackgroundColor"] = Color.FromHex("efffff");
|
|
||||||
App.Current.Resources["EntryTextColor"] = Color.FromHex("#000000");
|
|
||||||
App.Current.Resources["EntryPlaceholderTextColor"] = Color.FromHex("#231412");
|
|
||||||
App.Current.Resources["EntryBackgroundColor"] = Color.FromHex("#efffff");
|
|
||||||
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#eeffff");
|
|
||||||
App.Current.Resources["SwitchActiveColor"] = Color.FromHex("#360485");
|
|
||||||
App.Current.Resources["SearchBarBackgroundColor"] = Color.FromHex("#eeffff");
|
|
||||||
App.Current.Resources["SearchBarCancelButtonColor"] = Color.FromHex("#360485");
|
|
||||||
App.Current.Resources["SearchBarPlaceholderTextColor"] = Color.FromHex("#111111");
|
|
||||||
App.Current.Resources["SearchBarTextColor"] = Color.FromHex("#000000");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
|
||||||
<ProduceAssemblyReference>true</ProduceAssemblyReference>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
|
||||||
<PackageReference Include="Plugin.MediaManager" Version="0.6.7" />
|
|
||||||
<PackageReference Include="RestSharp" Version="106.6.9" />
|
|
||||||
<PackageReference Include="Rg.Plugins.Popup" Version="1.1.5.188" />
|
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
|
|
||||||
<PackageReference Include="UXDivers.GorillaPlayer.SDK" Version="1.5.2" />
|
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Views\ArtistView.xaml.cs">
|
|
||||||
<DependentUpon>ArtistView.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Views\AlbumView.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\ArtistView.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\Landing.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\LoginPage.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\MearPlayerView.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\MusicLibrary.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\Popups\AboutPopup.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\RegisterPage.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\SettingsPage.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Views\SongView.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup />
|
|
||||||
</Project>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
public class Album
|
|
||||||
{
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[JsonProperty("title")]
|
|
||||||
public string Title { get; set; }
|
|
||||||
[JsonProperty("album_artist")]
|
|
||||||
public string AlbumArtist { get; set; }
|
|
||||||
[JsonProperty("song_count")]
|
|
||||||
public int SongCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
public class Artist
|
|
||||||
{
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[JsonProperty("song_count")]
|
|
||||||
public int SongCount { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Mear.Models.Authentication
|
|
||||||
{
|
|
||||||
public class BaseResult
|
|
||||||
{
|
|
||||||
[JsonProperty("message")]
|
|
||||||
public string Message { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Mear.Models.Authentication
|
|
||||||
{
|
|
||||||
public class LoginResult : BaseResult
|
|
||||||
{
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public int UserId { get; set; }
|
|
||||||
[JsonProperty("username")]
|
|
||||||
public string Username { get; set; }
|
|
||||||
[JsonProperty("token")]
|
|
||||||
public string Token { get; set; }
|
|
||||||
[JsonProperty("token_type")]
|
|
||||||
public string TokenType { get; set; }
|
|
||||||
[JsonProperty("expiration")]
|
|
||||||
public int Expiration { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Mear.Models.Authentication
|
|
||||||
{
|
|
||||||
public class RegisterResult : BaseResult
|
|
||||||
{
|
|
||||||
[JsonProperty("username")]
|
|
||||||
public string Username { get; set; }
|
|
||||||
[JsonProperty("successfully_registered")]
|
|
||||||
public bool SuccessfullyRegistered { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Models.Authentication
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("Token")]
|
|
||||||
public class Token
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string AccessToken { get; set; }
|
|
||||||
public int UserId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Models.Authentication
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("User")]
|
|
||||||
public class User
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[JsonProperty("username")]
|
|
||||||
public string Username { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("nickname")]
|
|
||||||
public string Nickname { get; set; }
|
|
||||||
[JsonProperty("password")]
|
|
||||||
public string Password { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("email")]
|
|
||||||
public string Email { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("phone_number")]
|
|
||||||
public string PhoneNumber { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("first_name")]
|
|
||||||
public string Firstname { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("last_name")]
|
|
||||||
public string Lastname { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("email_verified")]
|
|
||||||
public bool EmailVerified { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("date_created")]
|
|
||||||
public DateTime DateCreated { get; set; }
|
|
||||||
[Ignore]
|
|
||||||
[JsonProperty("last_login")]
|
|
||||||
public DateTime? LastLogin { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
using Mear.Models.PlayerControls;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("MusicControls")]
|
|
||||||
public class MusicControls
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
public int Id { get; set; }
|
|
||||||
public bool ShuffleOn { get; set; } = false;
|
|
||||||
public int RepeatOn { get; set; } = (int)PlayerControls.Repeat.OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("PlayCount")]
|
|
||||||
public class PlayCount
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int? PlayCounter { get; set; }
|
|
||||||
public int? SongId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mear.Models.PlayerControls
|
|
||||||
{
|
|
||||||
public enum Repeat
|
|
||||||
{
|
|
||||||
OFF = 0,
|
|
||||||
ONE,
|
|
||||||
ALL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Mear.Models.PlayerControls
|
|
||||||
{
|
|
||||||
public enum Shuffle
|
|
||||||
{
|
|
||||||
Off = 0,
|
|
||||||
All
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("Settings")]
|
|
||||||
public class Settings
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
public int Id { get; set; }
|
|
||||||
public bool DarkTheme { get; set; } = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Models
|
|
||||||
{
|
|
||||||
[DataContract]
|
|
||||||
[Table("Song")]
|
|
||||||
public class Song
|
|
||||||
{
|
|
||||||
[PrimaryKey, Column("Id"), AutoIncrement]
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[JsonProperty("title")]
|
|
||||||
public string Title { get; set; }
|
|
||||||
[JsonProperty("album")]
|
|
||||||
public string Album { get; set; }
|
|
||||||
[JsonProperty("artist")]
|
|
||||||
public string Artist { get; set; }
|
|
||||||
[JsonProperty("year")]
|
|
||||||
public int? Year { get; set; }
|
|
||||||
[JsonProperty("genre")]
|
|
||||||
public string Genre { get; set; }
|
|
||||||
[JsonProperty("duration")]
|
|
||||||
public int? Duration { get; set; }
|
|
||||||
[JsonProperty("filename")]
|
|
||||||
public string Filename { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SongPath { set; get; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool Downloaded { get; set; } = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,560 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using MediaManager;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants;
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Managers;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
using Mear.Models.PlayerControls;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
using Mear.Repositories.Remote;
|
|
||||||
using Mear.Utilities;
|
|
||||||
|
|
||||||
namespace Mear.Playback
|
|
||||||
{
|
|
||||||
public class MearPlayer
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private static Queue<Song> _mearQueue = null;
|
|
||||||
private static Song _song;
|
|
||||||
private static bool? _initialized = null;
|
|
||||||
private static SortedDictionary<MusicViews, bool?> _songChanged =
|
|
||||||
new SortedDictionary<MusicViews, bool?>{
|
|
||||||
{ MusicViews.Song, false },
|
|
||||||
{ MusicViews.Album, false },
|
|
||||||
{ MusicViews.Artist, false },
|
|
||||||
{ MusicViews.Player, false }
|
|
||||||
};
|
|
||||||
private static int _songIndex;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public static Song OnSong
|
|
||||||
{
|
|
||||||
get => _song;
|
|
||||||
set => _song = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int QueueIndex
|
|
||||||
{
|
|
||||||
get => _songIndex;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value >= QueueCount)
|
|
||||||
{
|
|
||||||
_songIndex = 0;
|
|
||||||
}
|
|
||||||
else if (value < 0)
|
|
||||||
{
|
|
||||||
_songIndex = QueueCount;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_songIndex = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static int QueueCount
|
|
||||||
{
|
|
||||||
get => _mearQueue.Count;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public static async Task<Song> ControlMusic(Song song, PlayControls control)
|
|
||||||
{
|
|
||||||
if (song != null)
|
|
||||||
{
|
|
||||||
_song = song;
|
|
||||||
}
|
|
||||||
switch (control)
|
|
||||||
{
|
|
||||||
case PlayControls.PLAYOFFLINE:
|
|
||||||
DeterminePlayType();
|
|
||||||
var plyCountRepo = new DBPlayCountRepository();
|
|
||||||
plyCountRepo.AffectPlayCount(_song);
|
|
||||||
InitializeRepeatMode();
|
|
||||||
break;
|
|
||||||
case PlayControls.PAUSE:
|
|
||||||
PauseSong();
|
|
||||||
break;
|
|
||||||
case PlayControls.RESUME:
|
|
||||||
ResumeSong();
|
|
||||||
break;
|
|
||||||
case PlayControls.STREAM:
|
|
||||||
InitializeRepeatMode();
|
|
||||||
return await StreamSong();
|
|
||||||
case PlayControls.REPEAT:
|
|
||||||
ToggleRepeat();
|
|
||||||
break;
|
|
||||||
case PlayControls.SHUFFLE:
|
|
||||||
ToggleShuffle();
|
|
||||||
break;
|
|
||||||
case PlayControls.NEXT:
|
|
||||||
var res = DetermineControlFlow();
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
QueueIndex++;
|
|
||||||
}
|
|
||||||
_song = _mearQueue.ToArray()[QueueIndex];
|
|
||||||
DeterminePlayType();
|
|
||||||
|
|
||||||
_songChanged[MusicViews.Player] = true;
|
|
||||||
break;
|
|
||||||
case PlayControls.PREVIOUS:
|
|
||||||
var prevRes = DetermineControlFlow();
|
|
||||||
if (!prevRes)
|
|
||||||
{
|
|
||||||
QueueIndex--;
|
|
||||||
}
|
|
||||||
_song = _mearQueue.ToArray()[QueueIndex];
|
|
||||||
DeterminePlayType();
|
|
||||||
|
|
||||||
_songChanged[MusicViews.Player] = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<string> ConvertToTime()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var ttlSec = (int)CrossMediaManager.Current.Position.TotalSeconds;
|
|
||||||
return TimeFormat.ConvertToSongTime(ttlSec);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<double?> ProgressValue()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var totalSeconds = (int)CrossMediaManager.Current.Position.TotalSeconds;
|
|
||||||
double progVal = ((double)totalSeconds) / ((double)_song.Duration) * 100;
|
|
||||||
|
|
||||||
return progVal;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task AlterIndex(Song song)
|
|
||||||
{
|
|
||||||
QueueIndex = _mearQueue.ToArray().ToList().IndexOf(song);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task LoadQueue(List<Song> songs)
|
|
||||||
{
|
|
||||||
if (_mearQueue == null)
|
|
||||||
{
|
|
||||||
_mearQueue = new Queue<Song>();
|
|
||||||
}
|
|
||||||
_mearQueue.Clear();
|
|
||||||
songs.ForEach(_mearQueue.Enqueue);
|
|
||||||
_songIndex = 0;
|
|
||||||
}
|
|
||||||
public static async Task DownloadSongToFS()
|
|
||||||
{
|
|
||||||
var songRepo = new RemoteSongRepository();
|
|
||||||
songRepo.DownloadSong(_song);
|
|
||||||
|
|
||||||
_song.Downloaded = true;
|
|
||||||
}
|
|
||||||
public static async Task RemoveSongFromFS()
|
|
||||||
{
|
|
||||||
var dbSongRepo = new DBSongRepository();
|
|
||||||
var plyCount = new DBPlayCountRepository();
|
|
||||||
dbSongRepo.DeleteSong(_song);
|
|
||||||
plyCount.DeletePlayCount(_song);
|
|
||||||
|
|
||||||
File.Delete(_song.SongPath);
|
|
||||||
|
|
||||||
_song.Downloaded = false;
|
|
||||||
}
|
|
||||||
public static async Task ResetSongChange(MusicViews type)
|
|
||||||
{
|
|
||||||
_songChanged[type] = false;
|
|
||||||
}
|
|
||||||
public static async Task SeekTo(double songProress)
|
|
||||||
{
|
|
||||||
double newPosition = (songProress / 100) * ((double)_song.Duration);
|
|
||||||
await CrossMediaManager.Current.SeekTo(TimeSpan.FromSeconds(newPosition));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string RetrieveRepeatString()
|
|
||||||
{
|
|
||||||
var ctrlRepo = new DBMusicControlsRepository();
|
|
||||||
var ctrlRepeatMode = ctrlRepo.IsRepeatOn();
|
|
||||||
|
|
||||||
switch (ctrlRepeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.OFF:
|
|
||||||
return "RepOff";
|
|
||||||
case Repeat.ONE:
|
|
||||||
return "RepOn";
|
|
||||||
case Repeat.ALL:
|
|
||||||
return "RepAll";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
public static string RetrieveShuffleString()
|
|
||||||
{
|
|
||||||
var controlRepo = new DBMusicControlsRepository();
|
|
||||||
var shuffleOn = controlRepo.IsShuffleOn();
|
|
||||||
|
|
||||||
switch (shuffleOn)
|
|
||||||
{
|
|
||||||
case Shuffle.Off:
|
|
||||||
return "ShfOff";
|
|
||||||
case Shuffle.All:
|
|
||||||
return "ShfOn";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsPlaying()
|
|
||||||
{
|
|
||||||
return CrossMediaManager.Current.IsPlaying();
|
|
||||||
}
|
|
||||||
public static bool SongHasBeenChanged(MusicViews type)
|
|
||||||
{
|
|
||||||
return _songChanged[type].Value;
|
|
||||||
}
|
|
||||||
public static bool RepeatMatchedDatabase()
|
|
||||||
{
|
|
||||||
var playerRepeatMode = CrossMediaManager.Current.RepeatMode;
|
|
||||||
var controlRepo = new DBMusicControlsRepository();
|
|
||||||
var repeatMode = controlRepo.IsRepeatOn();
|
|
||||||
var repeatModeConverted = RepeatUtility.RetrieveRepeatMode(repeatMode);
|
|
||||||
|
|
||||||
return (playerRepeatMode == repeatModeConverted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateRepeatControls()
|
|
||||||
{
|
|
||||||
InitializeRepeatMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Task<Song> StreamSong()
|
|
||||||
{
|
|
||||||
var tmpFile = Path.GetTempPath() + "track.mp3";
|
|
||||||
|
|
||||||
if (File.Exists(tmpFile))
|
|
||||||
File.Delete(tmpFile);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var songMgr = new SongManager();
|
|
||||||
_song.SongPath = tmpFile;
|
|
||||||
|
|
||||||
songMgr.StreamSong();
|
|
||||||
|
|
||||||
/**
|
|
||||||
var downloaded = songMgr.DownloadStream(ref _song);
|
|
||||||
|
|
||||||
|
|
||||||
if (downloaded)
|
|
||||||
{
|
|
||||||
PlaySong();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
PlaySong();
|
|
||||||
return Task.Run(() =>
|
|
||||||
{
|
|
||||||
return _song;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
private static Song StreamSong(Song song)
|
|
||||||
{
|
|
||||||
string tmpFile = Path.GetTempPath() + "track.mp3";
|
|
||||||
|
|
||||||
if (File.Exists(tmpFile))
|
|
||||||
{
|
|
||||||
File.Delete(tmpFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var writer = File.OpenWrite(tmpFile))
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/song/stream/{song.Id}"; ;
|
|
||||||
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
var tokRepo = new DBTokenRepository();
|
|
||||||
var token = tokRepo.RetrieveToken();
|
|
||||||
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
request.ResponseWriter = (responseStream) =>
|
|
||||||
responseStream.CopyTo(writer);
|
|
||||||
|
|
||||||
var response = client.DownloadData(request);
|
|
||||||
|
|
||||||
PlaySong(tmpFile);
|
|
||||||
|
|
||||||
song.SongPath = tmpFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
return song;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool DetermineControlFlow()
|
|
||||||
{
|
|
||||||
var ctrlRepo = new DBMusicControlsRepository();
|
|
||||||
var repeatMode = ctrlRepo.IsRepeatOn();
|
|
||||||
|
|
||||||
var repRes = DetermineControlFlow(repeatMode);
|
|
||||||
if (repRes)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var shuffleMode = ctrlRepo.IsShuffleOn();
|
|
||||||
var shfRes = DetermineControlFlow(shuffleMode);
|
|
||||||
if (shfRes)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static bool DetermineControlFlow(Repeat repeatMode)
|
|
||||||
{
|
|
||||||
switch (repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.ONE:
|
|
||||||
CrossMediaManager.Current.SeekToStart();
|
|
||||||
PlaySong();
|
|
||||||
return true;
|
|
||||||
case Repeat.ALL:
|
|
||||||
PlaySong();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
private static bool DetermineControlFlow(Shuffle shuffleMode)
|
|
||||||
{
|
|
||||||
switch (shuffleMode)
|
|
||||||
{
|
|
||||||
case Shuffle.Off:
|
|
||||||
return false;
|
|
||||||
case Shuffle.All:
|
|
||||||
var rnd = new Random();
|
|
||||||
var rando = rnd.Next(QueueCount);
|
|
||||||
QueueIndex = rando;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
private static void DeterminePlayType()
|
|
||||||
{
|
|
||||||
if (!_song.Downloaded)
|
|
||||||
{
|
|
||||||
StreamSong();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlaySong();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static void InitializeModes()
|
|
||||||
{
|
|
||||||
InitializeRepeatMode();
|
|
||||||
}
|
|
||||||
private static void InitializeRepeatMode()
|
|
||||||
{
|
|
||||||
var ctrlRepo = new DBMusicControlsRepository();
|
|
||||||
var repeatMode = ctrlRepo.IsRepeatOn();
|
|
||||||
|
|
||||||
var mode = RepeatUtility.RetrieveRepeatMode(repeatMode);
|
|
||||||
|
|
||||||
CrossMediaManager.Current.RepeatMode = mode;
|
|
||||||
}
|
|
||||||
private static async Task PauseSong()
|
|
||||||
{
|
|
||||||
await CrossMediaManager.Current.Pause();
|
|
||||||
}
|
|
||||||
private static async Task PlaySong()
|
|
||||||
{
|
|
||||||
await CrossMediaManager.Current.Play(_song.SongPath);
|
|
||||||
|
|
||||||
if (_initialized == null)
|
|
||||||
{
|
|
||||||
CrossMediaManager.Current.MediaItemFinished += Current_MediaItemFinished;
|
|
||||||
_initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_songChanged[MusicViews.Song] = true;
|
|
||||||
_songChanged[MusicViews.Album] = true;
|
|
||||||
_songChanged[MusicViews.Artist] = true;
|
|
||||||
}
|
|
||||||
private static async Task PlaySong(string songPath)
|
|
||||||
{
|
|
||||||
await CrossMediaManager.Current.Play(songPath);
|
|
||||||
InitializePlayer();
|
|
||||||
|
|
||||||
SongChanged();
|
|
||||||
}
|
|
||||||
private static async Task ResumeSong()
|
|
||||||
{
|
|
||||||
await CrossMediaManager.Current.PlayPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InitializePlayer()
|
|
||||||
{
|
|
||||||
if (_initialized == null)
|
|
||||||
{
|
|
||||||
CrossMediaManager.Current.MediaItemFinished += Current_MediaItemFinished;
|
|
||||||
CrossMediaManager.Current.VolumeManager.CurrentVolume = CrossMediaManager.Current.VolumeManager.MaxVolume;
|
|
||||||
_initialized = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static void SongChanged()
|
|
||||||
{
|
|
||||||
_songChanged[MusicViews.Song] = true;
|
|
||||||
_songChanged[MusicViews.Album] = true;
|
|
||||||
_songChanged[MusicViews.Artist] = true;
|
|
||||||
}
|
|
||||||
private static void ToggleRepeat()
|
|
||||||
{
|
|
||||||
var musicCtrl = new DBMusicControlsRepository();
|
|
||||||
musicCtrl.UpdateRepeat();
|
|
||||||
var repeatMode = musicCtrl.IsRepeatOn();
|
|
||||||
|
|
||||||
CrossMediaManager.Current.RepeatMode = RepeatUtility.RetrieveRepeatMode(repeatMode);
|
|
||||||
}
|
|
||||||
private static void ToggleShuffle()
|
|
||||||
{
|
|
||||||
var musicCtrl = new DBMusicControlsRepository();
|
|
||||||
musicCtrl.UpdateShuffle();
|
|
||||||
var shuffleMode = musicCtrl.IsShuffleOn();
|
|
||||||
|
|
||||||
CrossMediaManager.Current.ShuffleMode = ShuffleUtility.RetrieveShuffleMode(shuffleMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Background
|
|
||||||
private static async Task BackgroundWork()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
new Thread(async () =>
|
|
||||||
{
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Events
|
|
||||||
private static void Current_MediaItemFinished(object sender, MediaManager.Media.MediaItemEventArgs e)
|
|
||||||
{
|
|
||||||
var ctrlRepo = new DBMusicControlsRepository();
|
|
||||||
var repeatMode = ctrlRepo.IsRepeatOn();
|
|
||||||
|
|
||||||
DetermineControlFlow();
|
|
||||||
|
|
||||||
switch(repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.ONE:
|
|
||||||
CrossMediaManager.Current.SeekToStart();
|
|
||||||
PlaySong(_song.SongPath);
|
|
||||||
return;
|
|
||||||
case Repeat.ALL:
|
|
||||||
// Will implment this fully later once Queues are a feature
|
|
||||||
PlaySong(_song.SongPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var shuffleMode = ctrlRepo.IsShuffleOn();
|
|
||||||
|
|
||||||
switch (shuffleMode)
|
|
||||||
{
|
|
||||||
case Shuffle.Off:
|
|
||||||
QueueIndex++;
|
|
||||||
break;
|
|
||||||
case Shuffle.All:
|
|
||||||
Random rnd = new Random();
|
|
||||||
var rando = rnd.Next(QueueCount);
|
|
||||||
QueueIndex = rando;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_song = _mearQueue.ToArray()[QueueIndex];
|
|
||||||
if (_song.Downloaded)
|
|
||||||
{
|
|
||||||
PlaySong();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StreamSong();
|
|
||||||
}
|
|
||||||
|
|
||||||
_songChanged[MusicViews.Player] = true;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Enums
|
|
||||||
public enum MusicViews
|
|
||||||
{
|
|
||||||
Song = 0,
|
|
||||||
Album,
|
|
||||||
Artist,
|
|
||||||
Player
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Models.PlayerControls;
|
|
||||||
using Mear.Utilities;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBMusicControlsRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DBMusicControlsRepository()
|
|
||||||
{
|
|
||||||
Initialize();
|
|
||||||
InitializeTable();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public Shuffle IsShuffleOn()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("MusicControls"))
|
|
||||||
{
|
|
||||||
bool? shuffle = _Db.Table<MusicControls>().First().ShuffleOn;
|
|
||||||
|
|
||||||
if (shuffle != null)
|
|
||||||
{
|
|
||||||
return shuffle.Value ? Shuffle.All : Shuffle.Off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Shuffle.Off;
|
|
||||||
}
|
|
||||||
public Repeat IsRepeatOn()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("MusicControls"))
|
|
||||||
{
|
|
||||||
var repeat = _Db.Table<MusicControls>().First().RepeatOn;
|
|
||||||
|
|
||||||
return (Repeat)repeat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Repeat.OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateRepeat()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("MusicControls"))
|
|
||||||
{
|
|
||||||
var control = RetrieveMusicControls();
|
|
||||||
var repeatMode = (Repeat)control.RepeatOn;
|
|
||||||
control.RepeatOn = RepeatUtility.ToggleRepeatMode(repeatMode);
|
|
||||||
|
|
||||||
_Db.Update(control);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void UpdateShuffle()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("MusicControls"))
|
|
||||||
{
|
|
||||||
var control = RetrieveMusicControls();
|
|
||||||
control.ShuffleOn = (!control.ShuffleOn);
|
|
||||||
|
|
||||||
_Db.Update(control);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private MusicControls RetrieveMusicControls()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var controls = _Db.Table<MusicControls>().First();
|
|
||||||
|
|
||||||
return controls;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
private void InitializeTable()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("MusicControls"))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<MusicControls>();
|
|
||||||
}
|
|
||||||
|
|
||||||
var controls = RetrieveMusicControls();
|
|
||||||
|
|
||||||
if (controls == null)
|
|
||||||
{
|
|
||||||
var initControl = new MusicControls();
|
|
||||||
_Db.Insert(initControl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBPlayCountRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DBPlayCountRepository()
|
|
||||||
{
|
|
||||||
Initialize();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public PlayCount RetrievePlayCount(int songId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("PlayCount"))
|
|
||||||
{
|
|
||||||
var playCount = _Db.Table<PlayCount>()
|
|
||||||
.Where(p => p.SongId==songId).First();
|
|
||||||
|
|
||||||
if (playCount != null)
|
|
||||||
{
|
|
||||||
return playCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AffectPlayCount(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("PlayCount"))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<PlayCount>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var plyCount = RetrievePlayCount(song);
|
|
||||||
if (plyCount == null)
|
|
||||||
{
|
|
||||||
_Db.Insert(new PlayCount
|
|
||||||
{
|
|
||||||
PlayCounter = 1,
|
|
||||||
SongId = song.Id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plyCount.PlayCounter++;
|
|
||||||
_Db.Update(plyCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void DeletePlayCount(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var plyCount = RetrievePlayCount(song);
|
|
||||||
_Db.Delete(plyCount);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void SavePlayCount(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("PlayCount"))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<PlayCount>();
|
|
||||||
}
|
|
||||||
var playCount = new PlayCount
|
|
||||||
{
|
|
||||||
PlayCounter = 1,
|
|
||||||
SongId = song.Id
|
|
||||||
};
|
|
||||||
|
|
||||||
_Db.Insert(playCount);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void UpdatePlayCount(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("PlayCount"))
|
|
||||||
{
|
|
||||||
var songId = song.Id;
|
|
||||||
var plyCount = RetrievePlayCount(songId);
|
|
||||||
if (plyCount != null)
|
|
||||||
{
|
|
||||||
plyCount.PlayCounter += 1;
|
|
||||||
|
|
||||||
_Db.Update(plyCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private PlayCount RetrievePlayCount(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist("PlayCount"))
|
|
||||||
{
|
|
||||||
var songId = song.Id;
|
|
||||||
var playCount = _Db.Table<PlayCount>()
|
|
||||||
.Where(p => p.SongId==songId).First();
|
|
||||||
|
|
||||||
if (playCount != null)
|
|
||||||
{
|
|
||||||
return playCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Constants.App;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
protected static SQLiteConnection _DbConn = null;
|
|
||||||
protected SQLiteConnection _Db;
|
|
||||||
protected static string _table;
|
|
||||||
protected string _dbPath;
|
|
||||||
protected string _tableName;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public string DBPath
|
|
||||||
{
|
|
||||||
get => _dbPath;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
protected static bool TableExists()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = _DbConn.GetTableInfo(_table).Count;
|
|
||||||
|
|
||||||
if (result > 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
protected bool DoesTableExist(string tablename)
|
|
||||||
{
|
|
||||||
var result = 0;
|
|
||||||
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
result = _Db.GetTableInfo(tablename).Count;
|
|
||||||
|
|
||||||
if (result > 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void CloseDbConnection()
|
|
||||||
{
|
|
||||||
_DbConn.Close();
|
|
||||||
}
|
|
||||||
protected void CloseDb()
|
|
||||||
{
|
|
||||||
_Db.Close();
|
|
||||||
}
|
|
||||||
protected void Initialize()
|
|
||||||
{
|
|
||||||
var appName = Info.AppName;
|
|
||||||
_dbPath = Path.Combine(Environment.GetFolderPath(
|
|
||||||
Environment.SpecialFolder.Personal), appName);
|
|
||||||
|
|
||||||
_Db = new SQLiteConnection(_dbPath);
|
|
||||||
}
|
|
||||||
protected static void InitializeDatabase(string tablename)
|
|
||||||
{
|
|
||||||
if (_DbConn != null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_table = tablename;
|
|
||||||
var appName = Info.AppName;
|
|
||||||
_DbConn = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(
|
|
||||||
Environment.SpecialFolder.Personal), appName));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBSettingsRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DBSettingsRepository()
|
|
||||||
{
|
|
||||||
_tableName = "Settings";
|
|
||||||
Initialize();
|
|
||||||
InitializeTable();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public bool IsDarkThemeOn()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist(_tableName))
|
|
||||||
{
|
|
||||||
bool? darkTheme = RetrieveSettings().DarkTheme;
|
|
||||||
|
|
||||||
if (darkTheme != null)
|
|
||||||
{
|
|
||||||
return darkTheme.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateDarkTheme()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist(_tableName))
|
|
||||||
{
|
|
||||||
var settings = RetrieveSettings();
|
|
||||||
settings.DarkTheme = !settings.DarkTheme;
|
|
||||||
|
|
||||||
_Db.Update(settings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void UpdateDarkTheme(bool isDarkTheme)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (DoesTableExist(_tableName))
|
|
||||||
{
|
|
||||||
var settings = RetrieveSettings();
|
|
||||||
settings.DarkTheme = isDarkTheme;
|
|
||||||
_Db.Update(settings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Settings RetrieveSettings()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var settings = _Db.Table<Settings>().First();
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeTable()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!DoesTableExist(_tableName))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<Settings>();
|
|
||||||
}
|
|
||||||
|
|
||||||
var settings = RetrieveSettings();
|
|
||||||
|
|
||||||
if (settings == null)
|
|
||||||
{
|
|
||||||
var initSettings = new Settings();
|
|
||||||
_Db.Insert(initSettings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
using Mear.Constants.App;
|
|
||||||
using Mear.Models;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBSongRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DBSongRepository()
|
|
||||||
{
|
|
||||||
Initialize();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<Song> RetrieveSongs()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var songs = _Db.Table<Song>().ToList();
|
|
||||||
|
|
||||||
return songs;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public Song RetrieveSong(int id)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var song = _Db.Table<Song>().Where(s => s.Id == id).First();
|
|
||||||
|
|
||||||
return song;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public Song RetrieveSong(string artist, string title)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var song = _Db.Table<Song>().Where(s =>
|
|
||||||
(s.Artist.Equals(artist) && s.Title.Equals(title))).First();
|
|
||||||
|
|
||||||
return song;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteSong(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_Db.Delete(song);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void SaveSong(Song song)
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("Song"))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<Song>();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_Db.Insert(song);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void UpdateSong(Song song)
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("Song"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Implement functionality for udpating song
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using SQLite;
|
|
||||||
|
|
||||||
using Mear.Constants.App;
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBTokenRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DBTokenRepository()
|
|
||||||
{
|
|
||||||
Initialize();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public Token RetrieveToken()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var token = _Db.Table<Token>().FirstOrDefault();
|
|
||||||
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public void SaveToken(Token token)
|
|
||||||
{
|
|
||||||
if (!DoesTableExist("Token"))
|
|
||||||
{
|
|
||||||
_Db.CreateTable<Token>();
|
|
||||||
}
|
|
||||||
|
|
||||||
_Db.DeleteAll<Token>();
|
|
||||||
|
|
||||||
_Db.Insert(token);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Database
|
|
||||||
{
|
|
||||||
public class DBUserRepository : DBRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public static User RetrieveUser()
|
|
||||||
{
|
|
||||||
InitializeDatabase("User");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (TableExists())
|
|
||||||
{
|
|
||||||
var user = _DbConn.Table<User>().First();
|
|
||||||
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DeleteUser()
|
|
||||||
{
|
|
||||||
InitializeDatabase("User");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (TableExists())
|
|
||||||
{
|
|
||||||
_DbConn.Table<User>().Delete(u => !string.IsNullOrEmpty(u.Username));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void SaveUser(User user)
|
|
||||||
{
|
|
||||||
InitializeDatabase("User");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!TableExists())
|
|
||||||
{
|
|
||||||
_DbConn.CreateTable<User>();
|
|
||||||
}
|
|
||||||
|
|
||||||
_DbConn.Insert(user);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Local
|
|
||||||
{
|
|
||||||
public class LocalSongRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Contructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<Song> RetrieveSongs()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dbSongRepo = new DBSongRepository();
|
|
||||||
|
|
||||||
var songs = dbSongRepo.RetrieveSongs();
|
|
||||||
|
|
||||||
if (songs == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Unable to retrieve song metadata from the local database");
|
|
||||||
}
|
|
||||||
|
|
||||||
return songs;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models.Authentication;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Mock
|
|
||||||
{
|
|
||||||
public class MockUserRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private List<User> _users;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<User> Users
|
|
||||||
{
|
|
||||||
get => _users;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public MockUserRepository()
|
|
||||||
{
|
|
||||||
InitializeMockUser();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
private void InitializeMockUser()
|
|
||||||
{
|
|
||||||
_users = new List<User>();
|
|
||||||
|
|
||||||
var firstname = "kuoth";
|
|
||||||
var lastname = "Universe";
|
|
||||||
var email = "life@hell.org";
|
|
||||||
var phone = "4330944491";
|
|
||||||
var username = "kverse";
|
|
||||||
var password = "demolaugh";
|
|
||||||
|
|
||||||
_users.Add(new User
|
|
||||||
{
|
|
||||||
Firstname = firstname,
|
|
||||||
Lastname = lastname,
|
|
||||||
Email = email,
|
|
||||||
PhoneNumber = phone,
|
|
||||||
Username = username,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Remote
|
|
||||||
{
|
|
||||||
public class RemoteAlbumRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<Album> RetrieveAlbums()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/album";
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
|
|
||||||
var tkRepo = new DBTokenRepository();
|
|
||||||
var token = tkRepo.RetrieveToken();
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
request.AddHeader("Connection", "Keep-Alive");
|
|
||||||
|
|
||||||
var reponse = client.Execute(request);
|
|
||||||
|
|
||||||
var albums = JsonConvert.DeserializeObject<List<Album>>(reponse.Content);
|
|
||||||
|
|
||||||
return albums;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Remote
|
|
||||||
{
|
|
||||||
public class RemoteArtistRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<Artist> RetrieveArtists()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/artist";
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
|
|
||||||
var tkRepo = new DBTokenRepository();
|
|
||||||
var token = tkRepo.RetrieveToken();
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
request.AddHeader("Connection", "Keep-Alive");
|
|
||||||
|
|
||||||
var response = client.Execute(request);
|
|
||||||
|
|
||||||
var artists = JsonConvert.DeserializeObject<List<Artist>>(response.Content);
|
|
||||||
|
|
||||||
return artists;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
using Mear.Constants.API;
|
|
||||||
using Mear.Models;
|
|
||||||
using Mear.Repositories.Database;
|
|
||||||
using Mear.Utilities;
|
|
||||||
|
|
||||||
namespace Mear.Repositories.Remote
|
|
||||||
{
|
|
||||||
public class RemoteSongRepository
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public List<Song> RetrieveSongs()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/song";
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
|
|
||||||
DBTokenRepository tkRepo = new DBTokenRepository();
|
|
||||||
var token = tkRepo.RetrieveToken();
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
request.AddHeader("Connection", "Keep-Alive");
|
|
||||||
|
|
||||||
var response = client.Execute(request);
|
|
||||||
|
|
||||||
var songs = JsonConvert.DeserializeObject<List<Song>>(response.Content);
|
|
||||||
|
|
||||||
return songs;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public void DownloadSong(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dirMgr = new DirectoryManager(song);
|
|
||||||
var path = dirMgr.CreateSongPath(song);
|
|
||||||
using (var writer = File.OpenWrite(path))
|
|
||||||
{
|
|
||||||
var client = new RestClient(API.ApiUrl);
|
|
||||||
var apiEndpoint = $@"api/{API.APIVersion}/song/data/{song.Id}"; ;
|
|
||||||
var request = new RestRequest(apiEndpoint, Method.GET);
|
|
||||||
|
|
||||||
DBTokenRepository tkRepo = new DBTokenRepository();
|
|
||||||
var token = tkRepo.RetrieveToken();
|
|
||||||
request.AddHeader("Authorization", $"Bearer {token.AccessToken}");
|
|
||||||
|
|
||||||
request.ResponseWriter = (responseStream) =>
|
|
||||||
responseStream.CopyTo(writer);
|
|
||||||
|
|
||||||
var response = client.DownloadData(request);
|
|
||||||
}
|
|
||||||
song.Downloaded = true;
|
|
||||||
song.SongPath = path;
|
|
||||||
|
|
||||||
var dbSongRepo = new DBSongRepository();
|
|
||||||
dbSongRepo.SaveSong(song);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
|
|
||||||
namespace Mear.Utilities
|
|
||||||
{
|
|
||||||
public class DirectoryManager
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
private Song _song;
|
|
||||||
private string _path;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public DirectoryManager(Song song)
|
|
||||||
{
|
|
||||||
_song = song;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public string CreateSongPath(Song song)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var artist = song.Artist;
|
|
||||||
var album = song.Album;
|
|
||||||
var title = song.Title;
|
|
||||||
|
|
||||||
if (!ArtistDirectoryExist(song))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(ArtistPath(song));
|
|
||||||
}
|
|
||||||
if (!AlbumDirectoryExist(song))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(AlbumPath(song));
|
|
||||||
}
|
|
||||||
if (SongPathExist(song))
|
|
||||||
{
|
|
||||||
// TODO: Song exists
|
|
||||||
return SongPath(song);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SongPath(song);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string RootPath(Song song)
|
|
||||||
{
|
|
||||||
var path = $@"{Environment.GetFolderPath(Environment.SpecialFolder.Personal)}/";
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
private string ArtistPath(Song song)
|
|
||||||
{
|
|
||||||
var path = RootPath(song);
|
|
||||||
path += $@"{song.Artist}/";
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
private string AlbumPath(Song song)
|
|
||||||
{
|
|
||||||
var path = ArtistPath(song);
|
|
||||||
path += $@"{song.Album}/";
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
private string SongPath(Song song)
|
|
||||||
{
|
|
||||||
var path = AlbumPath(song);
|
|
||||||
path += $@"{song.Filename}";
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ArtistDirectoryExist(Song song)
|
|
||||||
{
|
|
||||||
var path = RootPath(song);
|
|
||||||
path += song.Artist;
|
|
||||||
|
|
||||||
return Directory.Exists(path);
|
|
||||||
}
|
|
||||||
private bool AlbumDirectoryExist(Song song)
|
|
||||||
{
|
|
||||||
var path = AlbumPath(song);
|
|
||||||
|
|
||||||
return Directory.Exists(path);
|
|
||||||
}
|
|
||||||
private bool SongPathExist(Song song)
|
|
||||||
{
|
|
||||||
var path = SongPath(song);
|
|
||||||
|
|
||||||
return File.Exists(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Initialize()
|
|
||||||
{
|
|
||||||
_path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"/";
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using MediaManager;
|
|
||||||
|
|
||||||
using Mear.Models.PlayerControls;
|
|
||||||
|
|
||||||
namespace Mear.Utilities
|
|
||||||
{
|
|
||||||
public class RepeatUtility
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public static MediaManager.Playback.RepeatMode RetrieveRepeatMode(Repeat repeatMode)
|
|
||||||
{
|
|
||||||
switch (repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.OFF:
|
|
||||||
return MediaManager.Playback.RepeatMode.Off;
|
|
||||||
case Repeat.ONE:
|
|
||||||
return MediaManager.Playback.RepeatMode.One;
|
|
||||||
case Repeat.ALL:
|
|
||||||
return MediaManager.Playback.RepeatMode.All;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MediaManager.Playback.RepeatMode.Off;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string RepeatString(Repeat repeatMode)
|
|
||||||
{
|
|
||||||
switch (repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.OFF:
|
|
||||||
return "RepOff";
|
|
||||||
case Repeat.ONE:
|
|
||||||
return "RepOne";
|
|
||||||
case Repeat.ALL:
|
|
||||||
return "RepAll";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
public static string ToggleRepeatString(Repeat repeatMode)
|
|
||||||
{
|
|
||||||
switch (repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.OFF:
|
|
||||||
return "RepOn";
|
|
||||||
case Repeat.ONE:
|
|
||||||
return "RepAll";
|
|
||||||
case Repeat.ALL:
|
|
||||||
return "RepOff";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int ToggleRepeatMode(Repeat repeatMode)
|
|
||||||
{
|
|
||||||
switch (repeatMode)
|
|
||||||
{
|
|
||||||
case Repeat.OFF:
|
|
||||||
return (int)Repeat.ONE;
|
|
||||||
case Repeat.ONE:
|
|
||||||
return (int)Repeat.ALL;
|
|
||||||
case Repeat.ALL:
|
|
||||||
return (int)Repeat.OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using MediaManager;
|
|
||||||
|
|
||||||
using Mear.Models.PlayerControls;
|
|
||||||
|
|
||||||
namespace Mear.Utilities
|
|
||||||
{
|
|
||||||
public class ShuffleUtility
|
|
||||||
{
|
|
||||||
#region Methods
|
|
||||||
public static MediaManager.Queue.ShuffleMode RetrieveShuffleMode(Shuffle shuffleMode)
|
|
||||||
{
|
|
||||||
switch (shuffleMode)
|
|
||||||
{
|
|
||||||
case Shuffle.Off:
|
|
||||||
return MediaManager.Queue.ShuffleMode.Off;
|
|
||||||
case Shuffle.All:
|
|
||||||
return MediaManager.Queue.ShuffleMode.All;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MediaManager.Queue.ShuffleMode.Off;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Mear.Models;
|
|
||||||
|
|
||||||
using IOFile = System.IO.File;
|
|
||||||
|
|
||||||
namespace Mear.Utilities
|
|
||||||
{
|
|
||||||
public class SongMetadataRetriever
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public Song ExtractData(string songPath)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public Stream ExtractCovertArtStream(Song song)
|
|
||||||
{
|
|
||||||
var strm = new FileStream(song.SongPath, FileMode.Open);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return strm;
|
|
||||||
}
|
|
||||||
public string ExtractCoverArtData(Song song)
|
|
||||||
{
|
|
||||||
var imgData = string.Empty;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var d = IOFile.ReadAllBytes(song.SongPath);
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var msg = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return imgData;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||