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()); }
public static void AddSaveInfo(FillResponse.Builder responseBuilder, FieldCollection fields) { 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); } responseBuilder.SetSaveInfo(saveBuilder.Build()); }
public static void AddSaveInfo(Parser parser, FillRequest fillRequest, FillResponse.Builder responseBuilder, FieldCollection fields) { // Docs state that password fields cannot be reliably saved in Compat mode since they will show as // masked values. bool?compatRequest = null; if (Build.VERSION.SdkInt >= BuildVersionCodes.Q && fillRequest != null) { // Attempt to automatically establish compat request mode on Android 10+ compatRequest = (fillRequest.Flags | FillRequest.FlagCompatibilityModeRequest) == fillRequest.Flags; } var compatBrowser = compatRequest ?? 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()); }