diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 0841a3c86..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -#init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -#on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -#install: -# - choco install cloc --no-progress -# - "cloc --vcs git --exclude-dir Resources,store,test,UWP,Properties --include-lang C#,JavaScript,TypeScript,PowerShell" -# - appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -# - appveyor DownloadFile https://aka.ms/vs/15/release/vs_community.exe -# - vs_community.exe update --wait --quiet --norestart --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" -# - ps: .\src\Android\update-android.ps1 -before_build: - - nuget restore - - IF DEFINED keystore_dec_secret nuget install secure-file -ExcludeVersion - - IF DEFINED google_services_dec_secret secure-file\tools\secure-file -decrypt src\Android\google-services.json.enc -secret %google_services_dec_secret% -after_build: - - ps: IF($env:keystore_dec_secret) { .\src\Android\ci-build-apks.ps1 } -on_success: - - IF DEFINED play_dec_secret secure-file\tools\secure-file -decrypt store\google\Publisher\play_creds.json.enc -secret %play_dec_secret% - - IF DEFINED play_dec_secret dotnet store\google\Publisher\bin\Release\netcoreapp2.0\Publisher.dll %APPVEYOR_BUILD_FOLDER%\store\google\Publisher\play_creds.json %APPVEYOR_BUILD_FOLDER%\com.x8bit.bitwarden-%APPVEYOR_BUILD_NUMBER%.apk alpha -artifacts: - - path: com.x8bit.bitwarden-%APPVEYOR_BUILD_NUMBER%.apk - - path: com.x8bit.bitwarden-fdroid-%APPVEYOR_BUILD_NUMBER%.apk -branches: - except: - - l10n_master -skip_tags: true -configuration: Release -image: Visual Studio 2017 diff --git a/bitwarden-mobile.sln b/bitwarden-mobile.sln deleted file mode 100644 index 417cf1c94..000000000 --- a/bitwarden-mobile.sln +++ /dev/null @@ -1,523 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Android", "src\Android\Android.csproj", "{04B18ED2-B76D-4947-8474-191F8FD2B5E0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS", "src\iOS\iOS.csproj", "{1F78403F-9A28-405B-9289-B9DBEB55F074}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0D790714-ECF8-4A83-BE4A-E9C84DD1BB5D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EC730FD9-F623-4B6C-B503-95CDCFBCF277}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App.Test", "test\App.Test\App.Test.csproj", "{A300DCE1-8D10-4267-B96A-CB01AEB7C220}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Extension", "src\iOS.Extension\iOS.Extension.csproj", "{32F5A2D6-F54D-4DA1-AE26-0A980D48F422}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Core", "src\iOS.Core\iOS.Core.csproj", "{B2538ADA-B605-4D6F-ACD2-62A409680F84}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "store", "store", "{92470CBD-9047-4C3C-8EA3-D972D6622D84}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "google", "google", "{2E399654-26A2-46F6-B9CA-1B496A3F370A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App", "src\App\App.csproj", "{8A279EE4-4537-4656-9C93-44945E594556}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Publisher", "store\google\Publisher\Publisher.csproj", "{D5D91152-CB01-4F24-A503-304D3A94408B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F0E2E596-C3DB-474A-9C88-7824662894FA}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - appveyor.yml = appveyor.yml - crowdin.yml = crowdin.yml - README.md = README.md - SECURITY.md = SECURITY.md - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Autofill", "src\iOS.Autofill\iOS.Autofill.csproj", "{C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Ad-Hoc|Any CPU = Ad-Hoc|Any CPU - Ad-Hoc|ARM = Ad-Hoc|ARM - Ad-Hoc|iPhone = Ad-Hoc|iPhone - Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator - Ad-Hoc|x64 = Ad-Hoc|x64 - Ad-Hoc|x86 = Ad-Hoc|x86 - AppStore|Any CPU = AppStore|Any CPU - AppStore|ARM = AppStore|ARM - AppStore|iPhone = AppStore|iPhone - AppStore|iPhoneSimulator = AppStore|iPhoneSimulator - AppStore|x64 = AppStore|x64 - AppStore|x86 = AppStore|x86 - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|iPhone = Debug|iPhone - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - FDroid|Any CPU = FDroid|Any CPU - FDroid|ARM = FDroid|ARM - FDroid|iPhone = FDroid|iPhone - FDroid|iPhoneSimulator = FDroid|iPhoneSimulator - FDroid|x64 = FDroid|x64 - FDroid|x86 = FDroid|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|Any CPU.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|ARM.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|ARM.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|ARM.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x64.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x64.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x64.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x86.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x86.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.AppStore|x86.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|ARM.Build.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|ARM.Deploy.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|x64.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|x86.ActiveCfg = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|x86.Build.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Debug|x86.Deploy.0 = Debug|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|Any CPU.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|Any CPU.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|Any CPU.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|ARM.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|ARM.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|ARM.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhone.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhone.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhone.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhoneSimulator.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhoneSimulator.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|iPhoneSimulator.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x64.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x64.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x64.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x86.ActiveCfg = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x86.Build.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.FDroid|x86.Deploy.0 = FDroid|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|Any CPU.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|Any CPU.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|ARM.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|ARM.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|ARM.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|iPhone.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x64.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x64.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x64.Deploy.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x86.ActiveCfg = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x86.Build.0 = Release|Any CPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0}.Release|x86.Deploy.0 = Release|Any CPU - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|iPhone.Build.0 = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|x64.ActiveCfg = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.AppStore|x86.ActiveCfg = AppStore|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|ARM.ActiveCfg = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|iPhone.ActiveCfg = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|iPhone.Build.0 = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|x64.ActiveCfg = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|x86.ActiveCfg = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Debug|x86.Build.0 = Debug|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|Any CPU.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|Any CPU.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|ARM.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|ARM.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|iPhone.ActiveCfg = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|iPhone.Build.0 = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|x64.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|x64.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|x86.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.FDroid|x86.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|Any CPU.ActiveCfg = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|ARM.ActiveCfg = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|iPhone.ActiveCfg = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|iPhone.Build.0 = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|x64.ActiveCfg = Release|iPhone - {1F78403F-9A28-405B-9289-B9DBEB55F074}.Release|x86.ActiveCfg = Release|iPhone - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|Any CPU.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|ARM.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|ARM.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|x64.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|x64.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|x86.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.AppStore|x86.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|ARM.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|x64.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|x86.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Debug|x86.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|Any CPU.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|Any CPU.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|ARM.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|ARM.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|iPhone.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|iPhone.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|iPhoneSimulator.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|x64.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|x64.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|x86.ActiveCfg = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.FDroid|x86.Build.0 = Debug|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|Any CPU.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|ARM.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|ARM.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|iPhone.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|x64.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|x64.Build.0 = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|x86.ActiveCfg = Release|Any CPU - {A300DCE1-8D10-4267-B96A-CB01AEB7C220}.Release|x86.Build.0 = Release|Any CPU - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|iPhone.Build.0 = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|x64.ActiveCfg = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.AppStore|x86.ActiveCfg = AppStore|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|ARM.ActiveCfg = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|iPhone.ActiveCfg = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|iPhone.Build.0 = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|x64.ActiveCfg = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|x86.ActiveCfg = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Debug|x86.Build.0 = Debug|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|Any CPU.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|Any CPU.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|ARM.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|ARM.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|iPhone.ActiveCfg = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|iPhone.Build.0 = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|x64.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|x64.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|x86.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.FDroid|x86.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|Any CPU.ActiveCfg = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|ARM.ActiveCfg = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|iPhone.ActiveCfg = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|iPhone.Build.0 = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|x64.ActiveCfg = Release|iPhone - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422}.Release|x86.ActiveCfg = Release|iPhone - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|Any CPU.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|ARM.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|ARM.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|iPhone.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|x64.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|x64.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|x86.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.AppStore|x86.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|ARM.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|iPhone.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|x64.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|x86.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Debug|x86.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|Any CPU.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|Any CPU.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|ARM.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|ARM.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|iPhone.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|iPhone.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|iPhoneSimulator.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|x64.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|x64.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|x86.ActiveCfg = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.FDroid|x86.Build.0 = Debug|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|ARM.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|iPhone.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|iPhone.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|x64.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|x64.Build.0 = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|x86.ActiveCfg = Release|Any CPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84}.Release|x86.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|ARM.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|iPhone.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|x64.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|x64.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|x86.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.AppStore|x86.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|ARM.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|ARM.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|iPhone.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|x64.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|x64.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|x86.ActiveCfg = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Debug|x86.Build.0 = Debug|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|Any CPU.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|Any CPU.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|ARM.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|ARM.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|iPhone.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|iPhone.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|iPhoneSimulator.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|iPhoneSimulator.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|x64.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|x64.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|x86.ActiveCfg = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.FDroid|x86.Build.0 = FDroid|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|Any CPU.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|ARM.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|ARM.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|iPhone.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|iPhone.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|x64.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|x64.Build.0 = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|x86.ActiveCfg = Release|Any CPU - {8A279EE4-4537-4656-9C93-44945E594556}.Release|x86.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|ARM.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|iPhone.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|x64.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|x64.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|x86.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.AppStore|x86.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|ARM.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|ARM.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|iPhone.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|x64.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|x64.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|x86.ActiveCfg = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Debug|x86.Build.0 = Debug|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|Any CPU.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|Any CPU.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|ARM.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|ARM.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|iPhone.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|iPhone.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|iPhoneSimulator.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|x64.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|x64.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|x86.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.FDroid|x86.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|Any CPU.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|ARM.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|ARM.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|iPhone.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|iPhone.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|x64.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|x64.Build.0 = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|x86.ActiveCfg = Release|Any CPU - {D5D91152-CB01-4F24-A503-304D3A94408B}.Release|x86.Build.0 = Release|Any CPU - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|iPhone.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|x64.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.AppStore|x86.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|ARM.ActiveCfg = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|iPhone.ActiveCfg = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|iPhone.Build.0 = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|x64.ActiveCfg = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Debug|x86.ActiveCfg = Debug|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|Any CPU.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|Any CPU.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|ARM.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|ARM.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|iPhone.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|iPhone.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|x64.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|x64.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|x86.ActiveCfg = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.FDroid|x86.Build.0 = AppStore|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|Any CPU.ActiveCfg = Release|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|ARM.ActiveCfg = Release|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|iPhone.ActiveCfg = Release|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|iPhone.Build.0 = Release|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|x64.ActiveCfg = Release|iPhone - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F}.Release|x86.ActiveCfg = Release|iPhone - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {04B18ED2-B76D-4947-8474-191F8FD2B5E0} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - {1F78403F-9A28-405B-9289-B9DBEB55F074} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - {A300DCE1-8D10-4267-B96A-CB01AEB7C220} = {0D790714-ECF8-4A83-BE4A-E9C84DD1BB5D} - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - {B2538ADA-B605-4D6F-ACD2-62A409680F84} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - {2E399654-26A2-46F6-B9CA-1B496A3F370A} = {92470CBD-9047-4C3C-8EA3-D972D6622D84} - {8A279EE4-4537-4656-9C93-44945E594556} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - {D5D91152-CB01-4F24-A503-304D3A94408B} = {2E399654-26A2-46F6-B9CA-1B496A3F370A} - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F} = {EC730FD9-F623-4B6C-B503-95CDCFBCF277} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {318CB2DF-0118-43A3-AC83-56BADCF71CCD} - EndGlobalSection -EndGlobal diff --git a/src/Android/8bit.keystore.enc b/src/Android/8bit.keystore.enc deleted file mode 100644 index 0318720af..000000000 Binary files a/src/Android/8bit.keystore.enc and /dev/null differ diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj deleted file mode 100644 index c1246e57a..000000000 --- a/src/Android/Android.csproj +++ /dev/null @@ -1,1025 +0,0 @@ - - - - Debug - AnyCPU - {04B18ED2-B76D-4947-8474-191F8FD2B5E0} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Properties - Bit.Android - BitwardenAndroid - 512 - true - Resources\Resource.Designer.cs - Off - Properties\AndroidManifest.xml - false - v9.0 - armeabi,armeabi-v7a,x86 - Xamarin.Android.Net.AndroidClientHandler - - - - - - - - - True - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - True - None - PushNotification.Plugin;PushNotification.Plugin.Abstractions;Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;SQLite-net;Xamarin.Android.Net - True - False - False - Xamarin - False - 1G - Xamarin.Android.Net.AndroidClientHandler - False - False - False - btls - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - False - Full - True - False - False - Xamarin - False - False - False - False - False - 1G - PushNotification.Plugin;PushNotification.Plugin.Abstractions;Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;SQLite-net;Xamarin.Android.Net - Xamarin.Android.Net.AndroidClientHandler - armeabi;armeabi-v7a;x86;x86_64;arm64-v8a - btls - SHA1withRSA - - - bin\FDroid\ - TRACE;FDROID - true - pdbonly - AnyCPU - Off - prompt - MinimumRecommendedRules.ruleset - false - true - Full - BitwardenAndroid;BitwardenApp;SQLite-net;Xamarin.Android.Net - btls - armeabi;armeabi-v7a;x86;x86_64;arm64-v8a - 1G - SHA1withRSA - - - - - - False - .\Naxam.Ittianyu.BottomNavExtension.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - AndroidResource - - - AndroidResource - - - AndroidResource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8a279ee4-4537-4656-9c93-44945e594556} - App - - - - - 60.1142.1 - - - 4.4.0 - - - 27.0.2.1 - - - 27.0.2.1 - - - 27.0.2.1 - - - 27.0.2.1 - - - 27.0.2.1 - - - 60.1142.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Android/Assets/AboutAssets.txt b/src/Android/Assets/AboutAssets.txt deleted file mode 100644 index 5ddf08729..000000000 --- a/src/Android/Assets/AboutAssets.txt +++ /dev/null @@ -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"); diff --git a/src/Android/Autofill/AutofillHelpers.cs b/src/Android/Autofill/AutofillHelpers.cs deleted file mode 100644 index 792a56a71..000000000 --- a/src/Android/Autofill/AutofillHelpers.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Content; -using Android.Service.Autofill; -using Android.Widget; -using System.Linq; -using Android.App; -using Bit.App.Abstractions; -using System.Threading.Tasks; -using Bit.App.Resources; -using Bit.App.Enums; -using Android.Views.Autofill; - -namespace Bit.Android.Autofill -{ - public static class AutofillHelpers - { - private static int _pendingIntentId = 0; - - // These browser work natively with the autofill framework - public static HashSet TrustedBrowsers = new HashSet - { - "org.mozilla.focus","org.mozilla.klar","com.duckduckgo.mobile.android" - }; - - // These browsers work using the compatibility shim for the autofill framework - public static HashSet CompatBrowsers = new HashSet - { - "org.mozilla.firefox","org.mozilla.firefox_beta","com.microsoft.emmx","com.android.chrome", - "com.chrome.beta","com.android.browser","com.brave.browser","com.opera.browser", - "com.opera.browser.beta","com.opera.mini.native","com.chrome.dev","com.chrome.canary", - "com.google.android.apps.chrome","com.google.android.apps.chrome_dev","com.yandex.browser", - "com.sec.android.app.sbrowser","com.sec.android.app.sbrowser.beta","org.codeaurora.swe.browser", - "com.amazon.cloud9","mark.via.gp","org.bromite.bromite","org.chromium.chrome","com.kiwibrowser.browser", - "com.ecosia.android","com.opera.mini.native.beta","org.mozilla.fennec_aurora","com.qwant.liberty", - "com.opera.touch" - }; - - // The URLs are blacklisted from autofilling - public static HashSet BlacklistedUris = new HashSet - { - "androidapp://android", "androidapp://com.x8bit.bitwarden", "androidapp://com.oneplus.applocker" - }; - - public static async Task> GetFillItemsAsync(Parser parser, ICipherService service) - { - var items = new List(); - - if(parser.FieldCollection.FillableForLogin) - { - var ciphers = await service.GetAllAsync(parser.Uri); - if(ciphers.Item1.Any() || ciphers.Item2.Any()) - { - var allCiphers = ciphers.Item1.ToList(); - allCiphers.AddRange(ciphers.Item2.ToList()); - foreach(var cipher in allCiphers) - { - items.Add(new FilledItem(cipher)); - } - } - } - else if(parser.FieldCollection.FillableForCard) - { - var ciphers = await service.GetAllAsync(); - foreach(var cipher in ciphers.Where(c => c.Type == CipherType.Card)) - { - items.Add(new FilledItem(cipher)); - } - } - - return items; - } - - public static FillResponse BuildFillResponse(Context context, Parser parser, List items, bool locked) - { - var responseBuilder = new FillResponse.Builder(); - if(items != null && items.Count > 0) - { - foreach(var item in items) - { - var dataset = BuildDataset(context, parser.FieldCollection, item); - if(dataset != null) - { - responseBuilder.AddDataset(dataset); - } - } - } - - responseBuilder.AddDataset(BuildVaultDataset(context, parser.FieldCollection, parser.Uri, locked)); - AddSaveInfo(parser, responseBuilder, parser.FieldCollection); - responseBuilder.SetIgnoredIds(parser.FieldCollection.IgnoreAutofillIds.ToArray()); - return responseBuilder.Build(); - } - - public static Dataset BuildDataset(Context context, FieldCollection fields, FilledItem filledItem) - { - var datasetBuilder = new Dataset.Builder( - BuildListView(context.PackageName, filledItem.Name, filledItem.Subtitle, filledItem.Icon)); - if(filledItem.ApplyToFields(fields, datasetBuilder)) - { - return datasetBuilder.Build(); - } - return null; - } - - public static Dataset BuildVaultDataset(Context context, FieldCollection fields, string uri, bool locked) - { - var intent = new Intent(context, typeof(MainActivity)); - intent.PutExtra("autofillFramework", true); - if(fields.FillableForLogin) - { - intent.PutExtra("autofillFrameworkFillType", (int)CipherType.Login); - } - else if(fields.FillableForCard) - { - intent.PutExtra("autofillFrameworkFillType", (int)CipherType.Card); - } - else if(fields.FillableForIdentity) - { - intent.PutExtra("autofillFrameworkFillType", (int)CipherType.Identity); - } - else - { - return null; - } - intent.PutExtra("autofillFrameworkUri", uri); - var pendingIntent = PendingIntent.GetActivity(context, ++_pendingIntentId, intent, - PendingIntentFlags.CancelCurrent); - - var view = BuildListView(context.PackageName, AppResources.AutofillWithBitwarden, - locked ? AppResources.VaultIsLocked : AppResources.GoToMyVault, Resource.Drawable.icon); - - var datasetBuilder = new Dataset.Builder(view); - datasetBuilder.SetAuthentication(pendingIntent.IntentSender); - - // Dataset must have a value set. We will reset this in the main activity when the real item is chosen. - foreach(var autofillId in fields.AutofillIds) - { - datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER")); - } - - return datasetBuilder.Build(); - } - - public static RemoteViews BuildListView(string packageName, string text, string subtext, int iconId) - { - var view = new RemoteViews(packageName, Resource.Layout.autofill_listitem); - view.SetTextViewText(Resource.Id.text, text); - view.SetTextViewText(Resource.Id.text2, subtext); - view.SetImageViewResource(Resource.Id.icon, iconId); - return view; - } - - public static void AddSaveInfo(Parser parser, FillResponse.Builder responseBuilder, FieldCollection fields) - { - // Docs state that password fields cannot be reliably saved in Compat mode since they will show as - // masked values. - var compatBrowser = CompatBrowsers.Contains(parser.PackageName); - if(compatBrowser && fields.SaveType == SaveDataType.Password) - { - return; - } - - var requiredIds = fields.GetRequiredSaveFields(); - if(fields.SaveType == SaveDataType.Generic || requiredIds.Length == 0) - { - return; - } - - var saveBuilder = new SaveInfo.Builder(fields.SaveType, requiredIds); - var optionalIds = fields.GetOptionalSaveIds(); - if(optionalIds.Length > 0) - { - saveBuilder.SetOptionalIds(optionalIds); - } - if(compatBrowser) - { - saveBuilder.SetFlags(SaveFlags.SaveOnAllViewsInvisible); - } - responseBuilder.SetSaveInfo(saveBuilder.Build()); - } - } -} \ No newline at end of file diff --git a/src/Android/Autofill/AutofillService.cs b/src/Android/Autofill/AutofillService.cs deleted file mode 100644 index cd0b05430..000000000 --- a/src/Android/Autofill/AutofillService.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Android; -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Service.Autofill; -using Android.Widget; -using Bit.App; -using Bit.App.Abstractions; -using Bit.App.Enums; -using System.Collections.Generic; -using System.Linq; -using XLabs.Ioc; - -namespace Bit.Android.Autofill -{ - [Service(Permission = Manifest.Permission.BindAutofillService, Label = "Bitwarden")] - [IntentFilter(new string[] { "android.service.autofill.AutofillService" })] - [MetaData("android.autofill", Resource = "@xml/autofillservice")] - [Register("com.x8bit.bitwarden.Autofill.AutofillService")] - public class AutofillService : global::Android.Service.Autofill.AutofillService - { - private ICipherService _cipherService; - private ILockService _lockService; - - public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback) - { - var structure = request.FillContexts?.LastOrDefault()?.Structure; - if(structure == null) - { - return; - } - - var parser = new Parser(structure); - parser.Parse(); - - if(!parser.ShouldAutofill) - { - return; - } - - if(_lockService == null) - { - _lockService = Resolver.Resolve(); - } - - List items = null; - var locked = (await _lockService.GetLockTypeAsync(false)) != LockType.None; - if(!locked) - { - if(_cipherService == null) - { - _cipherService = Resolver.Resolve(); - } - - items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService); - } - - // build response - var response = AutofillHelpers.BuildFillResponse(this, parser, items, locked); - callback.OnSuccess(response); - } - - public override void OnSaveRequest(SaveRequest request, SaveCallback callback) - { - var structure = request.FillContexts?.LastOrDefault()?.Structure; - if(structure == null) - { - return; - } - - var parser = new Parser(structure); - parser.Parse(); - - var savedItem = parser.FieldCollection.GetSavedItem(); - if(savedItem == null) - { - Toast.MakeText(this, "Unable to save this form.", ToastLength.Short).Show(); - return; - } - - var intent = new Intent(this, typeof(MainActivity)); - intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop); - intent.PutExtra("autofillFramework", true); - intent.PutExtra("autofillFrameworkSave", true); - intent.PutExtra("autofillFrameworkType", (int)savedItem.Type); - switch(savedItem.Type) - { - case CipherType.Login: - intent.PutExtra("autofillFrameworkName", parser.Uri - .Replace(Constants.AndroidAppProtocol, string.Empty) - .Replace("https://", string.Empty) - .Replace("http://", string.Empty)); - intent.PutExtra("autofillFrameworkUri", parser.Uri); - intent.PutExtra("autofillFrameworkUsername", savedItem.Login.Username); - intent.PutExtra("autofillFrameworkPassword", savedItem.Login.Password); - break; - case CipherType.Card: - intent.PutExtra("autofillFrameworkCardName", savedItem.Card.Name); - intent.PutExtra("autofillFrameworkCardNumber", savedItem.Card.Number); - intent.PutExtra("autofillFrameworkCardExpMonth", savedItem.Card.ExpMonth); - intent.PutExtra("autofillFrameworkCardExpYear", savedItem.Card.ExpYear); - intent.PutExtra("autofillFrameworkCardCode", savedItem.Card.Code); - break; - default: - Toast.MakeText(this, "Unable to save this type of form.", ToastLength.Short).Show(); - return; - } - StartActivity(intent); - } - } -} diff --git a/src/Android/Autofill/Field.cs b/src/Android/Autofill/Field.cs deleted file mode 100644 index 36d18de20..000000000 --- a/src/Android/Autofill/Field.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Android.Service.Autofill; -using Android.Views; -using Android.Views.Autofill; -using static Android.App.Assist.AssistStructure; -using Android.Text; -using static Android.Views.ViewStructure; - -namespace Bit.Android.Autofill -{ - public class Field - { - private List _hints; - - public Field(ViewNode node) - { - Id = node.Id; - TrackingId = $"{node.Id}_{node.GetHashCode()}"; - IdEntry = node.IdEntry; - AutofillId = node.AutofillId; - AutofillType = node.AutofillType; - InputType = node.InputType; - Focused = node.IsFocused; - Selected = node.IsSelected; - Clickable = node.IsClickable; - Visible = node.Visibility == ViewStates.Visible; - Hints = FilterForSupportedHints(node.GetAutofillHints()); - Hint = node.Hint; - AutofillOptions = node.GetAutofillOptions()?.ToList(); - HtmlInfo = node.HtmlInfo; - Node = node; - - if(node.AutofillValue != null) - { - if(node.AutofillValue.IsList) - { - var autofillOptions = node.GetAutofillOptions(); - if(autofillOptions != null && autofillOptions.Length > 0) - { - ListValue = node.AutofillValue.ListValue; - TextValue = autofillOptions[node.AutofillValue.ListValue]; - } - } - else if(node.AutofillValue.IsDate) - { - DateValue = node.AutofillValue.DateValue; - } - else if(node.AutofillValue.IsText) - { - TextValue = node.AutofillValue.TextValue; - } - else if(node.AutofillValue.IsToggle) - { - ToggleValue = node.AutofillValue.ToggleValue; - } - } - } - - public SaveDataType SaveType { get; set; } = SaveDataType.Generic; - public List Hints - { - get => _hints; - set - { - _hints = value; - UpdateSaveTypeFromHints(); - } - } - public string Hint { get; set; } - public int Id { get; private set; } - public string TrackingId { get; private set; } - public string IdEntry { get; set; } - public AutofillId AutofillId { get; private set; } - public AutofillType AutofillType { get; private set; } - public InputTypes InputType { get; private set; } - public bool Focused { get; private set; } - public bool Selected { get; private set; } - public bool Clickable { get; private set; } - public bool Visible { get; private set; } - public List AutofillOptions { get; set; } - public string TextValue { get; set; } - public long? DateValue { get; set; } - public int? ListValue { get; set; } - public bool? ToggleValue { get; set; } - public HtmlInfo HtmlInfo { get; private set; } - public ViewNode Node { get; private set; } - - private void UpdateSaveTypeFromHints() - { - SaveType = SaveDataType.Generic; - if(_hints == null) - { - return; - } - - foreach(var hint in _hints) - { - switch(hint) - { - case View.AutofillHintCreditCardExpirationDate: - case View.AutofillHintCreditCardExpirationDay: - case View.AutofillHintCreditCardExpirationMonth: - case View.AutofillHintCreditCardExpirationYear: - case View.AutofillHintCreditCardNumber: - case View.AutofillHintCreditCardSecurityCode: - SaveType |= SaveDataType.CreditCard; - break; - case View.AutofillHintEmailAddress: - SaveType |= SaveDataType.EmailAddress; - break; - case View.AutofillHintPhone: - case View.AutofillHintName: - SaveType |= SaveDataType.Generic; - break; - case View.AutofillHintPassword: - SaveType |= SaveDataType.Password; - SaveType &= ~SaveDataType.EmailAddress; - SaveType &= ~SaveDataType.Username; - break; - case View.AutofillHintPostalAddress: - case View.AutofillHintPostalCode: - SaveType |= SaveDataType.Address; - break; - case View.AutofillHintUsername: - SaveType |= SaveDataType.Username; - break; - } - } - } - - public bool ValueIsNull() - { - return TextValue == null && DateValue == null && ToggleValue == null; - } - - public override bool Equals(object obj) - { - if(this == obj) - { - return true; - } - - if(obj == null || GetType() != obj.GetType()) - { - return false; - } - - var field = obj as Field; - if(TextValue != null ? !TextValue.Equals(field.TextValue) : field.TextValue != null) - { - return false; - } - - if(DateValue != null ? !DateValue.Equals(field.DateValue) : field.DateValue != null) - { - return false; - } - - return ToggleValue != null ? ToggleValue.Equals(field.ToggleValue) : field.ToggleValue == null; - } - - public override int GetHashCode() - { - var result = TextValue != null ? TextValue.GetHashCode() : 0; - result = 31 * result + (DateValue != null ? DateValue.GetHashCode() : 0); - result = 31 * result + (ToggleValue != null ? ToggleValue.GetHashCode() : 0); - return result; - } - - private static List FilterForSupportedHints(string[] hints) - { - return hints?.Where(h => IsValidHint(h)).ToList() ?? new List(); - } - - private static bool IsValidHint(string hint) - { - switch(hint) - { - case View.AutofillHintCreditCardExpirationDate: - case View.AutofillHintCreditCardExpirationDay: - case View.AutofillHintCreditCardExpirationMonth: - case View.AutofillHintCreditCardExpirationYear: - case View.AutofillHintCreditCardNumber: - case View.AutofillHintCreditCardSecurityCode: - case View.AutofillHintEmailAddress: - case View.AutofillHintPhone: - case View.AutofillHintName: - case View.AutofillHintPassword: - case View.AutofillHintPostalAddress: - case View.AutofillHintPostalCode: - case View.AutofillHintUsername: - return true; - default: - return false; - } - } - } -} diff --git a/src/Android/Autofill/FieldCollection.cs b/src/Android/Autofill/FieldCollection.cs deleted file mode 100644 index 05210073a..000000000 --- a/src/Android/Autofill/FieldCollection.cs +++ /dev/null @@ -1,348 +0,0 @@ -using System.Collections.Generic; -using Android.Service.Autofill; -using Android.Views.Autofill; -using System.Linq; -using Android.Text; -using Android.Views; - -namespace Bit.Android.Autofill -{ - public class FieldCollection - { - private List _passwordFields = null; - private List _usernameFields = null; - private HashSet _ignoreSearchTerms = new HashSet { "search", "find", "recipient", "edit" }; - private HashSet _passwordTerms = new HashSet { "password", "pswd" }; - - public List AutofillIds { get; private set; } = new List(); - public SaveDataType SaveType - { - get - { - if(FillableForLogin) - { - return SaveDataType.Password; - } - else if(FillableForCard) - { - return SaveDataType.CreditCard; - } - - return SaveDataType.Generic; - } - } - public HashSet Hints { get; private set; } = new HashSet(); - public HashSet FocusedHints { get; private set; } = new HashSet(); - public HashSet FieldTrackingIds { get; private set; } = new HashSet(); - public List Fields { get; private set; } = new List(); - public IDictionary> HintToFieldsMap { get; private set; } = - new Dictionary>(); - public List IgnoreAutofillIds { get; private set; } = new List(); - - public List PasswordFields - { - get - { - if(_passwordFields != null) - { - return _passwordFields; - } - - if(Hints.Any()) - { - _passwordFields = new List(); - if(HintToFieldsMap.ContainsKey(View.AutofillHintPassword)) - { - _passwordFields.AddRange(HintToFieldsMap[View.AutofillHintPassword]); - } - } - else - { - _passwordFields = Fields.Where(f => FieldIsPassword(f)).ToList(); - if(!_passwordFields.Any()) - { - _passwordFields = Fields.Where(f => FieldHasPasswordTerms(f)).ToList(); - } - } - - return _passwordFields; - } - } - - public List UsernameFields - { - get - { - if(_usernameFields != null) - { - return _usernameFields; - } - - _usernameFields = new List(); - if(Hints.Any()) - { - if(HintToFieldsMap.ContainsKey(View.AutofillHintEmailAddress)) - { - _usernameFields.AddRange(HintToFieldsMap[View.AutofillHintEmailAddress]); - } - if(HintToFieldsMap.ContainsKey(View.AutofillHintUsername)) - { - _usernameFields.AddRange(HintToFieldsMap[View.AutofillHintUsername]); - } - } - else - { - foreach(var passwordField in PasswordFields) - { - var usernameField = Fields.TakeWhile(f => f.AutofillId != passwordField.AutofillId) - .LastOrDefault(); - if(usernameField != null) - { - _usernameFields.Add(usernameField); - } - } - } - - return _usernameFields; - } - } - - public bool FillableForLogin => FocusedHintsContain( - new string[] { View.AutofillHintUsername, View.AutofillHintEmailAddress, View.AutofillHintPassword }) || - UsernameFields.Any(f => f.Focused) || PasswordFields.Any(f => f.Focused); - public bool FillableForCard => FocusedHintsContain( - new string[] { View.AutofillHintCreditCardNumber, View.AutofillHintCreditCardExpirationMonth, - View.AutofillHintCreditCardExpirationYear, View.AutofillHintCreditCardSecurityCode}); - public bool FillableForIdentity => FocusedHintsContain( - new string[] { View.AutofillHintName, View.AutofillHintPhone, View.AutofillHintPostalAddress, - View.AutofillHintPostalCode }); - - public bool Fillable => FillableForLogin || FillableForCard || FillableForIdentity; - - public void Add(Field field) - { - if(field == null || FieldTrackingIds.Contains(field.TrackingId)) - { - return; - } - - _passwordFields = _usernameFields = null; - - FieldTrackingIds.Add(field.TrackingId); - Fields.Add(field); - AutofillIds.Add(field.AutofillId); - - if(field.Hints != null) - { - foreach(var hint in field.Hints) - { - Hints.Add(hint); - if(field.Focused) - { - FocusedHints.Add(hint); - } - - if(!HintToFieldsMap.ContainsKey(hint)) - { - HintToFieldsMap.Add(hint, new List()); - } - - HintToFieldsMap[hint].Add(field); - } - } - } - - public SavedItem GetSavedItem() - { - if(SaveType == SaveDataType.Password) - { - var passwordField = PasswordFields.FirstOrDefault(f => !string.IsNullOrWhiteSpace(f.TextValue)); - if(passwordField == null) - { - return null; - } - - var savedItem = new SavedItem - { - Type = App.Enums.CipherType.Login, - Login = new SavedItem.LoginItem - { - Password = GetFieldValue(passwordField) - } - }; - - var usernameField = Fields.TakeWhile(f => f.AutofillId != passwordField.AutofillId).LastOrDefault(); - savedItem.Login.Username = GetFieldValue(usernameField); - - return savedItem; - } - else if(SaveType == SaveDataType.CreditCard) - { - var savedItem = new SavedItem - { - Type = App.Enums.CipherType.Card, - Card = new SavedItem.CardItem - { - Number = GetFieldValue(View.AutofillHintCreditCardNumber), - Name = GetFieldValue(View.AutofillHintName), - ExpMonth = GetFieldValue(View.AutofillHintCreditCardExpirationMonth, true), - ExpYear = GetFieldValue(View.AutofillHintCreditCardExpirationYear), - Code = GetFieldValue(View.AutofillHintCreditCardSecurityCode) - } - }; - - return savedItem; - } - - return null; - } - - public AutofillId[] GetOptionalSaveIds() - { - if(SaveType == SaveDataType.Password) - { - return UsernameFields.Select(f => f.AutofillId).ToArray(); - } - else if(SaveType == SaveDataType.CreditCard) - { - var fieldList = new List(); - if(HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardSecurityCode)) - { - fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardSecurityCode]); - } - if(HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardExpirationYear)) - { - fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardExpirationYear]); - } - if(HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardExpirationMonth)) - { - fieldList.AddRange(HintToFieldsMap[View.AutofillHintCreditCardExpirationMonth]); - } - if(HintToFieldsMap.ContainsKey(View.AutofillHintName)) - { - fieldList.AddRange(HintToFieldsMap[View.AutofillHintName]); - } - return fieldList.Select(f => f.AutofillId).ToArray(); - } - - return new AutofillId[0]; - } - - public AutofillId[] GetRequiredSaveFields() - { - if(SaveType == SaveDataType.Password) - { - return PasswordFields.Select(f => f.AutofillId).ToArray(); - } - else if(SaveType == SaveDataType.CreditCard && HintToFieldsMap.ContainsKey(View.AutofillHintCreditCardNumber)) - { - return HintToFieldsMap[View.AutofillHintCreditCardNumber].Select(f => f.AutofillId).ToArray(); - } - - return new AutofillId[0]; - } - - private bool FocusedHintsContain(IEnumerable hints) - { - return hints.Any(h => FocusedHints.Contains(h)); - } - - private string GetFieldValue(string hint, bool monthValue = false) - { - if(HintToFieldsMap.ContainsKey(hint)) - { - foreach(var field in HintToFieldsMap[hint]) - { - var val = GetFieldValue(field, monthValue); - if(!string.IsNullOrWhiteSpace(val)) - { - return val; - } - } - } - - return null; - } - - private string GetFieldValue(Field field, bool monthValue = false) - { - if(field == null) - { - return null; - } - - if(!string.IsNullOrWhiteSpace(field.TextValue)) - { - if(field.AutofillType == AutofillType.List && field.ListValue.HasValue && monthValue) - { - if(field.AutofillOptions.Count == 13) - { - return field.ListValue.ToString(); - } - else if(field.AutofillOptions.Count == 12) - { - return (field.ListValue + 1).ToString(); - } - } - return field.TextValue; - } - else if(field.DateValue.HasValue) - { - return field.DateValue.Value.ToString(); - } - else if(field.ToggleValue.HasValue) - { - return field.ToggleValue.Value.ToString(); - } - - return null; - } - - private bool FieldIsPassword(Field f) - { - var inputTypePassword = f.InputType.HasFlag(InputTypes.TextVariationPassword) || - f.InputType.HasFlag(InputTypes.TextVariationVisiblePassword) || - f.InputType.HasFlag(InputTypes.TextVariationWebPassword); - - // For whatever reason, multi-line input types are coming through with TextVariationPassword flags - if(inputTypePassword && f.InputType.HasFlag(InputTypes.TextVariationPassword) && - f.InputType.HasFlag(InputTypes.TextFlagMultiLine)) - { - inputTypePassword = false; - } - - if(!inputTypePassword && f.HtmlInfo != null && f.HtmlInfo.Tag == "input" && - (f.HtmlInfo.Attributes?.Any() ?? false)) - { - foreach(var a in f.HtmlInfo.Attributes) - { - var key = a.First as Java.Lang.String; - var val = a.Second as Java.Lang.String; - if(key != null && val != null && key.ToString() == "type" && val.ToString() == "password") - { - return true; - } - } - } - - return inputTypePassword && !ValueContainsAnyTerms(f.IdEntry, _ignoreSearchTerms) && - !ValueContainsAnyTerms(f.Hint, _ignoreSearchTerms); - } - - private bool FieldHasPasswordTerms(Field f) - { - return ValueContainsAnyTerms(f.IdEntry, _passwordTerms) || ValueContainsAnyTerms(f.Hint, _passwordTerms); - } - - private bool ValueContainsAnyTerms(string value, HashSet terms) - { - if(string.IsNullOrWhiteSpace(value)) - { - return false; - } - - var lowerValue = value.ToLowerInvariant(); - return terms.Any(t => lowerValue.Contains(t)); - } - } -} \ No newline at end of file diff --git a/src/Android/Autofill/FilledItem.cs b/src/Android/Autofill/FilledItem.cs deleted file mode 100644 index 854b4531d..000000000 --- a/src/Android/Autofill/FilledItem.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using Android.Service.Autofill; -using Android.Views.Autofill; -using System.Linq; -using Bit.App.Models; -using Bit.App.Enums; -using Android.Views; - -namespace Bit.Android.Autofill -{ - public class FilledItem - { - private Lazy _password; - private Lazy _cardName; - private string _cardNumber; - private Lazy _cardExpMonth; - private Lazy _cardExpYear; - private Lazy _cardCode; - private Lazy _idPhone; - private Lazy _idEmail; - private Lazy _idUsername; - private Lazy _idAddress; - private Lazy _idPostalCode; - - public FilledItem(Cipher cipher) - { - Name = cipher.Name?.Decrypt(cipher.OrganizationId) ?? "--"; - Type = cipher.Type; - - switch(Type) - { - case CipherType.Login: - Subtitle = cipher.Login.Username?.Decrypt(cipher.OrganizationId) ?? string.Empty; - Icon = Resource.Drawable.login; - _password = new Lazy(() => cipher.Login.Password?.Decrypt(cipher.OrganizationId)); - break; - case CipherType.Card: - Subtitle = cipher.Card.Brand?.Decrypt(cipher.OrganizationId); - _cardNumber = cipher.Card.Number?.Decrypt(cipher.OrganizationId); - if(!string.IsNullOrWhiteSpace(_cardNumber) && _cardNumber.Length >= 4) - { - if(!string.IsNullOrWhiteSpace(_cardNumber)) - { - Subtitle += ", "; - } - Subtitle += ("*" + _cardNumber.Substring(_cardNumber.Length - 4)); - } - Icon = Resource.Drawable.card; - _cardName = new Lazy(() => cipher.Card.CardholderName?.Decrypt(cipher.OrganizationId)); - _cardCode = new Lazy(() => cipher.Card.Code?.Decrypt(cipher.OrganizationId)); - _cardExpMonth = new Lazy(() => cipher.Card.ExpMonth?.Decrypt(cipher.OrganizationId)); - _cardExpYear = new Lazy(() => cipher.Card.ExpYear?.Decrypt(cipher.OrganizationId)); - break; - case CipherType.Identity: - var firstName = cipher.Identity?.FirstName?.Decrypt(cipher.OrganizationId) ?? " "; - var lastName = cipher.Identity?.LastName?.Decrypt(cipher.OrganizationId) ?? " "; - Subtitle = " "; - if(!string.IsNullOrWhiteSpace(firstName)) - { - Subtitle = firstName; - } - if(!string.IsNullOrWhiteSpace(lastName)) - { - if(!string.IsNullOrWhiteSpace(Subtitle)) - { - Subtitle += " "; - } - Subtitle += lastName; - } - Icon = Resource.Drawable.id; - _idPhone = new Lazy(() => cipher.Identity.Phone?.Decrypt(cipher.OrganizationId)); - _idEmail = new Lazy(() => cipher.Identity.Email?.Decrypt(cipher.OrganizationId)); - _idUsername = new Lazy(() => cipher.Identity.Username?.Decrypt(cipher.OrganizationId)); - _idAddress = new Lazy(() => - { - var address = cipher.Identity.Address1?.Decrypt(cipher.OrganizationId); - - var address2 = cipher.Identity.Address2?.Decrypt(cipher.OrganizationId); - if(!string.IsNullOrWhiteSpace(address2)) - { - if(!string.IsNullOrWhiteSpace(address)) - { - address += ", "; - } - - address += address2; - } - - var address3 = cipher.Identity.Address3?.Decrypt(cipher.OrganizationId); - if(!string.IsNullOrWhiteSpace(address3)) - { - if(!string.IsNullOrWhiteSpace(address)) - { - address += ", "; - } - - address += address3; - } - - return address; - }); - _idPostalCode = new Lazy(() => cipher.Identity.PostalCode?.Decrypt(cipher.OrganizationId)); - break; - default: - break; - } - } - - public string Name { get; set; } - public string Subtitle { get; set; } = string.Empty; - public int Icon { get; set; } = Resource.Drawable.login; - public CipherType Type { get; set; } - - public bool ApplyToFields(FieldCollection fieldCollection, Dataset.Builder datasetBuilder) - { - if(!fieldCollection?.Fields.Any() ?? true) - { - return false; - } - - var setValues = false; - if(Type == CipherType.Login) - { - if(fieldCollection.PasswordFields.Any() && !string.IsNullOrWhiteSpace(_password.Value)) - { - foreach(var f in fieldCollection.PasswordFields) - { - var val = ApplyValue(f, _password.Value); - if(val != null) - { - setValues = true; - datasetBuilder.SetValue(f.AutofillId, val); - } - } - } - - if(fieldCollection.UsernameFields.Any() && !string.IsNullOrWhiteSpace(Subtitle)) - { - foreach(var f in fieldCollection.UsernameFields) - { - var val = ApplyValue(f, Subtitle); - if(val != null) - { - setValues = true; - datasetBuilder.SetValue(f.AutofillId, val); - } - } - } - } - else if(Type == CipherType.Card) - { - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintCreditCardNumber, - new Lazy(() => _cardNumber))) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintCreditCardSecurityCode, _cardCode)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintCreditCardExpirationMonth, _cardExpMonth, true)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintCreditCardExpirationYear, _cardExpYear)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintName, _cardName)) - { - setValues = true; - } - } - else if(Type == CipherType.Identity) - { - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintPhone, _idPhone)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintEmailAddress, _idEmail)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintUsername, _idUsername)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintPostalAddress, _idAddress)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintPostalCode, _idPostalCode)) - { - setValues = true; - } - if(ApplyValue(datasetBuilder, fieldCollection, View.AutofillHintName, new Lazy(() => Subtitle))) - { - setValues = true; - } - } - - return setValues; - } - - private static bool ApplyValue(Dataset.Builder builder, FieldCollection fieldCollection, - string hint, Lazy value, bool monthValue = false) - { - bool setValues = false; - if(fieldCollection.HintToFieldsMap.ContainsKey(hint) && !string.IsNullOrWhiteSpace(value.Value)) - { - foreach(var f in fieldCollection.HintToFieldsMap[hint]) - { - var val = ApplyValue(f, value.Value, monthValue); - if(val != null) - { - setValues = true; - builder.SetValue(f.AutofillId, val); - } - } - } - return setValues; - } - - private static AutofillValue ApplyValue(Field field, string value, bool monthValue = false) - { - switch(field.AutofillType) - { - case AutofillType.Date: - if(long.TryParse(value, out long dateValue)) - { - return AutofillValue.ForDate(dateValue); - } - break; - case AutofillType.List: - if(field.AutofillOptions != null) - { - if(monthValue && int.TryParse(value, out int monthIndex)) - { - if(field.AutofillOptions.Count == 13) - { - return AutofillValue.ForList(monthIndex); - } - else if(field.AutofillOptions.Count >= monthIndex) - { - return AutofillValue.ForList(monthIndex - 1); - } - } - - for(var i = 0; i < field.AutofillOptions.Count; i++) - { - if(field.AutofillOptions[i].Equals(value)) - { - return AutofillValue.ForList(i); - } - } - } - break; - case AutofillType.Text: - return AutofillValue.ForText(value); - case AutofillType.Toggle: - if(bool.TryParse(value, out bool toggleValue)) - { - return AutofillValue.ForToggle(toggleValue); - } - break; - default: - break; - } - - return null; - } - } -} \ No newline at end of file diff --git a/src/Android/Autofill/Parser.cs b/src/Android/Autofill/Parser.cs deleted file mode 100644 index 92d80c9b7..000000000 --- a/src/Android/Autofill/Parser.cs +++ /dev/null @@ -1,136 +0,0 @@ -using static Android.App.Assist.AssistStructure; -using Android.App.Assist; -using Bit.App; -using System.Collections.Generic; - -namespace Bit.Android.Autofill -{ - public class Parser - { - - public static HashSet ExcludedPackageIds = new HashSet - { - "android" - }; - - private readonly AssistStructure _structure; - private string _uri; - private string _packageName; - private string _webDomain; - - public Parser(AssistStructure structure) - { - _structure = structure; - } - - public FieldCollection FieldCollection { get; private set; } = new FieldCollection(); - public string Uri - { - get - { - if(!string.IsNullOrWhiteSpace(_uri)) - { - return _uri; - } - - if(string.IsNullOrWhiteSpace(WebDomain) && string.IsNullOrWhiteSpace(PackageName)) - { - _uri = null; - } - else if(!string.IsNullOrWhiteSpace(WebDomain)) - { - _uri = string.Concat("http://", WebDomain); - } - else - { - _uri = string.Concat(Constants.AndroidAppProtocol, PackageName); - } - - return _uri; - } - } - public string PackageName - { - get => _packageName; - set - { - if(string.IsNullOrWhiteSpace(value)) - { - _packageName = _uri = null; - } - - _packageName = value; - } - } - public string WebDomain - { - get => _webDomain; - set - { - if(string.IsNullOrWhiteSpace(value)) - { - _webDomain = _uri = null; - } - - _webDomain = value; - } - } - - public bool ShouldAutofill - { - get - { - return !string.IsNullOrWhiteSpace(Uri) && !AutofillHelpers.BlacklistedUris.Contains(Uri) && - FieldCollection != null && FieldCollection.Fillable; - } - } - - public void Parse() - { - for(var i = 0; i < _structure.WindowNodeCount; i++) - { - var node = _structure.GetWindowNodeAt(i); - ParseNode(node.RootViewNode); - } - - if(!AutofillHelpers.TrustedBrowsers.Contains(PackageName) && - !AutofillHelpers.CompatBrowsers.Contains(PackageName)) - { - WebDomain = null; - } - } - - private void ParseNode(ViewNode node) - { - SetPackageAndDomain(node); - var hints = node.GetAutofillHints(); - var isEditText = node.ClassName == "android.widget.EditText" || node?.HtmlInfo?.Tag == "input"; - if(isEditText || (hints?.Length ?? 0) > 0) - { - FieldCollection.Add(new Field(node)); - } - else - { - FieldCollection.IgnoreAutofillIds.Add(node.AutofillId); - } - - for(var i = 0; i < node.ChildCount; i++) - { - ParseNode(node.GetChildAt(i)); - } - } - - private void SetPackageAndDomain(ViewNode node) - { - if(string.IsNullOrWhiteSpace(PackageName) && !string.IsNullOrWhiteSpace(node.IdPackage) && - !ExcludedPackageIds.Contains(node.IdPackage)) - { - PackageName = node.IdPackage; - } - if(string.IsNullOrWhiteSpace(WebDomain) && !string.IsNullOrWhiteSpace(node.WebDomain)) - { - WebDomain = node.WebDomain; - } - } - } -} \ No newline at end of file diff --git a/src/Android/Autofill/SavedItem.cs b/src/Android/Autofill/SavedItem.cs deleted file mode 100644 index 280335199..000000000 --- a/src/Android/Autofill/SavedItem.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Bit.App.Enums; - -namespace Bit.Android.Autofill -{ - public class SavedItem - { - public CipherType Type { get; set; } - public LoginItem Login { get; set; } - public CardItem Card { get; set; } - - public class LoginItem - { - public string Username { get; set; } - public string Password { get; set; } - } - - public class CardItem - { - public string Name { get; set; } - public string Number { get; set; } - public string ExpMonth { get; set; } - public string ExpYear { get; set; } - public string Code { get; set; } - } - } -} \ No newline at end of file diff --git a/src/Android/AutofillActivity.cs b/src/Android/AutofillActivity.cs deleted file mode 100644 index fac004836..000000000 --- a/src/Android/AutofillActivity.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; -using System; - -namespace Bit.Android -{ - [Activity(Theme = "@style/BitwardenTheme.Splash", WindowSoftInputMode = SoftInput.StateHidden)] - public class AutofillActivity : Activity - { - private DateTime? _lastLaunch = null; - private string _lastQueriedUri; - - public static AutofillCredentials LastCredentials { get; set; } - - protected override void OnCreate(Bundle bundle) - { - base.OnCreate(bundle); - LaunchMainActivity(Intent, 932473); - } - - protected override void OnNewIntent(Intent intent) - { - base.OnNewIntent(intent); - LaunchMainActivity(intent, 489729); - } - - protected override void OnDestroy() - { - base.OnDestroy(); - } - - protected override void OnResume() - { - base.OnResume(); - if(!Intent.HasExtra("uri")) - { - Finish(); - return; - } - - Intent.RemoveExtra("uri"); - } - - protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) - { - base.OnActivityResult(requestCode, resultCode, data); - if(data == null) - { - LastCredentials = null; - } - else - { - try - { - if(data.GetStringExtra("canceled") != null) - { - LastCredentials = null; - } - else - { - var uri = data.GetStringExtra("uri"); - var username = data.GetStringExtra("username"); - var password = data.GetStringExtra("password"); - - LastCredentials = new AutofillCredentials - { - Username = username, - Password = password, - Uri = uri, - LastUri = _lastQueriedUri - }; - } - } - catch - { - LastCredentials = null; - } - } - - Finish(); - } - - private void LaunchMainActivity(Intent callingIntent, int requestCode) - { - _lastQueriedUri = callingIntent?.GetStringExtra("uri"); - if(_lastQueriedUri == null) - { - Finish(); - return; - } - - var now = DateTime.UtcNow; - if(_lastLaunch.HasValue && (now - _lastLaunch.Value <= TimeSpan.FromSeconds(2))) - { - return; - } - - _lastLaunch = now; - var intent = new Intent(this, typeof(MainActivity)); - if(!callingIntent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory)) - { - intent.PutExtra("uri", _lastQueriedUri); - } - StartActivityForResult(intent, requestCode); - } - } -} diff --git a/src/Android/AutofillCredentials.cs b/src/Android/AutofillCredentials.cs deleted file mode 100644 index 8ee4647ac..000000000 --- a/src/Android/AutofillCredentials.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Bit.Android -{ - public class AutofillCredentials - { - public string Username { get; set; } - public string Password { get; set; } - public string Uri { get; set; } - public string LastUri { get; set; } - } -} diff --git a/src/Android/AutofillService.cs b/src/Android/AutofillService.cs deleted file mode 100644 index 9ffc31625..000000000 --- a/src/Android/AutofillService.cs +++ /dev/null @@ -1,546 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Android.AccessibilityServices; -using Android.App; -using Android.Content; -using Android.OS; -using Android.Views.Accessibility; -using Bit.App.Abstractions; -using XLabs.Ioc; -using Bit.App.Resources; - -namespace Bit.Android -{ - [Service(Permission = global::Android.Manifest.Permission.BindAccessibilityService, Label = "Bitwarden")] - [IntentFilter(new string[] { "android.accessibilityservice.AccessibilityService" })] - [MetaData("android.accessibilityservice", Resource = "@xml/accessibilityservice")] - public class AutofillService : AccessibilityService - { - private NotificationChannel _notificationChannel; - - private const string BitwardenTag = "bw_access"; - private const int AutoFillNotificationId = 34573; - private const string SystemUiPackage = "com.android.systemui"; - private const string BitwardenPackage = "com.x8bit.bitwarden"; - private const string BitwardenWebsite = "vault.bitwarden.com"; - - private static Dictionary SupportedBrowsers => new List - { - new Browser("com.android.chrome", "url_bar"), - new Browser("com.chrome.beta", "url_bar"), - new Browser("org.chromium.chrome", "url_bar"), - new Browser("com.android.browser", "url"), - new Browser("com.brave.browser", "url_bar"), - new Browser("com.opera.browser", "url_field"), - new Browser("com.opera.browser.beta", "url_field"), - new Browser("com.opera.mini.native", "url_field"), - new Browser("com.opera.touch", "addressbarEdit"), - new Browser("com.chrome.dev", "url_bar"), - new Browser("com.chrome.canary", "url_bar"), - new Browser("com.google.android.apps.chrome", "url_bar"), - new Browser("com.google.android.apps.chrome_dev", "url_bar"), - new Browser("org.codeaurora.swe.browser", "url_bar"), - new Browser("org.iron.srware", "url_bar"), - new Browser("com.sec.android.app.sbrowser", "location_bar_edit_text"), - new Browser("com.sec.android.app.sbrowser.beta", "location_bar_edit_text"), - new Browser("com.yandex.browser", "bro_omnibar_address_title_text", - (s) => s.Split(new char[]{' ', ''}).FirstOrDefault()), // 0 = Regular Space, 1 = No-break space (00A0) - new Browser("org.mozilla.firefox", "url_bar_title"), - new Browser("org.mozilla.firefox_beta", "url_bar_title"), - new Browser("org.mozilla.fennec_aurora", "url_bar_title"), - new Browser("org.mozilla.focus", "display_url"), - new Browser("org.mozilla.klar", "display_url"), - new Browser("com.ghostery.android.ghostery", "search_field"), - new Browser("org.adblockplus.browser", "url_bar_title"), - new Browser("com.htc.sense.browser", "title"), - new Browser("com.amazon.cloud9", "url"), - new Browser("mobi.mgeek.TunnyBrowser", "title"), - new Browser("com.nubelacorp.javelin", "enterUrl"), - new Browser("com.jerky.browser2", "enterUrl"), - new Browser("com.mx.browser", "address_editor_with_progress"), - new Browser("com.mx.browser.tablet", "address_editor_with_progress"), - new Browser("com.linkbubble.playstore", "url_text"), - new Browser("com.ksmobile.cb", "address_bar_edit_text"), - new Browser("acr.browser.lightning", "search"), - new Browser("acr.browser.barebones", "search"), - new Browser("com.microsoft.emmx", "url_bar"), - new Browser("com.duckduckgo.mobile.android", "omnibarTextInput"), - new Browser("mark.via.gp", "aw"), - new Browser("org.bromite.bromite", "url_bar"), - new Browser("com.kiwibrowser.browser", "url_bar"), - new Browser("com.ecosia.android", "url_bar"), - new Browser("com.qwant.liberty", "url_bar_title"), - }.ToDictionary(n => n.PackageName); - - // Known packages to skip - private static HashSet FilteredPackageNames => new HashSet - { - SystemUiPackage, - "com.google.android.googlequicksearchbox", - "com.google.android.apps.nexuslauncher", - "com.google.android.launcher", - "com.computer.desktop.ui.launcher", - "com.launcher.notelauncher", - "com.anddoes.launcher", - "com.actionlauncher.playstore", - "ch.deletescape.lawnchair.plah", - "com.microsoft.launcher", - "com.teslacoilsw.launcher", - "com.teslacoilsw.launcher.prime", - "is.shortcut", - "me.craftsapp.nlauncher", - "com.ss.squarehome2" - }; - - private readonly IAppSettingsService _appSettings; - private long _lastNotificationTime = 0; - private string _lastNotificationUri = null; - private HashSet _launcherPackageNames = null; - private DateTime? _lastLauncherSetBuilt = null; - private TimeSpan _rebuildLauncherSpan = TimeSpan.FromHours(1); - - public AutofillService() - { - _appSettings = Resolver.Resolve(); - } - - public override void OnAccessibilityEvent(AccessibilityEvent e) - { - try - { - var powerManager = (PowerManager)GetSystemService(PowerService); - if(Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch && !powerManager.IsInteractive) - { - return; - } - else if(Build.VERSION.SdkInt < BuildVersionCodes.Lollipop && !powerManager.IsScreenOn) - { - return; - } - - if(SkipPackage(e?.PackageName)) - { - return; - } - - var root = RootInActiveWindow; - if(root == null || root.PackageName != e.PackageName) - { - return; - } - - // var testNodes = GetWindowNodes(root, e, n => n.ViewIdResourceName != null && n.Text != null, false); - // var testNodesData = testNodes.Select(n => new { id = n.ViewIdResourceName, text = n.Text }); - - var notificationManager = (NotificationManager)GetSystemService(NotificationService); - var cancelNotification = true; - - switch(e.EventType) - { - case EventTypes.ViewFocused: - if(e.Source == null || !e.Source.Password || !_appSettings.AutofillPasswordField) - { - break; - } - - if(e.PackageName == BitwardenPackage) - { - CancelNotification(notificationManager); - break; - } - - if(ScanAndAutofill(root, e, notificationManager, cancelNotification)) - { - CancelNotification(notificationManager); - } - break; - case EventTypes.WindowContentChanged: - case EventTypes.WindowStateChanged: - if(_appSettings.AutofillPasswordField && e.Source.Password) - { - break; - } - else if(_appSettings.AutofillPasswordField && AutofillActivity.LastCredentials == null) - { - if(string.IsNullOrWhiteSpace(_lastNotificationUri)) - { - CancelNotification(notificationManager); - break; - } - - var uri = GetUri(root); - if(uri != _lastNotificationUri) - { - CancelNotification(notificationManager); - } - else if(uri.StartsWith(App.Constants.AndroidAppProtocol)) - { - CancelNotification(notificationManager, 30000); - } - - break; - } - - if(e.PackageName == BitwardenPackage) - { - CancelNotification(notificationManager); - break; - } - - if(_appSettings.AutofillPersistNotification) - { - var uri = GetUri(root); - if(uri != null && !uri.Contains(BitwardenWebsite)) - { - var needToFill = NeedToAutofill(AutofillActivity.LastCredentials, uri); - if(needToFill) - { - var passwordNodes = GetWindowNodes(root, e, n => n.Password, false); - needToFill = passwordNodes.Any(); - if(needToFill) - { - var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); - var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault(); - FillCredentials(usernameEditText, passwordNodes); - - allEditTexts.Dispose(); - usernameEditText.Dispose(); - } - passwordNodes.Dispose(); - } - - if(!needToFill) - { - NotifyToAutofill(uri, notificationManager); - cancelNotification = false; - } - } - - AutofillActivity.LastCredentials = null; - } - else - { - cancelNotification = ScanAndAutofill(root, e, notificationManager, cancelNotification); - } - - if(cancelNotification) - { - CancelNotification(notificationManager); - } - break; - default: - break; - } - - notificationManager?.Dispose(); - root.Dispose(); - e.Dispose(); - } - // Suppress exceptions so that service doesn't crash - catch { } - } - - public override void OnInterrupt() - { - - } - - public bool ScanAndAutofill(AccessibilityNodeInfo root, AccessibilityEvent e, - NotificationManager notificationManager, bool cancelNotification) - { - var passwordNodes = GetWindowNodes(root, e, n => n.Password, false); - if(passwordNodes.Count > 0) - { - var uri = GetUri(root); - if(uri != null && !uri.Contains(BitwardenWebsite)) - { - if(NeedToAutofill(AutofillActivity.LastCredentials, uri)) - { - var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); - var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault(); - FillCredentials(usernameEditText, passwordNodes); - - allEditTexts.Dispose(); - usernameEditText.Dispose(); - } - else - { - NotifyToAutofill(uri, notificationManager); - cancelNotification = false; - } - } - - AutofillActivity.LastCredentials = null; - } - else if(AutofillActivity.LastCredentials != null) - { - System.Threading.Tasks.Task.Run(async () => - { - await System.Threading.Tasks.Task.Delay(1000); - AutofillActivity.LastCredentials = null; - }); - } - - passwordNodes.Dispose(); - return cancelNotification; - } - - public void CancelNotification(NotificationManager notificationManager, long limit = 250) - { - if(Java.Lang.JavaSystem.CurrentTimeMillis() - _lastNotificationTime < limit) - { - return; - } - - _lastNotificationUri = null; - notificationManager?.Cancel(AutoFillNotificationId); - } - - private string GetUri(AccessibilityNodeInfo root) - { - var uri = string.Concat(App.Constants.AndroidAppProtocol, root.PackageName); - if(SupportedBrowsers.ContainsKey(root.PackageName)) - { - var addressNode = root.FindAccessibilityNodeInfosByViewId( - $"{root.PackageName}:id/{SupportedBrowsers[root.PackageName].UriViewId}").FirstOrDefault(); - if(addressNode != null) - { - uri = ExtractUri(uri, addressNode, SupportedBrowsers[root.PackageName]); - addressNode.Dispose(); - } - } - - return uri; - } - - private string ExtractUri(string uri, AccessibilityNodeInfo addressNode, Browser browser) - { - if(addressNode?.Text != null) - { - uri = browser.GetUriFunction(addressNode.Text)?.Trim(); - if(uri != null && uri.Contains(".")) - { - if(!uri.Contains("://") && !uri.Contains(" ")) - { - uri = string.Concat("http://", uri); - } - else if(Build.VERSION.SdkInt <= BuildVersionCodes.KitkatWatch) - { - var parts = uri.Split(new string[] { ". " }, StringSplitOptions.None); - if(parts.Length > 1) - { - var urlPart = parts.FirstOrDefault(p => p.StartsWith("http")); - if(urlPart != null) - { - uri = urlPart.Trim(); - } - } - } - } - } - - return uri; - } - - /// - /// Check to make sure it is ok to autofill still on the current screen - /// - private bool NeedToAutofill(AutofillCredentials creds, string currentUriString) - { - if(creds == null) - { - return false; - } - - Uri lastUri, currentUri; - if(Uri.TryCreate(creds.LastUri, UriKind.Absolute, out lastUri) && - Uri.TryCreate(currentUriString, UriKind.Absolute, out currentUri) && - lastUri.Host == currentUri.Host) - { - return true; - } - - return false; - } - - private static bool EditText(AccessibilityNodeInfo n) - { - return n?.ClassName?.Contains("EditText") ?? false; - } - - private void NotifyToAutofill(string uri, NotificationManager notificationManager) - { - if(notificationManager == null || string.IsNullOrWhiteSpace(uri)) - { - return; - } - - var now = Java.Lang.JavaSystem.CurrentTimeMillis(); - var intent = new Intent(this, typeof(AutofillActivity)); - intent.PutExtra("uri", uri); - intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop); - var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.UpdateCurrent); - - var notificationContent = Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch ? - AppResources.BitwardenAutofillServiceNotificationContent : - AppResources.BitwardenAutofillServiceNotificationContentOld; - - var builder = new Notification.Builder(this); - builder.SetSmallIcon(Resource.Drawable.notification_sm) - .SetContentTitle(AppResources.BitwardenAutofillService) - .SetContentText(notificationContent) - .SetTicker(notificationContent) - .SetWhen(now) - .SetContentIntent(pendingIntent); - - if(Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch) - { - builder.SetVisibility(NotificationVisibility.Secret) - .SetColor(global::Android.Support.V4.Content.ContextCompat.GetColor(ApplicationContext, - Resource.Color.primary)); - } - - if(Build.VERSION.SdkInt >= BuildVersionCodes.O) - { - if(_notificationChannel == null) - { - _notificationChannel = new NotificationChannel("bitwarden_autofill_service", - AppResources.AutofillService, NotificationImportance.Low); - notificationManager.CreateNotificationChannel(_notificationChannel); - } - builder.SetChannelId(_notificationChannel.Id); - } - - if(/*Build.VERSION.SdkInt <= BuildVersionCodes.N && */_appSettings.AutofillPersistNotification) - { - builder.SetPriority(-2); - } - - _lastNotificationTime = now; - _lastNotificationUri = uri; - notificationManager.Notify(AutoFillNotificationId, builder.Build()); - - builder.Dispose(); - } - - private void FillCredentials(AccessibilityNodeInfo usernameNode, IEnumerable passwordNodes) - { - FillEditText(usernameNode, AutofillActivity.LastCredentials?.Username); - foreach(var n in passwordNodes) - { - FillEditText(n, AutofillActivity.LastCredentials?.Password); - } - } - - private static void FillEditText(AccessibilityNodeInfo editTextNode, string value) - { - if(editTextNode == null || value == null) - { - return; - } - - var bundle = new Bundle(); - bundle.PutString(AccessibilityNodeInfo.ActionArgumentSetTextCharsequence, value); - editTextNode.PerformAction(global::Android.Views.Accessibility.Action.SetText, bundle); - } - - private NodeList GetWindowNodes(AccessibilityNodeInfo n, AccessibilityEvent e, - Func condition, bool disposeIfUnused, NodeList nodes = null, - int recursionDepth = 0) - { - if(nodes == null) - { - nodes = new NodeList(); - } - - var dispose = disposeIfUnused; - if(n != null && recursionDepth < 50) - { - if(n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n)) - { - dispose = false; - nodes.Add(n); - } - - for(var i = 0; i < n.ChildCount; i++) - { - var childNode = n.GetChild(i); - if(i > 100) - { - global::Android.Util.Log.Info(BitwardenTag, "Too many child iterations."); - break; - } - else if(childNode.GetHashCode() == n.GetHashCode()) - { - global::Android.Util.Log.Info(BitwardenTag, - "Child node is the same as parent for some reason."); - } - else - { - GetWindowNodes(childNode, e, condition, true, nodes, recursionDepth++); - } - } - } - - if(dispose) - { - n?.Dispose(); - } - - return nodes; - } - - private bool SkipPackage(string eventPackageName) - { - if(string.IsNullOrWhiteSpace(eventPackageName) || FilteredPackageNames.Contains(eventPackageName) - || eventPackageName.Contains("launcher")) - { - return true; - } - - if(_launcherPackageNames == null || _lastLauncherSetBuilt == null || - (DateTime.Now - _lastLauncherSetBuilt.Value) > _rebuildLauncherSpan) - { - // refresh launcher list every now and then - _lastLauncherSetBuilt = DateTime.Now; - var intent = new Intent(Intent.ActionMain); - intent.AddCategory(Intent.CategoryHome); - var resolveInfo = PackageManager.QueryIntentActivities(intent, 0); - _launcherPackageNames = resolveInfo.Select(ri => ri.ActivityInfo.PackageName).ToHashSet(); - } - - return _launcherPackageNames.Contains(eventPackageName); - } - - public class Browser - { - public Browser(string packageName, string uriViewId) - { - PackageName = packageName; - UriViewId = uriViewId; - } - - public Browser(string packageName, string uriViewId, Func getUriFunction) - : this(packageName, uriViewId) - { - GetUriFunction = getUriFunction; - } - - public string PackageName { get; set; } - public string UriViewId { get; set; } - public Func GetUriFunction { get; set; } = (s) => s; - } - - public class NodeList : List, IDisposable - { - public void Dispose() - { - foreach(var item in this) - { - item.Dispose(); - } - } - } - } -} diff --git a/src/Android/Controls/CustomButtonRenderer.cs b/src/Android/Controls/CustomButtonRenderer.cs deleted file mode 100644 index 18b681662..000000000 --- a/src/Android/Controls/CustomButtonRenderer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.ComponentModel; -using Android.Content; -using Bit.Android.Controls; -using Xamarin.Forms; -using Xamarin.Forms.Platform.Android; - -[assembly: ExportRenderer(typeof(Button), typeof(CustomButtonRenderer))] -namespace Bit.Android.Controls -{ - public class CustomButtonRenderer : ButtonRenderer - { - public CustomButtonRenderer(Context context) - : base(context) - { } - - protected override void OnElementChanged(ElementChangedEventArgs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/iOS.Autofill/Models/Context.cs b/src/iOS.Autofill/Models/Context.cs deleted file mode 100644 index c4a6ccf2b..000000000 --- a/src/iOS.Autofill/Models/Context.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AuthenticationServices; -using Bit.iOS.Core.Models; -using Foundation; - -namespace Bit.iOS.Autofill.Models -{ - public class Context : AppExtensionContext - { - public NSExtensionContext ExtContext { get; set; } - public ASCredentialServiceIdentifier[] ServiceIdentifiers { get; set; } - public ASPasswordCredentialIdentity CredentialIdentity { get; set; } - public bool Configuring { get; set; } - } -} diff --git a/src/iOS.Autofill/PasswordGeneratorViewController.cs b/src/iOS.Autofill/PasswordGeneratorViewController.cs deleted file mode 100644 index 402cef12b..000000000 --- a/src/iOS.Autofill/PasswordGeneratorViewController.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Autofill -{ - public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController - { - public PasswordGeneratorViewController(IntPtr handle) : base(handle, true) - { } - - public LoginAddViewController Parent { get; set; } - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelBarButton; - public override UIBarButtonItem BaseSelectBarButton => SelectBarButton; - public override UILabel BasePasswordLabel => PasswordLabel; - - partial void SelectBarButton_Activated(UIBarButtonItem sender) - { - GoogleAnalyticsService.TrackAutofillExtensionEvent("SelectedGeneratedPassword"); - DismissViewController(true, () => - { - Parent.PasswordCell.TextField.Text = PasswordLabel.Text; - }); - } - - partial void CancelBarButton_Activated(UIBarButtonItem sender) - { - DismissViewController(true, null); - } - } -} diff --git a/src/iOS.Autofill/PasswordGeneratorViewController.designer.cs b/src/iOS.Autofill/PasswordGeneratorViewController.designer.cs deleted file mode 100644 index cff6e5a65..000000000 --- a/src/iOS.Autofill/PasswordGeneratorViewController.designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Visual Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Autofill -{ - [Register ("PasswordGeneratorViewController")] - partial class PasswordGeneratorViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIView BaseView { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelBarButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIView OptionsContainer { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel PasswordLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem SelectBarButton { get; set; } - - [Action ("CancelBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelBarButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("SelectBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void SelectBarButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (BaseView != null) { - BaseView.Dispose (); - BaseView = null; - } - - if (CancelBarButton != null) { - CancelBarButton.Dispose (); - CancelBarButton = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (OptionsContainer != null) { - OptionsContainer.Dispose (); - OptionsContainer = null; - } - - if (PasswordLabel != null) { - PasswordLabel.Dispose (); - PasswordLabel = null; - } - - if (SelectBarButton != null) { - SelectBarButton.Dispose (); - SelectBarButton = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Autofill/Properties/AssemblyInfo.cs b/src/iOS.Autofill/Properties/AssemblyInfo.cs deleted file mode 100644 index a4f6227ac..000000000 --- a/src/iOS.Autofill/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -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("BitwardeniOSAutofill")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("8bit Solutions LLC")] -[assembly: AssemblyProduct("Bitwarden")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[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("32f5a2d6-f54d-4da1-ae26-0a980d48f421")] - -// 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")] diff --git a/src/iOS.Autofill/Resources/Icon.png b/src/iOS.Autofill/Resources/Icon.png deleted file mode 100644 index e4b594ad5..000000000 Binary files a/src/iOS.Autofill/Resources/Icon.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/Icon@2x.png b/src/iOS.Autofill/Resources/Icon@2x.png deleted file mode 100644 index 37369f4d3..000000000 Binary files a/src/iOS.Autofill/Resources/Icon@2x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/Icon@3x.png b/src/iOS.Autofill/Resources/Icon@3x.png deleted file mode 100644 index 0bfafae46..000000000 Binary files a/src/iOS.Autofill/Resources/Icon@3x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/check.png b/src/iOS.Autofill/Resources/check.png deleted file mode 100644 index f2d0c4a2b..000000000 Binary files a/src/iOS.Autofill/Resources/check.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/check@2x.png b/src/iOS.Autofill/Resources/check@2x.png deleted file mode 100644 index 9efd035c6..000000000 Binary files a/src/iOS.Autofill/Resources/check@2x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/check@3x.png b/src/iOS.Autofill/Resources/check@3x.png deleted file mode 100644 index 0e95759b4..000000000 Binary files a/src/iOS.Autofill/Resources/check@3x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/fingerprint.png b/src/iOS.Autofill/Resources/fingerprint.png deleted file mode 100644 index 754e39825..000000000 Binary files a/src/iOS.Autofill/Resources/fingerprint.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/fingerprint@2x.png b/src/iOS.Autofill/Resources/fingerprint@2x.png deleted file mode 100644 index 79547a076..000000000 Binary files a/src/iOS.Autofill/Resources/fingerprint@2x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/fingerprint@3x.png b/src/iOS.Autofill/Resources/fingerprint@3x.png deleted file mode 100644 index 236c8da73..000000000 Binary files a/src/iOS.Autofill/Resources/fingerprint@3x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/logo.png b/src/iOS.Autofill/Resources/logo.png deleted file mode 100644 index 33ced5b12..000000000 Binary files a/src/iOS.Autofill/Resources/logo.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/logo@2x.png b/src/iOS.Autofill/Resources/logo@2x.png deleted file mode 100644 index 2a0ba60b9..000000000 Binary files a/src/iOS.Autofill/Resources/logo@2x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/logo@3x.png b/src/iOS.Autofill/Resources/logo@3x.png deleted file mode 100644 index 904731676..000000000 Binary files a/src/iOS.Autofill/Resources/logo@3x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/smile.png b/src/iOS.Autofill/Resources/smile.png deleted file mode 100644 index 25f2f45b1..000000000 Binary files a/src/iOS.Autofill/Resources/smile.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/smile@2x.png b/src/iOS.Autofill/Resources/smile@2x.png deleted file mode 100644 index 71dd21e35..000000000 Binary files a/src/iOS.Autofill/Resources/smile@2x.png and /dev/null differ diff --git a/src/iOS.Autofill/Resources/smile@3x.png b/src/iOS.Autofill/Resources/smile@3x.png deleted file mode 100644 index 6e7189e69..000000000 Binary files a/src/iOS.Autofill/Resources/smile@3x.png and /dev/null differ diff --git a/src/iOS.Autofill/SetupViewController.cs b/src/iOS.Autofill/SetupViewController.cs deleted file mode 100644 index 789de5800..000000000 --- a/src/iOS.Autofill/SetupViewController.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using UIKit; -using Bit.iOS.Core.Controllers; -using Bit.App.Resources; -using Bit.iOS.Core.Utilities; -using XLabs.Ioc; -using Bit.App.Abstractions; - -namespace Bit.iOS.Autofill -{ - public partial class SetupViewController : ExtendedUIViewController - { - public SetupViewController(IntPtr handle) : base(handle) - { } - - public CredentialProviderViewController CPViewController { get; set; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - var descriptor = UIFontDescriptor.PreferredBody; - DescriptionLabel.Text = $@"{AppResources.AutofillSetup} - -{AppResources.AutofillSetup2}"; - DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); - DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - ActivatedLabel.Text = AppResources.AutofillActivated; - ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f); - - BackButton.Title = AppResources.Back; - base.ViewDidLoad(); - - var tasks = ASHelpers.ReplaceAllIdentities(Resolver.Resolve()); - } - - partial void BackButton_Activated(UIBarButtonItem sender) - { - CPViewController.CompleteRequest(); - } - } -} diff --git a/src/iOS.Autofill/SetupViewController.designer.cs b/src/iOS.Autofill/SetupViewController.designer.cs deleted file mode 100644 index 7374b7e8f..000000000 --- a/src/iOS.Autofill/SetupViewController.designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Visual Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Autofill -{ - [Register ("SetupViewController")] - partial class SetupViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel ActivatedLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem BackButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel DescriptionLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIImageView IconImage { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Action ("BackButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void BackButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (ActivatedLabel != null) { - ActivatedLabel.Dispose (); - ActivatedLabel = null; - } - - if (BackButton != null) { - BackButton.Dispose (); - BackButton = null; - } - - if (DescriptionLabel != null) { - DescriptionLabel.Dispose (); - DescriptionLabel = null; - } - - if (IconImage != null) { - IconImage.Dispose (); - IconImage = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Autofill/Utilities/AutofillHelpers.cs b/src/iOS.Autofill/Utilities/AutofillHelpers.cs deleted file mode 100644 index b82bcc101..000000000 --- a/src/iOS.Autofill/Utilities/AutofillHelpers.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Linq; -using Bit.App.Resources; -using Bit.iOS.Core.Utilities; -using Bit.iOS.Core.Views; -using Foundation; -using Plugin.Settings.Abstractions; -using UIKit; - -namespace Bit.iOS.Autofill.Utilities -{ - public static class AutofillHelpers - { - public static void TableRowSelected(UITableView tableView, NSIndexPath indexPath, - ExtensionTableSource tableSource, CredentialProviderViewController cpViewController, - UITableViewController controller, ISettings settings, string loginAddSegue) - { - tableView.DeselectRow(indexPath, true); - tableView.EndEditing(true); - - if(tableSource.Items == null || tableSource.Items.Count() == 0) - { - controller.PerformSegue(loginAddSegue, tableSource); - return; - } - - var item = tableSource.Items.ElementAt(indexPath.Row); - if(item == null) - { - cpViewController.CompleteRequest(null); - return; - } - - if(!string.IsNullOrWhiteSpace(item.Username) && !string.IsNullOrWhiteSpace(item.Password)) - { - string totp = null; - if(!settings.GetValueOrDefault(App.Constants.SettingDisableTotpCopy, false)) - { - totp = tableSource.GetTotp(item); - } - - cpViewController.CompleteRequest(item.Username, item.Password, totp); - } - else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) || - !string.IsNullOrWhiteSpace(item.Totp.Value)) - { - var sheet = Dialogs.CreateActionSheet(item.Name, controller); - if(!string.IsNullOrWhiteSpace(item.Username)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyUsername, UIAlertActionStyle.Default, a => - { - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = item.Username; - var alert = Dialogs.CreateMessageAlert(AppResources.CopyUsername); - controller.PresentViewController(alert, true, () => - { - controller.DismissViewController(true, null); - }); - })); - } - - if(!string.IsNullOrWhiteSpace(item.Password)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyPassword, UIAlertActionStyle.Default, a => - { - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = item.Password; - var alert = Dialogs.CreateMessageAlert(AppResources.CopiedPassword); - controller.PresentViewController(alert, true, () => - { - controller.DismissViewController(true, null); - }); - })); - } - - if(!string.IsNullOrWhiteSpace(item.Totp.Value)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a => - { - var totp = tableSource.GetTotp(item); - if(string.IsNullOrWhiteSpace(totp)) - { - return; - } - - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = totp; - var alert = Dialogs.CreateMessageAlert(AppResources.CopiedTotp); - controller.PresentViewController(alert, true, () => - { - controller.DismissViewController(true, null); - }); - })); - } - - sheet.AddAction(UIAlertAction.Create(AppResources.Cancel, UIAlertActionStyle.Cancel, null)); - controller.PresentViewController(sheet, true, null); - } - else - { - var alert = Dialogs.CreateAlert(null, AppResources.NoUsernamePasswordConfigured, AppResources.Ok); - controller.PresentViewController(alert, true, null); - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Autofill/iOS.Autofill.csproj b/src/iOS.Autofill/iOS.Autofill.csproj deleted file mode 100644 index 4c29600c9..000000000 --- a/src/iOS.Autofill/iOS.Autofill.csproj +++ /dev/null @@ -1,302 +0,0 @@ - - - Debug - iPhoneSimulator - {C2B7ADCA-5964-43C5-A7C8-D3B6F8023F4F} - {EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Bit.iOS.Autofill - BitwardeniOSAutofill - Resources - Properties - - - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG - prompt - 4 - false - i386, x86_64 - None - True - Entitlements.plist - 12.0 - False - False - False - False - True - False - False - Default - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler - - - none - true - bin\iPhoneSimulator\Release - prompt - 4 - Full - i386, x86_64 - false - Entitlements.plist - 9.3 - False - False - False - False - False - False - True - Default - NSUrlSessionHandler - False - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - - - true - full - false - bin\iPhone\Debug - DEBUG - prompt - 4 - false - ARM64 - Entitlements.plist - iPhone Developer - True - - - - - None - False - False - False - False - False - True - False - False - --http-message-handler=NSUrlSessionHandler - - - Default - NSUrlSessionHandler - - - none - true - bin\iPhone\Release - prompt - 4 - Entitlements.plist - ARM64 - false - iPhone Developer - Full - False - False - False - False - False - False - True - False - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - - - none - True - bin\iPhone\Ad-Hoc - prompt - 4 - False - ARM64 - Entitlements.plist - True - Automatic:AdHoc - iPhone Distribution - Full - False - False - False - False - False - False - True - False - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - - - none - True - bin\iPhone\AppStore - prompt - 4 - False - ARM64 - Entitlements.plist - Automatic:AppStore - iPhone Distribution - Full - False - False - False - False - False - False - True - False - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - 10.2 - Default - NSUrlSessionHandler - - - 9.3 - Full - False - False - False - i386, x86_64 - False - False - False - True - Default - NSUrlSessionHandler - False - bin\iPhoneSimulator\Ad-Hoc - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - Entitlements.plist - - - 9.3 - Full - False - False - False - i386, x86_64 - False - False - False - True - Default - NSUrlSessionHandler - False - bin\iPhoneSimulator\AppStore - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSAutofill --linkskip=BitwardenApp --linkskip=SQLite-net - - - - - - - - - - - - - - - SetupViewController.cs - - - - - - - - - - CredentialProviderViewController.cs - - - - LockFingerprintViewController.cs - - - LockPasswordViewController.cs - - - LockPinViewController.cs - - - LoginAddViewController.cs - - - LoginListViewController.cs - - - PasswordGeneratorViewController.cs - - - - LoginSearchViewController.cs - - - - - - - - - - - - - - - - - - - - - - - - - - {8a279ee4-4537-4656-9c93-44945e594556} - App - - - {B2538ADA-B605-4D6F-ACD2-62A409680F84} - iOS.Core - False - False - - - - - 4.4.0 - - - 2.0.5782 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/iOS.Core/Constants.cs b/src/iOS.Core/Constants.cs deleted file mode 100644 index 50941c0bb..000000000 --- a/src/iOS.Core/Constants.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Bit.iOS.Core -{ - public static class Constants - { - public const string AppExtensionVersionNumberKey = "version_number"; - public const string AppExtensionUrlStringKey = "url_string"; - public const string AppExtensionUsernameKey = "username"; - public const string AppExtensionPasswordKey = "password"; - public const string AppExtensionTotpKey = "totp"; - public const string AppExtensionTitleKey = "login_title"; - public const string AppExtensionNotesKey = "notes"; - public const string AppExtensionSectionTitleKey = "section_title"; - public const string AppExtensionFieldsKey = "fields"; - public const string AppExtensionReturnedFieldsKey = "returned_fields"; - public const string AppExtensionOldPasswordKey = "old_password"; - public const string AppExtensionPasswordGeneratorOptionsKey = "password_generator_options"; - public const string AppExtensionGeneratedPasswordMinLengthKey = "password_min_length"; - public const string AppExtensionGeneratedPasswordMaxLengthKey = "password_max_length"; - public const string AppExtensionGeneratedPasswordRequireDigitsKey = "password_require_digits"; - public const string AppExtensionGeneratedPasswordRequireSymbolsKey = "password_require_symbols"; - public const string AppExtensionGeneratedPasswordForbiddenCharactersKey = "password_forbidden_characters"; - public const string AppExtensionWebViewPageFillScript = "fillScript"; - public const string AppExtensionWebViewPageDetails = "pageDetails"; - - public const string UTTypeAppExtensionFindLoginAction = "org.appextension.find-login-action"; - public const string UTTypeAppExtensionSaveLoginAction = "org.appextension.save-login-action"; - public const string UTTypeAppExtensionChangePasswordAction = "org.appextension.change-password-action"; - public const string UTTypeAppExtensionFillWebViewAction = "org.appextension.fill-webview-action"; - public const string UTTypeAppExtensionFillBrowserAction = "org.appextension.fill-browser-action"; - public const string UTTypeAppExtensionSetup = "com.8bit.bitwarden.extension-setup"; - } -} diff --git a/src/iOS.Core/Controllers/ExtendedUITableViewController.cs b/src/iOS.Core/Controllers/ExtendedUITableViewController.cs deleted file mode 100644 index 26ebd1184..000000000 --- a/src/iOS.Core/Controllers/ExtendedUITableViewController.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Bit.App.Abstractions; -using System; -using UIKit; -using XLabs.Ioc; - -namespace Bit.iOS.Core.Controllers -{ - public class ExtendedUITableViewController : UITableViewController - { - public ExtendedUITableViewController(IntPtr handle) - : base(handle) - { } - - public override void ViewDidAppear(bool animated) - { - var googleAnalyticsService = Resolver.Resolve(); - googleAnalyticsService.TrackPage(GetType().Name); - base.ViewDidAppear(animated); - } - } -} diff --git a/src/iOS.Core/Controllers/ExtendedUIViewController.cs b/src/iOS.Core/Controllers/ExtendedUIViewController.cs deleted file mode 100644 index 49cde1e34..000000000 --- a/src/iOS.Core/Controllers/ExtendedUIViewController.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using UIKit; -using Bit.App.Abstractions; -using XLabs.Ioc; - -namespace Bit.iOS.Core.Controllers -{ - public class ExtendedUIViewController : UIViewController - { - public ExtendedUIViewController(IntPtr handle) - : base(handle) - { } - - public override void ViewDidAppear(bool animated) - { - var googleAnalyticsService = Resolver.Resolve(); - googleAnalyticsService.TrackPage(GetType().Name); - base.ViewDidAppear(animated); - } - } -} diff --git a/src/iOS.Core/Controllers/LockFingerprintViewController.cs b/src/iOS.Core/Controllers/LockFingerprintViewController.cs deleted file mode 100644 index 43447d96d..000000000 --- a/src/iOS.Core/Controllers/LockFingerprintViewController.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using UIKit; -using XLabs.Ioc; -using Plugin.Fingerprint.Abstractions; -using System.Threading.Tasks; -using Bit.iOS.Core.Controllers; -using Bit.App.Resources; -using Bit.App.Abstractions; - -namespace Bit.iOS.Core.Controllers -{ - public abstract class LockFingerprintViewController : ExtendedUIViewController - { - private IAppSettingsService _appSettingsService; - private IFingerprint _fingerprint; - private IDeviceInfoService _deviceInfo; - - public LockFingerprintViewController(IntPtr handle) : base(handle) - { } - - public abstract UINavigationItem BaseNavItem { get; } - public abstract UIBarButtonItem BaseCancelButton { get; } - public abstract UIButton BaseUseButton { get; } - public abstract UIButton BaseFingerprintButton { get; } - public abstract Action Success { get; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - _appSettingsService = Resolver.Resolve(); - _fingerprint = Resolver.Resolve(); - _deviceInfo = Resolver.Resolve(); - - BaseNavItem.Title = _deviceInfo.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint; - BaseCancelButton.Title = AppResources.Cancel; - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - - BaseUseButton.SetTitle(_deviceInfo.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock : - AppResources.UseFingerprintToUnlock, UIControlState.Normal); - var descriptor = UIFontDescriptor.PreferredBody; - BaseUseButton.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); - BaseUseButton.BackgroundColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); - BaseUseButton.TintColor = UIColor.White; - BaseUseButton.TouchUpInside += UseButton_TouchUpInside; - - BaseFingerprintButton.SetImage(new UIImage(_deviceInfo.HasFaceIdSupport ? "smile.png" : "fingerprint.png"), - UIControlState.Normal); - - base.ViewDidLoad(); - } - - private void UseButton_TouchUpInside(object sender, EventArgs e) - { - var task = CheckFingerprintAsync(); - } - - public override void ViewDidAppear(bool animated) - { - base.ViewDidAppear(animated); - var task = CheckFingerprintAsync(); - } - - public async Task CheckFingerprintAsync() - { - var fingerprintRequest = new AuthenticationRequestConfiguration( - _deviceInfo.HasFaceIdSupport ? AppResources.FaceIDDirection : AppResources.FingerprintDirection) - { - AllowAlternativeAuthentication = true, - CancelTitle = AppResources.Cancel, - FallbackTitle = AppResources.LogOut - }; - var result = await _fingerprint.AuthenticateAsync(fingerprintRequest); - if(result.Authenticated) - { - _appSettingsService.Locked = false; - Success(); - } - } - } -} diff --git a/src/iOS.Core/Controllers/LockPasswordViewController.cs b/src/iOS.Core/Controllers/LockPasswordViewController.cs deleted file mode 100644 index 0b5ec45e1..000000000 --- a/src/iOS.Core/Controllers/LockPasswordViewController.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using UIKit; -using XLabs.Ioc; -using Foundation; -using Bit.iOS.Core.Views; -using Bit.App.Resources; -using Bit.iOS.Core.Utilities; -using Bit.App.Abstractions; -using System.Linq; -using Bit.iOS.Core.Controllers; - -namespace Bit.iOS.Core.Controllers -{ - public abstract class LockPasswordViewController : ExtendedUITableViewController - { - private IAppSettingsService _appSettingsService; - private IAuthService _authService; - private ICryptoService _cryptoService; - - public LockPasswordViewController(IntPtr handle) : base(handle) - { } - - public abstract UINavigationItem BaseNavItem { get; } - public abstract UIBarButtonItem BaseCancelButton { get; } - public abstract UIBarButtonItem BaseSubmitButton { get; } - public abstract Action Success { get; } - - public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell( - AppResources.MasterPassword, useLabelAsPlaceholder: true); - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - _appSettingsService = Resolver.Resolve(); - _authService = Resolver.Resolve(); - _cryptoService = Resolver.Resolve(); - - BaseNavItem.Title = AppResources.VerifyMasterPassword; - BaseCancelButton.Title = AppResources.Cancel; - BaseSubmitButton.Title = AppResources.Submit; - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - - var descriptor = UIFontDescriptor.PreferredBody; - - MasterPasswordCell.TextField.SecureTextEntry = true; - MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go; - MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) => - { - CheckPassword(); - return true; - }; - - TableView.RowHeight = UITableView.AutomaticDimension; - TableView.EstimatedRowHeight = 70; - TableView.Source = new TableSource(this); - TableView.AllowsSelection = true; - - base.ViewDidLoad(); - } - - public override void ViewDidAppear(bool animated) - { - base.ViewDidAppear(animated); - MasterPasswordCell.TextField.BecomeFirstResponder(); - } - - protected void CheckPassword() - { - if(string.IsNullOrWhiteSpace(MasterPasswordCell.TextField.Text)) - { - var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, - string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword), AppResources.Ok); - PresentViewController(alert, true, null); - return; - } - - var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email, - _authService.Kdf, _authService.KdfIterations); - if(key.Key.SequenceEqual(_cryptoService.Key.Key)) - { - _appSettingsService.Locked = false; - MasterPasswordCell.TextField.ResignFirstResponder(); - Success(); - } - else - { - // TODO: keep track of invalid attempts and logout? - - var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, - string.Format(null, AppResources.InvalidMasterPassword), AppResources.Ok, (a) => - { - - MasterPasswordCell.TextField.Text = string.Empty; - MasterPasswordCell.TextField.BecomeFirstResponder(); - }); - - PresentViewController(alert, true, null); - } - } - - public class TableSource : UITableViewSource - { - private LockPasswordViewController _controller; - - public TableSource(LockPasswordViewController controller) - { - _controller = controller; - } - - public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) - { - if(indexPath.Section == 0) - { - if(indexPath.Row == 0) - { - return _controller.MasterPasswordCell; - } - } - - return new UITableViewCell(); - } - - public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) - { - return UITableView.AutomaticDimension; - } - - public override nint NumberOfSections(UITableView tableView) - { - return 1; - } - - public override nint RowsInSection(UITableView tableview, nint section) - { - if(section == 0) - { - return 1; - } - - return 0; - } - - public override nfloat GetHeightForHeader(UITableView tableView, nint section) - { - return UITableView.AutomaticDimension; - } - - public override string TitleForHeader(UITableView tableView, nint section) - { - return null; - } - - public override void RowSelected(UITableView tableView, NSIndexPath indexPath) - { - tableView.DeselectRow(indexPath, true); - tableView.EndEditing(true); - - var cell = tableView.CellAt(indexPath); - if(cell == null) - { - return; - } - - var selectableCell = cell as ISelectable; - if(selectableCell != null) - { - selectableCell.Select(); - } - } - } - } -} diff --git a/src/iOS.Core/Controllers/LockPinViewController.cs b/src/iOS.Core/Controllers/LockPinViewController.cs deleted file mode 100644 index 2211c69e6..000000000 --- a/src/iOS.Core/Controllers/LockPinViewController.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using UIKit; -using XLabs.Ioc; -using Bit.App.Abstractions; -using Bit.iOS.Core.Utilities; -using Bit.App.Resources; -using System.Diagnostics; -using Bit.iOS.Core.Controllers; - -namespace Bit.iOS.Core.Controllers -{ - public abstract class LockPinViewController : ExtendedUIViewController - { - private IAppSettingsService _appSettingsService; - private IAuthService _authService; - - public LockPinViewController(IntPtr handle) : base(handle) - { } - - public abstract UINavigationItem BaseNavItem { get; } - public abstract UIBarButtonItem BaseCancelButton { get; } - public abstract UILabel BasePinLabel { get; } - public abstract UILabel BaseInstructionLabel { get; } - public abstract UITextField BasePinTextField { get; } - public abstract Action Success { get; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - _appSettingsService = Resolver.Resolve(); - _authService = Resolver.Resolve(); - - BaseNavItem.Title = AppResources.VerifyPIN; - BaseCancelButton.Title = AppResources.Cancel; - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - - var descriptor = UIFontDescriptor.PreferredBody; - BasePinLabel.Font = UIFont.FromName("Menlo-Regular", 35); - - BaseInstructionLabel.Text = AppResources.EnterPIN; - BaseInstructionLabel.LineBreakMode = UILineBreakMode.WordWrap; - BaseInstructionLabel.Lines = 0; - BaseInstructionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 0.8f); - BaseInstructionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - BasePinTextField.EditingChanged += PinTextField_EditingChanged; - - base.ViewDidLoad(); - } - - public override void ViewDidAppear(bool animated) - { - base.ViewDidAppear(animated); - BasePinTextField.BecomeFirstResponder(); - } - - private void PinTextField_EditingChanged(object sender, EventArgs e) - { - SetLabelText(); - - if(BasePinTextField.Text.Length >= 4) - { - if(BasePinTextField.Text == _authService.PIN) - { - Debug.WriteLine("BW Log, Start Dismiss PIN controller."); - _appSettingsService.Locked = false; - BasePinTextField.ResignFirstResponder(); - Success(); - } - else - { - // TODO: keep track of invalid attempts and logout? - - var alert = Dialogs.CreateAlert(null, AppResources.InvalidPIN, AppResources.Ok, (a) => - { - BasePinTextField.Text = string.Empty; - SetLabelText(); - BasePinTextField.BecomeFirstResponder(); - }); - PresentViewController(alert, true, null); - } - } - } - - private void SetLabelText() - { - var newText = string.Empty; - for(int i = 0; i < 4; i++) - { - newText += BasePinTextField.Text.Length <= i ? "- " : "• "; - } - - BasePinLabel.Text = newText.TrimEnd(); - } - } -} diff --git a/src/iOS.Core/Controllers/LoginAddViewController.cs b/src/iOS.Core/Controllers/LoginAddViewController.cs deleted file mode 100644 index 7076a88bd..000000000 --- a/src/iOS.Core/Controllers/LoginAddViewController.cs +++ /dev/null @@ -1,338 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Bit.App.Abstractions; -using Bit.App.Models; -using Bit.App.Resources; -using Bit.iOS.Core.Views; -using Foundation; -using UIKit; -using XLabs.Ioc; -using Bit.App; -using Plugin.Connectivity.Abstractions; -using Bit.iOS.Core.Utilities; -using Bit.iOS.Core.Models; -using System.Threading.Tasks; -using AuthenticationServices; - -namespace Bit.iOS.Core.Controllers -{ - public abstract class LoginAddViewController : ExtendedUITableViewController - { - private ICipherService _cipherService; - private IFolderService _folderService; - private IConnectivity _connectivity; - private IEnumerable _folders; - protected IGoogleAnalyticsService _googleAnalyticsService; - - public LoginAddViewController(IntPtr handle) : base(handle) - { - } - - public AppExtensionContext Context { get; set; } - public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name); - public FormEntryTableViewCell UsernameCell { get; set; } = new FormEntryTableViewCell(AppResources.Username); - public FormEntryTableViewCell PasswordCell { get; set; } = new FormEntryTableViewCell(AppResources.Password); - public UITableViewCell GeneratePasswordCell { get; set; } = new UITableViewCell(UITableViewCellStyle.Subtitle, "GeneratePasswordCell"); - public FormEntryTableViewCell UriCell { get; set; } = new FormEntryTableViewCell(AppResources.URI); - public SwitchTableViewCell FavoriteCell { get; set; } = new SwitchTableViewCell(AppResources.Favorite); - public FormEntryTableViewCell NotesCell { get; set; } = new FormEntryTableViewCell(useTextView: true, height: 180); - public PickerTableViewCell FolderCell { get; set; } = new PickerTableViewCell(AppResources.Folder); - - public abstract UINavigationItem BaseNavItem { get; } - public abstract UIBarButtonItem BaseCancelButton { get; } - public abstract UIBarButtonItem BaseSaveButton { get; } - public abstract Action Success { get; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - _cipherService = Resolver.Resolve(); - _connectivity = Resolver.Resolve(); - _folderService = Resolver.Resolve(); - _googleAnalyticsService = Resolver.Resolve(); - - BaseNavItem.Title = AppResources.AddItem; - BaseCancelButton.Title = AppResources.Cancel; - BaseSaveButton.Title = AppResources.Save; - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - - NameCell.TextField.Text = Context?.Uri?.Host ?? string.Empty; - NameCell.TextField.ReturnKeyType = UIReturnKeyType.Next; - NameCell.TextField.ShouldReturn += (UITextField tf) => - { - UsernameCell.TextField.BecomeFirstResponder(); - return true; - }; - - UsernameCell.TextField.AutocapitalizationType = UITextAutocapitalizationType.None; - UsernameCell.TextField.AutocorrectionType = UITextAutocorrectionType.No; - UsernameCell.TextField.SpellCheckingType = UITextSpellCheckingType.No; - UsernameCell.TextField.ReturnKeyType = UIReturnKeyType.Next; - UsernameCell.TextField.ShouldReturn += (UITextField tf) => - { - PasswordCell.TextField.BecomeFirstResponder(); - return true; - }; - - PasswordCell.TextField.SecureTextEntry = true; - PasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Next; - PasswordCell.TextField.ShouldReturn += (UITextField tf) => - { - UriCell.TextField.BecomeFirstResponder(); - return true; - }; - - GeneratePasswordCell.TextLabel.Text = AppResources.GeneratePassword; - GeneratePasswordCell.Accessory = UITableViewCellAccessory.DisclosureIndicator; - - UriCell.TextField.Text = Context?.UrlString ?? string.Empty; - UriCell.TextField.KeyboardType = UIKeyboardType.Url; - UriCell.TextField.ReturnKeyType = UIReturnKeyType.Next; - UriCell.TextField.ShouldReturn += (UITextField tf) => - { - NotesCell.TextView.BecomeFirstResponder(); - return true; - }; - - _folders = _folderService.GetAllAsync().GetAwaiter().GetResult(); - var folderNames = _folders.Select(s => s.Name.Decrypt()).OrderBy(s => s).ToList(); - folderNames.Insert(0, AppResources.FolderNone); - FolderCell.Items = folderNames; - - TableView.RowHeight = UITableView.AutomaticDimension; - TableView.EstimatedRowHeight = 70; - TableView.Source = new TableSource(this); - TableView.AllowsSelection = true; - - base.ViewDidLoad(); - } - - public override void ViewDidAppear(bool animated) - { - base.ViewDidAppear(animated); - } - - protected async Task SaveAsync() - { - if(!_connectivity.IsConnected) - { - AlertNoConnection(); - return; - } - - if(string.IsNullOrWhiteSpace(PasswordCell.TextField.Text)) - { - DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.Password), AppResources.Ok); - return; - } - - if(string.IsNullOrWhiteSpace(NameCell.TextField.Text)) - { - DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.Name), AppResources.Ok); - return; - } - - var cipher = new Cipher - { - Name = string.IsNullOrWhiteSpace(NameCell.TextField.Text) ? null : NameCell.TextField.Text.Encrypt(), - Notes = string.IsNullOrWhiteSpace(NotesCell.TextView.Text) ? null : NotesCell.TextView.Text.Encrypt(), - Favorite = FavoriteCell.Switch.On, - FolderId = FolderCell.SelectedIndex == 0 ? null : _folders.ElementAtOrDefault(FolderCell.SelectedIndex - 1)?.Id, - Type = App.Enums.CipherType.Login, - Login = new Login - { - Uris = null, - Username = string.IsNullOrWhiteSpace(UsernameCell.TextField.Text) ? null : UsernameCell.TextField.Text.Encrypt(), - Password = string.IsNullOrWhiteSpace(PasswordCell.TextField.Text) ? null : PasswordCell.TextField.Text.Encrypt() - } - }; - - if(!string.IsNullOrWhiteSpace(UriCell.TextField.Text)) - { - cipher.Login.Uris = new List - { - new LoginUri - { - Uri = UriCell.TextField.Text.Encrypt() - } - }; - } - - var saveTask = _cipherService.SaveAsync(cipher); - var loadingAlert = Dialogs.CreateLoadingAlert(AppResources.Saving); - PresentViewController(loadingAlert, true, null); - await saveTask; - - await loadingAlert.DismissViewControllerAsync(true); - if(saveTask.Result.Succeeded) - { - if (await ASHelpers.IdentitiesCanIncremental()) - { - var identity = await ASHelpers.GetCipherIdentityAsync(saveTask.Result.Result.Id, _cipherService); - if (identity != null) - { - await ASCredentialIdentityStore.SharedStore.SaveCredentialIdentitiesAsync( - new ASPasswordCredentialIdentity[] { identity }); - } - } - else - { - await ASHelpers.ReplaceAllIdentities(_cipherService); - } - Success(); - } - else if(saveTask.Result.Errors.Count() > 0) - { - DisplayAlert(AppResources.AnErrorHasOccurred, saveTask.Result.Errors.First().Message, AppResources.Ok); - } - else - { - DisplayAlert(null, AppResources.AnErrorHasOccurred, AppResources.Ok); - } - } - - public void DisplayAlert(string title, string message, string accept) - { - var alert = Dialogs.CreateAlert(title, message, accept); - PresentViewController(alert, true, null); - } - - private void AlertNoConnection() - { - DisplayAlert(AppResources.InternetConnectionRequiredTitle, AppResources.InternetConnectionRequiredMessage, AppResources.Ok); - } - - public class TableSource : UITableViewSource - { - private LoginAddViewController _controller; - - public TableSource(LoginAddViewController controller) - { - _controller = controller; - } - - public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) - { - if(indexPath.Section == 0) - { - if(indexPath.Row == 0) - { - return _controller.NameCell; - } - else if(indexPath.Row == 1) - { - return _controller.UsernameCell; - } - else if(indexPath.Row == 2) - { - return _controller.PasswordCell; - } - else if(indexPath.Row == 3) - { - return _controller.GeneratePasswordCell; - } - } - else if(indexPath.Section == 1) - { - return _controller.UriCell; - } - else if(indexPath.Section == 2) - { - if(indexPath.Row == 0) - { - return _controller.FolderCell; - } - else if(indexPath.Row == 1) - { - return _controller.FavoriteCell; - } - } - else if(indexPath.Section == 3) - { - return _controller.NotesCell; - } - - return new UITableViewCell(); - } - - public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) - { - return UITableView.AutomaticDimension; - } - - public override nint NumberOfSections(UITableView tableView) - { - return 4; - } - - public override nint RowsInSection(UITableView tableview, nint section) - { - if(section == 0) - { - return 4; - } - else if(section == 1) - { - return 1; - } - else if(section == 2) - { - return 2; - } - else - { - return 1; - } - } - - public override nfloat GetHeightForHeader(UITableView tableView, nint section) - { - return section == 0 || section == 3 ? UITableView.AutomaticDimension : 0.00001f; - } - - public override string TitleForHeader(UITableView tableView, nint section) - { - if(section == 0) - { - return AppResources.ItemInformation; - } - else if(section == 3) - { - return AppResources.Notes; - } - - return string.Empty; - } - - public override void RowSelected(UITableView tableView, NSIndexPath indexPath) - { - tableView.DeselectRow(indexPath, true); - tableView.EndEditing(true); - - if(indexPath.Section == 0 && indexPath.Row == 3) - { - _controller.PerformSegue("passwordGeneratorSegue", this); - } - - var cell = tableView.CellAt(indexPath); - if(cell == null) - { - return; - } - - var selectableCell = cell as ISelectable; - if(selectableCell != null) - { - selectableCell.Select(); - } - } - } - } -} diff --git a/src/iOS.Core/Controllers/PasswordGeneratorViewController.cs b/src/iOS.Core/Controllers/PasswordGeneratorViewController.cs deleted file mode 100644 index 089c7b447..000000000 --- a/src/iOS.Core/Controllers/PasswordGeneratorViewController.cs +++ /dev/null @@ -1,360 +0,0 @@ -using System; -using System.Linq; -using Bit.App.Abstractions; -using Bit.iOS.Core.Views; -using Bit.iOS.Core.Models; -using Foundation; -using UIKit; -using XLabs.Ioc; -using Plugin.Settings.Abstractions; -using CoreGraphics; -using Bit.iOS.Core.Utilities; -using Bit.App.Resources; - -namespace Bit.iOS.Core.Controllers -{ - public abstract class PasswordGeneratorViewController : ExtendedUIViewController - { - private IPasswordGenerationService _passwordGenerationService; - private ISettings _settings; - private bool _isAutofill; - - public PasswordGeneratorViewController(IntPtr handle, bool autofill) : base(handle) - { - _isAutofill = autofill; - } - - protected IGoogleAnalyticsService GoogleAnalyticsService { get; private set; } - public UITableViewController OptionsTableViewController { get; set; } - public SwitchTableViewCell UppercaseCell { get; set; } = new SwitchTableViewCell("A-Z"); - public SwitchTableViewCell LowercaseCell { get; set; } = new SwitchTableViewCell("a-z"); - public SwitchTableViewCell NumbersCell { get; set; } = new SwitchTableViewCell("0-9"); - public SwitchTableViewCell SpecialCell { get; set; } = new SwitchTableViewCell("!@#$%^&*"); - public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell(AppResources.MinNumbers, 1, 0, 5, 1); - public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell(AppResources.MinSpecial, 1, 0, 5, 1); - public SliderTableViewCell LengthCell { get; set; } = new SliderTableViewCell(AppResources.Length, 10, 5, 64); - - public PasswordGenerationOptions PasswordOptions { get; set; } - public abstract UINavigationItem BaseNavItem { get; } - public abstract UIBarButtonItem BaseCancelButton { get; } - public abstract UIBarButtonItem BaseSelectBarButton { get; } - public abstract UILabel BasePasswordLabel { get; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - _passwordGenerationService = Resolver.Resolve(); - _settings = Resolver.Resolve(); - GoogleAnalyticsService = Resolver.Resolve(); - - BaseNavItem.Title = AppResources.PasswordGenerator; - BaseCancelButton.Title = AppResources.Cancel; - BaseSelectBarButton.Title = AppResources.Select; - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - - var descriptor = UIFontDescriptor.PreferredBody; - BasePasswordLabel.Font = UIFont.FromName("Menlo-Regular", descriptor.PointSize * 1.3f); - BasePasswordLabel.LineBreakMode = UILineBreakMode.TailTruncation; - BasePasswordLabel.Lines = 1; - BasePasswordLabel.AdjustsFontSizeToFitWidth = false; - - var controller = ChildViewControllers.LastOrDefault(); - if(controller != null) - { - OptionsTableViewController = controller as UITableViewController; - } - - if(OptionsTableViewController != null) - { - OptionsTableViewController.TableView.RowHeight = UITableView.AutomaticDimension; - OptionsTableViewController.TableView.EstimatedRowHeight = 70; - OptionsTableViewController.TableView.Source = new TableSource(this); - OptionsTableViewController.TableView.AllowsSelection = true; - OptionsTableViewController.View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - } - - UppercaseCell.Switch.On = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorUppercase, true); - LowercaseCell.Switch.On = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorLowercase, true); - SpecialCell.Switch.On = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorSpecial, true); - NumbersCell.Switch.On = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorNumbers, true); - MinNumbersCell.Value = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorMinNumbers, 1); - MinSpecialCell.Value = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorMinSpecial, 1); - LengthCell.Value = _settings.GetValueOrDefault(App.Constants.PasswordGeneratorLength, 10); - - UppercaseCell.ValueChanged += Options_ValueChanged; - LowercaseCell.ValueChanged += Options_ValueChanged; - NumbersCell.ValueChanged += Options_ValueChanged; - SpecialCell.ValueChanged += Options_ValueChanged; - MinNumbersCell.ValueChanged += Options_ValueChanged; - MinSpecialCell.ValueChanged += Options_ValueChanged; - LengthCell.ValueChanged += Options_ValueChanged; - - // Adjust based on context password options - if(PasswordOptions != null) - { - if(PasswordOptions.RequireDigits) - { - NumbersCell.Switch.On = true; - NumbersCell.Switch.Enabled = false; - - if(MinNumbersCell.Value < 1) - { - MinNumbersCell.Value = 1; - } - - MinNumbersCell.Stepper.MinimumValue = 1; - } - - if(PasswordOptions.RequireSymbols) - { - SpecialCell.Switch.On = true; - SpecialCell.Switch.Enabled = false; - - if(MinSpecialCell.Value < 1) - { - MinSpecialCell.Value = 1; - } - - MinSpecialCell.Stepper.MinimumValue = 1; - } - - if(PasswordOptions.MinLength < PasswordOptions.MaxLength) - { - if(PasswordOptions.MinLength > 0 && PasswordOptions.MinLength > LengthCell.Slider.MinValue) - { - if(LengthCell.Value < PasswordOptions.MinLength) - { - LengthCell.Slider.Value = PasswordOptions.MinLength; - } - - LengthCell.Slider.MinValue = PasswordOptions.MinLength; - } - - if(PasswordOptions.MaxLength > 5 && PasswordOptions.MaxLength < LengthCell.Slider.MaxValue) - { - if(LengthCell.Value > PasswordOptions.MaxLength) - { - LengthCell.Slider.Value = PasswordOptions.MaxLength; - } - - LengthCell.Slider.MaxValue = PasswordOptions.MaxLength; - } - } - } - - GeneratePassword(); - if(_isAutofill) - { - GoogleAnalyticsService.TrackAutofillExtensionEvent("GeneratedPassword"); - } - else - { - GoogleAnalyticsService.TrackExtensionEvent("GeneratedPassword"); - } - base.ViewDidLoad(); - } - - private void Options_ValueChanged(object sender, EventArgs e) - { - if(InvalidState()) - { - LowercaseCell.Switch.On = true; - } - - GeneratePassword(); - } - - private bool InvalidState() - { - return !LowercaseCell.Switch.On && !UppercaseCell.Switch.On && !NumbersCell.Switch.On && !SpecialCell.Switch.On; - } - - private void GeneratePassword() - { - BasePasswordLabel.Text = _passwordGenerationService.GeneratePassword( - length: LengthCell.Value, - uppercase: UppercaseCell.Switch.On, - lowercase: LowercaseCell.Switch.On, - numbers: NumbersCell.Switch.On, - special: SpecialCell.Switch.On, - minSpecial: MinSpecialCell.Value, - minNumbers: MinNumbersCell.Value); - } - - public class TableSource : UITableViewSource - { - private PasswordGeneratorViewController _controller; - - public TableSource(PasswordGeneratorViewController controller) - { - _controller = controller; - } - - public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) - { - if(indexPath.Section == 0) - { - var cell = new UITableViewCell(); - cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); - if(indexPath.Row == 0) - { - cell.TextLabel.Text = AppResources.RegeneratePassword; - } - else if(indexPath.Row == 1) - { - cell.TextLabel.Text = AppResources.CopyPassword; - } - return cell; - } - - if(indexPath.Row == 0) - { - return _controller.LengthCell; - } - else if(indexPath.Row == 1) - { - return _controller.UppercaseCell; - } - else if(indexPath.Row == 2) - { - return _controller.LowercaseCell; - } - else if(indexPath.Row == 3) - { - return _controller.NumbersCell; - } - else if(indexPath.Row == 4) - { - return _controller.SpecialCell; - } - else if(indexPath.Row == 5) - { - return _controller.MinNumbersCell; - } - else if(indexPath.Row == 6) - { - return _controller.MinSpecialCell; - } - - return new UITableViewCell(); - } - - public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) - { - return UITableView.AutomaticDimension; - } - - public override nint NumberOfSections(UITableView tableView) - { - return 2; - } - - public override nint RowsInSection(UITableView tableview, nint section) - { - if(section == 0) - { - return 2; - } - - return 7; - } - - public override nfloat GetHeightForHeader(UITableView tableView, nint section) - { - if(section == 0) - { - return 0.00001f; - } - - return UITableView.AutomaticDimension; - } - - public override UIView GetViewForHeader(UITableView tableView, nint section) - { - if(section == 0) - { - return new UIView(CGRect.Empty) - { - Hidden = true - }; - } - - return null; - } - - public override string TitleForHeader(UITableView tableView, nint section) - { - if(section == 1) - { - return AppResources.Options; - } - - return null; - } - - public override string TitleForFooter(UITableView tableView, nint section) - { - if(section == 1) - { - return AppResources.OptionDefaults; - } - - return null; - } - - public override void RowSelected(UITableView tableView, NSIndexPath indexPath) - { - if(indexPath.Section == 0) - { - if(indexPath.Row == 0) - { - if(_controller._isAutofill) - { - _controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("RegeneratedPassword"); - } - else - { - _controller.GoogleAnalyticsService.TrackExtensionEvent("RegeneratedPassword"); - } - _controller.GeneratePassword(); - } - else if(indexPath.Row == 1) - { - if(_controller._isAutofill) - { - _controller.GoogleAnalyticsService.TrackAutofillExtensionEvent("CopiedGeneratedPassword"); - } - else - { - _controller.GoogleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword"); - } - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = _controller.BasePasswordLabel.Text; - var alert = Dialogs.CreateMessageAlert(AppResources.Copied); - _controller.PresentViewController(alert, true, () => - { - _controller.DismissViewController(true, null); - }); - } - } - - tableView.DeselectRow(indexPath, true); - tableView.EndEditing(true); - } - - public NSDate DateTimeToNSDate(DateTime date) - { - DateTime reference = TimeZone.CurrentTimeZone.ToLocalTime( - new DateTime(2001, 1, 1, 0, 0, 0)); - return NSDate.FromTimeIntervalSinceReferenceDate( - (date - reference).TotalSeconds); - } - } - } -} diff --git a/src/iOS.Core/HockeyAppCrashManagerDelegate.cs b/src/iOS.Core/HockeyAppCrashManagerDelegate.cs deleted file mode 100644 index 4016f5ce8..000000000 --- a/src/iOS.Core/HockeyAppCrashManagerDelegate.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Bit.App.Abstractions; -using HockeyApp.iOS; -using Newtonsoft.Json; - -namespace Bit.iOS.Core -{ - public class HockeyAppCrashManagerDelegate : BITCrashManagerDelegate - { - private readonly IAppIdService _appIdService; - private readonly IAuthService _authService; - - public HockeyAppCrashManagerDelegate( - IAppIdService appIdService, - IAuthService authService) - { - _appIdService = appIdService; - _authService = authService; - } - - public override string ApplicationLogForCrashManager(BITCrashManager crashManager) - { - var log = new - { - AppId = _appIdService.AppId, - UserId = _authService.UserId - }; - - return JsonConvert.SerializeObject(log, Formatting.Indented); - } - } -} diff --git a/src/iOS.Core/Models/AppExtensionContext.cs b/src/iOS.Core/Models/AppExtensionContext.cs deleted file mode 100644 index e55377fdc..000000000 --- a/src/iOS.Core/Models/AppExtensionContext.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; - -namespace Bit.iOS.Core.Models -{ - public class AppExtensionContext - { - private string _uriString; - - public Uri Uri - { - get - { - Uri uri; - if(string.IsNullOrWhiteSpace(UrlString) || !Uri.TryCreate(UrlString, UriKind.Absolute, out uri)) - { - return null; - } - - return uri; - } - } - public string UrlString - { - get - { - return _uriString; - } - set - { - _uriString = value; - if(string.IsNullOrWhiteSpace(_uriString)) - { - return; - } - - if(!_uriString.StartsWith(App.Constants.iOSAppProtocol) && _uriString.Contains(".")) - { - if(!_uriString.Contains("://") && !_uriString.Contains(" ")) - { - _uriString = string.Concat("http://", _uriString); - } - } - - if(!_uriString.StartsWith("http") && !_uriString.StartsWith(App.Constants.iOSAppProtocol)) - { - _uriString = string.Concat(App.Constants.iOSAppProtocol, _uriString); - } - } - } - public PasswordGenerationOptions PasswordOptions { get; set; } - } -} \ No newline at end of file diff --git a/src/iOS.Core/Models/CipherViewModel.cs b/src/iOS.Core/Models/CipherViewModel.cs deleted file mode 100644 index 869ddc28f..000000000 --- a/src/iOS.Core/Models/CipherViewModel.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Bit.App.Enums; -using Bit.App.Models; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Bit.iOS.Core.Models -{ - public class CipherViewModel - { - public CipherViewModel(Cipher cipher) - { - Id = cipher.Id; - Name = cipher.Name?.Decrypt(cipher.OrganizationId); - Username = cipher.Login?.Username?.Decrypt(cipher.OrganizationId); - Password = cipher.Login?.Password?.Decrypt(cipher.OrganizationId); - Uris = cipher.Login?.Uris?.Select(u => new LoginUriModel(u, cipher.OrganizationId)); - Totp = new Lazy(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId)); - Fields = new Lazy>>(() => - { - if(!cipher.Fields?.Any() ?? true) - { - return null; - } - - var fields = new List>(); - foreach(var field in cipher.Fields) - { - fields.Add(new Tuple( - field.Name?.Decrypt(cipher.OrganizationId), - field.Value?.Decrypt(cipher.OrganizationId))); - } - return fields; - }); - } - - public string Id { get; set; } - public string Name { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public IEnumerable Uris { get; set; } - public Lazy Totp { get; set; } - public Lazy>> Fields { get; set; } - - public class LoginUriModel - { - public LoginUriModel(LoginUri data, string orgId) - { - Uri = data?.Uri?.Decrypt(orgId); - Match = data?.Match; - } - - public string Uri { get; set; } - public UriMatchType? Match { get; set; } - } - } -} diff --git a/src/iOS.Core/Models/PasswordGenerationOptions.cs b/src/iOS.Core/Models/PasswordGenerationOptions.cs deleted file mode 100644 index 4c2aa0c8b..000000000 --- a/src/iOS.Core/Models/PasswordGenerationOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Bit.iOS.Core.Models -{ - public class PasswordGenerationOptions - { - public int MinLength { get; set; } - public int MaxLength { get; set; } - public bool RequireDigits { get; set; } - public bool RequireSymbols { get; set; } - public string ForbiddenCharacters { get; set; } - } -} diff --git a/src/iOS.Core/Properties/AssemblyInfo.cs b/src/iOS.Core/Properties/AssemblyInfo.cs deleted file mode 100644 index 5fd5acd93..000000000 --- a/src/iOS.Core/Properties/AssemblyInfo.cs +++ /dev/null @@ -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("BitwardeniOSCore")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("8bit Solutions LLC")] -[assembly: AssemblyProduct("Bitwarden")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[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("b2538ada-b605-4d6f-acd2-62a409680f84")] - -// 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")] diff --git a/src/iOS.Core/Services/AppInfoService.cs b/src/iOS.Core/Services/AppInfoService.cs deleted file mode 100644 index 090a57456..000000000 --- a/src/iOS.Core/Services/AppInfoService.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using Bit.App.Abstractions; -using Foundation; - -namespace Bit.iOS.Core.Services -{ - public class AppInfoService : IAppInfoService - { - public string Build => NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString(); - public string Version => NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString(); - public bool AutofillAccessibilityServiceEnabled => false; - public bool AutofillServiceEnabled => false; - } -} diff --git a/src/iOS.Core/Services/CommonCryptoKeyDerivationService.cs b/src/iOS.Core/Services/CommonCryptoKeyDerivationService.cs deleted file mode 100644 index 8f296adab..000000000 --- a/src/iOS.Core/Services/CommonCryptoKeyDerivationService.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Bit.App.Abstractions; -using Foundation; -using System; -using System.Runtime.InteropServices; - -namespace Bit.iOS.Core.Services -{ - public class CommonCryptoKeyDerivationService : IKeyDerivationService - { - private const uint PBKDFAlgorithm = 2; // PBKDF2 - private const uint PseudoRandomAlgorithm = 3; // SHA256 - private const uint KeyLength = 32; // 256 bit - - public byte[] DeriveKey(byte[] password, byte[] salt, uint rounds) - { - var passwordData = NSData.FromArray(password); - var saltData = NSData.FromArray(salt); - - var keyData = new NSMutableData(); - keyData.Length = KeyLength; - var result = CCKeyCerivationPBKDF(PBKDFAlgorithm, passwordData.Bytes, passwordData.Length, saltData.Bytes, - saltData.Length, PseudoRandomAlgorithm, rounds, keyData.MutableBytes, keyData.Length); - - byte[] keyBytes = new byte[keyData.Length]; - Marshal.Copy(keyData.Bytes, keyBytes, 0, Convert.ToInt32(keyData.Length)); - return keyBytes; - } - - // ref: http://opensource.apple.com//source/CommonCrypto/CommonCrypto-55010/CommonCrypto/CommonKeyDerivation.h - [DllImport(ObjCRuntime.Constants.libSystemLibrary, EntryPoint = "CCKeyDerivationPBKDF")] - private extern static int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen, - IntPtr salt, nuint saltLen, uint prf, nuint rounds, IntPtr derivedKey, nuint derivedKeyLength); - } -} diff --git a/src/iOS.Core/Services/DeviceInfoService.cs b/src/iOS.Core/Services/DeviceInfoService.cs deleted file mode 100644 index e51ff1f0a..000000000 --- a/src/iOS.Core/Services/DeviceInfoService.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Bit.App.Abstractions; -using Foundation; -using LocalAuthentication; -using UIKit; - -namespace Bit.iOS.Core.Services -{ - public class DeviceInfoService : IDeviceInfoService - { - public DeviceInfoService() - : this(false) - { } - - public DeviceInfoService(bool isExtension) - { - IsExtension = isExtension; - } - - public string Type => Xamarin.Forms.Device.iOS; - public string Model => UIDevice.CurrentDevice.Model; - public int Version - { - get - { - var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.'); - if(versionParts.Length > 0 && int.TryParse(versionParts[0], out int version)) - { - return version; - } - - // unable to determine version - return -1; - } - } - public float Scale => (float)UIScreen.MainScreen.Scale; - public bool NfcEnabled => CoreNFC.NFCNdefReaderSession.ReadingAvailable; - public bool HasCamera => true; - public bool AutofillServiceSupported => false; - public bool HasFaceIdSupport - { - get - { - if(Version < 11) - { - return false; - } - - var context = new LAContext(); - if(!context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out NSError e)) - { - return false; - } - - return context.BiometryType == LABiometryType.FaceId; - } - } - public bool IsExtension { get; private set; } - } -} diff --git a/src/iOS.Core/Services/GoogleAnalyticsService.cs b/src/iOS.Core/Services/GoogleAnalyticsService.cs deleted file mode 100644 index a8eb843ec..000000000 --- a/src/iOS.Core/Services/GoogleAnalyticsService.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Bit.App.Abstractions; -using Plugin.Settings.Abstractions; - -namespace Bit.iOS.Core.Services -{ - public class GoogleAnalyticsService : IGoogleAnalyticsService - { - public GoogleAnalyticsService( - IAppIdService appIdService, - ISettings settings) - {} - - public void TrackAppEvent(string eventName, string label = null) - { - } - - public void TrackExtensionEvent(string eventName, string label = null) - { - } - - public void TrackAutofillExtensionEvent(string eventName, string label = null) - { - } - - public void TrackEvent(string category, string eventName, string label = null) - { - } - - public void TrackException(string message, bool fatal) - { - } - - public void TrackPage(string pageName) - { - } - - public void Dispatch(Action completionHandler = null) - { - completionHandler?.Invoke(); - } - - public void SetAppOptOut(bool optOut) - { - } - } -} diff --git a/src/iOS.Core/Services/HttpService.cs b/src/iOS.Core/Services/HttpService.cs deleted file mode 100644 index e1c2c5128..000000000 --- a/src/iOS.Core/Services/HttpService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Bit.App; -using Bit.App.Abstractions; - -namespace Bit.iOS.Core.Services -{ - public class HttpService : IHttpService - { - public ApiHttpClient ApiClient => new ApiHttpClient(); - public IdentityHttpClient IdentityClient => new IdentityHttpClient(); - } -} diff --git a/src/iOS.Core/Services/KeyChainStorageService.cs b/src/iOS.Core/Services/KeyChainStorageService.cs deleted file mode 100644 index c646a43ff..000000000 --- a/src/iOS.Core/Services/KeyChainStorageService.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using Bit.App.Abstractions; -using Foundation; -using Security; - -namespace Bit.iOS.Core.Services -{ - public class KeyChainStorageService : ISecureStorageService - { - public void Store(string key, byte[] dataBytes) - { - using(var data = NSData.FromArray(dataBytes)) - using(var newRecord = GetKeyRecord(key, data)) - { - Delete(key); - CheckError(SecKeyChain.Add(newRecord)); - } - } - - public byte[] Retrieve(string key) - { - SecStatusCode resultCode; - - using(var existingRecord = GetKeyRecord(key)) - using(var record = SecKeyChain.QueryAsRecord(existingRecord, out resultCode)) - { - if(resultCode == SecStatusCode.ItemNotFound) - { - return null; - } - - CheckError(resultCode); - return record.Generic.ToArray(); - } - } - - public void Delete(string key) - { - using(var record = GetExistingRecord(key)) - { - if(record != null) - { - CheckError(SecKeyChain.Remove(record)); - } - } - } - - public bool Contains(string key) - { - using(var existingRecord = GetExistingRecord(key)) - { - return existingRecord != null; - } - } - - private static void CheckError(SecStatusCode resultCode, [CallerMemberName] string caller = null) - { - if(resultCode != SecStatusCode.Success) - { - throw new Exception(string.Format("Failed to execute {0}. Result code: {1}", caller, resultCode)); - } - } - - private static SecRecord GetKeyRecord(string key, NSData data = null) - { - var record = new SecRecord(SecKind.GenericPassword) - { - Service = "com.8bit.bitwarden", - Account = key, - AccessGroup = "LTZ2PFU5D6.com.8bit.bitwarden" - }; - - if(data != null) - { - record.Generic = data; - } - - return record; - } - - private static SecRecord GetExistingRecord(string key) - { - var existingRecord = GetKeyRecord(key); - - SecStatusCode resultCode; - SecKeyChain.QueryAsRecord(existingRecord, out resultCode); - - return resultCode == SecStatusCode.Success ? existingRecord : null; - } - } -} diff --git a/src/iOS.Core/Services/LocalizeService.cs b/src/iOS.Core/Services/LocalizeService.cs deleted file mode 100644 index 28fab5b96..000000000 --- a/src/iOS.Core/Services/LocalizeService.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Globalization; -using System.Threading; -using Foundation; -using Bit.App.Abstractions; -using Bit.App.Models; - -namespace Bit.iOS.Core.Services -{ - public class LocalizeService : ILocalizeService - { - public void SetLocale(CultureInfo ci) - { - Thread.CurrentThread.CurrentCulture = ci; - Thread.CurrentThread.CurrentUICulture = ci; - Console.WriteLine("CurrentCulture set: " + ci.Name); - } - - public CultureInfo GetCurrentCultureInfo() - { - var netLanguage = "en"; - if(NSLocale.PreferredLanguages.Length > 0) - { - var pref = NSLocale.PreferredLanguages[0]; - - netLanguage = iOSToDotnetLanguage(pref); - } - - // this gets called a lot - try/catch can be expensive so consider caching or something - CultureInfo ci = null; - try - { - ci = new CultureInfo(netLanguage); - } - catch(CultureNotFoundException e1) - { - // iOS locale not valid .NET culture (eg. "en-ES" : English in Spain) - // fallback to first characters, in this case "en" - try - { - var fallback = ToDotnetFallbackLanguage(new PlatformCulture(netLanguage)); - Console.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")"); - ci = new CultureInfo(fallback); - } - catch(CultureNotFoundException e2) - { - // iOS language not valid .NET culture, falling back to English - Console.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")"); - ci = new CultureInfo("en"); - } - } - - return ci; - } - - private string iOSToDotnetLanguage(string iOSLanguage) - { - Console.WriteLine("iOS Language:" + iOSLanguage); - var netLanguage = iOSLanguage; - - if(iOSLanguage.StartsWith("zh-Hant") || iOSLanguage.StartsWith("zh-HK")) - { - netLanguage = "zh-Hant"; - } - else if(iOSLanguage.StartsWith("zh")) - { - netLanguage = "zh-Hans"; - } - else - { - //certain languages need to be converted to CultureInfo equivalent - switch(iOSLanguage) - { - case "ms-MY": // "Malaysian (Malaysia)" not supported .NET culture - case "ms-SG": // "Malaysian (Singapore)" not supported .NET culture - netLanguage = "ms"; // closest supported - break; - case "gsw-CH": // "Schwiizertüütsch (Swiss German)" not supported .NET culture - netLanguage = "de-CH"; // closest supported - break; - // add more application-specific cases here (if required) - // ONLY use cultures that have been tested and known to work - } - } - - Console.WriteLine(".NET Language/Locale:" + netLanguage); - return netLanguage; - } - - private string ToDotnetFallbackLanguage(PlatformCulture platCulture) - { - Console.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode); - var netLanguage = platCulture.LanguageCode; // use the first part of the identifier (two chars, usually); - - switch(platCulture.LanguageCode) - { - case "pt": - netLanguage = "pt-PT"; // fallback to Portuguese (Portugal) - break; - case "gsw": - netLanguage = "de-CH"; // equivalent to German (Switzerland) for this app - break; - // add more application-specific cases here (if required) - // ONLY use cultures that have been tested and known to work - } - - Console.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)"); - return netLanguage; - } - } -} diff --git a/src/iOS.Core/Services/LogService.cs b/src/iOS.Core/Services/LogService.cs deleted file mode 100644 index e5c9b8131..000000000 --- a/src/iOS.Core/Services/LogService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Bit.App.Abstractions; - -namespace Bit.iOS.Core.Services -{ - public class LogService : ILogService - { - public void WriteLine(string message) - { - Console.WriteLine(message); - } - } -} diff --git a/src/iOS.Core/Services/NoopDeviceActionService.cs b/src/iOS.Core/Services/NoopDeviceActionService.cs deleted file mode 100644 index 36f35b20c..000000000 --- a/src/iOS.Core/Services/NoopDeviceActionService.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using Bit.App.Abstractions; -using System.Threading.Tasks; -using Bit.App.Models.Page; -using Xamarin.Forms; - -namespace Bit.iOS.Core.Services -{ - public class NoopDeviceActionService : IDeviceActionService - { - public void Autofill(VaultListPageModel.Cipher cipher) - { - // do nothing - } - - public void Background() - { - // do nothing - } - - public bool CanOpenFile(string fileName) - { - return false; - } - - public void ClearCache() - { - // do nothing - } - - public void CloseAutofill() - { - // do nothing - } - - public void CopyToClipboard(string text) - { - // do nothing - } - - public void DismissKeyboard() - { - // do nothing - } - - public Task DisplayAlertAsync(string title, string message, string cancel, params string[] buttons) - { - return Task.FromResult(null); - } - - public Task DisplayPromptAync(string title = null, string description = null, string text = null) - { - return Task.FromResult(null); - } - - public Task HideLoadingAsync() - { - return Task.FromResult(0); - } - - public Task LaunchAppAsync(string appName, Page page) - { - return Task.FromResult(0); - } - - public void OpenAccessibilitySettings() - { - // do nothing - } - - public void OpenAutofillSettings() - { - // do nothing - } - - public bool OpenFile(byte[] fileData, string id, string fileName) - { - return false; - } - - public void RateApp() - { - // do nothing - } - - public Task SelectFileAsync() - { - return Task.FromResult(0); - } - - public Task ShowLoadingAsync(string text) - { - return Task.FromResult(0); - } - - public void Toast(string text, bool longDuration = false) - { - // do nothing - } - } -} diff --git a/src/iOS.Core/Services/Settings.cs b/src/iOS.Core/Services/Settings.cs deleted file mode 100644 index 2d36bab01..000000000 --- a/src/iOS.Core/Services/Settings.cs +++ /dev/null @@ -1,495 +0,0 @@ -using System; -using Foundation; -#if __IOS__ -using UIKit; -#endif -using Plugin.Settings.Abstractions; - -namespace Bit.iOS.Core.Services -{ - /// - /// Main implementation for ISettings - /// - [Preserve(AllMembers = true)] - public class Settings : ISettings - { - private readonly object locker = new object(); - private readonly string _defaultsName; - - public Settings(string defaultsName) - { - _defaultsName = defaultsName; - } - - /// - /// Gets the current value or the default that you specify. - /// - /// Vaue of t (bool, int, float, long, string) - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - T GetValueOrDefaultInternal(string key, T defaultValue = default(T), string fileName = null) - { - lock(locker) - { - var defaults = GetUserDefaults(fileName); - - if(defaults[key] == null) - return defaultValue; - - Type typeOf = typeof(T); - if(typeOf.IsGenericType && typeOf.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - typeOf = Nullable.GetUnderlyingType(typeOf); - } - object value = null; - var typeCode = Type.GetTypeCode(typeOf); - switch(typeCode) - { - case TypeCode.Decimal: - var savedDecimal = defaults.StringForKey(key); - value = Convert.ToDecimal(savedDecimal, System.Globalization.CultureInfo.InvariantCulture); - break; - case TypeCode.Boolean: - value = defaults.BoolForKey(key); - break; - case TypeCode.Int64: - var savedInt64 = defaults.StringForKey(key); - value = Convert.ToInt64(savedInt64, System.Globalization.CultureInfo.InvariantCulture); - break; - case TypeCode.Double: - value = defaults.DoubleForKey(key); - break; - case TypeCode.String: - value = defaults.StringForKey(key); - break; - case TypeCode.Int32: - value = (Int32)defaults.IntForKey(key); - break; - case TypeCode.Single: - value = defaults.FloatForKey(key); - break; - - case TypeCode.DateTime: - var savedTime = defaults.StringForKey(key); - if(string.IsNullOrWhiteSpace(savedTime)) - { - value = defaultValue; - } - else - { - var ticks = Convert.ToInt64(savedTime, System.Globalization.CultureInfo.InvariantCulture); - if(ticks >= 0) - { - //Old value, stored before update to UTC values - value = new DateTime(ticks); - } - else - { - //New value, UTC - value = new DateTime(-ticks, DateTimeKind.Utc); - } - } - break; - default: - - if(defaultValue is Guid) - { - var outGuid = Guid.Empty; - var savedGuid = defaults.StringForKey(key); - if(string.IsNullOrWhiteSpace(savedGuid)) - { - value = outGuid; - } - else - { - Guid.TryParse(savedGuid, out outGuid); - value = outGuid; - } - } - else - { - throw new ArgumentException($"Value of type {typeCode} is not supported."); - } - - break; - } - - - return null != value ? (T)value : defaultValue; - } - } - - /// - /// Adds or updates a value - /// - /// key to update - /// value to set - /// Name of file for settings to be stored and retrieved - /// True if added or update and you need to save - bool AddOrUpdateValueInternal(string key, T value, string fileName = null) - { - if(value == null) - { - Remove(key, fileName); - return true; - } - - Type typeOf = typeof(T); - if(typeOf.IsGenericType && typeOf.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - typeOf = Nullable.GetUnderlyingType(typeOf); - } - var typeCode = Type.GetTypeCode(typeOf); - return AddOrUpdateValueCore(key, value, typeCode, fileName); - } - - bool AddOrUpdateValueCore(string key, object value, TypeCode typeCode, string fileName) - { - lock(locker) - { - var defaults = GetUserDefaults(fileName); - switch(typeCode) - { - case TypeCode.Decimal: - defaults.SetString(Convert.ToString(value, System.Globalization.CultureInfo.InvariantCulture), key); - break; - case TypeCode.Boolean: - defaults.SetBool(Convert.ToBoolean(value), key); - break; - case TypeCode.Int64: - defaults.SetString(Convert.ToString(value, System.Globalization.CultureInfo.InvariantCulture), key); - break; - case TypeCode.Double: - defaults.SetDouble(Convert.ToDouble(value, System.Globalization.CultureInfo.InvariantCulture), key); - break; - case TypeCode.String: - defaults.SetString(Convert.ToString(value), key); - break; - case TypeCode.Int32: - defaults.SetInt(Convert.ToInt32(value, System.Globalization.CultureInfo.InvariantCulture), key); - break; - case TypeCode.Single: - defaults.SetFloat(Convert.ToSingle(value, System.Globalization.CultureInfo.InvariantCulture), key); - break; - case TypeCode.DateTime: - defaults.SetString(Convert.ToString(-(Convert.ToDateTime(value)).ToUniversalTime().Ticks), key); - break; - default: - if(value is Guid) - { - if(value == null) - value = Guid.Empty; - - defaults.SetString(((Guid)value).ToString(), key); - } - else - { - throw new ArgumentException($"Value of type {typeCode} is not supported."); - } - break; - } - try - { - defaults.Synchronize(); - } - catch(Exception ex) - { - Console.WriteLine("Unable to save: " + key, " Message: " + ex.Message); - } - } - - - return true; - } - - /// - /// Removes a desired key from the settings - /// - /// Key for setting - /// Name of file for settings to be stored and retrieved - public void Remove(string key, string fileName = null) - { - lock(locker) - { - var defaults = GetUserDefaults(fileName); - try - { - if(defaults[key] != null) - { - defaults.RemoveObject(key); - defaults.Synchronize(); - } - } - catch(Exception ex) - { - Console.WriteLine("Unable to remove: " + key, " Message: " + ex.Message); - } - } - } - - /// - /// Clear all keys from settings - /// - /// Name of file for settings to be stored and retrieved - public void Clear(string fileName = null) - { - lock(locker) - { - var defaults = GetUserDefaults(fileName); - try - { - var items = defaults.ToDictionary(); - - foreach(var item in items.Keys) - { - if(item is NSString nsString) - defaults.RemoveObject(nsString); - } - defaults.Synchronize(); - } - catch(Exception ex) - { - Console.WriteLine("Unable to clear all defaults. Message: " + ex.Message); - } - } - } - - /// - /// Checks to see if the key has been added. - /// - /// Key to check - /// Name of file for settings to be stored and retrieved - /// True if contains key, else false - public bool Contains(string key, string fileName = null) - { - lock(locker) - { - var defaults = GetUserDefaults(fileName); - try - { - var setting = defaults[key]; - return setting != null; - } - catch(Exception ex) - { - Console.WriteLine("Unable to clear all defaults. Message: " + ex.Message); - } - - return false; - } - } - - NSUserDefaults GetUserDefaults(string fileName = null) - { - if(string.IsNullOrWhiteSpace(fileName) && !string.IsNullOrWhiteSpace(_defaultsName)) - { - return new NSUserDefaults(_defaultsName, NSUserDefaultsType.SuiteName); - } - - return string.IsNullOrWhiteSpace(fileName) ? - NSUserDefaults.StandardUserDefaults : - new NSUserDefaults(fileName, NSUserDefaultsType.SuiteName); - } - - - - #region GetValueOrDefault - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public decimal GetValueOrDefault(string key, decimal defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public bool GetValueOrDefault(string key, bool defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public long GetValueOrDefault(string key, long defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public string GetValueOrDefault(string key, string defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public int GetValueOrDefault(string key, int defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public float GetValueOrDefault(string key, float defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public DateTime GetValueOrDefault(string key, DateTime defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public Guid GetValueOrDefault(string key, Guid defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - /// - /// Gets the current value or the default that you specify. - /// - /// Key for settings - /// default value if not set - /// Name of file for settings to be stored and retrieved - /// Value or default - public double GetValueOrDefault(string key, double defaultValue, string fileName = null) => - GetValueOrDefaultInternal(key, defaultValue, fileName); - #endregion - - #region AddOrUpdateValue - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, decimal value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, bool value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, long value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, string value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, int value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, float value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, DateTime value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, Guid value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - /// - /// Adds or updates the value - /// - /// Key for settting - /// Value to set - /// Name of file for settings to be stored and retrieved - /// True of was added or updated and you need to save it. - public bool AddOrUpdateValue(string key, double value, string fileName = null) => - AddOrUpdateValueInternal(key, value, fileName); - - #endregion - - - /// - /// Attempts to open the app settings page. - /// - /// true if success, else false and not supported - public bool OpenAppSettings() - { -#if __IOS__ - //Opening settings only open in iOS 8+ - if(!UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) - return false; - - try - { - UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString)); - return true; - } - catch - { - return false; - } -#else - return false; -#endif - } - - } - -} \ No newline at end of file diff --git a/src/iOS.Core/Services/SqlService.cs b/src/iOS.Core/Services/SqlService.cs deleted file mode 100644 index 570e834f9..000000000 --- a/src/iOS.Core/Services/SqlService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.IO; -using Bit.App.Abstractions; -using Foundation; -using SQLite; - -namespace Bit.iOS.Core.Services -{ - public class SqlService : ISqlService - { - private SQLiteConnection _connection; - - public SQLiteConnection GetConnection() - { - if(_connection != null) - { - return _connection; - } - - var sqliteFilename = "bitwarden.db3"; - var fileManager = new NSFileManager(); - var appGroupContainer = fileManager.GetContainerUrl("group.com.8bit.bitwarden"); - var libraryPath = Path.Combine(appGroupContainer.Path, "Library"); // Library folder - var path = Path.Combine(libraryPath, sqliteFilename); - Console.WriteLine(path); - - _connection = new SQLiteConnection(path, - SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex | SQLiteOpenFlags.SharedCache); - return _connection; - } - } -} diff --git a/src/iOS.Core/Utilities/ASHelpers.cs b/src/iOS.Core/Utilities/ASHelpers.cs deleted file mode 100644 index ac1692270..000000000 --- a/src/iOS.Core/Utilities/ASHelpers.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AuthenticationServices; -using Bit.App.Abstractions; -using Bit.App.Models; - -namespace Bit.iOS.Core.Utilities -{ - public static class ASHelpers - { - public static async Task ReplaceAllIdentities(ICipherService cipherService) - { - if (await AutofillEnabled()) - { - var identities = new List(); - var ciphers = await cipherService.GetAllAsync(); - foreach (var cipher in ciphers) - { - var identity = ToCredentialIdentity(cipher); - if (identity != null) - { - identities.Add(identity); - } - } - if (identities.Any()) - { - await ASCredentialIdentityStore.SharedStore?.ReplaceCredentialIdentitiesAsync(identities.ToArray()); - } - } - } - - public static async Task IdentitiesCanIncremental() - { - var state = await ASCredentialIdentityStore.SharedStore?.GetCredentialIdentityStoreStateAsync(); - return state != null && state.Enabled && state.SupportsIncrementalUpdates; - } - - public static async Task AutofillEnabled() - { - var state = await ASCredentialIdentityStore.SharedStore?.GetCredentialIdentityStoreStateAsync(); - return state != null && state.Enabled; - } - - public static async Task GetCipherIdentityAsync(string cipherId, ICipherService cipherService) - { - var cipher = await cipherService.GetByIdAsync(cipherId); - return ToCredentialIdentity(cipher); - } - - public static ASPasswordCredentialIdentity ToCredentialIdentity(Cipher cipher) - { - if (!cipher?.Login?.Uris?.Any() ?? true) - { - return null; - } - var uri = cipher.Login.Uris.FirstOrDefault()?.Uri?.Decrypt(cipher.OrganizationId); - if (string.IsNullOrWhiteSpace(uri)) - { - return null; - } - var username = cipher.Login.Username?.Decrypt(cipher.OrganizationId); - if (string.IsNullOrWhiteSpace(username)) - { - return null; - } - var serviceId = new ASCredentialServiceIdentifier(uri, ASCredentialServiceIdentifierType.Url); - return new ASPasswordCredentialIdentity(serviceId, username, cipher.Id); - } - } -} diff --git a/src/iOS.Core/Utilities/Dialogs.cs b/src/iOS.Core/Utilities/Dialogs.cs deleted file mode 100644 index 817013632..000000000 --- a/src/iOS.Core/Utilities/Dialogs.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Drawing; -using CoreGraphics; -using UIKit; - -namespace Bit.iOS.Core.Utilities -{ - public static class Dialogs - { - public static UIAlertController CreateLoadingAlert(string message) - { - var loadingIndicator = new UIActivityIndicatorView(new CGRect(10, 5, 50, 50)); - loadingIndicator.HidesWhenStopped = true; - loadingIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray; - loadingIndicator.StartAnimating(); - - var alert = UIAlertController.Create(null, message, UIAlertControllerStyle.Alert); - alert.View.TintColor = UIColor.Black; - alert.View.Add(loadingIndicator); - return alert; - } - - public static UIAlertController CreateMessageAlert(string message) - { - var alert = UIAlertController.Create(null, message, UIAlertControllerStyle.Alert); - alert.View.TintColor = UIColor.Black; - return alert; - } - - public static UIAlertController CreateAlert(string title, string message, string accept, Action acceptHandle = null) - { - var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert); - var oldFrame = alert.View.Frame; - alert.View.Frame = new RectangleF((float)oldFrame.X, (float)oldFrame.Y, (float)oldFrame.Width, (float)oldFrame.Height - 20); - alert.AddAction(UIAlertAction.Create(accept, UIAlertActionStyle.Default, acceptHandle)); - return alert; - } - - public static UIAlertController CreateActionSheet(string title, UIViewController controller) - { - var sheet = UIAlertController.Create(title, null, UIAlertControllerStyle.ActionSheet); - if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) - { - var x = controller.View.Bounds.Width / 2; - var y = controller.View.Bounds.Bottom; - var rect = new CGRect(x, y, 0, 0); - - sheet.PopoverPresentationController.SourceView = controller.View; - sheet.PopoverPresentationController.SourceRect = rect; - sheet.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Unknown; - } - return sheet; - } - } -} diff --git a/src/iOS.Core/Views/ExtensionSearchDelegate.cs b/src/iOS.Core/Views/ExtensionSearchDelegate.cs deleted file mode 100644 index 317d55138..000000000 --- a/src/iOS.Core/Views/ExtensionSearchDelegate.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Foundation; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class ExtensionSearchDelegate : UISearchBarDelegate - { - private readonly UITableView _tableView; - private CancellationTokenSource _filterResultsCancellationTokenSource; - - public ExtensionSearchDelegate(UITableView tableView) - { - _tableView = tableView; - } - - public override void TextChanged(UISearchBar searchBar, string searchText) - { - var cts = new CancellationTokenSource(); - Task.Run(() => - { - NSRunLoop.Main.BeginInvokeOnMainThread(async () => - { - if(!string.IsNullOrWhiteSpace(searchText)) - { - await Task.Delay(300); - if(searchText != searchBar.Text) - { - return; - } - else - { - _filterResultsCancellationTokenSource?.Cancel(); - } - } - try - { - ((ExtensionTableSource)_tableView.Source).FilterResults(searchText, cts.Token); - _tableView.ReloadData(); - } - catch(OperationCanceledException) { } - _filterResultsCancellationTokenSource = cts; - }); - }, cts.Token); - } - } -} \ No newline at end of file diff --git a/src/iOS.Core/Views/ExtensionTableSource.cs b/src/iOS.Core/Views/ExtensionTableSource.cs deleted file mode 100644 index 4abcbc8a1..000000000 --- a/src/iOS.Core/Views/ExtensionTableSource.cs +++ /dev/null @@ -1,149 +0,0 @@ -using Bit.App.Abstractions; -using Bit.App.Models; -using Bit.App.Resources; -using Bit.App.Utilities; -using Bit.iOS.Core.Models; -using Foundation; -using Plugin.Settings.Abstractions; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using UIKit; -using XLabs.Ioc; - -namespace Bit.iOS.Core.Views -{ - public class ExtensionTableSource : UITableViewSource - { - private const string CellIdentifier = "TableCell"; - - private IEnumerable _allItems = new List(); - protected ICipherService _cipherService; - protected ISettings _settings; - private bool _accessPremium; - private AppExtensionContext _context; - private UIViewController _controller; - - public ExtensionTableSource(AppExtensionContext context, UIViewController controller) - { - _accessPremium = Helpers.CanAccessPremium(); - _cipherService = Resolver.Resolve(); - _settings = Resolver.Resolve(); - _context = context; - _controller = controller; - } - - public IEnumerable Items { get; private set; } - - public async Task LoadItemsAsync(bool urlFilter = true, string searchFilter = null) - { - var combinedLogins = new List(); - - if(urlFilter) - { - var logins = await _cipherService.GetAllAsync(_context.UrlString); - if(logins?.Item1 != null) - { - combinedLogins.AddRange(logins.Item1); - } - if(logins?.Item2 != null) - { - combinedLogins.AddRange(logins.Item2); - } - } - else - { - var logins = await _cipherService.GetAllAsync(); - combinedLogins.AddRange(logins); - } - - _allItems = combinedLogins - .Where(c => c.Type == App.Enums.CipherType.Login) - .Select(s => new CipherViewModel(s)) - .OrderBy(s => s.Name) - .ThenBy(s => s.Username) - .ToList() ?? new List(); - FilterResults(searchFilter, new CancellationToken()); - } - - public void FilterResults(string searchFilter, CancellationToken ct) - { - ct.ThrowIfCancellationRequested(); - - if(string.IsNullOrWhiteSpace(searchFilter)) - { - Items = _allItems.ToList(); - } - else - { - searchFilter = searchFilter.ToLower(); - Items = _allItems - .Where(s => s.Name?.ToLower().Contains(searchFilter) ?? false || - (s.Username?.ToLower().Contains(searchFilter) ?? false) || - (s.Uris?.FirstOrDefault()?.Uri?.ToLower().Contains(searchFilter) ?? false)) - .TakeWhile(s => !ct.IsCancellationRequested) - .ToArray(); - } - } - - public IEnumerable TableItems { get; set; } - - public override nint RowsInSection(UITableView tableview, nint section) - { - return Items == null || Items.Count() == 0 ? 1 : Items.Count(); - } - - public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) - { - if(Items == null || Items.Count() == 0) - { - var noDataCell = new UITableViewCell(UITableViewCellStyle.Default, "NoDataCell"); - noDataCell.TextLabel.Text = AppResources.NoItemsTap; - noDataCell.TextLabel.TextAlignment = UITextAlignment.Center; - noDataCell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap; - noDataCell.TextLabel.Lines = 0; - return noDataCell; - } - - var cell = tableView.DequeueReusableCell(CellIdentifier); - - // if there are no cells to reuse, create a new one - if(cell == null) - { - Debug.WriteLine("BW Log, Make new cell for list."); - cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier); - cell.DetailTextLabel.TextColor = cell.DetailTextLabel.TintColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - } - return cell; - } - - public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) - { - if(Items == null || Items.Count() == 0 || cell == null) - { - return; - } - - var item = Items.ElementAt(indexPath.Row); - cell.TextLabel.Text = item.Name; - cell.DetailTextLabel.Text = item.Username; - } - - public string GetTotp(CipherViewModel item) - { - string totp = null; - if(_accessPremium) - { - if(item != null && !string.IsNullOrWhiteSpace(item.Totp.Value)) - { - totp = Crypto.Totp(item.Totp.Value); - } - } - - return totp; - } - } -} diff --git a/src/iOS.Core/Views/FormEntryTableViewCell.cs b/src/iOS.Core/Views/FormEntryTableViewCell.cs deleted file mode 100644 index 9088e7e0a..000000000 --- a/src/iOS.Core/Views/FormEntryTableViewCell.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class FormEntryTableViewCell : UITableViewCell, ISelectable - { - public FormEntryTableViewCell( - string labelName = null, - bool useTextView = false, - nfloat? height = null, - bool useLabelAsPlaceholder = false) - : base(UITableViewCellStyle.Default, nameof(FormEntryTableViewCell)) - { - var descriptor = UIFontDescriptor.PreferredBody; - var pointSize = descriptor.PointSize; - - if(labelName != null && !useLabelAsPlaceholder) - { - Label = new UILabel - { - Text = labelName, - TranslatesAutoresizingMaskIntoConstraints = false, - Font = UIFont.FromDescriptor(descriptor, 0.8f * pointSize), - TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f) - }; - - ContentView.Add(Label); - } - - if(useTextView) - { - TextView = new UITextView - { - TranslatesAutoresizingMaskIntoConstraints = false, - Font = UIFont.FromDescriptor(descriptor, pointSize) - }; - - ContentView.Add(TextView); - ContentView.AddConstraints(new NSLayoutConstraint[] { - NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Trailing, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Bottom, 1f, 10f) - }); - - if(labelName != null && !useLabelAsPlaceholder) - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f)); - } - else - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f)); - } - - if(height.HasValue) - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value)); - } - } - else - { - TextField = new UITextField - { - TranslatesAutoresizingMaskIntoConstraints = false, - BorderStyle = UITextBorderStyle.None, - Font = UIFont.FromDescriptor(descriptor, pointSize), - ClearButtonMode = UITextFieldViewMode.WhileEditing - }; - - if(useLabelAsPlaceholder) - { - TextField.Placeholder = labelName; - } - - ContentView.Add(TextField); - ContentView.AddConstraints(new NSLayoutConstraint[] { - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Trailing, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f) - }); - - if(labelName != null && !useLabelAsPlaceholder) - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f)); - } - else - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f)); - } - - if(height.HasValue) - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value)); - } - } - - if(labelName != null && !useLabelAsPlaceholder) - { - ContentView.AddConstraints(new NSLayoutConstraint[] { - NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), - NSLayoutConstraint.Create(Label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Trailing, 1f, 15f) - }); - } - } - - public UILabel Label { get; set; } - public UITextField TextField { get; set; } - public UITextView TextView { get; set; } - - public void Select() - { - if(TextView != null) - { - TextView.BecomeFirstResponder(); - } - else if(TextField != null) - { - TextField.BecomeFirstResponder(); - } - } - } -} diff --git a/src/iOS.Core/Views/ISelectable.cs b/src/iOS.Core/Views/ISelectable.cs deleted file mode 100644 index 463d783fd..000000000 --- a/src/iOS.Core/Views/ISelectable.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Bit.iOS.Core.Views -{ - public interface ISelectable - { - void Select(); - } -} diff --git a/src/iOS.Core/Views/PickerTableViewCell.cs b/src/iOS.Core/Views/PickerTableViewCell.cs deleted file mode 100644 index 84094b752..000000000 --- a/src/iOS.Core/Views/PickerTableViewCell.cs +++ /dev/null @@ -1,195 +0,0 @@ -using CoreGraphics; -using System; -using System.Collections.Generic; -using System.Drawing; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class PickerTableViewCell : UITableViewCell, ISelectable - { - private List _items = new List(); - private int _selectedIndex = 0; - - public PickerTableViewCell( - string labelName, - nfloat? height = null) - : base(UITableViewCellStyle.Default, nameof(PickerTableViewCell)) - { - var descriptor = UIFontDescriptor.PreferredBody; - var pointSize = descriptor.PointSize; - - Label = new UILabel - { - Text = labelName, - TranslatesAutoresizingMaskIntoConstraints = false, - Font = UIFont.FromDescriptor(descriptor, 0.8f * pointSize), - TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f) - }; - - ContentView.Add(Label); - - TextField = new NoCaretField - { - BorderStyle = UITextBorderStyle.None, - TranslatesAutoresizingMaskIntoConstraints = false, - Font = UIFont.FromDescriptor(descriptor, pointSize) - }; - - var width = (float)UIScreen.MainScreen.Bounds.Width; - var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44)) - { - BarStyle = UIBarStyle.Default, - Translucent = true - }; - var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); - var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) => - { - var s = (PickerSource)Picker.Model; - if(s.SelectedIndex == -1 && Items != null && Items.Count > 0) - { - UpdatePickerSelectedIndex(0); - } - TextField.Text = s.SelectedItem; - TextField.ResignFirstResponder(); - }); - - toolbar.SetItems(new[] { spacer, doneButton }, false); - - TextField.InputView = Picker; - TextField.InputAccessoryView = toolbar; - - ContentView.Add(TextField); - - ContentView.AddConstraints(new NSLayoutConstraint[] { - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Trailing, 1f, 15f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f), - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f), - NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f), - NSLayoutConstraint.Create(Label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f), - NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Trailing, 1f, 15f) - }); - - if(height.HasValue) - { - ContentView.AddConstraint( - NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value)); - } - - Picker.Model = new PickerSource(this); - } - - public UITextField TextField { get; set; } - public UILabel Label { get; set; } - public UIPickerView Picker { get; set; } = new UIPickerView(); - - public List Items - { - get { return _items; } - set - { - _items = value; - UpdatePicker(); - } - } - - public int SelectedIndex - { - get { return _selectedIndex; } - set - { - _selectedIndex = value; - UpdatePicker(); - } - } - - public string SelectedItem => TextField.Text; - - private void UpdatePicker() - { - TextField.Text = SelectedIndex == -1 || Items == null ? "" : Items[SelectedIndex]; - Picker.ReloadAllComponents(); - if(Items == null || Items.Count == 0) - { - return; - } - - UpdatePickerSelectedIndex(SelectedIndex); - } - - private void UpdatePickerFromModel(PickerSource s) - { - TextField.Text = s.SelectedItem; - _selectedIndex = s.SelectedIndex; - } - - private void UpdatePickerSelectedIndex(int formsIndex) - { - var source = (PickerSource)Picker.Model; - source.SelectedIndex = formsIndex; - source.SelectedItem = formsIndex >= 0 ? Items[formsIndex] : null; - Picker.Select(Math.Max(formsIndex, 0), 0, true); - } - - public void Select() - { - TextField?.BecomeFirstResponder(); - } - - private class NoCaretField : UITextField - { - public NoCaretField() : base(default(CGRect)) - { } - - public override CGRect GetCaretRectForPosition(UITextPosition position) - { - return default(CGRect); - } - } - - private class PickerSource : UIPickerViewModel - { - private readonly PickerTableViewCell _cell; - - public PickerSource(PickerTableViewCell cell) - { - _cell = cell; - } - - public int SelectedIndex { get; internal set; } - public string SelectedItem { get; internal set; } - - public override nint GetComponentCount(UIPickerView picker) - { - return 1; - } - - public override nint GetRowsInComponent(UIPickerView pickerView, nint component) - { - return _cell.Items != null ? _cell.Items.Count : 0; - } - - public override string GetTitle(UIPickerView picker, nint row, nint component) - { - return _cell.Items[(int)row]; - } - - public override void Selected(UIPickerView picker, nint row, nint component) - { - if(_cell.Items.Count == 0) - { - SelectedItem = null; - SelectedIndex = -1; - } - else - { - SelectedItem = _cell.Items[(int)row]; - SelectedIndex = (int)row; - } - - _cell.UpdatePickerFromModel(this); - } - } - } -} diff --git a/src/iOS.Core/Views/SliderTableViewCell.cs b/src/iOS.Core/Views/SliderTableViewCell.cs deleted file mode 100644 index 30231d2dd..000000000 --- a/src/iOS.Core/Views/SliderTableViewCell.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class SliderTableViewCell : UITableViewCell - { - private string _detailRightSpace = "\t"; - private int _value; - - public SliderTableViewCell(string labelName, int value, int min, int max) - : base(UITableViewCellStyle.Value1, nameof(SwitchTableViewCell)) - { - TextLabel.Text = labelName; - DetailTextLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - Slider = new UISlider - { - MinValue = min, - MaxValue = max, - TintColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f), - Frame = new CoreGraphics.CGRect(0, 0, 180, 30) - }; - Slider.ValueChanged += Slider_ValueChanged; - Value = value; - - AccessoryView = Slider; - } - - private void Slider_ValueChanged(object sender, EventArgs e) - { - var newValue = Convert.ToInt32(Math.Round(Slider.Value, 0)); - bool valueChanged = newValue != Value; - - Value = newValue; - - if(valueChanged) - { - ValueChanged?.Invoke(this, null); - } - } - - public UISlider Slider { get; set; } - public int Value - { - get { return _value; } - set - { - _value = value; - Slider.Value = value; - DetailTextLabel.Text = string.Concat(value.ToString(), _detailRightSpace); - } - } - public event EventHandler ValueChanged; - } -} diff --git a/src/iOS.Core/Views/StepperTableViewCell.cs b/src/iOS.Core/Views/StepperTableViewCell.cs deleted file mode 100644 index 02bdf8ce1..000000000 --- a/src/iOS.Core/Views/StepperTableViewCell.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class StepperTableViewCell : UITableViewCell - { - // Give some space to the right of the detail in between the spacer. - // This is a bit of a hack, but I did not see a way to specify a margin on the - // detaul DetailTextLabel or AccessoryView - private string _detailRightSpace = "\t"; - private int _value; - - public StepperTableViewCell(string labelName, int value, int min, int max, int increment) - : base(UITableViewCellStyle.Value1, nameof(SwitchTableViewCell)) - { - TextLabel.Text = labelName; - DetailTextLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - Stepper = new UIStepper - { - TintColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f), - MinimumValue = min, - MaximumValue = max - }; - Stepper.ValueChanged += Stepper_ValueChanged; - Value = value; - - AccessoryView = Stepper; - } - - private void Stepper_ValueChanged(object sender, EventArgs e) - { - Value = Convert.ToInt32(Stepper.Value); - ValueChanged?.Invoke(this, null); - } - - public UIStepper Stepper { get; private set; } - public int Value - { - get { return _value; } - set - { - _value = value; - Stepper.Value = value; - DetailTextLabel.Text = string.Concat(value.ToString(), _detailRightSpace); - } - } - public event EventHandler ValueChanged; - } -} diff --git a/src/iOS.Core/Views/SwitchTableViewCell.cs b/src/iOS.Core/Views/SwitchTableViewCell.cs deleted file mode 100644 index 9302f89e4..000000000 --- a/src/iOS.Core/Views/SwitchTableViewCell.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class SwitchTableViewCell : UITableViewCell - { - public SwitchTableViewCell(string labelName) - : base(UITableViewCellStyle.Default, nameof(SwitchTableViewCell)) - { - TextLabel.Text = labelName; - AccessoryView = Switch; - - Switch.ValueChanged += Switch_ValueChanged; - } - - private void Switch_ValueChanged(object sender, EventArgs e) - { - ValueChanged?.Invoke(this, null); - } - - public UISwitch Switch { get; set; } = new UISwitch(); - public event EventHandler ValueChanged; - } -} diff --git a/src/iOS.Core/Views/Toast.cs b/src/iOS.Core/Views/Toast.cs deleted file mode 100644 index e076b32dc..000000000 --- a/src/iOS.Core/Views/Toast.cs +++ /dev/null @@ -1,143 +0,0 @@ -using Foundation; -using System; -using UIKit; - -namespace Bit.iOS.Core.Views -{ - public class Toast : UIView - { - private NSTimer _dismissTimer; - private NSLayoutConstraint _heightConstraint; - private NSLayoutConstraint _leftMarginConstraint; - private NSLayoutConstraint _rightMarginConstraint; - private NSLayoutConstraint _bottomMarginConstraint; - - public Toast(string text) - : base(CoreGraphics.CGRect.FromLTRB(0, 0, 320, 38)) - { - TranslatesAutoresizingMaskIntoConstraints = false; - BackgroundColor = UIColor.DarkGray.ColorWithAlpha(0.9f); - Layer.CornerRadius = 15; - Layer.MasksToBounds = true; - - MessageLabel = new UILabel - { - TranslatesAutoresizingMaskIntoConstraints = false, - TextColor = UIColor.White, - Font = UIFont.SystemFontOfSize(14), - BackgroundColor = UIColor.Clear, - LineBreakMode = UILineBreakMode.WordWrap, - TextAlignment = UITextAlignment.Center, - Lines = 0, - Text = text - }; - - AddSubview(MessageLabel); - - var hMessageConstraints = NSLayoutConstraint.FromVisualFormat("H:|-5-[messageLabel]-5-|", 0, new NSDictionary(), - NSDictionary.FromObjectsAndKeys(new NSObject[] { MessageLabel }, - new NSObject[] { new NSString("messageLabel") }) - ); - - var vMessageConstraints = NSLayoutConstraint.FromVisualFormat("V:|-0-[messageLabel]-0-|", 0, new NSDictionary(), - NSDictionary.FromObjectsAndKeys(new NSObject[] { MessageLabel }, - new NSObject[] { new NSString("messageLabel") }) - ); - - AddConstraints(hMessageConstraints); - AddConstraints(vMessageConstraints); - - AddGestureRecognizer(new UITapGestureRecognizer(() => Dismiss(false))); - } - - public bool Dismissed { get; set; } - public Action DismissCallback { get; set; } - public TimeSpan Duration { get; set; } = TimeSpan.FromSeconds(3); - public UILabel MessageLabel { get; set; } - public nfloat LeftMargin { get; set; } = 5; - public nfloat RightMargin { get; set; } = 5; - public nfloat BottomMargin { get; set; } = 5; - public nfloat Height { get; set; } = 38; - - public void Show() - { - if(Superview != null) - { - return; - } - - _dismissTimer = NSTimer.CreateScheduledTimer(Duration, x => Dismiss()); - LayoutIfNeeded(); - - var localSuperView = UIApplication.SharedApplication.KeyWindow; - if(localSuperView != null) - { - localSuperView.AddSubview(this); - - _heightConstraint = NSLayoutConstraint.Create(this, NSLayoutAttribute.Height, - NSLayoutRelation.GreaterThanOrEqual, null, NSLayoutAttribute.NoAttribute, 1, Height); - - _leftMarginConstraint = NSLayoutConstraint.Create(this, NSLayoutAttribute.Left, NSLayoutRelation.Equal, - localSuperView, NSLayoutAttribute.Left, 1, LeftMargin); - - _rightMarginConstraint = NSLayoutConstraint.Create(this, NSLayoutAttribute.Right, NSLayoutRelation.Equal, - localSuperView, NSLayoutAttribute.Right, 1, -RightMargin); - - _bottomMarginConstraint = NSLayoutConstraint.Create(this, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, - localSuperView, NSLayoutAttribute.Bottom, 1, -BottomMargin); - - // Avoid the "UIView-Encapsulated-Layout-Height" constraint conflicts - // http://stackoverflow.com/questions/25059443/what-is-nslayoutconstraint-uiview-encapsulated-layout-height-and-how-should-i - _leftMarginConstraint.Priority = 999; - _rightMarginConstraint.Priority = 999; - - AddConstraint(_heightConstraint); - localSuperView.AddConstraint(_leftMarginConstraint); - localSuperView.AddConstraint(_rightMarginConstraint); - localSuperView.AddConstraint(_bottomMarginConstraint); - - ShowWithAnimation(); - } - else - { - Console.WriteLine("Toast needs a keyWindows to display."); - } - } - - public void Dismiss(bool animated = true) - { - if(Dismissed) - { - return; - } - - Dismissed = true; - _dismissTimer?.Invalidate(); - _dismissTimer = null; - - if(!animated) - { - RemoveFromSuperview(); - DismissCallback?.Invoke(); - return; - } - - SetNeedsLayout(); - Animate(0.3f, 0, UIViewAnimationOptions.CurveEaseIn, () => { Alpha = 0; }, () => - { - RemoveFromSuperview(); - DismissCallback?.Invoke(); - }); - } - - private void ShowWithAnimation() - { - Alpha = 0; - SetNeedsLayout(); - _bottomMarginConstraint.Constant = -BottomMargin; - _leftMarginConstraint.Constant = LeftMargin; - _rightMarginConstraint.Constant = -RightMargin; - AnimateNotify(0.3f, 0, 0.7f, 5f, UIViewAnimationOptions.CurveEaseInOut, () => { Alpha = 1; }, null); - } - } -} diff --git a/src/iOS.Core/iOS.Core.csproj b/src/iOS.Core/iOS.Core.csproj deleted file mode 100644 index 9972b60dc..000000000 --- a/src/iOS.Core/iOS.Core.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - Debug - AnyCPU - {B2538ADA-B605-4D6F-ACD2-62A409680F84} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Bit.iOS.Core - Resources - BitwardeniOSCore - - - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {8a279ee4-4537-4656-9c93-44945e594556} - App - - - - \ No newline at end of file diff --git a/src/iOS.Extension/AppDelegate.cs b/src/iOS.Extension/AppDelegate.cs deleted file mode 100644 index a8149c102..000000000 --- a/src/iOS.Extension/AppDelegate.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; - -using Foundation; -using UIKit; - -namespace Bit.iOS.Extension -{ - // 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 : UIApplicationDelegate - { - // class-level declarations - - public override UIWindow Window - { - get; set; - } - - // This method is invoked when the application is about to move from active to inactive state. - // OpenGL applications should use this method to pause. - public override void OnResignActivation(UIApplication application) - { - } - - // This method should be used to release shared resources and it should store the application state. - // If your application supports background exection this method is called instead of WillTerminate - // when the user quits. - public override void DidEnterBackground(UIApplication application) - { - } - - // This method is called as part of the transiton from background to active state. - public override void WillEnterForeground(UIApplication application) - { - } - - // This method is called when the application is about to terminate. Save data, if needed. - public override void WillTerminate(UIApplication application) - { - } - } -} diff --git a/src/iOS.Extension/Entitlements.plist b/src/iOS.Extension/Entitlements.plist deleted file mode 100644 index b20900dcc..000000000 --- a/src/iOS.Extension/Entitlements.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - com.apple.security.application-groups - - group.com.8bit.bitwarden - - keychain-access-groups - - $(AppIdentifierPrefix)com.8bit.bitwarden - - - diff --git a/src/iOS.Extension/Info.plist b/src/iOS.Extension/Info.plist deleted file mode 100644 index 11ca56447..000000000 --- a/src/iOS.Extension/Info.plist +++ /dev/null @@ -1,104 +0,0 @@ - - - - - MinimumOSVersion - 10.0 - CFBundleDevelopmentRegion - en - CFBundleIdentifier - com.8bit.bitwarden.find-login-action-extension - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - XPC! - CFBundleShortVersionString - 1.22.0 - CFBundleSignature - ???? - CFBundleVersion - 46 - NSExtension - - NSExtensionAttributes - - NSExtensionJavaScriptPreprocessingFile - extension - NSExtensionActivationRule - SUBQUERY ( - extensionItems, - $extensionItem, - SUBQUERY ( - $extensionItem.attachments, - $attachment, - ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.find-login-action" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.save-login-action" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.change-password-action" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.fill-webview-action" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.fill-browser-action" - || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.8bit.bitwarden.extension-setup" - ).@count == $extensionItem.attachments.@count - ).@count == 1 - - NSExtensionMainStoryboard - MainInterface - NSExtensionPointIdentifier - com.apple.ui-services - - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - ITSAppUsesNonExemptEncryption - - ITSEncryptionExportComplianceCode - ecf076d3-4824-4d7b-b716-2a9a47d7d296 - CFBundleName - Bitwarden Extension - CFBundleDisplayName - Bitwarden - UIRequiredDeviceCapabilities - - arm64 - - - CFBundleLocalizations - - en - es - zh-Hans - zh-Hant - pt-PT - pt-BR - sv - sk - it - fi - fr - ro - id - hr - hu - nl - tr - uk - de - dk - cz - nb - ja - et - vi - pl - ko - fa - - NSFaceIDUsageDescription - Use Face ID to unlock your vault. - - diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs deleted file mode 100644 index d33996598..000000000 --- a/src/iOS.Extension/LoadingViewController.cs +++ /dev/null @@ -1,530 +0,0 @@ -using System; -using System.Drawing; -using System.Diagnostics; -using Bit.App.Abstractions; -using Bit.App.Repositories; -using Bit.App.Services; -using Bit.iOS.Core.Services; -using Foundation; -using UIKit; -using XLabs.Ioc; -using Bit.iOS.Core; -using Newtonsoft.Json; -using Bit.iOS.Extension.Models; -using MobileCoreServices; -using Plugin.Settings.Abstractions; -using Plugin.Connectivity; -using Plugin.Fingerprint; -using Bit.iOS.Core.Utilities; -using Bit.App.Resources; -using Bit.iOS.Core.Controllers; -using SimpleInjector; -using XLabs.Ioc.SimpleInjectorContainer; -using System.Collections.Generic; -using Bit.iOS.Core.Models; - -namespace Bit.iOS.Extension -{ - public partial class LoadingViewController : ExtendedUIViewController - { - private Context _context = new Context(); - private bool _setupHockeyApp = false; - private readonly JsonSerializerSettings _jsonSettings = - new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; - private IGoogleAnalyticsService _googleAnalyticsService; - - public LoadingViewController(IntPtr handle) : base(handle) - { } - - public override void ViewDidLoad() - { - SetIoc(); - SetCulture(); - - base.ViewDidLoad(); - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - _context.ExtContext = ExtensionContext; - _googleAnalyticsService = Resolver.Resolve(); - - if(!_setupHockeyApp) - { - var appIdService = Resolver.Resolve(); - var crashManagerDelegate = new HockeyAppCrashManagerDelegate(appIdService, Resolver.Resolve()); - var manager = HockeyApp.iOS.BITHockeyManager.SharedHockeyManager; - manager.Configure("51f96ae568ba45f699a18ad9f63046c3", crashManagerDelegate); - manager.CrashManager.CrashManagerStatus = HockeyApp.iOS.BITCrashManagerStatus.AutoSend; - manager.UserId = appIdService.AppId; - manager.StartManager(); - manager.Authenticator.AuthenticateInstallation(); - _setupHockeyApp = true; - } - - foreach(var item in ExtensionContext.InputItems) - { - var processed = false; - foreach(var itemProvider in item.Attachments) - { - if(ProcessWebUrlProvider(itemProvider) - || ProcessFindLoginProvider(itemProvider) - || ProcessFindLoginBrowserProvider(itemProvider, Constants.UTTypeAppExtensionFillBrowserAction) - || ProcessFindLoginBrowserProvider(itemProvider, Constants.UTTypeAppExtensionFillWebViewAction) - || ProcessSaveLoginProvider(itemProvider) - || ProcessChangePasswordProvider(itemProvider) - || ProcessExtensionSetupProvider(itemProvider)) - { - processed = true; - break; - } - } - - if(processed) - { - break; - } - } - } - - public override void ViewDidAppear(bool animated) - { - base.ViewDidAppear(animated); - - var authService = Resolver.Resolve(); - if(!authService.IsAuthenticated) - { - var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) => - { - CompleteRequest(null); - }); - PresentViewController(alert, true, null); - return; - } - - if(_context.ProviderType == Constants.UTTypeAppExtensionSetup) - { - PerformSegue("setupSegue", this); - return; - } - - var lockService = Resolver.Resolve(); - var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult(); - switch(lockType) - { - case App.Enums.LockType.Fingerprint: - PerformSegue("lockFingerprintSegue", this); - break; - case App.Enums.LockType.PIN: - PerformSegue("lockPinSegue", this); - break; - case App.Enums.LockType.Password: - PerformSegue("lockPasswordSegue", this); - break; - default: - ContinueOn(); - break; - } - } - - public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) - { - var navController = segue.DestinationViewController as UINavigationController; - if(navController != null) - { - var listLoginController = navController.TopViewController as LoginListViewController; - var addLoginController = navController.TopViewController as LoginAddViewController; - var fingerprintViewController = navController.TopViewController as LockFingerprintViewController; - var pinViewController = navController.TopViewController as LockPinViewController; - var passwordViewController = navController.TopViewController as LockPasswordViewController; - var setupViewController = navController.TopViewController as SetupViewController; - - if(listLoginController != null) - { - listLoginController.Context = _context; - listLoginController.LoadingController = this; - } - else if(addLoginController != null) - { - addLoginController.Context = _context; - addLoginController.LoadingController = this; - } - else if(fingerprintViewController != null) - { - fingerprintViewController.LoadingController = this; - } - else if(pinViewController != null) - { - pinViewController.LoadingController = this; - } - else if(passwordViewController != null) - { - passwordViewController.LoadingController = this; - } - else if(setupViewController != null) - { - setupViewController.Context = _context; - setupViewController.LoadingController = this; - } - } - } - - public void DismissLockAndContinue() - { - Debug.WriteLine("BW Log, Dismissing lock controller."); - DismissViewController(false, () => - { - ContinueOn(); - }); - } - - private void ContinueOn() - { - Debug.WriteLine("BW Log, Segue to setup, login add or list."); - if(_context.ProviderType == Constants.UTTypeAppExtensionSaveLoginAction) - { - PerformSegue("newLoginSegue", this); - } - else if(_context.ProviderType == Constants.UTTypeAppExtensionSetup) - { - PerformSegue("setupSegue", this); - } - else - { - PerformSegue("loginListSegue", this); - } - } - - public void CompleteUsernamePasswordRequest(string username, string password, - List> fields, string totp) - { - NSDictionary itemData = null; - if(_context.ProviderType == UTType.PropertyList) - { - var fillScript = new FillScript(_context.Details, username, password, fields); - var scriptJson = JsonConvert.SerializeObject(fillScript, _jsonSettings); - var scriptDict = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson); - itemData = new NSDictionary(NSJavaScriptExtension.FinalizeArgumentKey, scriptDict); - } - else if(_context.ProviderType == Constants.UTTypeAppExtensionFindLoginAction) - { - itemData = new NSDictionary( - Constants.AppExtensionUsernameKey, username, - Constants.AppExtensionPasswordKey, password); - } - else if(_context.ProviderType == Constants.UTTypeAppExtensionFillBrowserAction - || _context.ProviderType == Constants.UTTypeAppExtensionFillWebViewAction) - { - var fillScript = new FillScript(_context.Details, username, password, fields); - var scriptJson = JsonConvert.SerializeObject(fillScript, _jsonSettings); - itemData = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson); - } - else if(_context.ProviderType == Constants.UTTypeAppExtensionSaveLoginAction) - { - itemData = new NSDictionary( - Constants.AppExtensionUsernameKey, username, - Constants.AppExtensionPasswordKey, password); - } - else if(_context.ProviderType == Constants.UTTypeAppExtensionChangePasswordAction) - { - itemData = new NSDictionary( - Constants.AppExtensionPasswordKey, string.Empty, - Constants.AppExtensionOldPasswordKey, password); - } - - if(!string.IsNullOrWhiteSpace(totp)) - { - UIPasteboard.General.String = totp; - } - - CompleteRequest(itemData); - } - - public void CompleteRequest(NSDictionary itemData) - { - Debug.WriteLine("BW LOG, itemData: " + itemData); - - var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList); - var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } }; - var returningItems = new NSExtensionItem[] { resultsItem }; - - if(itemData != null) - { - _googleAnalyticsService.TrackExtensionEvent("AutoFilled", _context.ProviderType); - } - else - { - _googleAnalyticsService.TrackExtensionEvent("Closed", _context.ProviderType); - } - - _googleAnalyticsService.Dispatch(() => - { - NSRunLoop.Main.BeginInvokeOnMainThread(() => - { - Resolver.ResetResolver(); - ExtensionContext?.CompleteRequest(returningItems, null); - }); - }); - } - - private void SetIoc() - { - var container = new Container(); - - // Services - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterInstance(new DeviceInfoService(true)); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - - // Repositories - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - - // Other - container.RegisterSingleton(CrossConnectivity.Current); - container.RegisterSingleton(CrossFingerprint.Current); - - var settings = new Settings("group.com.8bit.bitwarden"); - container.RegisterSingleton(settings); - - Resolver.ResetResolver(new SimpleInjectorResolver(container)); - } - - private void SetCulture() - { - var localizeService = Resolver.Resolve(); - var ci = localizeService.GetCurrentCultureInfo(); - AppResources.Culture = ci; - localizeService.SetLocale(ci); - } - - private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action dictAction, - Action urlAction = null) - { - if(!itemProvider.HasItemConformingTo(type)) - { - return false; - } - - itemProvider.LoadItem(type, null, (NSObject list, NSError error) => - { - if(list == null) - { - return; - } - - _context.ProviderType = type; - - var dict = list as NSDictionary; - if(dict != null && dictAction != null) - { - dictAction(dict); - } - else if(list is NSUrl && urlAction != null) - { - var url = list as NSUrl; - urlAction(url); - } - else - { - throw new Exception("Cannot parse list for action. List is " + - (list?.GetType().ToString() ?? "null")); - } - - _googleAnalyticsService.TrackExtensionEvent("ProcessItemProvider", type); - - Debug.WriteLine("BW LOG, ProviderType: " + _context.ProviderType); - Debug.WriteLine("BW LOG, Url: " + _context.UrlString); - Debug.WriteLine("BW LOG, Title: " + _context.LoginTitle); - Debug.WriteLine("BW LOG, Username: " + _context.Username); - Debug.WriteLine("BW LOG, Password: " + _context.Password); - Debug.WriteLine("BW LOG, Old Password: " + _context.OldPassword); - Debug.WriteLine("BW LOG, Notes: " + _context.Notes); - Debug.WriteLine("BW LOG, Details: " + _context.Details); - - if(_context.PasswordOptions != null) - { - Debug.WriteLine("BW LOG, PasswordOptions Min Length: " + _context.PasswordOptions.MinLength); - Debug.WriteLine("BW LOG, PasswordOptions Max Length: " + _context.PasswordOptions.MaxLength); - Debug.WriteLine("BW LOG, PasswordOptions Require Digits: " + _context.PasswordOptions.RequireDigits); - Debug.WriteLine("BW LOG, PasswordOptions Require Symbols: " + _context.PasswordOptions.RequireSymbols); - Debug.WriteLine("BW LOG, PasswordOptions Forbidden Chars: " + _context.PasswordOptions.ForbiddenCharacters); - } - }); - - return true; - } - - private bool ProcessWebUrlProvider(NSItemProvider itemProvider) - { - return ProcessItemProvider(itemProvider, UTType.PropertyList, (dict) => - { - var result = dict[NSJavaScriptExtension.PreprocessingResultsKey]; - if(result == null) - { - return; - } - - _context.UrlString = result.ValueForKey(new NSString(Constants.AppExtensionUrlStringKey)) as NSString; - var jsonStr = result.ValueForKey(new NSString(Constants.AppExtensionWebViewPageDetails)) as NSString; - _context.Details = DeserializeString(jsonStr); - }); - } - - private bool ProcessFindLoginProvider(NSItemProvider itemProvider) - { - return ProcessItemProvider(itemProvider, Constants.UTTypeAppExtensionFindLoginAction, (dict) => - { - var version = dict[Constants.AppExtensionVersionNumberKey] as NSNumber; - var url = dict[Constants.AppExtensionUrlStringKey] as NSString; - - if(url != null) - { - _context.UrlString = url; - } - }); - } - - private bool ProcessFindLoginBrowserProvider(NSItemProvider itemProvider, string action) - { - return ProcessItemProvider(itemProvider, action, (dict) => - { - var version = dict[Constants.AppExtensionVersionNumberKey] as NSNumber; - var url = dict[Constants.AppExtensionUrlStringKey] as NSString; - if(url != null) - { - _context.UrlString = url; - } - - _context.Details = DeserializeDictionary(dict[Constants.AppExtensionWebViewPageDetails] as NSDictionary); - }, (url) => - { - if(url != null) - { - _context.UrlString = url.AbsoluteString; - } - }); - } - - private bool ProcessSaveLoginProvider(NSItemProvider itemProvider) - { - return ProcessItemProvider(itemProvider, Constants.UTTypeAppExtensionSaveLoginAction, (dict) => - { - var version = dict[Constants.AppExtensionVersionNumberKey] as NSNumber; - var url = dict[Constants.AppExtensionUrlStringKey] as NSString; - var title = dict[Constants.AppExtensionTitleKey] as NSString; - var sectionTitle = dict[Constants.AppExtensionSectionTitleKey] as NSString; - var username = dict[Constants.AppExtensionUsernameKey] as NSString; - var password = dict[Constants.AppExtensionPasswordKey] as NSString; - var notes = dict[Constants.AppExtensionNotesKey] as NSString; - var fields = dict[Constants.AppExtensionFieldsKey] as NSDictionary; - - if(url != null) - { - _context.UrlString = url; - } - - _context.LoginTitle = title; - _context.Username = username; - _context.Password = password; - _context.Notes = notes; - _context.PasswordOptions = DeserializeDictionary(dict[Constants.AppExtensionPasswordGeneratorOptionsKey] as NSDictionary); - }); - } - - private bool ProcessChangePasswordProvider(NSItemProvider itemProvider) - { - return ProcessItemProvider(itemProvider, Constants.UTTypeAppExtensionChangePasswordAction, (dict) => - { - var version = dict[Constants.AppExtensionVersionNumberKey] as NSNumber; - var url = dict[Constants.AppExtensionUrlStringKey] as NSString; - var title = dict[Constants.AppExtensionTitleKey] as NSString; - var sectionTitle = dict[Constants.AppExtensionSectionTitleKey] as NSString; - var username = dict[Constants.AppExtensionUsernameKey] as NSString; - var password = dict[Constants.AppExtensionPasswordKey] as NSString; - var oldPassword = dict[Constants.AppExtensionOldPasswordKey] as NSString; - var notes = dict[Constants.AppExtensionNotesKey] as NSString; - var fields = dict[Constants.AppExtensionFieldsKey] as NSDictionary; - - if(url != null) - { - _context.UrlString = url; - } - - _context.LoginTitle = title; - _context.Username = username; - _context.Password = password; - _context.OldPassword = oldPassword; - _context.Notes = notes; - _context.PasswordOptions = DeserializeDictionary(dict[Constants.AppExtensionPasswordGeneratorOptionsKey] as NSDictionary); - }); - } - - private bool ProcessExtensionSetupProvider(NSItemProvider itemProvider) - { - if(itemProvider.HasItemConformingTo(Constants.UTTypeAppExtensionSetup)) - { - _context.ProviderType = Constants.UTTypeAppExtensionSetup; - return true; - } - - return false; - } - - private T DeserializeDictionary(NSDictionary dict) - { - if(dict != null) - { - NSError jsonError; - var jsonData = NSJsonSerialization.Serialize(dict, NSJsonWritingOptions.PrettyPrinted, out jsonError); - if(jsonData != null) - { - var jsonString = new NSString(jsonData, NSStringEncoding.UTF8); - return DeserializeString(jsonString); - } - } - - return default(T); - } - - private T DeserializeString(NSString jsonString) - { - if(jsonString != null) - { - var convertedObject = JsonConvert.DeserializeObject(jsonString.ToString()); - return convertedObject; - } - - return default(T); - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LoadingViewController.designer.cs b/src/iOS.Extension/LoadingViewController.designer.cs deleted file mode 100644 index 5d55235f4..000000000 --- a/src/iOS.Extension/LoadingViewController.designer.cs +++ /dev/null @@ -1,21 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Visual Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LoadingViewController")] - partial class LoadingViewController - { - void ReleaseDesignerOutlets () - { - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LockFingerprintViewController.cs b/src/iOS.Extension/LockFingerprintViewController.cs deleted file mode 100644 index a5a81466a..000000000 --- a/src/iOS.Extension/LockFingerprintViewController.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Extension -{ - public partial class LockFingerprintViewController : Core.Controllers.LockFingerprintViewController - { - public LockFingerprintViewController(IntPtr handle) : base(handle) - { } - - public LoadingViewController LoadingController { get; set; } - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelButton; - public override UIButton BaseUseButton => UseButton; - public override UIButton BaseFingerprintButton => FingerprintButton; - public override Action Success => () => LoadingController.DismissLockAndContinue(); - - partial void CancelButton_Activated(UIBarButtonItem sender) - { - LoadingController.CompleteRequest(null); - } - - partial void FingerprintButton_TouchUpInside(UIButton sender) - { - var task = CheckFingerprintAsync(); - } - } -} diff --git a/src/iOS.Extension/LockFingerprintViewController.designer.cs b/src/iOS.Extension/LockFingerprintViewController.designer.cs deleted file mode 100644 index 6fb08458b..000000000 --- a/src/iOS.Extension/LockFingerprintViewController.designer.cs +++ /dev/null @@ -1,64 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LockFingerprintViewController")] - partial class LockFingerprintViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIButton FingerprintButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIButton UseButton { get; set; } - - [Action ("CancelButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("FingerprintButton_TouchUpInside:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void FingerprintButton_TouchUpInside (UIKit.UIButton sender); - - void ReleaseDesignerOutlets () - { - if (CancelButton != null) { - CancelButton.Dispose (); - CancelButton = null; - } - - if (FingerprintButton != null) { - FingerprintButton.Dispose (); - FingerprintButton = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (UseButton != null) { - UseButton.Dispose (); - UseButton = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LockPasswordViewController.cs b/src/iOS.Extension/LockPasswordViewController.cs deleted file mode 100644 index d51531591..000000000 --- a/src/iOS.Extension/LockPasswordViewController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Extension -{ - public partial class LockPasswordViewController : Core.Controllers.LockPasswordViewController - { - public LockPasswordViewController(IntPtr handle) : base(handle) - { } - - public LoadingViewController LoadingController { get; set; } - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelButton; - public override UIBarButtonItem BaseSubmitButton => SubmitButton; - public override Action Success => () => LoadingController.DismissLockAndContinue(); - - partial void SubmitButton_Activated(UIBarButtonItem sender) - { - CheckPassword(); - } - - partial void CancelButton_Activated(UIBarButtonItem sender) - { - LoadingController.CompleteRequest(null); - } - } -} diff --git a/src/iOS.Extension/LockPasswordViewController.designer.cs b/src/iOS.Extension/LockPasswordViewController.designer.cs deleted file mode 100644 index fdc17a29f..000000000 --- a/src/iOS.Extension/LockPasswordViewController.designer.cs +++ /dev/null @@ -1,64 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LockPasswordViewController")] - partial class LockPasswordViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UITableView MainTableView { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem SubmitButton { get; set; } - - [Action ("CancelButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("SubmitButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void SubmitButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (CancelButton != null) { - CancelButton.Dispose (); - CancelButton = null; - } - - if (MainTableView != null) { - MainTableView.Dispose (); - MainTableView = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (SubmitButton != null) { - SubmitButton.Dispose (); - SubmitButton = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LockPinViewController.cs b/src/iOS.Extension/LockPinViewController.cs deleted file mode 100644 index 2737135be..000000000 --- a/src/iOS.Extension/LockPinViewController.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Extension -{ - public partial class LockPinViewController : Core.Controllers.LockPinViewController - { - public LockPinViewController(IntPtr handle) : base(handle) - { } - - public LoadingViewController LoadingController { get; set; } - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelButton; - public override UILabel BasePinLabel => PinLabel; - public override UILabel BaseInstructionLabel => InstructionLabel; - public override UITextField BasePinTextField => PinTextField; - public override Action Success => () => LoadingController.DismissLockAndContinue(); - - partial void CancelButton_Activated(UIBarButtonItem sender) - { - LoadingController.CompleteRequest(null); - } - } -} diff --git a/src/iOS.Extension/LockPinViewController.designer.cs b/src/iOS.Extension/LockPinViewController.designer.cs deleted file mode 100644 index 4dfa52722..000000000 --- a/src/iOS.Extension/LockPinViewController.designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LockPinViewController")] - partial class LockPinViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel InstructionLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel PinLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UITextField PinTextField { get; set; } - - [Action ("CancelButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (CancelButton != null) { - CancelButton.Dispose (); - CancelButton = null; - } - - if (InstructionLabel != null) { - InstructionLabel.Dispose (); - InstructionLabel = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (PinLabel != null) { - PinLabel.Dispose (); - PinLabel = null; - } - - if (PinTextField != null) { - PinTextField.Dispose (); - PinTextField = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LoginAddViewController.cs b/src/iOS.Extension/LoginAddViewController.cs deleted file mode 100644 index ce1c83613..000000000 --- a/src/iOS.Extension/LoginAddViewController.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using Foundation; -using UIKit; - -namespace Bit.iOS.Extension -{ - public partial class LoginAddViewController : Core.Controllers.LoginAddViewController - { - public LoginAddViewController(IntPtr handle) : base(handle) - { } - - public LoginListViewController LoginListController { get; set; } - public LoadingViewController LoadingController { get; set; } - - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelBarButton; - public override UIBarButtonItem BaseSaveButton => SaveBarButton; - - public override Action Success => () => - { - _googleAnalyticsService.TrackExtensionEvent("CreatedLogin"); - if(LoginListController != null) - { - LoginListController.DismissModal(); - } - else if(LoadingController != null) - { - LoadingController.CompleteUsernamePasswordRequest(UsernameCell.TextField.Text, - PasswordCell.TextField.Text, null, null); - } - }; - - partial void CancelBarButton_Activated(UIBarButtonItem sender) - { - if(LoginListController != null) - { - DismissViewController(true, null); - } - else - { - LoadingController.CompleteRequest(null); - } - } - - async partial void SaveBarButton_Activated(UIBarButtonItem sender) - { - await this.SaveAsync(); - } - - public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) - { - var navController = segue.DestinationViewController as UINavigationController; - if(navController != null) - { - var passwordGeneratorController = navController.TopViewController as PasswordGeneratorViewController; - if(passwordGeneratorController != null) - { - passwordGeneratorController.PasswordOptions = Context.PasswordOptions; - passwordGeneratorController.Parent = this; - } - } - } - } -} diff --git a/src/iOS.Extension/LoginAddViewController.designer.cs b/src/iOS.Extension/LoginAddViewController.designer.cs deleted file mode 100644 index 191c7991b..000000000 --- a/src/iOS.Extension/LoginAddViewController.designer.cs +++ /dev/null @@ -1,55 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LoginAddViewController")] - partial class LoginAddViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelBarButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem SaveBarButton { get; set; } - - [Action ("CancelBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelBarButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("SaveBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void SaveBarButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (CancelBarButton != null) { - CancelBarButton.Dispose (); - CancelBarButton = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (SaveBarButton != null) { - SaveBarButton.Dispose (); - SaveBarButton = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/LoginListViewController.cs b/src/iOS.Extension/LoginListViewController.cs deleted file mode 100644 index b332e51cc..000000000 --- a/src/iOS.Extension/LoginListViewController.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Linq; -using Bit.iOS.Extension.Models; -using Foundation; -using UIKit; -using Bit.iOS.Core.Utilities; -using Bit.iOS.Core; -using MobileCoreServices; -using Bit.iOS.Core.Controllers; -using Bit.App.Resources; -using Bit.iOS.Core.Views; - -namespace Bit.iOS.Extension -{ - public partial class LoginListViewController : ExtendedUITableViewController - { - public LoginListViewController(IntPtr handle) : base(handle) - { } - - public Context Context { get; set; } - public LoadingViewController LoadingController { get; set; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public async override void ViewDidLoad() - { - base.ViewDidLoad(); - NavItem.Title = AppResources.Items; - if(!CanAutoFill()) - { - CancelBarButton.Title = AppResources.Close; - } - else - { - CancelBarButton.Title = AppResources.Cancel; - } - - TableView.RowHeight = UITableView.AutomaticDimension; - TableView.EstimatedRowHeight = 44; - TableView.Source = new TableSource(this); - await ((TableSource)TableView.Source).LoadItemsAsync(); - } - - public bool CanAutoFill() - { - if(Context.ProviderType != Constants.UTTypeAppExtensionFillBrowserAction - && Context.ProviderType != Constants.UTTypeAppExtensionFillWebViewAction - && Context.ProviderType != UTType.PropertyList) - { - return true; - } - - return Context.Details?.HasPasswordField ?? false; - - } - - partial void CancelBarButton_Activated(UIBarButtonItem sender) - { - LoadingController.CompleteRequest(null); - } - - partial void AddBarButton_Activated(UIBarButtonItem sender) - { - PerformSegue("loginAddSegue", this); - } - - public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) - { - var navController = segue.DestinationViewController as UINavigationController; - if(navController != null) - { - var addLoginController = navController.TopViewController as LoginAddViewController; - if(addLoginController != null) - { - addLoginController.Context = Context; - addLoginController.LoginListController = this; - } - } - } - - public void DismissModal() - { - DismissViewController(true, async () => - { - await ((TableSource)TableView.Source).LoadItemsAsync(); - TableView.ReloadData(); - }); - } - - public class TableSource : ExtensionTableSource - { - private LoginListViewController _controller; - - public TableSource(LoginListViewController controller) - : base(controller.Context, controller) - { - _controller = controller; - } - - public override void RowSelected(UITableView tableView, NSIndexPath indexPath) - { - tableView.DeselectRow(indexPath, true); - tableView.EndEditing(true); - - if(Items == null || Items.Count() == 0) - { - _controller.PerformSegue("loginAddSegue", this); - return; - } - - var item = Items.ElementAt(indexPath.Row); - if(item == null) - { - _controller.LoadingController.CompleteRequest(null); - return; - } - - if(_controller.CanAutoFill() && !string.IsNullOrWhiteSpace(item.Password)) - { - string totp = null; - if(!_settings.GetValueOrDefault(App.Constants.SettingDisableTotpCopy, false)) - { - totp = GetTotp(item); - } - - _controller.LoadingController.CompleteUsernamePasswordRequest(item.Username, item.Password, - item.Fields.Value, totp); - } - else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) || - !string.IsNullOrWhiteSpace(item.Totp.Value)) - { - var sheet = Dialogs.CreateActionSheet(item.Name, _controller); - if(!string.IsNullOrWhiteSpace(item.Username)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyUsername, UIAlertActionStyle.Default, a => - { - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = item.Username; - var alert = Dialogs.CreateMessageAlert(AppResources.CopyUsername); - _controller.PresentViewController(alert, true, () => - { - _controller.DismissViewController(true, null); - }); - })); - } - - if(!string.IsNullOrWhiteSpace(item.Password)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyPassword, UIAlertActionStyle.Default, a => - { - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = item.Password; - var alert = Dialogs.CreateMessageAlert(AppResources.CopiedPassword); - _controller.PresentViewController(alert, true, () => - { - _controller.DismissViewController(true, null); - }); - })); - } - - if(!string.IsNullOrWhiteSpace(item.Totp.Value)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a => - { - var totp = GetTotp(item); - if(string.IsNullOrWhiteSpace(totp)) - { - return; - } - - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = totp; - var alert = Dialogs.CreateMessageAlert(AppResources.CopiedTotp); - _controller.PresentViewController(alert, true, () => - { - _controller.DismissViewController(true, null); - }); - })); - } - - sheet.AddAction(UIAlertAction.Create(AppResources.Cancel, UIAlertActionStyle.Cancel, null)); - _controller.PresentViewController(sheet, true, null); - } - else - { - var alert = Dialogs.CreateAlert(null, AppResources.NoUsernamePasswordConfigured, AppResources.Ok); - _controller.PresentViewController(alert, true, null); - } - } - } - } -} diff --git a/src/iOS.Extension/LoginListViewController.designer.cs b/src/iOS.Extension/LoginListViewController.designer.cs deleted file mode 100644 index aa1abf2ea..000000000 --- a/src/iOS.Extension/LoginListViewController.designer.cs +++ /dev/null @@ -1,55 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("LoginListViewController")] - partial class LoginListViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem AddBarButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelBarButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Action ("AddBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void AddBarButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("CancelBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelBarButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (AddBarButton != null) { - AddBarButton.Dispose (); - AddBarButton = null; - } - - if (CancelBarButton != null) { - CancelBarButton.Dispose (); - CancelBarButton = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/Main.cs b/src/iOS.Extension/Main.cs deleted file mode 100644 index 9291201f8..000000000 --- a/src/iOS.Extension/Main.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UIKit; - -namespace Bit.iOS.Extension -{ - 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"); - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard deleted file mode 100644 index f107fe8ef..000000000 --- a/src/iOS.Extension/MainInterface.storyboard +++ /dev/null @@ -1,615 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/iOS.Extension/Models/Context.cs b/src/iOS.Extension/Models/Context.cs deleted file mode 100644 index 94015819e..000000000 --- a/src/iOS.Extension/Models/Context.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Foundation; -using Bit.iOS.Core.Models; - -namespace Bit.iOS.Extension.Models -{ - public class Context : AppExtensionContext - { - private string _uriString; - - public NSExtensionContext ExtContext { get; set; } - public string ProviderType { get; set; } - public string LoginTitle { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public string OldPassword { get; set; } - public string Notes { get; set; } - public PageDetails Details { get; set; } - } -} diff --git a/src/iOS.Extension/Models/FillScript.cs b/src/iOS.Extension/Models/FillScript.cs deleted file mode 100644 index 0364d14dd..000000000 --- a/src/iOS.Extension/Models/FillScript.cs +++ /dev/null @@ -1,276 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; -using System.Text.RegularExpressions; - -namespace Bit.iOS.Extension.Models -{ - public class FillScript - { - private static string[] _usernameFieldNames = new[]{ "username", "user name", "email", - "email address", "e-mail", "e-mail address", "userid", "user id" }; - - public FillScript(PageDetails pageDetails, string fillUsername, string fillPassword, - List> fillFields) - { - if(pageDetails == null) - { - return; - } - - DocumentUUID = pageDetails.DocumentUUID; - - var filledFields = new Dictionary(); - - if(fillFields?.Any() ?? false) - { - var fieldNames = fillFields.Select(f => f.Item1?.ToLower()).ToArray(); - foreach(var field in pageDetails.Fields.Where(f => f.Viewable)) - { - if(filledFields.ContainsKey(field.OpId)) - { - continue; - } - - var matchingIndex = FindMatchingFieldIndex(field, fieldNames); - if(matchingIndex > -1) - { - filledFields.Add(field.OpId, field); - Script.Add(new List { "click_on_opid", field.OpId }); - Script.Add(new List { "fill_by_opid", field.OpId, fillFields[matchingIndex].Item2 }); - } - } - } - - if(string.IsNullOrWhiteSpace(fillPassword)) - { - // No password for this login. Maybe they just wanted to auto-fill some custom fields? - SetFillScriptForFocus(filledFields); - return; - } - - List usernames = new List(); - List passwords = new List(); - - var passwordFields = pageDetails.Fields.Where(f => f.Type == "password" && f.Viewable).ToArray(); - if(!passwordFields.Any()) - { - // not able to find any viewable password fields. maybe there are some "hidden" ones? - passwordFields = pageDetails.Fields.Where(f => f.Type == "password").ToArray(); - } - - foreach(var form in pageDetails.Forms) - { - var passwordFieldsForForm = passwordFields.Where(f => f.Form == form.Key).ToArray(); - passwords.AddRange(passwordFieldsForForm); - - if(string.IsNullOrWhiteSpace(fillUsername)) - { - continue; - } - - foreach(var pf in passwordFieldsForForm) - { - var username = FindUsernameField(pageDetails, pf, false, true); - if(username == null) - { - // not able to find any viewable username fields. maybe there are some "hidden" ones? - username = FindUsernameField(pageDetails, pf, true, true); - } - - if(username != null) - { - usernames.Add(username); - } - } - } - - if(passwordFields.Any() && !passwords.Any()) - { - // The page does not have any forms with password fields. Use the first password field on the page and the - // input field just before it as the username. - - var pf = passwordFields.First(); - passwords.Add(pf); - - if(!string.IsNullOrWhiteSpace(fillUsername) && pf.ElementNumber > 0) - { - var username = FindUsernameField(pageDetails, pf, false, false); - if(username == null) - { - // not able to find any viewable username fields. maybe there are some "hidden" ones? - username = FindUsernameField(pageDetails, pf, true, false); - } - - if(username != null) - { - usernames.Add(username); - } - } - } - - if(!passwordFields.Any()) - { - // No password fields on this page. Let's try to just fuzzy fill the username. - var usernameFieldNamesList = _usernameFieldNames.ToList(); - foreach(var f in pageDetails.Fields) - { - if(f.Viewable && (f.Type == "text" || f.Type == "email" || f.Type == "tel") && - FieldIsFuzzyMatch(f, usernameFieldNamesList)) - { - usernames.Add(f); - } - } - } - - foreach(var username in usernames.Where(u => !filledFields.ContainsKey(u.OpId))) - { - filledFields.Add(username.OpId, username); - Script.Add(new List { "click_on_opid", username.OpId }); - Script.Add(new List { "fill_by_opid", username.OpId, fillUsername }); - } - - foreach(var password in passwords.Where(p => !filledFields.ContainsKey(p.OpId))) - { - filledFields.Add(password.OpId, password); - Script.Add(new List { "click_on_opid", password.OpId }); - Script.Add(new List { "fill_by_opid", password.OpId, fillPassword }); - } - - SetFillScriptForFocus(filledFields); - } - - private PageDetails.Field FindUsernameField(PageDetails pageDetails, PageDetails.Field passwordField, bool canBeHidden, - bool checkForm) - { - PageDetails.Field usernameField = null; - - foreach(var f in pageDetails.Fields) - { - if(f.ElementNumber >= passwordField.ElementNumber) - { - break; - } - - if((!checkForm || f.Form == passwordField.Form) - && (canBeHidden || f.Viewable) - && f.ElementNumber < passwordField.ElementNumber - && (f.Type == "text" || f.Type == "email" || f.Type == "tel")) - { - usernameField = f; - - if(FindMatchingFieldIndex(f, _usernameFieldNames) > -1) - { - // We found an exact match. No need to keep looking. - break; - } - } - } - - return usernameField; - } - - private int FindMatchingFieldIndex(PageDetails.Field field, string[] names) - { - var matchingIndex = -1; - if(!string.IsNullOrWhiteSpace(field.HtmlId)) - { - matchingIndex = Array.IndexOf(names, field.HtmlId.ToLower()); - } - if(matchingIndex < 0 && !string.IsNullOrWhiteSpace(field.HtmlName)) - { - matchingIndex = Array.IndexOf(names, field.HtmlName.ToLower()); - } - if(matchingIndex < 0 && !string.IsNullOrWhiteSpace(field.LabelTag)) - { - matchingIndex = Array.IndexOf(names, CleanLabel(field.LabelTag)); - } - if(matchingIndex < 0 && !string.IsNullOrWhiteSpace(field.Placeholder)) - { - matchingIndex = Array.IndexOf(names, field.Placeholder.ToLower()); - } - - return matchingIndex; - } - - private bool FieldIsFuzzyMatch(PageDetails.Field field, List names) - { - if(!string.IsNullOrWhiteSpace(field.HtmlId) && FuzzyMatch(names, field.HtmlId.ToLower())) - { - return true; - } - if(!string.IsNullOrWhiteSpace(field.HtmlName) && FuzzyMatch(names, field.HtmlName.ToLower())) - { - return true; - } - if(!string.IsNullOrWhiteSpace(field.LabelTag) && FuzzyMatch(names, CleanLabel(field.LabelTag))) - { - return true; - } - if(!string.IsNullOrWhiteSpace(field.Placeholder) && FuzzyMatch(names, field.Placeholder.ToLower())) - { - return true; - } - - return false; - } - - private bool FuzzyMatch(List options, string value) - { - if((!options?.Any() ?? true) || string.IsNullOrWhiteSpace(value)) - { - return false; - } - - return options.Any(o => value.Contains(o)); - } - - private void SetFillScriptForFocus(IDictionary filledFields) - { - if(!filledFields.Any()) - { - return; - } - - PageDetails.Field lastField = null, lastPasswordField = null; - foreach(var field in filledFields) - { - if(field.Value.Viewable) - { - lastField = field.Value; - if(field.Value.Type == "password") - { - lastPasswordField = field.Value; - } - } - } - - // Prioritize password field over others. - if(lastPasswordField != null) - { - Script.Add(new List { "focus_by_opid", lastPasswordField.OpId }); - } - else if(lastField != null) - { - Script.Add(new List { "focus_by_opid", lastField.OpId }); - } - } - - private string CleanLabel(string label) - { - return Regex.Replace(label, @"(?:\r\n|\r|\n)", string.Empty).Trim().ToLower(); - } - - [JsonProperty(PropertyName = "script")] - public List> Script { get; set; } = new List>(); - [JsonProperty(PropertyName = "documentUUID")] - public object DocumentUUID { get; set; } - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } = new object(); - [JsonProperty(PropertyName = "options")] - public object Options { get; set; } = new { animate = false }; - [JsonProperty(PropertyName = "metadata")] - public object MetaData { get; set; } = new object(); - } -} diff --git a/src/iOS.Extension/Models/PageDetails.cs b/src/iOS.Extension/Models/PageDetails.cs deleted file mode 100644 index 004173bfc..000000000 --- a/src/iOS.Extension/Models/PageDetails.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Bit.iOS.Extension.Models -{ - public class PageDetails - { - public string DocumentUUID { get; set; } - public string Title { get; set; } - public string Url { get; set; } - public string DocumentUrl { get; set; } - public string TabUrl { get; set; } - public Dictionary Forms { get; set; } - public List Fields { get; set; } - public long CollectedTimestamp { get; set; } - public bool HasPasswordField => Fields.Any(f => f.Type == "password"); - - public class Form - { - public string OpId { get; set; } - public string HtmlName { get; set; } - public string HtmlId { get; set; } - public string HtmlAction { get; set; } - public string HtmlMethod { get; set; } - } - - public class Field - { - public string OpId { get; set; } - public int ElementNumber { get; set; } - public bool Visible { get; set; } - public bool Viewable { get; set; } - public string HtmlId { get; set; } - public string HtmlName { get; set; } - public string HtmlClass { get; set; } - public string LabelRight { get; set; } - public string LabelLeft { get; set; } - [JsonProperty("label-tag")] - public string LabelTag { get; set; } - public string Placeholder { get; set; } - public string Type { get; set; } - public string Value { get; set; } - public bool Disabled { get; set; } - public bool Readonly { get; set; } - public string OnePasswordFieldType { get; set; } - public string Form { get; set; } - } - } - -} diff --git a/src/iOS.Extension/PasswordGeneratorViewController.cs b/src/iOS.Extension/PasswordGeneratorViewController.cs deleted file mode 100644 index 4b015c243..000000000 --- a/src/iOS.Extension/PasswordGeneratorViewController.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using UIKit; - -namespace Bit.iOS.Extension -{ - public partial class PasswordGeneratorViewController : Core.Controllers.PasswordGeneratorViewController - { - public PasswordGeneratorViewController(IntPtr handle) : base(handle, false) - { } - - public LoginAddViewController Parent { get; set; } - public override UINavigationItem BaseNavItem => NavItem; - public override UIBarButtonItem BaseCancelButton => CancelBarButton; - public override UIBarButtonItem BaseSelectBarButton => SelectBarButton; - public override UILabel BasePasswordLabel => PasswordLabel; - - partial void SelectBarButton_Activated(UIBarButtonItem sender) - { - GoogleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword"); - DismissViewController(true, () => - { - Parent.PasswordCell.TextField.Text = PasswordLabel.Text; - }); - } - - partial void CancelBarButton_Activated(UIBarButtonItem sender) - { - DismissViewController(true, null); - } - } -} diff --git a/src/iOS.Extension/PasswordGeneratorViewController.designer.cs b/src/iOS.Extension/PasswordGeneratorViewController.designer.cs deleted file mode 100644 index 950ebf7a5..000000000 --- a/src/iOS.Extension/PasswordGeneratorViewController.designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("PasswordGeneratorViewController")] - partial class PasswordGeneratorViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIView BaseView { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem CancelBarButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIView OptionsContainer { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel PasswordLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem SelectBarButton { get; set; } - - [Action ("CancelBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void CancelBarButton_Activated (UIKit.UIBarButtonItem sender); - - [Action ("SelectBarButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void SelectBarButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (BaseView != null) { - BaseView.Dispose (); - BaseView = null; - } - - if (CancelBarButton != null) { - CancelBarButton.Dispose (); - CancelBarButton = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - - if (OptionsContainer != null) { - OptionsContainer.Dispose (); - OptionsContainer = null; - } - - if (PasswordLabel != null) { - PasswordLabel.Dispose (); - PasswordLabel = null; - } - - if (SelectBarButton != null) { - SelectBarButton.Dispose (); - SelectBarButton = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/Properties/AssemblyInfo.cs b/src/iOS.Extension/Properties/AssemblyInfo.cs deleted file mode 100644 index 183860705..000000000 --- a/src/iOS.Extension/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -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("BitwardeniOSExtension")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("8bit Solutions LLC")] -[assembly: AssemblyProduct("Bitwarden")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[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("32f5a2d6-f54d-4da1-ae26-0a980d48f422")] - -// 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")] diff --git a/src/iOS.Extension/Resources/Icon.png b/src/iOS.Extension/Resources/Icon.png deleted file mode 100644 index e4b594ad5..000000000 Binary files a/src/iOS.Extension/Resources/Icon.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/Icon@2x.png b/src/iOS.Extension/Resources/Icon@2x.png deleted file mode 100644 index 37369f4d3..000000000 Binary files a/src/iOS.Extension/Resources/Icon@2x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/Icon@3x.png b/src/iOS.Extension/Resources/Icon@3x.png deleted file mode 100644 index 0bfafae46..000000000 Binary files a/src/iOS.Extension/Resources/Icon@3x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/ext-icon.png b/src/iOS.Extension/Resources/ext-icon.png deleted file mode 100644 index 2663f2a8e..000000000 Binary files a/src/iOS.Extension/Resources/ext-icon.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/ext-icon@2x.png b/src/iOS.Extension/Resources/ext-icon@2x.png deleted file mode 100644 index c2ea619de..000000000 Binary files a/src/iOS.Extension/Resources/ext-icon@2x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/ext-icon@3x.png b/src/iOS.Extension/Resources/ext-icon@3x.png deleted file mode 100644 index 96e4d1ce0..000000000 Binary files a/src/iOS.Extension/Resources/ext-icon@3x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/fingerprint.png b/src/iOS.Extension/Resources/fingerprint.png deleted file mode 100644 index 754e39825..000000000 Binary files a/src/iOS.Extension/Resources/fingerprint.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/fingerprint@2x.png b/src/iOS.Extension/Resources/fingerprint@2x.png deleted file mode 100644 index 79547a076..000000000 Binary files a/src/iOS.Extension/Resources/fingerprint@2x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/fingerprint@3x.png b/src/iOS.Extension/Resources/fingerprint@3x.png deleted file mode 100644 index 236c8da73..000000000 Binary files a/src/iOS.Extension/Resources/fingerprint@3x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/logo.png b/src/iOS.Extension/Resources/logo.png deleted file mode 100644 index 33ced5b12..000000000 Binary files a/src/iOS.Extension/Resources/logo.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/logo@2x.png b/src/iOS.Extension/Resources/logo@2x.png deleted file mode 100644 index 2a0ba60b9..000000000 Binary files a/src/iOS.Extension/Resources/logo@2x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/logo@3x.png b/src/iOS.Extension/Resources/logo@3x.png deleted file mode 100644 index 904731676..000000000 Binary files a/src/iOS.Extension/Resources/logo@3x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/smile.png b/src/iOS.Extension/Resources/smile.png deleted file mode 100644 index 25f2f45b1..000000000 Binary files a/src/iOS.Extension/Resources/smile.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/smile@2x.png b/src/iOS.Extension/Resources/smile@2x.png deleted file mode 100644 index 71dd21e35..000000000 Binary files a/src/iOS.Extension/Resources/smile@2x.png and /dev/null differ diff --git a/src/iOS.Extension/Resources/smile@3x.png b/src/iOS.Extension/Resources/smile@3x.png deleted file mode 100644 index 6e7189e69..000000000 Binary files a/src/iOS.Extension/Resources/smile@3x.png and /dev/null differ diff --git a/src/iOS.Extension/SetupViewController.cs b/src/iOS.Extension/SetupViewController.cs deleted file mode 100644 index abeaaafc4..000000000 --- a/src/iOS.Extension/SetupViewController.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Bit.iOS.Extension.Models; -using UIKit; -using Plugin.Settings.Abstractions; -using Bit.iOS.Core.Controllers; -using Bit.App.Resources; - -namespace Bit.iOS.Extension -{ - public partial class SetupViewController : ExtendedUIViewController - { - public SetupViewController(IntPtr handle) : base(handle) - { } - - public Context Context { get; set; } - public LoadingViewController LoadingController { get; set; } - - public override void ViewWillAppear(bool animated) - { - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - base.ViewWillAppear(animated); - } - - public override void ViewDidLoad() - { - View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - var descriptor = UIFontDescriptor.PreferredBody; - DescriptionLabel.Text = $@"{AppResources.ExtensionSetup} - -{AppResources.ExtensionSetup2}"; - DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); - DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - ActivatedLabel.Text = AppResources.ExtensionActivated; - ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f); - - BackButton.Title = AppResources.Back; - base.ViewDidLoad(); - } - - partial void BackButton_Activated(UIBarButtonItem sender) - { - LoadingController.CompleteRequest(null); - } - } -} diff --git a/src/iOS.Extension/SetupViewController.designer.cs b/src/iOS.Extension/SetupViewController.designer.cs deleted file mode 100644 index 00c83f807..000000000 --- a/src/iOS.Extension/SetupViewController.designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("SetupViewController")] - partial class SetupViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel ActivatedLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIBarButtonItem BackButton { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UILabel DescriptionLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UIImageView IconImage { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UIKit.UINavigationItem NavItem { get; set; } - - [Action ("BackButton_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void BackButton_Activated (UIKit.UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (ActivatedLabel != null) { - ActivatedLabel.Dispose (); - ActivatedLabel = null; - } - - if (BackButton != null) { - BackButton.Dispose (); - BackButton = null; - } - - if (DescriptionLabel != null) { - DescriptionLabel.Dispose (); - DescriptionLabel = null; - } - - if (IconImage != null) { - IconImage.Dispose (); - IconImage = null; - } - - if (NavItem != null) { - NavItem.Dispose (); - NavItem = null; - } - } - } -} \ No newline at end of file diff --git a/src/iOS.Extension/extension.js b/src/iOS.Extension/extension.js deleted file mode 100644 index 6bbad37f2..000000000 --- a/src/iOS.Extension/extension.js +++ /dev/null @@ -1,101 +0,0 @@ -var BitwardenExtension = function () { }; - -BitwardenExtension.prototype = { - run: function (arguments) { - console.log('Run'); - console.log(arguments); - - var args = { - 'url_string': document.URL, - pageDetails: this.collect(document) - }; - - console.log(args); - arguments.completionFunction(args); - }, - finalize: function (arguments) { - console.log('Finalize'); - console.log(arguments); - - if (arguments.fillScript) { - this.fill(document, JSON.parse(arguments.fillScript)); - } - }, - - /* - 1Password Extension - - Lovingly handcrafted by Dave Teare, Michael Fey, Rad Azzouz, and Roustem Karimov. - Copyright (c) 2014 AgileBits. All rights reserved. - - ================================================================================ - - Copyright (c) 2014 AgileBits Inc. - - 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. - */ - - collect: function(document, undefined) { - var isFirefox = false, isChrome = false, isSafari = true; - document.elementsByOPID={};document.addEventListener('input',function(b){!1!==b.a&&'input'===b.target.tagName.toLowerCase()&&(b.target.dataset['com.agilebits.onepassword.userEdited']='yes')},!0); - function q(b,d){function f(a,e){var c=a[e];if('string'==typeof c)return c;c=a.getAttribute(e);return'string'==typeof c?c:null}function h(a,e){if(-1===['text','password'].indexOf(e.type.toLowerCase())||!(m.test(a.value)||m.test(a.htmlID)||m.test(a.htmlName)||m.test(a.placeholder)||m.test(a['label-tag'])||m.test(a['label-data'])||m.test(a['label-aria'])))return!1;if(!a.visible)return!0;if('password'==e.type.toLowerCase())return!1;var c=e.type;v(e,!0);return c!==e.type}function n(a){switch(p(a.type)){case 'checkbox':return a.checked? - '✓':'';case 'hidden':a=a.value;if(!a||'number'!=typeof a.length)return'';254\\?]/mg,''):null;return[c?c:null,a.value]}),{options:a}):null}function r(a){var e;for(a=a.parentElement||a.parentNode;a&&'td'!=p(a.tagName);)a=a.parentElement||a.parentNode;if(!a|| - void 0===a)return null;e=a.parentElement||a.parentNode;if('tr'!=e.tagName.toLowerCase())return null;e=e.previousElementSibling;if(!e||'tr'!=(e.tagName+'').toLowerCase()||e.cells&&a.cellIndex>=e.cells.length)return null;a=e.cells[a.cellIndex];a=a.textContent||a.innerText;return a=x(a)}function s(a){var e,c=[];if(a.labels&&a.labels.length&&0b.clientWidth||10>b.clientHeight)return!1;var s=b.getClientRects();if(0===s.length)return!1;for(var g=0;gh||0>r.right)return!1;if(0>l||l>h||0>d||d>n)return!1;for(f=b.ownerDocument.elementFromPoint(l+(f.right>window.innerWidth?(window.innerWidth-l)/2:f.width/2),d+(f.bottom>window.innerHeight? - (window.innerHeight-d)/2:f.height/2));f&&f!==b&&f!==document;){if(f.tagName&&'string'===typeof f.tagName&&'label'===f.tagName.toLowerCase()&&b.labels&&0 - - - Debug - iPhoneSimulator - {32F5A2D6-F54D-4DA1-AE26-0A980D48F422} - {EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Bit.iOS.Extension - BitwardeniOSExtension - Resources - Properties - - - - - true - full - false - bin\iPhoneSimulator\Debug - DEBUG - prompt - 4 - false - i386, x86_64 - None - True - Entitlements.plist - 9.3 - False - False - False - False - True - False - False - Default - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler - - - none - true - bin\iPhoneSimulator\Release - prompt - 4 - Full - i386, x86_64 - false - Entitlements.plist - 9.3 - False - False - False - False - False - False - True - Default - NSUrlSessionHandler - False - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - - - true - full - false - bin\iPhone\Debug - DEBUG - prompt - 4 - false - ARM64 - Entitlements.plist - iPhone Developer - True - - - - - None - False - False - False - False - False - True - False - False - --http-message-handler=NSUrlSessionHandler - 10.2 - Default - NSUrlSessionHandler - - - none - true - bin\iPhone\Release - prompt - 4 - Entitlements.plist - ARM64 - false - iPhone Developer - Full - False - False - False - False - False - False - True - False - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - - - none - True - bin\iPhone\Ad-Hoc - prompt - 4 - False - ARM64 - Entitlements.plist - True - Automatic:AdHoc - iPhone Distribution - Full - False - False - False - False - False - False - True - False - NSUrlSessionHandler - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - - - none - True - bin\iPhone\AppStore - prompt - 4 - False - ARM64 - Entitlements.plist - Automatic:AppStore - iPhone Distribution - Full - False - False - False - False - False - False - True - False - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - 10.2 - Default - NSUrlSessionHandler - - - 9.3 - Full - False - False - False - i386, x86_64 - False - False - False - True - Default - NSUrlSessionHandler - False - bin\iPhoneSimulator\Ad-Hoc - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - Entitlements.plist - - - 9.3 - Full - False - False - False - i386, x86_64 - False - False - False - True - Default - NSUrlSessionHandler - False - bin\iPhoneSimulator\AppStore - --http-message-handler=NSUrlSessionHandler --linkskip=BitwardeniOS --linkskip=BitwardeniOSCore --linkskip=BitwardeniOSExtension --linkskip=BitwardenApp --linkskip=SQLite-net - - - - - LockPasswordViewController.cs - - - - SetupViewController.cs - - - - LockPinViewController.cs - - - - LockFingerprintViewController.cs - - - - PasswordGeneratorViewController.cs - - - - LoginAddViewController.cs - - - - LoginListViewController.cs - - - - - - - - - LoadingViewController.cs - - - - - - - - - - - - - - - - Always - - - - - - - - - - - - - - - - - - - - {8a279ee4-4537-4656-9c93-44945e594556} - App - - - {B2538ADA-B605-4D6F-ACD2-62A409680F84} - iOS.Core - False - False - - - - - 4.4.0 - - - 2.0.5782 - - - - \ No newline at end of file diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs deleted file mode 100644 index 23f02c24c..000000000 --- a/src/iOS/AppDelegate.cs +++ /dev/null @@ -1,409 +0,0 @@ -using System; -using XLabs.Ioc; -using Foundation; -using UIKit; -using Bit.App.Abstractions; -using Bit.App.Services; -using Bit.iOS.Services; -using Plugin.Connectivity; -using Bit.App.Repositories; -using Plugin.Fingerprint; -using Plugin.Settings.Abstractions; -using System.Diagnostics; -using Xamarin.Forms; -using Bit.iOS.Core.Services; -using Plugin.Connectivity.Abstractions; -using Bit.App.Pages; -using HockeyApp.iOS; -using Bit.iOS.Core; -using SimpleInjector; -using XLabs.Ioc.SimpleInjectorContainer; -using CoreNFC; -using Bit.App.Resources; -using AuthenticationServices; -using System.Threading.Tasks; -using Bit.App.Models; -using System.Linq; -using System.Collections.Generic; -using Bit.iOS.Core.Utilities; - -namespace Bit.iOS -{ - [Register("AppDelegate")] - public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate - { - private NFCNdefReaderSession _nfcSession = null; - private ILockService _lockService; - private IDeviceInfoService _deviceInfoService; - private ICipherService _cipherService; - private iOSPushNotificationHandler _pushHandler = null; - private NFCReaderDelegate _nfcDelegate = null; - - public ISettings Settings { get; set; } - - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - Forms.Init(); - - if(!Resolver.IsSet) - { - SetIoc(); - } - - _lockService = Resolver.Resolve(); - _deviceInfoService = Resolver.Resolve(); - _cipherService = Resolver.Resolve(); - _pushHandler = new iOSPushNotificationHandler(Resolver.Resolve()); - _nfcDelegate = new NFCReaderDelegate((success, message) => ProcessYubikey(success, message)); - var appIdService = Resolver.Resolve(); - - var crashManagerDelegate = new HockeyAppCrashManagerDelegate( - appIdService, Resolver.Resolve()); - var manager = BITHockeyManager.SharedHockeyManager; - manager.Configure("51f96ae568ba45f699a18ad9f63046c3", crashManagerDelegate); - manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend; - manager.UserId = appIdService.AppId; - manager.StartManager(); - manager.Authenticator.AuthenticateInstallation(); - manager.DisableMetricsManager = manager.DisableFeedbackManager = manager.DisableUpdateManager = true; - - LoadApplication(new App.App( - null, - Resolver.Resolve(), - Resolver.Resolve(), - Resolver.Resolve(), - Resolver.Resolve(), - Resolver.Resolve(), - _lockService, - Resolver.Resolve(), - Resolver.Resolve(), - Resolver.Resolve(), - Resolver.Resolve())); - - // Appearance stuff - - var primaryColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); - var grayLight = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); - - UINavigationBar.Appearance.ShadowImage = new UIImage(); - UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - UIBarButtonItem.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).TintColor = primaryColor; - UIButton.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).SetTitleColor(primaryColor, - UIControlState.Normal); - UIButton.AppearanceWhenContainedIn(new Type[] { typeof(UISearchBar) }).TintColor = primaryColor; - UIStepper.Appearance.TintColor = grayLight; - UISlider.Appearance.TintColor = primaryColor; - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "ShowAppExtension", (sender, page) => - { - var itemProvider = new NSItemProvider(new NSDictionary(), Core.Constants.UTTypeAppExtensionSetup); - var extensionItem = new NSExtensionItem(); - extensionItem.Attachments = new NSItemProvider[] { itemProvider }; - var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null); - activityViewController.CompletionHandler = (activityType, completed) => - { - page.EnabledExtension(completed && activityType == "com.8bit.bitwarden.find-login-action-extension"); - }; - - var modal = UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController; - if(activityViewController.PopoverPresentationController != null) - { - activityViewController.PopoverPresentationController.SourceView = modal.View; - var frame = UIScreen.MainScreen.Bounds; - frame.Height /= 2; - activityViewController.PopoverPresentationController.SourceRect = frame; - } - - modal.PresentViewController(activityViewController, true, null); - }); - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "ListenYubiKeyOTP", (sender, listen) => - { - if(_deviceInfoService.NfcEnabled) - { - _nfcSession?.InvalidateSession(); - _nfcSession?.Dispose(); - _nfcSession = null; - if(listen) - { - _nfcSession = new NFCNdefReaderSession(_nfcDelegate, null, true); - _nfcSession.AlertMessage = AppResources.HoldYubikeyNearTop; - _nfcSession.BeginSession(); - } - } - }); - - UIApplication.SharedApplication.StatusBarHidden = false; - UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "ShowStatusBar", (sender, show) => - { - UIApplication.SharedApplication.SetStatusBarHidden(!show, false); - }); - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "FullSyncCompleted", async (sender, successfully) => - { - if(_deviceInfoService.Version >= 12 && successfully) - { - await ASHelpers.ReplaceAllIdentities(_cipherService); - } - }); - - MessagingCenter.Subscribe>( - Xamarin.Forms.Application.Current, "UpsertedCipher", async (sender, data) => - { - if(_deviceInfoService.Version >= 12) - { - if(await ASHelpers.IdentitiesCanIncremental()) - { - if(data.Item2) - { - var identity = await ASHelpers.GetCipherIdentityAsync(data.Item1, _cipherService); - if(identity == null) - { - return; - } - await ASCredentialIdentityStore.SharedStore?.SaveCredentialIdentitiesAsync( - new ASPasswordCredentialIdentity[] { identity }); - return; - } - } - await ASHelpers.ReplaceAllIdentities(_cipherService); - } - }); - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "DeletedCipher", async (sender, cipher) => - { - if(_deviceInfoService.Version >= 12) - { - if(await ASHelpers.IdentitiesCanIncremental()) - { - var identity = ASHelpers.ToCredentialIdentity(cipher); - if(identity == null) - { - return; - } - await ASCredentialIdentityStore.SharedStore?.RemoveCredentialIdentitiesAsync( - new ASPasswordCredentialIdentity[] { identity }); - return; - } - await ASHelpers.ReplaceAllIdentities(_cipherService); - } - }); - - MessagingCenter.Subscribe( - Xamarin.Forms.Application.Current, "LoggedOut", async (sender) => - { - if(_deviceInfoService.Version >= 12) - { - await ASCredentialIdentityStore.SharedStore?.RemoveAllCredentialIdentitiesAsync(); - } - }); - - ZXing.Net.Mobile.Forms.iOS.Platform.Init(); - return base.FinishedLaunching(app, options); - } - - public override void DidEnterBackground(UIApplication uiApplication) - { - var view = new UIView(UIApplication.SharedApplication.KeyWindow.Frame) - { - Tag = 4321 - }; - - var backgroundView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame) - { - BackgroundColor = new UIColor(red: 0.93f, green: 0.94f, blue: 0.96f, alpha: 1.0f) - }; - - var imageView = new UIImageView(new UIImage("logo.png")) - { - Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 30) - }; - - view.AddSubview(backgroundView); - view.AddSubview(imageView); - - UIApplication.SharedApplication.KeyWindow.AddSubview(view); - UIApplication.SharedApplication.KeyWindow.BringSubviewToFront(view); - UIApplication.SharedApplication.KeyWindow.EndEditing(true); - UIApplication.SharedApplication.SetStatusBarHidden(true, false); - - // Log the date/time we last backgrounded - _lockService.UpdateLastActivity(); - - // Dispatch Google Analytics - SendGoogleAnalyticsHitsInBackground(); - - base.DidEnterBackground(uiApplication); - Debug.WriteLine("DidEnterBackground"); - } - - public override void OnResignActivation(UIApplication uiApplication) - { - base.OnResignActivation(uiApplication); - Debug.WriteLine("OnResignActivation"); - } - - public override void WillTerminate(UIApplication uiApplication) - { - base.WillTerminate(uiApplication); - Debug.WriteLine("WillTerminate"); - } - - public override void OnActivated(UIApplication uiApplication) - { - base.OnActivated(uiApplication); - Debug.WriteLine("OnActivated"); - - UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; - - var view = UIApplication.SharedApplication.KeyWindow.ViewWithTag(4321); - if(view != null) - { - view.RemoveFromSuperview(); - UIApplication.SharedApplication.SetStatusBarHidden(false, false); - } - } - - public override void WillEnterForeground(UIApplication uiApplication) - { - SendResumedMessage(); - - base.WillEnterForeground(uiApplication); - Debug.WriteLine("WillEnterForeground"); - } - - public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, - NSObject annotation) - { - return true; - } - - public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error) - { - _pushHandler?.OnErrorReceived(error); - } - - public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) - { - _pushHandler?.OnRegisteredSuccess(deviceToken); - } - - public override void DidRegisterUserNotificationSettings(UIApplication application, - UIUserNotificationSettings notificationSettings) - { - application.RegisterForRemoteNotifications(); - } - - public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, - Action completionHandler) - { - _pushHandler?.OnMessageReceived(userInfo); - } - - public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) - { - _pushHandler?.OnMessageReceived(userInfo); - } - - private void SendResumedMessage() - { - MessagingCenter.Send(Xamarin.Forms.Application.Current, "Resumed", false); - } - - private void SetIoc() - { - var container = new Container(); - - // Services - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterInstance(new DeviceInfoService()); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - - // Repositories - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - - // Other - container.RegisterInstance(CrossConnectivity.Current); - container.RegisterInstance(CrossFingerprint.Current); - - Settings = new Settings("group.com.8bit.bitwarden"); - container.RegisterInstance(Settings); - - // Push - container.RegisterSingleton(); - container.RegisterSingleton(); - - FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); - Resolver.SetResolver(new SimpleInjectorResolver(container)); - } - - /// - /// This method sends any queued hits when the app enters the background. - /// ref: https://developers.google.com/analytics/devguides/collection/ios/v3/dispatch - /// - private void SendGoogleAnalyticsHitsInBackground() - { - var taskExpired = false; - var taskId = UIApplication.SharedApplication.BeginBackgroundTask(() => - { - taskExpired = true; - }); - - if(taskId == UIApplication.BackgroundTaskInvalid) - { - return; - } - } - - private void ProcessYubikey(bool success, string message) - { - if(success) - { - Device.BeginInvokeOnMainThread(() => - { - MessagingCenter.Send(Xamarin.Forms.Application.Current, "GotYubiKeyOTP", message); - }); - } - } - } -} diff --git a/src/iOS/Controls/ContentPageRenderer.cs b/src/iOS/Controls/ContentPageRenderer.cs deleted file mode 100644 index afff68785..000000000 --- a/src/iOS/Controls/ContentPageRenderer.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Bit.iOS.Controls; -using UIKit; -using Xamarin.Forms; -using Xamarin.Forms.Platform.iOS; - -[assembly: ExportRenderer(typeof(ContentPage), typeof(ContentPageRenderer))] -namespace Bit.iOS.Controls -{ - public class ContentPageRenderer : PageRenderer - { - public override void ViewWillAppear(bool animated) - { - base.ViewWillAppear(animated); - - var contentPage = Element as ContentPage; - if(contentPage == null || NavigationController == null) - { - return; - } - - var itemsInfo = contentPage.ToolbarItems; - - var navigationItem = NavigationController.TopViewController.NavigationItem; - var leftNativeButtons = (navigationItem.LeftBarButtonItems ?? new UIBarButtonItem[] { }).ToList(); - var rightNativeButtons = (navigationItem.RightBarButtonItems ?? new UIBarButtonItem[] { }).ToList(); - - var newLeftButtons = new List(); - var newRightButtons = new List(); - - rightNativeButtons.ForEach(nativeItem => - { - // Use reflection to get Xamarin private field "_item" - var field = nativeItem.GetType().GetField("_item", BindingFlags.NonPublic | BindingFlags.Instance); - if(field == null) - { - return; - } - - var info = field.GetValue(nativeItem) as ToolbarItem; - if(info == null) - { - return; - } - - if(info.Priority < 0) - { - newLeftButtons.Add(nativeItem); - } - else - { - newRightButtons.Add(nativeItem); - } - }); - - leftNativeButtons.ForEach(nativeItem => - { - newLeftButtons.Add(nativeItem); - }); - - navigationItem.RightBarButtonItems = newRightButtons.ToArray(); - navigationItem.LeftBarButtonItems = newLeftButtons.ToArray(); - } - } -} diff --git a/src/iOS/Controls/CustomButtonRenderer.cs b/src/iOS/Controls/CustomButtonRenderer.cs deleted file mode 100644 index d54a44465..000000000 --- a/src/iOS/Controls/CustomButtonRenderer.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Bit.iOS.Controls; -using UIKit; -using Xamarin.Forms; -using Xamarin.Forms.Platform.iOS; -using System.ComponentModel; - -[assembly: ExportRenderer(typeof(Button), typeof(CustomButtonRenderer))] -namespace Bit.iOS.Controls -{ - public class CustomButtonRenderer : ButtonRenderer - { - protected override void OnElementChanged(ElementChangedEventArgs